Uploaded image for project: 'Javassist'
  1. Javassist
  2. JASSIST-242

VerifyError: Inconsistent args count operand in invokeinterface when boolean parameter function with inheritance

This issue belongs to an archived project. You can view it, but you can't modify it. Learn more

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Done
    • 3.19.0-GA
    • 3.20.0-GA
    • None
    • Hide

      import javassist.ClassPool;
      import javassist.CtClass;
      import javassist.CtMethod;

      /**

      • Test code to reproduce the issue
        */

      interface IBooleanSeries {
      public void setValue(boolean value);
      }

      class BooleanDataSeries implements IBooleanSeries{

      @Override
      public void setValue(boolean value)

      { //do }

      }

      class Hello {

      IBooleanSeries BOOL_SERIES;

      public void say()

      { System.out.println("Hello end :) "); }

      public IBooleanSeries createBooleanSeriesStep()

      { return new BooleanDataSeries(); }

      }

      public class BoolSeriesTest {

      public static void main(String[] args) throws Exception {
      Boolean ss = new Boolean(2>3);
      ClassPool cp = ClassPool.getDefault();
      CtClass cc = cp.get("Hello");
      CtMethod m = cc.getDeclaredMethod("say");
      m.insertBefore("

      { System.out.println(\"Say Hello...\"); }

      ");

      StringBuilder sb = new StringBuilder();
      sb.append("BOOL_SERIES = createBooleanSeriesStep();");

      //Below code cause the issue
      sb.append("BOOL_SERIES.setValue(3>=3);"); //lets comment this and run it will work

      // Below code snippets will work
      // this cast into exact class and call the same function
      sb.append("((BooleanDataSeries)BOOL_SERIES).setValue(3>=3);");

      // this code snippet will set exact boolean variable to the function.
      sb.append("boolean var = 3>=3;");
      sb.append("BOOL_SERIES.setValue(var);");

      m.insertBefore(sb.toString());
      Class c = cc.toClass();
      Hello h = (Hello)c.newInstance();
      h.say();
      }

      }

      Show
      import javassist.ClassPool; import javassist.CtClass; import javassist.CtMethod; /** Test code to reproduce the issue */ interface IBooleanSeries { public void setValue(boolean value); } class BooleanDataSeries implements IBooleanSeries{ @Override public void setValue(boolean value) { //do } } class Hello { IBooleanSeries BOOL_SERIES; public void say() { System.out.println("Hello end :) "); } public IBooleanSeries createBooleanSeriesStep() { return new BooleanDataSeries(); } } public class BoolSeriesTest { public static void main(String[] args) throws Exception { Boolean ss = new Boolean(2>3); ClassPool cp = ClassPool.getDefault(); CtClass cc = cp.get("Hello"); CtMethod m = cc.getDeclaredMethod("say"); m.insertBefore(" { System.out.println(\"Say Hello...\"); } "); StringBuilder sb = new StringBuilder(); sb.append("BOOL_SERIES = createBooleanSeriesStep();"); //Below code cause the issue sb.append("BOOL_SERIES.setValue(3>=3);"); //lets comment this and run it will work // Below code snippets will work // this cast into exact class and call the same function sb.append("((BooleanDataSeries)BOOL_SERIES).setValue(3>=3);"); // this code snippet will set exact boolean variable to the function. sb.append("boolean var = 3>=3;"); sb.append("BOOL_SERIES.setValue(var);"); m.insertBefore(sb.toString()); Class c = cc.toClass(); Hello h = (Hello)c.newInstance(); h.say(); } }

    Description

      java.lang.VerifyError: Inconsistent args count operand in invokeinterface comes when there is a function in inheritance with boolean parameters. And if we call that function with some expression to evaluate as a boolean value.
      This error occurred.

      Error message
      Exception in thread "main" java.lang.VerifyError: Inconsistent args count operand in invokeinterface
      Exception Details:
      Location:
      Hello.say()V @22: invokeinterface
      Reason:
      Error exists in the bytecode
      Bytecode:
      0000000: 2a2a b600 2bb5 0029 2ab4 0029 0606 a200
      0000010: 0703 a700 0404 b900 3103 002a b400 29c0
      0000020: 0005 0606 a200 0703 a700 0404 b600 3206
      0000030: 06a2 0007 03a7 0004 043c 2ab4 0029 1bb9
      0000040: 0031 0200 b200 0212 27b6 0004 b200 0212
      0000050: 03b6 0004 b1
      Stackmap Table:
      same_locals_1_stack_item_frame(@21,Object45)
      full_frame(@22,

      {Object[#7]},{Object[#45],Integer})
      same_locals_1_stack_item_frame(@43,Object5)
      full_frame(@44,{Object[#7]}

      ,

      {Object[#5],Integer}

      )
      same_frame(@56)
      same_locals_1_stack_item_frame(@57,Integer)

      at java.lang.Class.getDeclaredConstructors0(Native Method)
      at java.lang.Class.privateGetDeclaredConstructors(Class.java:2493)
      at java.lang.Class.getConstructor0(Class.java:2803)
      at java.lang.Class.newInstance(Class.java:345)
      at BoolSeriesTest.main(BoolSeriesTest.java:59)

      Attachments

        Activity

          People

            chiba_jira Shigeru Chiba (Inactive)
            guruce Gurutharshan Nadarajah
            Archiver:
            samahaja@redhat.com Sagar Mahajan

            Dates

              Created:
              Updated:
              Resolved:
              Archived: