Java 8 Bug
Alan
alan at alanpinder.com
Fri Nov 8 07:58:31 PST 2013
Sorry if this isn't the correct list ! If not, please tell me where I
should post this bug.
The following code works in jdk1.7.0_21 but not in jdk1.8.0
private static <E extends Enum<?>> Map<String, Enum<?>>
parseEnumConstants(Class<E> clazz) {} = ...
Class<?> type = ...
parseEnumConstants(type.asSubclass(Enum.class))
Map<String, Enum<?>> universe = (Map<String, Enum<?>>)
parseEnumConstants(type.asSubclass(Enum.class));
required: Class<E>
found: Class<CAP#1>
reason: cannot infer type-variable(s) E,U
(argument mismatch; Class<CAP#2> cannot be converted to Class<CAP#3>)
where E,U are type-variables:
E extends Enum<?> declared in method <E>parseEnumConstants(Class<E>)
U extends Object declared in method <U>asSubclass(Class<U>)
where CAP#1,CAP#2,CAP#3 are fresh type-variables:
CAP#1 extends Enum from capture of ? extends Enum
CAP#2 extends Enum from capture of ? extends Enum
CAP#3 extends Enum from capture of ? extends Enum
What is really unusual is that I can't see how this error can be
occuring - none of the method signatures have changed!
More information about the lambda-dev
mailing list