procyon
procyon copied to clipboard
ClassCastException when reflecting a type that has generic constructors
Source seems to be this code here: https://github.com/mstrobel/procyon/blob/master/Procyon.Reflection/src/main/java/com/strobel/reflection/Resolver.java#L331-L350
It assumes that the only sources of generic declarations are 1) methods and 2) classes, but misses 3) constructors.
Minimal reproduction case:
static class Foo {
public int bar;
public <T> Foo(List<T> b) { }
}
public static void main(final String[] args) {
Type.of(Foo.class).getField("bar");
}