JSR-308 and @SuppressWarnings

Remi Forax forax at univ-mlv.fr
Mon Jun 23 20:35:24 UTC 2014


On 06/23/2014 09:55 PM, Martin Buchholz wrote:
> 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:
> http://www.oracle.com/technetwork/articles/java/ma14-architect-annotations-2177655.html
> suggests that @SuppressWarnings should work "out of the box", but I 
> don't see that with jdk8 javac.
>
> Are my hopes dashed?

that's a great idea !

Rémi


More information about the compiler-dev mailing list