[ https://issues.apache.org/jira/browse/GROOVY-7522?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Keegan Witt updated GROOVY-7522: -------------------------------- Description: {{@TupleConstructor}} should not overwrite existing empty default constructors. For example, this should work, but doesn't currently {code:java} assert new Cat("Mr. Bigglesworth").name == null // fails @groovy.transform.TupleConstructor class Cat { String name int age Cat(String name) {} } {code} Granted, this is an edge case. But unexpected behavior, nonetheless. was: Document that if you have a default constructor with no content, {{TupleConstructor}} will overwrite the content. ---- Jira was originally titled _TupleConstructor shouldn't overwrite existing constructors_, but was re-purposed for the reasons mentioned in the comments. Original content is below. {{@TupleConstructor}} should not overwrite existing constructors. For example, this should work, but doesn't currently {code:java} assert new Cat("Mr. Bigglesworth").name == null // fails @groovy.transform.TupleConstructor class Cat { String name int age Cat(String name) {} } {code} Why aren't the {{includes}}/{{excludes}} annotation elements a sufficient workaround? Because one might want all the other combinations {{@TupleConstructor}} provides, but still have their own implementation for a subset of the combinations. Issue Type: Bug (was: Documentation) Summary: TupleConstructor overwrites empty default constructors (was: Document TupleConstructor overwrites empty default constructors) I updated the Jira, based on our conversation. > TupleConstructor overwrites empty default constructors > ------------------------------------------------------ > > Key: GROOVY-7522 > URL: https://issues.apache.org/jira/browse/GROOVY-7522 > Project: Groovy > Issue Type: Bug > Reporter: Keegan Witt > > {{@TupleConstructor}} should not overwrite existing empty default > constructors. For example, this should work, but doesn't currently > {code:java} > assert new Cat("Mr. Bigglesworth").name == null // fails > @groovy.transform.TupleConstructor > class Cat { > String name > int age > Cat(String name) {} > } > {code} > Granted, this is an edge case. But unexpected behavior, nonetheless. -- This message was sent by Atlassian JIRA (v6.3.4#6332)