-
Bug
-
Resolution: Cannot Reproduce
-
P4
-
8, 11
-
x86_64
-
generic
A DESCRIPTION OF THE PROBLEM :
Type variable information is not always maintained for anonymous classes
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the source code
ACTUAL -
T
null
---------- BEGIN SOURCE ----------
public class Xx<S> {
public static <T> void main(String[] args) {
printIt(new Xx<T>() {}.getClass());
Runnable r = () -> printIt(new Xx<T>() {}.getClass());
r.run();
}
static void printIt(Class<?> cl) {
ParameterizedType pt = (ParameterizedType) cl.getGenericSuperclass();
System.out.println(pt.getActualTypeArguments()[0]);
}
}
---------- END SOURCE ----------
FREQUENCY : always
Type variable information is not always maintained for anonymous classes
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the source code
ACTUAL -
T
null
---------- BEGIN SOURCE ----------
public class Xx<S> {
public static <T> void main(String[] args) {
printIt(new Xx<T>() {}.getClass());
Runnable r = () -> printIt(new Xx<T>() {}.getClass());
r.run();
}
static void printIt(Class<?> cl) {
ParameterizedType pt = (ParameterizedType) cl.getGenericSuperclass();
System.out.println(pt.getActualTypeArguments()[0]);
}
}
---------- END SOURCE ----------
FREQUENCY : always
- relates to
-
JDK-8171335 MethodHandle.Lookup functionality to define a nestmate class
-
- Closed
-