Hello,

I am new to Javassist, so excuse me for all the things I do not know yet.

I am having trouble adding a class annotation. I do exactly what the 
AnnotationsAttribute API page sample does:

 ClassFile cf = ... ;
 ConstPool cp = cf.getConstPool();
 AnnotationsAttribute attr
     = new AnnotationsAttribute(cp, AnnotationsAttribute.visibleTag);
 Annotation a = new Annotation("Author", cp);
 a.addMemberValue("name", new StringMemberValue("Chiba", cp));
 attr.setAnnotation(a);
 cf.addAttribute(attr);
 cf.setVersionToJava5();

But when I create this page, using ct.write(), I just get a class which extends 
an Object with an empty constructor, but no annotation.

Any insight?

Thank you.

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

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4170227
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to