[jboss-user] [Javassist user questions] - Re: Altering Generics Information of Methods using Javassist

2008-05-25 Thread Ugn
I'am interested in reading return and parameter types like  Collection . With 
your suggestion it does not  work for me. I just get somer annotations an thats 
it. If I work with  mthod.getReturnType()  i get Collection but not Collection. 
Does someone have an idea how to solve this problem?

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4153234#4153234

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4153234
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [Javassist user questions] - Re: Altering Generics Information of Methods using Javassist

2007-12-20 Thread SimonRinguette
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(),
  | ()Ljava/util/ListLjava/lang/String;;);
  | methodInfo.addAttribute(signatureAttribute);

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=bbop=viewtopicp=4114787#4114787

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4114787
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user