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

VerifyError when instantiating class with @CompileStatic that implements a method with @DelegatesTo annotation.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.5.6, 3.0.7
    • 3.0.8, 4.0.0-alpha-3, 2.5.16
    • None
    • None
    • Windows 10, Java 11

    Description

      Please see the script in the attachment for a minimal code sample to reproduce this issue.

      This issue occurs both when implementing a trait, or when implementing an interface and using @Delegate to provide the implementation of the interface. Writing the implementation directly in the class works fine.

      When I take out either @CompileStatic or @DelegatesTo the issue disappears.

       

      stacktrace (groovy 3.0.7, using a trait (first example in script)):

      ERROR java.lang.VerifyError:
      Bad type on operand stack
      Exception Details:
      Location:
      P$C.P$Ttrait$super$stuff(Lgroovy/lang/Closure;)V @8: invokevirtual
      Reason:
      Type 'P$C' (current frame, stack[0]) is not assignable to 'groovy/lang/Closure'
      Current Frame:
      bci: @8
      flags: { }
      locals: { 'P$C', 'groovy/lang/Closure' }
      stack: { 'P$C' }
      Bytecode:
      0000000: 2ac1 003c 9900 232a b600 42c0 000d b900
      0000010: 4501 0012 4604 bd00 0459 032b 53b8 004c
      0000020: c000 4e57 a700 1712 042a 1246 c000 5004
      0000030: bd00 0459 032b 53b8 0056 57b1
      Stackmap Table:
      same_frame(@39)
      same_frame(@59)

      at P.run (groovysh_evaluate:13)
      at P$run.call (Unknown Source)

       

       

      stacktrace (groovy 3.0.7, using @Delegate (second example in script)):

      ERROR java.lang.VerifyError:
      Bad type on operand stack
      Exception Details:
      Location:
      P2$C.stuff(Lgroovy/lang/Closure;)V @1: invokevirtual
      Reason:
      Type 'P2$C' (current frame, stack[0]) is not assignable to 'groovy/lang/Closure'
      Current Frame:
      bci: @1
      flags: { }
      locals: { 'P2$C', 'groovy/lang/Closure' }
      stack: { 'P2$C' }
      Bytecode:
      0000000: 2ab6 002f c000 0b2b b600 3101 57b1

      at P2.run (groovysh_evaluate:19)
      at P2$run.call (Unknown Source)

      Attachments

        1. script.groovy
          1 kB
          Felix ter Beek

        Activity

          People

            emilles Eric Milles
            GroovyUser Felix ter Beek
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 0.5h
                0.5h