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 2024/03/05 04:09:00 UTC
[jira] [Resolved] (GROOVY-11329) Class using trait and @Immutable and allProperties gives BUG! exception in phase 'canonicalization' NPE
[ https://issues.apache.org/jira/browse/GROOVY-11329?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paul King resolved GROOVY-11329.
--------------------------------
Resolution: Fixed
> 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)