I'm using javassist 3.1, and I want to add parameters to an existing method.
I haven't found anything in the API that supports that, so I've tried to create a new method with the new parameters, and copy the method body over from the old method to the new (by copying over the CodeAttribute).
But when I try to instrument the new method using ExprEditor.edit(NewExpr e) (I want to add a code line after a "new" statement), the "$args" identifier references the NewExpr parameters rather than the method parameters.
This makes me think that the copying ov the method body wasn't done correctly.
Does anyone have a clue?
Thanks / Jonas
Maybe it's a bug in how ExprEditor.edit(NewExpr e) handles $args, because I got it working by declaring new local variables at the top of the new method and assigning them to the new parameters (using $args), and then I used the those variables in the ExprEditor.edit code instead of $args.