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