1 Reply Latest reply on Nov 18, 2006 6:25 PM by Jonas Bergström

    What is the best way to a add parameters to a method?

    Jonas Bergström Newbie

      Hello.

      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