Aleks Tamarkin created GROOVY-10919:
---------------------------------------

             Summary: @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


@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. 



 



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

Reply via email to