[Java] Force an unchecked call
- by François Cassistat
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 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: <K,V>doSomethingWithSomeMap(java.util.Map<K,V>,V) in SomeClass cannot be applied to (java.util.Map,SomeClass)
Any way to force it to compile with a warning?
Thanks.