Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6569079

Deprecation warnings for use within deprecated entities

    XMLWordPrintable

Details

    • Bug
    • Resolution: Cannot Reproduce
    • P4
    • 7
    • 6
    • tools
    • x86
    • windows_xp

    Description

      FULL PRODUCT VERSION :
      java version "1.6.0_01"
      Java(TM) SE Runtime Environment (build 1.6.0_01-b06)
      Java HotSpot(TM) Client VM (build 1.6.0_01-b06, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [Version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      According to JLS 3:

      A Java compiler must produce a warning when a deprecated type, method, field, or constructor is used (overridden, invoked, or referenced by name) unless:

          * The use is within an entity that itself is is annotated with the annotation @Deprecated
          * ...

      However the compiler issues deprecation warnings for uses of deprecated API that are themselves within deprecated entities.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      ClassA.java:

      @Deprecated public class ClassA {}


      ClassB.java:

      @Deprecated public class ClassB {
        public ClassA myvar() {return new ClassA();}
      }

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      No warnings.
      ACTUAL -
      Deprecation warnings.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Note: ClassB.java uses or overrides a deprecated API.
      Note: Recompile with -Xlint:deprecation for details.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      CUSTOMER SUBMITTED WORKAROUND :
      None. This bug is also in the 5.0 compiler. @SuppressWarnings("deprecation") doesn't work in the 6.0 compiler but it does work in the 5.0 compiler.

      Attachments

        Activity

          People

            jlahoda Jan Lahoda
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: