@SuppressWarnings("deprecation") does not not work correctly?

Jan Lahoda lahoda at gmail.com
Mon Aug 20 09:50:42 PDT 2007

    when I try to compile the following piece of code with
"-Xlint:deprecation", it produces

/tmp/JavaApplication1/src/javaapplication1/Main.java:7: warning:
[deprecation] java.rmi.RMISecurityException in java.rmi has been deprecated

This does not seem right to me, as JLS says that:
"a Java compiler must not report any warning identified by one of *S1, ... ,
Sk* if that warning would have been generated as a result of the annotated
declaration or any of its parts"

I read this in such a way that even the type of the variable should be
covered by the SuppressWarnings. Is this a bug or do I misread the

I have tested this on:
[snip]/jdk17/bin$ ./java -version
java version "1.7.0-ea"
Java(TM) SE Runtime Environment (build 1.7.0-ea-b18)
Java HotSpot(TM) Server VM (build 1.7.0-ea-b18, mixed mode)


package javaapplication1;

public class Main {

    public static void main(String[] args) {
        java.rmi.RMISecurityException ex;

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20070820/26e9453b/attachment.html 

More information about the compiler-dev mailing list