Community
Participate
Working Groups
The following code compiles in eclipse with a WARNING: Type safety: The expression of type EnumSet needs unchecked conversion to conform to EnumSet<Enum> The code fails in javac 1.5.0_01 with an ERROR: EnumTest.java:15: type parameter java.lang.Enum is not within its bound EnumSet<Enum> eSet = EnumSet.allOf(c); Changing EnumSet<Enum> to EnumSet<Foo> resolves the javac error. I tried to figure out the JLS3 interpretation of this, but got confused. ////////////////////////////////////////////////////// import java.util.EnumSet; enum Foo { blargh, baz, boz; } public class EnumTest { public static void main(String[] args) { Class c = Foo.class; EnumSet<Enum> eSet = EnumSet.allOf(c); } }
Added regression test: GenericTypeTest#test533-538. Adjusted type variable bound check. Fixed
Verified in I20050330-0500