langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java
changeset 27854 22b4bfc4e22f
parent 27231 c1ca668b421e
child 27857 7e913a535736
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java	Fri Nov 21 16:36:39 2014 -0500
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java	Mon Nov 24 16:02:35 2014 +0100
@@ -33,6 +33,7 @@
 import javax.tools.JavaFileObject;
 
 import com.sun.tools.javac.code.*;
+import com.sun.tools.javac.code.Lint.LintCategory;
 import com.sun.tools.javac.code.Scope.ImportFilter;
 import com.sun.tools.javac.code.Scope.NamedImportScope;
 import com.sun.tools.javac.code.Scope.StarImportScope;
@@ -123,12 +124,18 @@
         typeEnvs = TypeEnvs.instance(context);
         dependencies = Dependencies.instance(context);
         allowTypeAnnos = source.allowTypeAnnotations();
+        allowDeprecationOnImport = source.allowDeprecationOnImport();
     }
 
     /** Switch: support type annotations.
      */
     boolean allowTypeAnnos;
 
+    /**
+     * Switch: should deprecation warnings be issued on import
+     */
+    boolean allowDeprecationOnImport;
+
     /** A queue for classes whose members still need to be entered into the
      *  symbol table.
      */
@@ -771,6 +778,8 @@
 
     Type attribImportType(JCTree tree, Env<AttrContext> env) {
         Assert.check(completionEnabled);
+        Lint prevLint = chk.setLint(allowDeprecationOnImport ?
+                lint : lint.suppress(LintCategory.DEPRECATION));
         try {
             // To prevent deep recursion, suppress completion of some
             // types.
@@ -778,6 +787,7 @@
             return attr.attribType(tree, env);
         } finally {
             completionEnabled = true;
+            chk.setLint(prevLint);
         }
     }