SuppressWarnings("deprecation") does not suppress warnings when it should

XMLWordPrintable

    • Type: Bug
    • Resolution: Duplicate
    • Priority: P4
    • tbd
    • Affects Version/s: 8
    • Component/s: tools
    • None
    • generic
    • generic

      Here's an example of using @SuppressWarnings to suppress a deprecation warning:

      class Test {

          @Deprecated
          interface Foo { }

          @SuppressWarnings("deprecation")
          interface Bar extends Foo { }
      }

      Now consider the case where Foo and Bar are in separate source files:

      Foo.java:

        @Deprecated
        interface Foo { }

      Bar.java

        @SuppressWarnings("deprecation")
        interface Bar extends Foo { }

      In that case it doesn't seem to be possible to suppress the warning:

      $ javac -Xlint:all Foo.java Bar.java
      Bar.java:2: warning: [deprecation] Foo in unnamed package has been deprecated
      interface Bar extends Foo { }
                            ^
      1 warning

            Assignee:
            Jan Lahoda
            Reporter:
            Alan Bateman
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: