< prev index next >

src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java

Print this page

        

@@ -90,10 +90,13 @@
     private Source source;
 
     /** The name table. */
     private Names names;
 
+    /** The lint settings. */
+    private Lint lint;
+
     /** End position mappings container */
     protected final AbstractEndPosTable endPosTable;
 
     // Because of javac's limited lookahead, some contexts are ambiguous in
     // the presence of type annotations even though they are not ambiguous

@@ -184,10 +187,11 @@
         this.parseModuleInfo = parseModuleInfo;
         docComments = newDocCommentTable(keepDocComments, fac);
         this.keepLineMap = keepLineMap;
         this.errorTree = F.Erroneous();
         endPosTable = newEndPosTable(keepEndPositions);
+        this.lint = fac.lint;
     }
 
     protected AbstractEndPosTable newEndPosTable(boolean keepEndPositions) {
         return  keepEndPositions
                 ? new SimpleEndPosTable(this)

@@ -637,11 +641,14 @@
                 nextToken();
                 return names.error;
             }
         } else if (token.kind == UNDERSCORE) {
             if (allowUnderscoreIdentifier) {
+                if (lint.isEnabled(Lint.LintCategory.FUTURE) &&
+                    !lint.isSuppressed(Lint.LintCategory.FUTURE)) {
                 warning(token.pos, "underscore.as.identifier");
+                }
             } else {
                 error(token.pos, "underscore.as.identifier");
             }
             Name name = token.name();
             nextToken();
< prev index next >