The purpose of it is to mark a block (e.g. a method) so it would not generate certain warnings.
In my case I have to mix a "legacy" library with my own code that uses generics. So "per definition" I get unchecked-warnings whenever I assign the non-generic collection from the library to my "generified" collections.
No worries there, that's what the
@SuppressWarnings("unchecked")is for - right ?
Wrong.
Well not quite wrong. It's true, that's what the annotation is for.
However, it does not work.
I did a lot of yelling, wondering, code-changing (e.g. the explicit-non-varargs version like @SuppressWarnings({"unchecked"}), ...), but that did change this.
What helped was of course googling around for a couple of minutes.
There I stumled onto Sun bug #4986256 which clearly describes that the @SuppressWarnings was indeed documented, but not implemented in 1.5.0.
Well finally, it has been implemented in update 6 and guess what - I was still on update 5.
So am now on update 9 and it works.
technorati tags:Java
No comments:
Post a Comment