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