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

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • tbd
    • 8
    • 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

            jlahoda Jan Lahoda
            alanb Alan Bateman
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: