Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-5613

@CompileStatic - Caught: java.lang.VerifyError - Inconsistent stack height 1 != 2

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.0
    • Fix Version/s: 2.0.1
    • Component/s: Compiler
    • Environment:
      Groovy Version: 2.0.0 JVM: 1.7.0_05 Vendor: Oracle Corporation OS: Linux
      CentOS release 6.3 (Final) x86_64
      CentOS release 5.8 (Final) x86_64

      Description

      Hello,

      I am trying to build an application and I am getting some “Inconsistent stack height” errors, I don’t really know if it’s an error in the libraries I am using or a Groovy bug.
      I have managed the reproduce the error with the minimum code and I have also attached all the needed files to reproduce the error.

      Note:

      • We don’t get the Verify Error if we use “import static” and change “msg?.” with “msg.”
      • We don’t get the Verify Error if we use “import” and with “msg?.”
      • We don’t get the Verify Error if we run the code with @TypeChecked
      import groovy.transform.CompileStatic
      import groovy.transform.TypeChecked
      
      import com.hp.openview.ib.api.jopc.JOpcServerMessage
      import com.hp.openview.ib.api.jopc.JOpcMessage
      import static com.hp.openview.ib.api.jopc.JOpcHelper.*  // Uncomment for example VerifyError and Works
      //import com.hp.openview.ib.api.jopc.JOpcHelper  // Uncomment for example Works2
      
      
      //@TypeChecked // All the examples work is we use TypeChecked instead of CompileStatic
      @CompileStatic
      class ErrorReproduction {
        JOpcServerMessage msg
      
        ErrorReproduction() {
          String VerifyError = long2EventType(msg?.getEventFlag())
          //String Works = long2EventType(msg.getEventFlag())  // This work if we remove the "?"
          //String Works2 = JOpcHelper.long2EventType(msg?.getEventFlag()) // This work if we dont use the "import static"
        }
      
        static void main(String[] args) {
          ErrorReproduction m = new ErrorReproduction()
        }
      }
      
      Caught: java.lang.VerifyError: (class: ErrorReproduction, method: <init> signature: ()V) Inconsistent stack height 1 != 2
      java.lang.VerifyError: (class: ErrorReproduction, method: <init> signature: ()V) Inconsistent stack height 1 != 2
      

        Attachments

        1. GroovyErrorReproduction.zip
          37 kB
          Sebastian YEPES FERNANDEZ

          Activity

            People

            • Assignee:
              melix Cédric Champeau
              Reporter:
              syepes Sebastian YEPES FERNANDEZ
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: