langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java
changeset 27854 22b4bfc4e22f
parent 27231 c1ca668b421e
child 27857 7e913a535736
equal deleted inserted replaced
27853:746c658e8d35 27854:22b4bfc4e22f
    31 import java.util.Set;
    31 import java.util.Set;
    32 
    32 
    33 import javax.tools.JavaFileObject;
    33 import javax.tools.JavaFileObject;
    34 
    34 
    35 import com.sun.tools.javac.code.*;
    35 import com.sun.tools.javac.code.*;
       
    36 import com.sun.tools.javac.code.Lint.LintCategory;
    36 import com.sun.tools.javac.code.Scope.ImportFilter;
    37 import com.sun.tools.javac.code.Scope.ImportFilter;
    37 import com.sun.tools.javac.code.Scope.NamedImportScope;
    38 import com.sun.tools.javac.code.Scope.NamedImportScope;
    38 import com.sun.tools.javac.code.Scope.StarImportScope;
    39 import com.sun.tools.javac.code.Scope.StarImportScope;
    39 import com.sun.tools.javac.code.Scope.WriteableScope;
    40 import com.sun.tools.javac.code.Scope.WriteableScope;
    40 import com.sun.tools.javac.jvm.*;
    41 import com.sun.tools.javac.jvm.*;
   121         deferredLintHandler = DeferredLintHandler.instance(context);
   122         deferredLintHandler = DeferredLintHandler.instance(context);
   122         lint = Lint.instance(context);
   123         lint = Lint.instance(context);
   123         typeEnvs = TypeEnvs.instance(context);
   124         typeEnvs = TypeEnvs.instance(context);
   124         dependencies = Dependencies.instance(context);
   125         dependencies = Dependencies.instance(context);
   125         allowTypeAnnos = source.allowTypeAnnotations();
   126         allowTypeAnnos = source.allowTypeAnnotations();
       
   127         allowDeprecationOnImport = source.allowDeprecationOnImport();
   126     }
   128     }
   127 
   129 
   128     /** Switch: support type annotations.
   130     /** Switch: support type annotations.
   129      */
   131      */
   130     boolean allowTypeAnnos;
   132     boolean allowTypeAnnos;
       
   133 
       
   134     /**
       
   135      * Switch: should deprecation warnings be issued on import
       
   136      */
       
   137     boolean allowDeprecationOnImport;
   131 
   138 
   132     /** A queue for classes whose members still need to be entered into the
   139     /** A queue for classes whose members still need to be entered into the
   133      *  symbol table.
   140      *  symbol table.
   134      */
   141      */
   135     ListBuffer<Env<AttrContext>> halfcompleted = new ListBuffer<>();
   142     ListBuffer<Env<AttrContext>> halfcompleted = new ListBuffer<>();
   769  * Type completion
   776  * Type completion
   770  *********************************************************************/
   777  *********************************************************************/
   771 
   778 
   772     Type attribImportType(JCTree tree, Env<AttrContext> env) {
   779     Type attribImportType(JCTree tree, Env<AttrContext> env) {
   773         Assert.check(completionEnabled);
   780         Assert.check(completionEnabled);
       
   781         Lint prevLint = chk.setLint(allowDeprecationOnImport ?
       
   782                 lint : lint.suppress(LintCategory.DEPRECATION));
   774         try {
   783         try {
   775             // To prevent deep recursion, suppress completion of some
   784             // To prevent deep recursion, suppress completion of some
   776             // types.
   785             // types.
   777             completionEnabled = false;
   786             completionEnabled = false;
   778             return attr.attribType(tree, env);
   787             return attr.attribType(tree, env);
   779         } finally {
   788         } finally {
   780             completionEnabled = true;
   789             completionEnabled = true;
       
   790             chk.setLint(prevLint);
   781         }
   791         }
   782     }
   792     }
   783 
   793 
   784     /**
   794     /**
   785      * Check if a list of annotations contains a reference to
   795      * Check if a list of annotations contains a reference to