[jboss-user] [Javassist] - Re: Can I delete the modifier of a method with Javassist?

Nils Andreas Svee do-not-reply at jboss.com
Sat Dec 15 10:36:39 EST 2012


Nils Andreas Svee [https://community.jboss.org/people/doctorx] created the discussion

"Re: Can I delete the modifier of a method with Javassist?"

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

--------------------------------------------------------------
I would have done something like this:

{code}
ClassPool pool = ClassPool.getDefault();
CtClass cc = pool.get("ClsSync");

CtMethod m = cc.getDeclaredMethod("biat");
int oldMod = m.getModifiers();
int mod = Modifier.clear(oldMod, Modifier.SYNCHRONIZED);
m.setModifiers(mod);

Class newClass = cc.toClass(); // or cc.writeFile() if you wish to keep the changes
{/code}
--------------------------------------------------------------

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

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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20121215/c8742f99/attachment.html 


More information about the jboss-user mailing list