JSR-308 and @SuppressWarnings

Martin Buchholz martinrb at google.com
Mon Jun 23 19:55:32 UTC 2014

For years, those of us maintaining low-level libraries have been writing
code like this:

                        @SuppressWarnings("unchecked") E itemE = (E) item;
                        return itemE;

hoping that JSR-308 might someday allow us to write something like:

                       return (@SuppressWarnings("unchecked") E) item;

which is clearer, more compact, and generates slightly better bytecode.
This article:
suggests that @SuppressWarnings should work "out of the box", but I don't
see that with jdk8 javac.

Are my hopes dashed?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20140623/f056f064/attachment.html>

More information about the compiler-dev mailing list