[jboss-user] [Javassist user questions] - Re: Altering Generics Information of Methods using Javassist
do-not-reply at jboss.com
Thu Dec 20 15:19:52 EST 2007
I have done further reading on how this is implemented by the compiler and finally found out the answer I was looking for.
You can defenitely do that with javaassist. The key class is javassist.bytecode.SignatureAttribute.
>From a CtMethod, i've obtained the methodInfo I add a Signature attribute. You can do it with something like:
CtMethod method = ....
| MethodInfo methodInfo = method.getMethodInfo();
| SignatureAttribute signatureAttribute = new SignatureAttribute(methodInfo.getConstPool(),
If your more interesed in reading the signature with the generics inside, you can use the methodInfo.getAttribute(SignatureAttribute.tag).
I hope this helped.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4114787#4114787
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4114787
More information about the jboss-user