I've tested javassist 3 (beta), recompiling my sources with the above library, but the
behavior of the shown code has not changed. I've substituted the aPool.write() call
with a call toBytecode() over the CtClass object, but I'm still able to copy
duplicated members as detailed in previous
Well, I suppose it suffices the field_info is different, since even adding fields of
the same type works. I've tried it both with a primitice type (an int) and an object
(a string), both with the same name and the same access specifier (even if this should
not change things) and it works.
Luca
Well, src and dest are different CtClass, I mean they are produced from different
classes. When I try to define the class, in my classloader, as:
/* create the pools */
ClassPool aPool=ClassPool.getDefault();
this.addClasspathToPoll(aPool);
.
byte[]
Maybe I'm misunderstanding but I've the following code to work on my system:
CtField fields[]=src.getDeclaredFields();
CtField addingField=null;
for(int i=0;ifields.length;i++) {
addingField=new CtField(fields.getType(),fields.getName(),dest);
Hi,
is it possible, using Javassist, to insert in an exisiting class duplicated members? I
mean, supposing a class has a variable and a method like the following:
public int variable;
public void method(){..}
can I insert a CtField which represents a variable with variable name and is an int,