[jboss-dev-forums] [Javassist Development] - Why creating a new CtTypeClass while compiling

ami tabak do-not-reply at jboss.com
Sun Nov 18 06:56:15 EST 2012


ami tabak [https://community.jboss.org/people/amitabakoptier] created the discussion

"Why creating a new CtTypeClass while compiling"

To view the discussion, visit: https://community.jboss.org/message/777037#777037

--------------------------------------------------------------
A Question regarding the usage of CtClass 
I have a scenario where I first add a new field to the class and then add insertBefore which is using that new field.

I noticed javassist on the insertBefore has access to the CtClass (1^st^ image) but later on when looking up the new field it goes through MemberResolver. lookupClass0
The problem is that if anyone added via  public CtClass makeClass(InputStream classfile)  non synchronized method a CtClass based on the original  byteCode I will not find the new member I just added.

My questions are
1. Why do we need to look up the CtClass in the pool if we had it at the beginning of the insertBefore flow ?  e.g. use the same instance throughout the flow 
2. Why are some of the ClassPool makeClass syncronized and some are not ?
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/777037#777037]

Start a new discussion in Javassist Development at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2063]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20121118/66ca9185/attachment.html 


More information about the jboss-dev-forums mailing list