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

Jonathan Gibbons Jonathan.Gibbons at Sun.COM
Mon Aug 20 09:56:37 PDT 2007


Jan,

That looks like a bug. Please feel free to file a bug report.

-- Jon G.

On Aug 20, 2007, at 9:50 AM, Jan Lahoda wrote:

> Hi,
>     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 9.6.1.5 says that:
> "a Java compiler must not report any warning identified by one of  
> S1, ... , S k 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 specification?
>
> 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)
>
> Thanks,
>     Jan
>
> ---------------------------------------------------------------------- 
> ---------
> package javaapplication1;
>
> public class Main {
>
>     public static void main(String[] args) {
>         @SuppressWarnings("deprecation")
>         java.rmi.RMISecurityException ex;
>     }
>
> }
> ---------------------------------------------------------------------- 
> ------

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


More information about the compiler-dev mailing list