You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Aleks Tamarkin (Jira)" <ji...@apache.org> on 2023/01/26 21:41: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 ]
Aleks Tamarkin updated GROOVY-10919:
------------------------------------
Description:
@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.
was:
@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
{code:java}
Foo(x:2, y:0, z:3){code}
Which is incorrect. 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.
> @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
> Priority: Major
>
> @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)