langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java
changeset 6721 d92073844278
parent 6717 0103d76cfe48
child 6924 ef7a9281ad2f
--- a/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java	Wed Sep 29 23:27:57 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java	Thu Sep 30 10:47:12 2010 -0700
@@ -79,6 +79,8 @@
 
 import static javax.tools.StandardLocation.*;
 import static com.sun.tools.javac.util.JCDiagnostic.DiagnosticFlag.*;
+import static com.sun.tools.javac.main.OptionName.*;
+import static com.sun.tools.javac.code.Lint.LintCategory.PROCESSING;
 
 /**
  * Objects of this class hold and manage the state needed to support
@@ -160,15 +162,14 @@
         source = Source.instance(context);
         diags = JCDiagnostic.Factory.instance(context);
         options = Options.instance(context);
-        printProcessorInfo = options.get("-XprintProcessorInfo") != null;
-        printRounds = options.get("-XprintRounds") != null;
-        verbose = options.get("-verbose") != null;
-        lint = options.lint("processing");
-        procOnly = options.get("-proc:only") != null ||
-            options.get("-Xprint") != null;
-        fatalErrors = options.get("fatalEnterError") != null;
-        showResolveErrors = options.get("showResolveErrors") != null;
-        werror = options.get("-Werror") != null;
+        printProcessorInfo = options.isSet(XPRINTPROCESSORINFO);
+        printRounds = options.isSet(XPRINTROUNDS);
+        verbose = options.isSet(VERBOSE);
+        lint = Lint.instance(context).isEnabled(PROCESSING);
+        procOnly = options.isSet(PROC, "only") || options.isSet(XPRINT);
+        fatalErrors = options.isSet("fatalEnterError");
+        showResolveErrors = options.isSet("showResolveErrors");
+        werror = options.isSet(WERROR);
         platformAnnotations = initPlatformAnnotations();
         foundTypeProcessors = false;
 
@@ -200,7 +201,7 @@
         Log   log   = Log.instance(context);
         Iterator<? extends Processor> processorIterator;
 
-        if (options.get("-Xprint") != null) {
+        if (options.isSet(XPRINT)) {
             try {
                 Processor processor = PrintingProcessor.class.newInstance();
                 processorIterator = List.of(processor).iterator();
@@ -213,7 +214,7 @@
         } else if (processors != null) {
             processorIterator = processors.iterator();
         } else {
-            String processorNames = options.get("-processor");
+            String processorNames = options.get(PROCESSOR);
             JavaFileManager fileManager = context.get(JavaFileManager.class);
             try {
                 // If processorpath is not explicitly set, use the classpath.
@@ -264,7 +265,7 @@
                 ? standardFileManager.getLocation(ANNOTATION_PROCESSOR_PATH)
                 : standardFileManager.getLocation(CLASS_PATH);
 
-            if (needClassLoader(options.get("-processor"), workingPath) )
+            if (needClassLoader(options.get(PROCESSOR), workingPath) )
                 handleException(key, e);
 
         } else {
@@ -745,7 +746,7 @@
         psi.runContributingProcs(renv);
 
         // Debugging
-        if (options.get("displayFilerState") != null)
+        if (options.isSet("displayFilerState"))
             filer.displayState();
     }