You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2021/03/02 15:00:00 UTC

[jira] [Resolved] (GROOVY-9951) @CompileStatic @POJO annotation on static inner class with @Immutable annotation

     [ https://issues.apache.org/jira/browse/GROOVY-9951?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Eric Milles resolved GROOVY-9951.
---------------------------------
    Fix Version/s: 4.0.0-alpha-3
       Resolution: Fixed

> @CompileStatic @POJO annotation on static inner class with @Immutable annotation
> --------------------------------------------------------------------------------
>
>                 Key: GROOVY-9951
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9951
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static compilation
>    Affects Versions: 4.0.0-alpha-2
>         Environment: Ubuntu
>            Reporter: Marcio
>            Assignee: Eric Milles
>            Priority: Major
>             Fix For: 4.0.0-alpha-3
>
>          Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> Example:
>  
> {color:#cc7832}import {color}groovy.transform.{color:#bbb529}CompileStatic{color}
> {color:#cc7832}import {color}groovy.transform.{color:#bbb529}Immutable{color}
> {color:#cc7832}import {color}groovy.transform.stc.{color:#bbb529}POJO{color}
>  
> class X {color:#9876aa}{{color}
>  
> {color:#bbb529}  @Immutable @CompileStatic @POJO{color}
> {color:#cc7832}  static class {color}Id {color:#9876aa}{{color}
>      String {color:#9876aa}value{color}
> {color:#9876aa}  }
>  }
>  
>   
>  
>  Then call contructor:
>  
>  var x = new {color}X.Id{color:#9876aa}({color}{color:#6a8759}"1"{color}{color:#9876aa}){color}
>  
> 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,\{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)
>  
>  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,\{Object[#2],Object[#98]}
> ,{})
>  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)
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)