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;i<fields.length;i++) {

      addingField=new CtField(fields.getType(),fields.getName(),dest);
      addingField.setModifiers(fields.getModifiers());
      dest.addField(addingField);
}

supposing src and dest are CtClass objects. Now what I cannot understand is why the 
system is allowing me to copy (and create) objects from the dest class even if the I 
copy duplicated fields (I mean fields with the same name but different type) from src 
to dest. Moreover, if I try something similar with methods:

CtMethod toAdd[]=src.getDeclaredMethods();
CtMethod copy=null;

for(int i=0;i<toAdd.length;i++) {
        copy=CtNewMethod.copy(toAdd,dest,null);
         dest.addMethod(copy);
}

and the method has the same signature of another one, which already exists in src, I 
got an ClassFormatException during creation. Why this does not happen with the fields? 

Hope someone can explain me this.

Luca

View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3835345#3835345

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3835345


-------------------------------------------------------
This SF.Net email is sponsored by: SourceForge.net Broadband
Sign-up now for SourceForge Broadband and get the fastest
6.0/768 connection for only $19.95/mo for the first 3 months!
http://ads.osdn.com/?ad_id=2562&alloc_id=6184&op=click
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to