deprecation warnings should be emitted for uses of annotation methods inside other annotations

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P4
    • 21
    • Affects Version/s: 19
    • Component/s: tools
    • None
    • b08

      My colleague Chris Povirk noticed that in the following example, javac emits deprecation warnings for method invocations that refer to the deprecated method A.b, but not for uses of that method in other annotations.

      Ideally it would report a diagnostic for both usages of the deprecated element.

      ```
      @interface A {
        @Deprecated
        /**
         * @deprecated foo
         */
        boolean b() default false;
      }
      ```

      ```
      @A(b = true)
      // ^
      // expected a deprecation warning on use of b above
      class B {
        void x(A a) {
          a.b();
        }
      }
      ```
      $ javac -fullversion
      javac full version "19-ea+34-2229"
      $ javac -deprecation *.java
      B.java:6: warning: [deprecation] b() in A has been deprecated
          a.b();
           ^
      1 warning

            Assignee:
            Vicente Arturo Romero Zaldivar
            Reporter:
            Liam Miller-Cushon
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: