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 2023/02/03 17:44:00 UTC

[jira] [Updated] (GROOVY-10919) @MapConstructor Breaks in Groovy4 when combined with @TupleConstructor, fine in Groovy3

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

Eric Milles updated GROOVY-10919:
---------------------------------
    Fix Version/s: 4.0.9

> @MapConstructor Breaks in Groovy4 when combined with @TupleConstructor, fine in Groovy3
> ---------------------------------------------------------------------------------------
>
>                 Key: GROOVY-10919
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10919
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 4.0.8
>            Reporter: Aleks Tamarkin
>            Assignee: Eric Milles
>            Priority: Major
>             Fix For: 4.0.9
>
>
> @MapConstructor Breaks in Groovy4 when combined with @TupleConstructor, fine in Groovy3
>  
> Example in Groovy4
> {code:java}
> import groovy.transform.*
> @MapConstructor(includeFields = true)
> @TupleConstructor(includeFields = true)
> @ToString(includeNames = true, includeFields = true)
> class Foo {    
>   private final float w = 1    
>   private final int x    
>   private int y = 1    
>   private final int z
> }
> println new Foo(x:2, z: 3){code}
> outputs the incorrect value
> {code:java}
> Foo(x:2, y:0, z:3){code}
> In Groovy3 it outputs the correct 
> {code:java}
> Foo(x:2, y:1, z:3){code}
> Also commenting out @TupleConstructor in Groovy4 causes the output to be the correct value. 
>  



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