< prev index next >

langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Options.java

Print this page

        

@@ -25,11 +25,10 @@
 
 package com.sun.tools.javac.util;
 
 import java.util.*;
 
-import com.sun.tools.javac.code.Source;
 import com.sun.tools.javac.main.Option;
 import static com.sun.tools.javac.main.Option.*;
 
 /** A table of all command-line options.
  *  If an option has an argument, the option name is mapped to the argument.

@@ -111,10 +110,22 @@
      */
     public boolean isSet(Option option, String value) {
         return (values.get(option.primaryName + value) != null);
     }
 
+    /** Check if the value for a lint option has been explicitly set, either with -Xlint:opt
+     *  or if all lint options have enabled and this one not disabled with -Xlint:-opt.
+     */
+    public boolean isLintSet(String s) {
+        // return true if either the specific option is enabled, or
+        // they are all enabled without the specific one being
+        // disabled
+        return
+            isSet(XLINT_CUSTOM, s) ||
+            (isSet(XLINT) || isSet(XLINT_CUSTOM, "all")) && isUnset(XLINT_CUSTOM, "-" + s);
+    }
+
     /**
      * Check if the value for an undocumented option has not been set.
      */
     public boolean isUnset(String name) {
         return (values.get(name) == null);

@@ -168,27 +179,6 @@
 
     public void notifyListeners() {
         for (Runnable r: listeners)
             r.run();
     }
-
-    /** Check for a lint suboption. */
-    public boolean lint(String s) {
-        // return true if either the specific option is enabled, or
-        // they are all enabled without the specific one being
-        // disabled
-        return
-            isSet(XLINT_CUSTOM, s) ||
-            (isSet(XLINT) || isSet(XLINT_CUSTOM, "all") || (s.equals("dep-ann") && depAnnOnByDefault())) &&
-                isUnset(XLINT_CUSTOM, "-" + s);
-    }
-        // where
-        private boolean depAnnOnByDefault() {
-            String sourceName = get(Option.SOURCE);
-            Source source = null;
-            if (sourceName != null)
-                source = Source.lookup(sourceName);
-            if (source == null)
-                source = Source.DEFAULT;
-            return source.compareTo(Source.JDK1_9) >= 0;
-        }
 }
< prev index next >