src/share/classes/com/sun/tools/javac/comp/Attr.java

changeset 852
899f7c3d9426
parent 841
df371fd16386
child 853
875262e89b52
     1.1 --- a/src/share/classes/com/sun/tools/javac/comp/Attr.java	Tue Feb 01 10:11:05 2011 -0800
     1.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java	Thu Feb 03 09:35:21 2011 +0000
     1.3 @@ -83,6 +83,7 @@
     1.4      final Types types;
     1.5      final JCDiagnostic.Factory diags;
     1.6      final Annotate annotate;
     1.7 +    final DeferredLintHandler deferredLintHandler;
     1.8  
     1.9      public static Attr instance(Context context) {
    1.10          Attr instance = context.get(attrKey);
    1.11 @@ -108,6 +109,7 @@
    1.12          types = Types.instance(context);
    1.13          diags = JCDiagnostic.Factory.instance(context);
    1.14          annotate = Annotate.instance(context);
    1.15 +        deferredLintHandler = DeferredLintHandler.instance(context);
    1.16  
    1.17          Options options = Options.instance(context);
    1.18  
    1.19 @@ -125,7 +127,6 @@
    1.20          findDiamonds = options.get("findDiamond") != null &&
    1.21                   source.allowDiamond();
    1.22          useBeforeDeclarationWarning = options.isSet("useBeforeDeclarationWarning");
    1.23 -        enableSunApiLintControl = options.isSet("enableSunApiLintControl");
    1.24      }
    1.25  
    1.26      /** Switch: relax some constraints for retrofit mode.
    1.27 @@ -174,12 +175,6 @@
    1.28      boolean useBeforeDeclarationWarning;
    1.29  
    1.30      /**
    1.31 -     * Switch: allow lint infrastructure to control proprietary
    1.32 -     * API warnings.
    1.33 -     */
    1.34 -    boolean enableSunApiLintControl;
    1.35 -
    1.36 -    /**
    1.37       * Switch: allow strings in switch?
    1.38       */
    1.39      boolean allowStringsInSwitch;
    1.40 @@ -707,6 +702,7 @@
    1.41          Lint prevLint = chk.setLint(lint);
    1.42          MethodSymbol prevMethod = chk.setMethod(m);
    1.43          try {
    1.44 +            deferredLintHandler.flush(tree.pos());
    1.45              chk.checkDeprecatedAnnotation(tree.pos(), m);
    1.46  
    1.47              attribBounds(tree.typarams);
    1.48 @@ -849,6 +845,7 @@
    1.49  
    1.50          // Check that the variable's declared type is well-formed.
    1.51          chk.validate(tree.vartype, env);
    1.52 +        deferredLintHandler.flush(tree.pos());
    1.53  
    1.54          try {
    1.55              chk.checkDeprecatedAnnotation(tree.pos(), v);
    1.56 @@ -2578,17 +2575,10 @@
    1.57              // Test (1): emit a `deprecation' warning if symbol is deprecated.
    1.58              // (for constructors, the error was given when the constructor was
    1.59              // resolved)
    1.60 -            if (sym.name != names.init &&
    1.61 -                (sym.flags() & DEPRECATED) != 0 &&
    1.62 -                (env.info.scope.owner.flags() & DEPRECATED) == 0 &&
    1.63 -                sym.outermostClass() != env.info.scope.owner.outermostClass())
    1.64 -                chk.warnDeprecated(tree.pos(), sym);
    1.65 -
    1.66 -            if ((sym.flags() & PROPRIETARY) != 0) {
    1.67 -                if (enableSunApiLintControl)
    1.68 -                  chk.warnSunApi(tree.pos(), "sun.proprietary", sym);
    1.69 -                else
    1.70 -                  log.strictWarning(tree.pos(), "sun.proprietary", sym);
    1.71 +
    1.72 +            if (sym.name != names.init) {
    1.73 +                chk.checkDeprecated(tree.pos(), env.info.scope.owner, sym);
    1.74 +                chk.checkSunAPI(tree.pos(), sym);
    1.75              }
    1.76  
    1.77              // Test (3): if symbol is a variable, check that its type and

mercurial