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

[jira] [Resolved] (GROOVY-9406) `VerifyError` when annotating with both @InheritConstructors and @NullCheck and calling the resulting c'tor

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

Paul King resolved GROOVY-9406.
-------------------------------
    Fix Version/s: 3.0.2
         Assignee: Paul King
       Resolution: Fixed

This should be fixed now. It was previously getting declared methods which included generated ones in some cases. It now skips those but has a flag to try to add null checks on some generated cases too.

> `VerifyError` when annotating with both @InheritConstructors and @NullCheck and calling the resulting c'tor
> -----------------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-9406
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9406
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 3.0.1
>            Reporter: Christoph Frick
>            Assignee: Paul King
>            Priority: Major
>             Fix For: 3.0.2
>
>
> Given a class annotated with both `@InheritConstructors` and
>  `@NullCheck` (note the order!), a `java.lang.VerifyError` happens, when
>  the c'tor is called.
> E.g.
> {code:groovy}
> class Base {
> 	Long id
> 	Base(Long id) { this.id = id }
> }
> @groovy.transform.InheritConstructors // <1>
> @groovy.transform.NullCheck           // <2>
> class Sub extends Base {}
> new Sub(null)
> {code}
> Results in:
> {noformat}
> Caught: java.lang.VerifyError: Bad operand type when invoking <init>
> Exception Details:
>   Location:
>     Sub.<init>(Ljava/lang/Long;)V @38: invokespecial
>   Reason:
>     Invalid type: 'Sub' (current frame, stack[0])
>   Current Frame:
>     bci: @38
>     flags: { }
>     locals: { 'Sub', 'java/lang/Long', '[Lorg/codehaus/groovy/runtime/callsite/CallSite;' }
>     stack: { 'Sub', 'java/lang/Long' }
>   Bytecode:
>     0x0000000: b800 104d 2ab7 0013 2b01 b800 1999 0014
>     0x0000010: 2c12 1a32 121c 121e b900 2403 00c0 0026
>     0x0000020: bf2a 2bc0 0028 b700 2ab1               
>   Stackmap Table:
>     full_frame(@33,{Object[#2],Object[#40],Object[#48]},{})
> java.lang.VerifyError: Bad operand type when invoking <init>
> Exception Details:
>   Location:
>     Sub.<init>(Ljava/lang/Long;)V @38: invokespecial
>   Reason:
>     Invalid type: 'Sub' (current frame, stack[0])
>   Current Frame:
>     bci: @38
>     flags: { }
>     locals: { 'Sub', 'java/lang/Long', '[Lorg/codehaus/groovy/runtime/callsite/CallSite;' }
>     stack: { 'Sub', 'java/lang/Long' }
>   Bytecode:
>     0x0000000: b800 104d 2ab7 0013 2b01 b800 1999 0014
>     0x0000010: 2c12 1a32 121c 121e b900 2403 00c0 0026
>     0x0000020: bf2a 2bc0 0028 b700 2ab1               
>   Stackmap Table:
>     full_frame(@33,{Object[#2],Object[#40],Object[#48]},{})
> 	at nullcheckinherhitctor.run(nullcheckinherhitctor.groovy:10)
> {noformat}
> Please note: switching `<1>` and `<2>` does *not* show this error, but
>  the `null` does not throw either.



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