Community
Participate
Working Groups
I20050118-1015 Hiding of static method in superclass: Eclipse errors where java allows unchecked conversion: package p; enum Color { RED, GREEN, BLUE; public static Color valueOf(Class c, String s) { return null; } } Eclipse: Error: The return type is incompatible with Enum<Color>.valueOf(Class<T>, String) javac: warning: valueOf(java.lang.Class,java.lang.String) in p.Color overrides <T>valueOf(java.lang.Class<T>,java.lang.String) in java.lang.Enum; return type requires unchecked conversion
(In reply to comment #0) This problem doesn't seem to be limited to static methods. Consider this method: List<String> createStringList(final String[] array) { return new AbstractList<String>() { public int size() { return array.length; } public String get(int i) { // Here is where the problem lies return array[i]; } }; } M4 flags the return value of the get(int) method with an unchecked conversion warning very much like the one described in the original report. The applicable value of the List's type parameter is known to the compiler at this point, but it doesn't seem to be used. The anonymous class is using a covariant return type, true, but that's a legal. Sun's version 1.5.0 compiler handles the code without warning.
Kent - is this still an issue ?
Both of these cases work for me with the latest. Unsure when exactly they were fixed.