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

@CompileStatic @POJO annotation on static inner class with @Immutable annotation

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 4.0.0-alpha-2
    • Fix Version/s: 3.0.8, 4.0.0-alpha-3
    • Component/s: Static compilation
    • Labels:
      None
    • Environment:
      Ubuntu

      Description

      Example:

       

      import groovy.transform.CompileStatic

      import groovy.transform.Immutable

      import groovy.transform.stc.POJO

       

      class X {

       

        @Immutable @CompileStatic @POJO

        static class Id {

           String value

        }
      }

       

      Then call contructor:

      var x = new
      X.Id("1")

       

      Expected:

         No error at runtime.

       

      Actual:

      Bad type on operand stack
      Exception Details:
      Location:
      dev/X$Id.<init>(Ljava/util/Map;)V @44: invokevirtual
      Reason:
      Type 'dev/$Id' (current frame, stack[0]) is not assignable to 'groovy/lang/Closure'
      Current Frame:
      bci: @44
      flags: { }
      locals: { 'dev/X$Id', 'java/util/Map', top, 'java/util/List' }
      stack: { 'dev/X$Id' }
      Bytecode:
      0000000: 2ab7 0019 2bc7 0007 04a7 0004 0399 000f
      0000010: 03bd 0004 b800 264d 2c4c 2c57 04bd 0004
      0000020: 5903 1227 53b8 002b 4e2d 572a b600 31c0
      0000030: 0007 b600 37b9 003d 0100 013a 043a 0519
      0000040: 05b9 0043 0100 9900 4019 05b9 0046 0100
      0000050: b800 4cc0 001b 3a04 2ab6 0031 c000 0719
      0000060: 04b9 0052 0200 9a00 0704 a700 0403 9900
      0000070: 15bb 0054 5912 5619 04b8 005c b700 5ec0
      0000080: 0060 bfa7 ffbc 2b12 27b9 0065 0200 9900
      0000090: 202b 1227 b900 6902 00b8 004c c000 1b3a
      00000a0: 0619 062a 5fb5 001d 1906 57a7 0016 013a
      00000b0: 0719 07b8 004c c000 1b2a 5fb5 001d 1907
      00000c0: 57b1
      Stackmap Table:
      full_frame(@12,

      {Object[#2],Object[#98]}

      ,{})
      same_locals_1_stack_item_frame(@13,Integer)
      same_frame(@28)
      full_frame(@63,{Object2,Object98,Top,Object78,Object27,Object63},{})
      same_frame(@109)
      same_locals_1_stack_item_frame(@110,Integer)
      same_frame(@131)
      same_frame(@134)
      same_frame(@174)
      same_frame(@193)

      java.lang.VerifyError: Bad type on operand stack
      Exception Details:
      Location:
      dev/X$Id.<init>(Ljava/util/Map;)V @44: invokevirtual
      Reason:
      Type 'dev/X$Id' (current frame, stack[0]) is not assignable to 'groovy/lang/Closure'
      Current Frame:
      bci: @44
      flags: { }
      locals: { 'dev/X$Id', 'java/util/Map', top, 'java/util/List' }
      stack: { 'dev/sX$Id' }
      Bytecode:
      0000000: 2ab7 0019 2bc7 0007 04a7 0004 0399 000f
      0000010: 03bd 0004 b800 264d 2c4c 2c57 04bd 0004
      0000020: 5903 1227 53b8 002b 4e2d 572a b600 31c0
      0000030: 0007 b600 37b9 003d 0100 013a 043a 0519
      0000040: 05b9 0043 0100 9900 4019 05b9 0046 0100
      0000050: b800 4cc0 001b 3a04 2ab6 0031 c000 0719
      0000060: 04b9 0052 0200 9a00 0704 a700 0403 9900
      0000070: 15bb 0054 5912 5619 04b8 005c b700 5ec0
      0000080: 0060 bfa7 ffbc 2b12 27b9 0065 0200 9900
      0000090: 202b 1227 b900 6902 00b8 004c c000 1b3a
      00000a0: 0619 062a 5fb5 001d 1906 57a7 0016 013a
      00000b0: 0719 07b8 004c c000 1b2a 5fb5 001d 1907
      00000c0: 57b1
      Stackmap Table:
      full_frame(@12,{Object2,Object98}

      ,{})
      same_locals_1_stack_item_frame(@13,Integer)
      same_frame(@28)
      full_frame(@63,

      {Object[#2],Object[#98],Top,Object[#78],Object[#27],Object[#63]}

      ,{})
      same_frame(@109)
      same_locals_1_stack_item_frame(@110,Integer)
      same_frame(@131)
      same_frame(@134)
      same_frame(@174)
      same_frame(@193)

       

       

        Attachments

          Activity

            People

            • Assignee:
              emilles Eric Milles
              Reporter:
              marciodel Marcio
            • 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 - 1h 10m
                1h 10m