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

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P3
    • 9
    • Affects Version/s: 9
    • Component/s: 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

              Assignee:
              Jan Lahoda
              Reporter:
              Erik Gahlin
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: