I'm getting a compiler error with this code:
Map<String, String[]> myMap;
void set(Map<String, Object> foo) { }
set(myMap); // generates error
Error: "The method set(Map<String,Object>) in the type XXX is not applicable for the arguments (Map<String,String[]>)"
This makes no sense to me, because String[] is in fact an Object, and is entirely compatible with the parameter in set().
This error did not show up in my code until I upgraded from JDK 1.6 to 1.7. I do not see a switch in Eclipse to turn it off. How do I get this code to compile?
Edit:
It does compile if I use an intermediate variable, and drop the generics:
Map anotherMap = myMap;
set(anotherMap);