javassist不能为实现通用接口的类设置超类
代码如:
public interface A<T>{
T a();
}
public class Base {
//....
}
public class B extends Base implements A<String> {
//...
}
public class C extends Base {
}
像这样的javassist代码:
CtClass c = pool.getCtClass("com.test.B");
if (c.isFrozen()) {
c.defrost();
}
if (c.getSuperclass().getName().equals("com.test.Base")) {
c.setSuperclass(pool.getCtClass("com.test.C"));
}
我想通过javassist将类C设置为B类的超类,但它不起作用!