182 private final Names names;
183 private final Enter enter;
184 private final Completer initialCompleter;
185 private final Check chk;
186
187 private final Context context;
188
189 /**
190 * Support for preview language features.
191 */
192 private final Preview preview;
193
194 /** Get the JavacProcessingEnvironment instance for this context. */
195 public static JavacProcessingEnvironment instance(Context context) {
196 JavacProcessingEnvironment instance = context.get(JavacProcessingEnvironment.class);
197 if (instance == null)
198 instance = new JavacProcessingEnvironment(context);
199 return instance;
200 }
201
202 protected JavacProcessingEnvironment(Context context) {
203 this.context = context;
204 context.put(JavacProcessingEnvironment.class, this);
205 log = Log.instance(context);
206 source = Source.instance(context);
207 diags = JCDiagnostic.Factory.instance(context);
208 options = Options.instance(context);
209 printProcessorInfo = options.isSet(Option.XPRINTPROCESSORINFO);
210 printRounds = options.isSet(Option.XPRINTROUNDS);
211 verbose = options.isSet(Option.VERBOSE);
212 lint = Lint.instance(context).isEnabled(PROCESSING);
213 compiler = JavaCompiler.instance(context);
214 if (options.isSet(Option.PROC, "only") || options.isSet(Option.XPRINT)) {
215 compiler.shouldStopPolicyIfNoError = CompileState.PROCESS;
216 }
217 fatalErrors = options.isSet("fatalEnterError");
218 showResolveErrors = options.isSet("showResolveErrors");
219 werror = options.isSet(Option.WERROR);
220 fileManager = context.get(JavaFileManager.class);
221 platformAnnotations = initPlatformAnnotations();
|
182 private final Names names;
183 private final Enter enter;
184 private final Completer initialCompleter;
185 private final Check chk;
186
187 private final Context context;
188
189 /**
190 * Support for preview language features.
191 */
192 private final Preview preview;
193
194 /** Get the JavacProcessingEnvironment instance for this context. */
195 public static JavacProcessingEnvironment instance(Context context) {
196 JavacProcessingEnvironment instance = context.get(JavacProcessingEnvironment.class);
197 if (instance == null)
198 instance = new JavacProcessingEnvironment(context);
199 return instance;
200 }
201
202 @SuppressWarnings("this-escape")
203 protected JavacProcessingEnvironment(Context context) {
204 this.context = context;
205 context.put(JavacProcessingEnvironment.class, this);
206 log = Log.instance(context);
207 source = Source.instance(context);
208 diags = JCDiagnostic.Factory.instance(context);
209 options = Options.instance(context);
210 printProcessorInfo = options.isSet(Option.XPRINTPROCESSORINFO);
211 printRounds = options.isSet(Option.XPRINTROUNDS);
212 verbose = options.isSet(Option.VERBOSE);
213 lint = Lint.instance(context).isEnabled(PROCESSING);
214 compiler = JavaCompiler.instance(context);
215 if (options.isSet(Option.PROC, "only") || options.isSet(Option.XPRINT)) {
216 compiler.shouldStopPolicyIfNoError = CompileState.PROCESS;
217 }
218 fatalErrors = options.isSet("fatalEnterError");
219 showResolveErrors = options.isSet("showResolveErrors");
220 werror = options.isSet(Option.WERROR);
221 fileManager = context.get(JavaFileManager.class);
222 platformAnnotations = initPlatformAnnotations();
|