0 Replies Latest reply on Feb 15, 2008 11:33 AM by Guy Korland

    problem initialize a local variable

    Guy Korland Newbie

      Hi,

      I'm trying to add a local variable and then initialize it.
      The code is pretty simple (define a local variable and use a static get() to assign a value):

      method.addLocalVariable(LOCAL_VARIBALE_NAME, TEST_CLASS);
      method.insertBefore(LOCAL_VARIBALE_NAME + "=" + TEST_CLASS.getName() + ".get();");

      But I get the following error:
      Exception in thread "main" java.lang.VerifyError: (class: org/test/main/AA, method: foo3 signature: ()V) Incompatible argument to function
      at org.test.main.Main.main(Main.java:24)

      But if I switch it to:
      method.insertBefore(LOCAL_VARIBALE_NAME + "=new " + TEST_CLASS.getName() + "();");

      It works!

      Any ideas?

      Thanks,
      Guy