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

Paul King closed GROOVY-11329.
------------------------------
    Fix Version/s: 5.0.0-alpha-7
                   4.0.20
       Resolution: Fixed

NPE guard added.

> Class using trait and @Immutable and allProperties gives BUG! exception in 
> phase 'canonicalization' NPE
> -------------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-11329
>                 URL: https://issues.apache.org/jira/browse/GROOVY-11329
>             Project: Groovy
>          Issue Type: Bug
>            Reporter: Paul King
>            Assignee: Paul King
>            Priority: Major
>             Fix For: 5.0.0-alpha-7, 4.0.20
>
>
> {code}
> import groovy.transform.Immutable
> trait T {
>     String foo
> }
> @Immutable(allProperties=true)
> class C implements T {
>     String bar
> }
> assert new C('bar', 'foo').toString() == 'C(bar, foo)'
> {code}
> Gives:
> {noformat}
> BUG! exception in phase 'canonicalization' in source unit 'ConsoleScript0' 
> unexpected NullPointerException
> ...
> Caused by: java.lang.NullPointerException
>       at 
> groovy.transform.options.ImmutablePropertyHandler.assignFieldWithDefault(ImmutablePropertyHandler.java:237)
>       at 
> groovy.transform.options.ImmutablePropertyHandler.createConstructorStatementDefault(ImmutablePropertyHandler.java:225)
> {noformat}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to