[jira] [Commented] (GROOVY-8453) @TupleConstructor ignoring inherited standard Java Beans properties

2018-01-23 Thread Mauro Molinari (JIRA)

[ 
https://issues.apache.org/jira/browse/GROOVY-8453?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16335945#comment-16335945
 ] 

Mauro Molinari commented on GROOVY-8453:


Hi Paul, thank you very much! I still wonder what a "property" is for Groovy, 
if it's not a "Java Property" by default, and I also think there's an 
inconsistent behaviour if {{allProperties}} defaults to {{true}} for 
{{@Builder}} and {{@ToString}}, but I respect your choice.

Any plan to backport to 2.4.x?

> @TupleConstructor ignoring inherited standard Java Beans properties
> ---
>
> Key: GROOVY-8453
> URL: https://issues.apache.org/jira/browse/GROOVY-8453
> Project: Groovy
>  Issue Type: Bug
>  Components: ast builder
>Affects Versions: 2.4.13
>Reporter: Mauro Molinari
>Assignee: Paul King
>Priority: Major
> Fix For: 2.5.0-beta-3
>
>
> Consider this (it can be pasted on the Groovy console):
> {code:groovy}
> import groovy.transform.TupleConstructor
> public class Foobar {
>   private Long id;
>   
>   public Long getId() { return this.id; }
>   public void setId(Long id) { this.id = id; }
> }
> @TupleConstructor(includeSuperProperties=true)
> class Ext extends Foobar {
>   String foo
> }
> Ext.constructors.each {
>     println it
> }
> println 'end'
> {code}
>  
> The result is just:
> {noformat}
> public Ext(java.lang.String)
> public Ext()
> end
> {noformat}
> But {{id}} is a property (as per the Java Bean conventions) and I would 
> expect it to be present in the generated constructors for {{Ext}}.
> If I replace {{includeSuperProperties=true}} with 
> {{includeSuperFields=true}}, I get the expected result:
> {noformat}
> public Ext()
> public Ext(java.lang.Long)
> public Ext(java.lang.Long,java.lang.String)
> end
> {noformat}
> But in more complex cases, {{includeSuperFields=true}} will include unwanted 
> fields that are not actually properties.
> Discussing this on the users mailing list with Paul King, here is his 
> feedback:
> {quote}
> I think @Builder and @ToString originally had similar issues and we added an 
> `allProperties` attribute with default true. Perhaps that is needed here too
> {quote}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (GROOVY-8453) @TupleConstructor ignoring inherited standard Java Beans properties

2018-01-19 Thread Paul King (JIRA)

[ 
https://issues.apache.org/jira/browse/GROOVY-8453?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16333161#comment-16333161
 ] 

Paul King commented on GROOVY-8453:
---

Just looked into this a bit more - it's interesting to note that when property 
names (i.e. within {{includes}} and {{excludes}} if used) are checked, the 
JavaBean names are checked against.

> @TupleConstructor ignoring inherited standard Java Beans properties
> ---
>
> Key: GROOVY-8453
> URL: https://issues.apache.org/jira/browse/GROOVY-8453
> Project: Groovy
>  Issue Type: Bug
>  Components: ast builder
>Affects Versions: 2.4.13
>Reporter: Mauro Molinari
>Priority: Major
>
> Consider this (it can be pasted on the Groovy console):
> {code:groovy}
> import groovy.transform.TupleConstructor
> public class Foobar {
>   private Long id;
>   
>   public Long getId() \{ return this.id; }
>   public void setId(Long id) \{ this.id = id; }
> }
> @TupleConstructor(includeSuperProperties=true)
> class Ext extends Foobar {
>   String foo
> }
> Ext.constructors.each {
>     println it
> }
> println 'end'
> {code}
>  
> The result is just:
> {noformat}
> public Ext(java.lang.String)
> public Ext()
> end
> {noformat}
> But {{id}} is a property (as per the Java Bean conventions) and I would 
> expect it to be present in the generated constructors for {{Ext}}.
> If I replace {{includeSuperProperties=true}} with 
> {{includeSuperFields=true}}, I get the expected result:
> {noformat}
> public Ext()
> public Ext(java.lang.Long)
> public Ext(java.lang.Long,java.lang.String)
> end
> {noformat}
> But in more complex cases, {{includeSuperFields=true}} will include unwanted 
> fields that are not actually properties.
> Discussing this on the users mailing list with Paul King, here is his 
> feedback:
> {quote}
> I think @Builder and @ToString originally had similar issues and we added an 
> `allProperties` attribute with default true. Perhaps that is needed here too
> {quote}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (GROOVY-8453) @TupleConstructor ignoring inherited standard Java Beans properties

2018-01-19 Thread Paul King (JIRA)

[ 
https://issues.apache.org/jira/browse/GROOVY-8453?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16333113#comment-16333113
 ] 

Paul King commented on GROOVY-8453:
---

A minor point of clarification. The {{allProperties}} flag is all about 
providing a backwards compatibility switch. I.e. we should probably support 
JavaBean as well as Groovy properties  everywhere but if anyone is relying on 
the existing behavior, they will have a flag to turn off automatic JavaBean 
properties.

> @TupleConstructor ignoring inherited standard Java Beans properties
> ---
>
> Key: GROOVY-8453
> URL: https://issues.apache.org/jira/browse/GROOVY-8453
> Project: Groovy
>  Issue Type: Bug
>  Components: ast builder
>Affects Versions: 2.4.13
>Reporter: Mauro Molinari
>Priority: Major
>
> Consider this (it can be pasted on the Groovy console):
> {code:groovy}
> import groovy.transform.TupleConstructor
> public class Foobar {
>   private Long id;
>   
>   public Long getId() \{ return this.id; }
>   public void setId(Long id) \{ this.id = id; }
> }
> @TupleConstructor(includeSuperProperties=true)
> class Ext extends Foobar {
>   String foo
> }
> Ext.constructors.each {
>     println it
> }
> println 'end'
> {code}
>  
> The result is just:
> {noformat}
> public Ext(java.lang.String)
> public Ext()
> end
> {noformat}
> But {{id}} is a property (as per the Java Bean conventions) and I would 
> expect it to be present in the generated constructors for {{Ext}}.
> If I replace {{includeSuperProperties=true}} with 
> {{includeSuperFields=true}}, I get the expected result:
> {noformat}
> public Ext()
> public Ext(java.lang.Long)
> public Ext(java.lang.Long,java.lang.String)
> end
> {noformat}
> But in more complex cases, {{includeSuperFields=true}} will include unwanted 
> fields that are not actually properties.
> Discussing this on the users mailing list with Paul King, here is his 
> feedback:
> {quote}
> I think @Builder and @ToString originally had similar issues and we added an 
> `allProperties` attribute with default true. Perhaps that is needed here too
> {quote}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)