[jboss-user] [Javassist user questions] - Re: Duplicate a method

gkorland do-not-reply at jboss.com
Sun Feb 10 18:27:54 EST 2008

The thing is that I want the new method to look the same as the original code, for that I want to copy the original code.

The problem is that when I use the:
newMethod.setBody(method, null); to copy the original body I need to add the following code to fix the MaxLocals:
	CodeAttribute code = newMethod.getMethodInfo().getCodeAttribute();
	code.setMaxLocals(code.getMaxLocals() + 1);

Isn't there a better way?


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

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4128207

More information about the jboss-user mailing list