author | jjg |
Wed, 29 Oct 2014 17:25:23 -0700 | |
changeset 27319 | 030080f03e4f |
parent 23810 | b92eb80925f0 |
child 30730 | d3ce7619db2c |
permissions | -rw-r--r-- |
23810
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
1 |
/* |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
2 |
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
4 |
* |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
8 |
* |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
13 |
* accompanied this code). |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
14 |
* |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
18 |
* |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
21 |
* questions. |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
22 |
*/ |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
23 |
|
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
24 |
/* |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
25 |
* @test |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
26 |
* @bug 8038455 |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
27 |
* @summary Check that classfiles are read only once in common cases despite several rounds of |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
28 |
* annotation processing. |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
29 |
* @clean * |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
30 |
* @run main BaseClassesNotReRead |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
31 |
*/ |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
32 |
|
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
33 |
import java.io.*; |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
34 |
import java.util.*; |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
35 |
import javax.annotation.processing.*; |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
36 |
import javax.lang.model.*; |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
37 |
import javax.lang.model.element.*; |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
38 |
import javax.tools.*; |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
39 |
import javax.tools.JavaFileObject.Kind; |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
40 |
import com.sun.source.util.JavacTask; |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
41 |
|
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
42 |
|
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
43 |
@SupportedAnnotationTypes("*") |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
44 |
public class BaseClassesNotReRead extends AbstractProcessor { |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
45 |
public static void main(String... args) throws IOException { |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
46 |
new BaseClassesNotReRead().run(); |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
47 |
} |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
48 |
|
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
49 |
void run() throws IOException { |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
50 |
File sources = new File(System.getProperty("test.src")); |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
51 |
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); |
27319
030080f03e4f
8062348: langtools tests should close file manager (group 1)
jjg
parents:
23810
diff
changeset
|
52 |
try (StandardJavaFileManager fm = compiler.getStandardFileManager(null, null, null)) { |
030080f03e4f
8062348: langtools tests should close file manager (group 1)
jjg
parents:
23810
diff
changeset
|
53 |
Iterable<? extends JavaFileObject> files = |
030080f03e4f
8062348: langtools tests should close file manager (group 1)
jjg
parents:
23810
diff
changeset
|
54 |
fm.getJavaFileObjects(new File(sources, "BaseClassesNotReReadSource.java")); |
030080f03e4f
8062348: langtools tests should close file manager (group 1)
jjg
parents:
23810
diff
changeset
|
55 |
DiagnosticListener<JavaFileObject> noErrors = new DiagnosticListener<JavaFileObject>() { |
030080f03e4f
8062348: langtools tests should close file manager (group 1)
jjg
parents:
23810
diff
changeset
|
56 |
@Override |
030080f03e4f
8062348: langtools tests should close file manager (group 1)
jjg
parents:
23810
diff
changeset
|
57 |
public void report(Diagnostic<? extends JavaFileObject> diagnostic) { |
030080f03e4f
8062348: langtools tests should close file manager (group 1)
jjg
parents:
23810
diff
changeset
|
58 |
throw new IllegalStateException(diagnostic.toString()); |
030080f03e4f
8062348: langtools tests should close file manager (group 1)
jjg
parents:
23810
diff
changeset
|
59 |
} |
030080f03e4f
8062348: langtools tests should close file manager (group 1)
jjg
parents:
23810
diff
changeset
|
60 |
}; |
030080f03e4f
8062348: langtools tests should close file manager (group 1)
jjg
parents:
23810
diff
changeset
|
61 |
JavaFileManager manager = new OnlyOneReadFileManager(fm); |
030080f03e4f
8062348: langtools tests should close file manager (group 1)
jjg
parents:
23810
diff
changeset
|
62 |
Iterable<String> options = Arrays.asList("-processor", "BaseClassesNotReRead"); |
030080f03e4f
8062348: langtools tests should close file manager (group 1)
jjg
parents:
23810
diff
changeset
|
63 |
JavacTask task = (JavacTask) compiler.getTask(null, manager, noErrors, options, null, files); |
030080f03e4f
8062348: langtools tests should close file manager (group 1)
jjg
parents:
23810
diff
changeset
|
64 |
task.analyze(); |
030080f03e4f
8062348: langtools tests should close file manager (group 1)
jjg
parents:
23810
diff
changeset
|
65 |
} |
23810
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
66 |
} |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
67 |
|
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
68 |
int round = 1; |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
69 |
public boolean process(Set<? extends TypeElement> annotations, |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
70 |
RoundEnvironment roundEnv) { |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
71 |
if (round++ == 1) { |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
72 |
for (int c = 1; c <= 6; c++) { |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
73 |
generateSource("GenClass" + c, |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
74 |
"public class GenClass" + c + " { public void test() { } }"); |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
75 |
} |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
76 |
for (int c = 1; c <= 3; c++) { |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
77 |
generateSource("GenIntf" + c, |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
78 |
"public interface GenIntf" + c + " { public void test(); }"); |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
79 |
} |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
80 |
generateSource("GenAnnotation", |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
81 |
"public @interface GenAnnotation { }"); |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
82 |
generateSource("GenException", |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
83 |
"public class GenException extends Exception { }"); |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
84 |
} |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
85 |
|
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
86 |
return false; |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
87 |
} |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
88 |
|
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
89 |
private void generateSource(String name, String code) { |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
90 |
Filer filer = processingEnv.getFiler(); |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
91 |
try (Writer out = filer.createSourceFile(name).openWriter()) { |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
92 |
out.write(code); |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
93 |
out.close(); |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
94 |
} catch (IOException e) { |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
95 |
processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, e.toString()); |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
96 |
} |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
97 |
} |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
98 |
|
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
99 |
@Override |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
100 |
public SourceVersion getSupportedSourceVersion() { |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
101 |
return SourceVersion.latest(); |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
102 |
} |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
103 |
|
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
104 |
final class OnlyOneReadFileManager extends ForwardingJavaFileManager<JavaFileManager> { |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
105 |
|
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
106 |
public OnlyOneReadFileManager(JavaFileManager fileManager) { |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
107 |
super(fileManager); |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
108 |
} |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
109 |
|
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
110 |
@Override |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
111 |
public JavaFileObject getJavaFileForInput(Location location, String className, Kind kind) |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
112 |
throws IOException { |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
113 |
return new OnlyOneReadJavaFileObject(super.getJavaFileForInput(location, className, kind)); |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
114 |
} |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
115 |
|
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
116 |
@Override |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
117 |
public Iterable<JavaFileObject> list(Location location, String packageName, Set<Kind> kinds, |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
118 |
boolean recurse) throws IOException { |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
119 |
List<JavaFileObject> result = new ArrayList<>(); |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
120 |
for (JavaFileObject jfo : super.list(location, packageName, kinds, recurse)) { |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
121 |
result.add(new OnlyOneReadJavaFileObject(jfo)); |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
122 |
} |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
123 |
return result; |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
124 |
} |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
125 |
|
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
126 |
@Override |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
127 |
public String inferBinaryName(Location location, JavaFileObject file) { |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
128 |
return super.inferBinaryName(location, |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
129 |
((OnlyOneReadJavaFileObject) file).getFileObject()); |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
130 |
} |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
131 |
|
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
132 |
} |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
133 |
|
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
134 |
final class OnlyOneReadJavaFileObject extends ForwardingJavaFileObject<JavaFileObject> { |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
135 |
|
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
136 |
public OnlyOneReadJavaFileObject(JavaFileObject fileObject) { |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
137 |
super(fileObject); |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
138 |
} |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
139 |
|
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
140 |
boolean used; |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
141 |
|
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
142 |
@Override |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
143 |
public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException { |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
144 |
if (used) throw new IllegalStateException("Already read."); |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
145 |
used = true; |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
146 |
return super.getCharContent(ignoreEncodingErrors); |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
147 |
} |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
148 |
|
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
149 |
@Override |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
150 |
public InputStream openInputStream() throws IOException { |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
151 |
if (used) throw new IllegalStateException("Already read."); |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
152 |
used = true; |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
153 |
return super.openInputStream(); |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
154 |
} |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
155 |
|
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
156 |
@Override |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
157 |
public Reader openReader(boolean ignoreEncodingErrors) throws IOException { |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
158 |
if (used) throw new IllegalStateException("Already read."); |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
159 |
used = true; |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
160 |
return super.openReader(ignoreEncodingErrors); |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
161 |
} |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
162 |
|
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
163 |
public JavaFileObject getFileObject() { |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
164 |
return fileObject; |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
165 |
} |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
166 |
} |
b92eb80925f0
8038455: Use single Context for all rounds of annotation processing
jlahoda
parents:
diff
changeset
|
167 |
} |