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

@MapConstructor with @CompileStatic: Creating static inner class instance => VerifyError: Bad type on operand stack CTE

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.5.2
    • Fix Version/s: 3.0.0-alpha-4, 2.5.5
    • Component/s: Compiler
    • Labels:
      None

      Description

      import groovy.transform.CompileStatic
      import groovy.transform.MapConstructor
      
      @CompileStatic // static bug only
      class GroovyMapConstructorCheck {
      
       @MapConstructor
       static class Goo {
        final int x0
      
        @Override
        String toString() {
         return "Goo(|$x0|)"
        }
       }
      }
      
      println new GroovyMapConstructorCheck.Goo(x0:123)

      Throws

      java.lang.VerifyError: Bad type on operand stack
      Exception Details:
      Location:
      GroovyMapConstructorCheck$Goo.<init>(Ljava/util/Map;)V @57: invokevirtual
      Reason:
      Type 'GroovyMapConstructorCheck$Goo' (current frame, stack[0]) is not assignable to 'groovy/lang/Closure'
      Current Frame:
      bci: @57
      flags: { }
      locals:

      Unknown macro: { 'GroovyMapConstructorCheck$Goo', 'java/lang/Object', 'groovy/lang/MetaClass' }

      stack:

      Unknown macro: { 'GroovyMapConstructorCheck$Goo' }

      Bytecode:
      0x0000000: 2ab7 0015 2ab6 0019 4d2c 2a5f b500 1b2c
      0x0000010: 572b c700 0704 a700 0403 9900 1703 bd00
      0x0000020: 04b8 0021 4e2d 1223 b800 27c0 0023 4c2d
      0x0000030: 572a 2bb8 002d 0157 2ab6 0033 c000 3512
      0x0000040: 36b9 003c 0200 9900 202a b600 33c0 0035
      0x0000050: 1236 b900 4002 003a 0419 04b8 0046 2a5f
      0x0000060: b500 4819 0457 b1
      Stackmap Table:
      full_frame(@25,

      Unknown macro: {Object[#2],Object[#56],Object[#78]}

      ,{})
      same_locals_1_stack_item_frame(@26,Integer)
      full_frame(@49,

      Unknown macro: {Object[#2],Object[#4],Object[#78]}

      ,{})
      same_frame(@102)

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                paulk Paul King
                Reporter:
                emge mgroovy
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: