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

VerifyError - Virtual method call from a static context

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.8.0, 1.8.1
    • 1.8.2, 1.9-beta-3
    • bytecode, Compiler
    • None
    • Mac - JDK 1.6.0_22

    Description

      Failing to put a public accessor on the 'name' field of the attached test object causes an error in the bytecode.

      The exception is:
      <error message="(class: com/peersaver/model/Breaking, method: <clinit> signature: ()V) Incompatible object argument for function call" type="java.lang.VerifyError">java.lang.VerifyError: (class: com/peersaver/model/Breaking, method: <clinit> signature: ()V) Incompatible object argument for function call
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Class.java:169)
      at com.peersaver.model.BreakingTest.class$(BreakingTest.groovy)
      at com.peersaver.model.BreakingTest.$get$$class$com$peersaver$model$Breaking(BreakingTest.groovy)
      at com.peersaver.model.BreakingTest.testBreaking(BreakingTest.groovy:23)
      </error>

      The email conversation with details is here:
      http://groovy.329449.n5.nabble.com/VerifyError-when-upgrading-to-Groovy-1-8-1-clinit-problem-around-getter-generation-td4640586.html

      The relevant bit, again quoting BlackDragon:
      (in the <clinit> bytecode)
      "> ALOAD 0
      > INVOKEVIRTUAL Quiz.getName() : String
      > INVOKEINTERFACE CallSite.call(Object,Object) : Object

      it is a pretty bad idea to do a virtual method call from a static
      context. Looks like that information is missed on "

      Attachments

        1. BreakingTest.groovy
          0.5 kB
          Jason Griffith

        Activity

          People

            blackdrag Jochen Theodorou
            jason@bobberinteractive.com Jason Griffith
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: