The version I'm using, according to About Eclipse, is:
Ok, so, I found out that if I have an object (say a Map) with the Key type and Value type defined, but then do a get with the wrong object type, Eclipse doesn't complain.
That is, here's the sample code:
Why doesn't the last line give me a warning or error? I could've sworn that, when I used to use Eclipse for Java SE, that it would complain about that. Am I remembering this wrong? Is there some preference or setting that I have to use?
The signature of the Map#get() method is V get(Object) (and if you print it out, you get null, as expected). There is therefore no need for parameterisation of that method; if you precede it with
however, you get a compiler error.
Joined: Jan 05, 2005
Ah, got it! Ok, so I WAS remembering it incorrectly.
Of course, in my sudden indignation, I furiously asked "Well, why the hell isn't the signature V get(K key) instead of V get(Object key)???"
Though I can actually see arguments for both . . . so my indignation ran out of steam real quick, and has settled down into mere irritable grumbling.
subject: Eclipse Indigo for Java EE, why no typechecking for paramaterized objects?