Uploaded image for project: 'CCC Migration Project'
  1. CCC Migration Project
  2. CCC-8032211

Don't issue deprecation warnings on import statements

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 9
    • tools
    • minimal
    • Reducing the occurrence of warnings.
    • Language construct
    • SE

      Summary

      Update the JLS to not require deprecation warnings in import statements.

      Problem

      The current JLS mandates uninformative deprecation warnings on import statements. Such warnings cannot be suppressed with an @SuppressWarnings annotation.

      Solution

      Change the specification to not require a warning in this case.

      Specification

      From JLS, the section on @Deprecated states:

      A Java compiler must produce a deprecation warning when a type, method, field, or constructor whose declaration is annotated with the annotation @Deprecated is used (i.e. overridden, invoked, or referenced by name), unless:

      • The use is within an entity that is itself annotated with the annotation @Deprecated; or
      • The use is within an entity that is annotated to suppress the warning with the annotation @SuppressWarnings("deprecation"); or
      • The use and declaration are both within the same outermost class.

      See http://docs.oracle.com/javase/specs/jls/se7/html/jls-9.html#jls-9.6.3.6

      The specification change is adding another bullet

      • The use is within an import statement.

            darcy Joe Darcy
            darcy Joe Darcy
            Jan Lahoda
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: