2 Replies Latest reply on Dec 8, 2004 6:32 AM by john.howard9

    Declaring local variables

    john.howard9

      Hi,

      I'm new to javassit and am trying to create a method with local variables. As I couldn't find any examples I tried the code below. I was just wondering whether this is the right way to do this or is there a better approach.

      Thanks,

      John.


      meth.setBody(null);
       meth.addLocalVariable("a", CtClass.intType);
       meth.insertAfter("a = 1; return a;");