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

SuppressWarnings("deprecation") not respected on default clause on annotation declarations

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 9
    • 9
    • tools
    • b48
    • Verified

        javac doesn't respect the @SuppressWarnings("deprecation") on the enclosing class when it is processing the default clause of the annotation method declaration, i.e.

        @Deprecated
        enum Foo {
            Bar
        }

        @interface Baz {
            @SuppressWarnings("deprecation")
            Foo foo() default Foo.Bar;
        }


        javac -Xlint:deprecation Repro.java

        produces

        Repro.java:9: warning: [deprecation] Foo in unnamed package has been deprecated
            Foo foo() default Foo.Bar;
                              ^
        1 warning

        which seems to contradict the @Deprecated section of JLS

              jlahoda Jan Lahoda
              egahlin Erik Gahlin
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: