< prev index next >

langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java

Print this page

        

*** 60,69 **** --- 60,70 ---- import com.sun.tools.javac.comp.Enter; import com.sun.tools.javac.comp.Env; import com.sun.tools.javac.comp.Modules; import com.sun.tools.javac.file.JavacFileManager; import com.sun.tools.javac.main.JavaCompiler; + import com.sun.tools.javac.main.Option; import com.sun.tools.javac.model.JavacElements; import com.sun.tools.javac.model.JavacTypes; import com.sun.tools.javac.platform.PlatformDescription; import com.sun.tools.javac.platform.PlatformDescription.PluginInfo; import com.sun.tools.javac.resources.CompilerProperties.Errors;
*** 87,97 **** import com.sun.tools.javac.util.Names; import com.sun.tools.javac.util.Options; import static com.sun.tools.javac.code.Lint.LintCategory.PROCESSING; import static com.sun.tools.javac.code.Kinds.Kind.*; - import static com.sun.tools.javac.main.Option.*; import static com.sun.tools.javac.comp.CompileStates.CompileState; import static com.sun.tools.javac.util.JCDiagnostic.DiagnosticFlag.*; /** * Objects of this class hold and manage the state needed to support --- 88,97 ----
*** 194,214 **** context.put(JavacProcessingEnvironment.class, this); log = Log.instance(context); source = Source.instance(context); diags = JCDiagnostic.Factory.instance(context); options = Options.instance(context); ! printProcessorInfo = options.isSet(XPRINTPROCESSORINFO); ! printRounds = options.isSet(XPRINTROUNDS); ! verbose = options.isSet(VERBOSE); lint = Lint.instance(context).isEnabled(PROCESSING); compiler = JavaCompiler.instance(context); ! if (options.isSet(PROC, "only") || options.isSet(XPRINT)) { compiler.shouldStopPolicyIfNoError = CompileState.PROCESS; } fatalErrors = options.isSet("fatalEnterError"); showResolveErrors = options.isSet("showResolveErrors"); ! werror = options.isSet(WERROR); fileManager = context.get(JavaFileManager.class); platformAnnotations = initPlatformAnnotations(); // Initialize services before any processors are initialized // in case processors use them. --- 194,214 ---- context.put(JavacProcessingEnvironment.class, this); log = Log.instance(context); source = Source.instance(context); diags = JCDiagnostic.Factory.instance(context); options = Options.instance(context); ! printProcessorInfo = options.isSet(Option.XPRINTPROCESSORINFO); ! printRounds = options.isSet(Option.XPRINTROUNDS); ! verbose = options.isSet(Option.VERBOSE); lint = Lint.instance(context).isEnabled(PROCESSING); compiler = JavaCompiler.instance(context); ! if (options.isSet(Option.PROC, "only") || options.isSet(Option.XPRINT)) { compiler.shouldStopPolicyIfNoError = CompileState.PROCESS; } fatalErrors = options.isSet("fatalEnterError"); showResolveErrors = options.isSet("showResolveErrors"); ! werror = options.isSet(Option.WERROR); fileManager = context.get(JavaFileManager.class); platformAnnotations = initPlatformAnnotations(); // Initialize services before any processors are initialized // in case processors use them.
*** 277,287 **** } private void initProcessorIterator(Iterable<? extends Processor> processors) { Iterator<? extends Processor> processorIterator; ! if (options.isSet(XPRINT)) { try { processorIterator = List.of(new PrintingProcessor()).iterator(); } catch (Throwable t) { AssertionError assertError = new AssertionError("Problem instantiating PrintingProcessor."); --- 277,287 ---- } private void initProcessorIterator(Iterable<? extends Processor> processors) { Iterator<? extends Processor> processorIterator; ! if (options.isSet(Option.XPRINT)) { try { processorIterator = List.of(new PrintingProcessor()).iterator(); } catch (Throwable t) { AssertionError assertError = new AssertionError("Problem instantiating PrintingProcessor.");
*** 295,305 **** /* * If the "-processor" option is used, search the appropriate * path for the named class. Otherwise, use a service * provider mechanism to create the processor iterator. */ ! String processorNames = options.get(PROCESSOR); if (fileManager.hasLocation(ANNOTATION_PROCESSOR_MODULE_PATH)) { processorIterator = (processorNames == null) ? new ServiceIterator(serviceLoader, log) : new NameServiceIterator(serviceLoader, log, processorNames); } else if (processorNames != null) { --- 295,305 ---- /* * If the "-processor" option is used, search the appropriate * path for the named class. Otherwise, use a service * provider mechanism to create the processor iterator. */ ! String processorNames = options.get(Option.PROCESSOR); if (fileManager.hasLocation(ANNOTATION_PROCESSOR_MODULE_PATH)) { processorIterator = (processorNames == null) ? new ServiceIterator(serviceLoader, log) : new NameServiceIterator(serviceLoader, log, processorNames); } else if (processorNames != null) {
*** 361,371 **** StandardJavaFileManager standardFileManager = (JavacFileManager) fileManager; Iterable<? extends Path> workingPath = fileManager.hasLocation(ANNOTATION_PROCESSOR_PATH) ? standardFileManager.getLocationAsPaths(ANNOTATION_PROCESSOR_PATH) : standardFileManager.getLocationAsPaths(CLASS_PATH); ! if (needClassLoader(options.get(PROCESSOR), workingPath) ) handleException(key, e); } else { handleException(key, e); } --- 361,371 ---- StandardJavaFileManager standardFileManager = (JavacFileManager) fileManager; Iterable<? extends Path> workingPath = fileManager.hasLocation(ANNOTATION_PROCESSOR_PATH) ? standardFileManager.getLocationAsPaths(ANNOTATION_PROCESSOR_PATH) : standardFileManager.getLocationAsPaths(CLASS_PATH); ! if (needClassLoader(options.get(Option.PROCESSOR), workingPath) ) handleException(key, e); } else { handleException(key, e); }
< prev index next >