Force an unchecked call

Posted by François Cassistat on Stack Overflow See other posts from Stack Overflow or by François Cassistat
Published on 2010-03-24T20:28:09Z Indexed on 2010/03/24 20:53 UTC
Read the original article Hit count: 484

Filed under:
|
|

Hello,

Sometimes, when using Java reflection or some special storing operation into Object, you end up with unchecked warnings. I got used to it and when I can't do anything about it, I document why one call is unchecked and why it should be considered as safe.

But, for the first time, I've got an error about a unchecked call. This function :

public <K,V extends SomeClass & SomeOtherClass<K>> void doSomethingWithSomeMap (Map<K,V> map, V data);

I thought that calling it this way :

Map someMap = ...;
SomeClass someData = ...;
doSomethingWithSomeMap(someMap, someData);

would give me an unchecked call warning. Jikes does a warning, but javac gives me an error :

Error: doSomethingWithSomeMap(java.util.Map,V) in SomeClass cannot be applied to (java.util.Map,SomeClass)

Any way to force it to compile with a warning?

Thanks.

© Stack Overflow or respective owner

Related posts about java

Related posts about generics