[jira] [Commented] (TAP5-2032) GenericsUtils does not handle generics properly when extracting the actual type

2019-01-16 Thread Hudson (JIRA)


[ 
https://issues.apache.org/jira/browse/TAP5-2032?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16744674#comment-16744674
 ] 

Hudson commented on TAP5-2032:
--

FAILURE: Integrated in Jenkins build tapestry-trunk-freestyle-java-9 #16 (See 
[https://builds.apache.org/job/tapestry-trunk-freestyle-java-9/16/])
TAP5-2560: fixing JavaDoc errors and adding one test for TAP5-2032 (thiago: rev 
a02bf98bcaa57e471ea472a53e2f4ee08d152676)
* (edit) 
commons/src/main/java/org/apache/tapestry5/services/GenericsResolver.java
* (edit) 
genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/AbstractBeanModelSourceImplTest.java


> GenericsUtils does not handle generics properly when extracting the actual 
> type
> ---
>
> Key: TAP5-2032
> URL: https://issues.apache.org/jira/browse/TAP5-2032
> Project: Tapestry 5
>  Issue Type: Bug
>  Components: tapestry-ioc
>Affects Versions: 5.3.6, 5.5.0, 5.4.3
>Reporter: DI Florian Hackenberger
>Assignee: Thiago H. de Paula Figueiredo
>Priority: Major
>  Labels: desired_for_5.5
>
> We have the following interfaces / classes
> {code:java}
> public interface IPersonWithRoleAssociation extends 
> IEntityAssociationWithInfo {
>   PersonRole getRole();
>   void setRole(PersonRole role);
> }
> public interface IEntityAssociationWithInfo {
>   P getParent();
>   void setParent(P parent);
>   C getChild();
>   void setChild(C child);
> }
> public class Person implements Serializable {
>   
>   String name;
>   public String getName() {
>   return name;
>   }
> }
> {code}
> and the page:
> {code:java}
> public class EditPersonsWithRoles {
>   @Property(write=false) IPersonWithRoleAssociation personWithRole;
> }
> {code}
> and the template snippet:
> {code:html}
> 
> {code}
> Leads to the following exception:
> {noformat}
> Exception generating conduit for expression 'personWithRole.child.name': ...
> ...
> Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
>   at 
> org.apache.tapestry5.ioc.internal.util.GenericsUtils.resolve(GenericsUtils.java:388)
>  ~[tapestry-ioc-5.3.6.jar:na]
>   at 
> org.apache.tapestry5.ioc.internal.util.GenericsUtils.resolve(GenericsUtils.java:128)
>  ~[tapestry-ioc-5.3.6.jar:na]
>   at 
> org.apache.tapestry5.ioc.internal.util.GenericsUtils.extractActualType(GenericsUtils.java:74)
>  ~[tapestry-ioc-5.3.6.jar:na]
>   at 
> org.apache.tapestry5.internal.services.PropertyConduitSourceImpl$PropertyConduitBuilder.buildGetterMethodAccessTerm(PropertyConduitSourceImpl.java:1119)
>  ~[tapestry-core-5.3.6.jar:na]
> {noformat}
> At GenericsUtils.java:388 we have:
> {code:java}
> resolved = ((ParameterizedType) t).getActualTypeArguments()[i];
> {code}
> where:
> {code:java}
> i = 1
> resolved = C
> ((ParameterizedType) t).getActualTypeArguments() = 
> [org.topfive.entities.IPersonWithRoleAssociation]
> {code}
> so the problem seems to be that the code assumes that it can find the type 
> information for C as the second generic parameter for 
> IPersonWithRoleAssociation, when in fact is is the second generic parameter 
> for the superclass IEntityAssociationWithInfo which 
> IPersonWithRoleAssociation extends and passes C explicitly (Person). 
> Everything is fine, if I use a marker interface for Person (IPerson) and 
> declare:
> {code:java}
> public interface IPersonWithRoleAssociation extends 
> IEntityAssociationWithInfo
> {code}



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


[jira] [Commented] (TAP5-2560) Error in GenericsUtils affecting property access

2019-01-16 Thread Hudson (JIRA)


[ 
https://issues.apache.org/jira/browse/TAP5-2560?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16744673#comment-16744673
 ] 

Hudson commented on TAP5-2560:
--

FAILURE: Integrated in Jenkins build tapestry-trunk-freestyle-java-9 #16 (See 
[https://builds.apache.org/job/tapestry-trunk-freestyle-java-9/16/])
TAP5-2560: Error in GenericsUtils affecting property access (thiago: rev 
9a4dd324549ff637d3cb021f16d28239393d7941)
* (add) genericsresolver-guava/build.gradle
* (add) genericsresolver-guava/NOTICE.txt
* (add) 
genericsresolver-guava/src/main/java/org/apache/tapestry5/internal/genericsresolverguava/GuavaGenericsResolver.java
* (edit) 
tapestry-core/src/test/java/org/apache/tapestry5/internal/services/AbstractBeanModelSourceImplTest.java
* (add) genericsresolver-guava/LICENSE.txt
* (add) genericsresolver-guava/src/test/conf/.gitignore
* (add) 
genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/GuavaBeanModelSourceImplTest.java
* (add) 
genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/AbstractBeanModelSourceImplTest.java
* (add) 
commons/src/main/java/org/apache/tapestry5/internal/services/GenericsResolverImpl.java
* (edit) 
commons/src/main/java/org/apache/tapestry5/ioc/internal/util/GenericsUtils.java
* (add) 
commons/src/main/java/org/apache/tapestry5/services/GenericsResolver.java
* (add) 
genericsresolver-guava/src/main/resources/META-INF/services/org.apache.tapestry5.services.GenericsResolver
* (edit) 55_RELEASE_NOTES.md
* (add) genericsresolver-guava/src/test/resources/log4j.properties
* (edit) settings.gradle
TAP5-2560: fixing build errors (thiago: rev 
7590909a2882f75e2272c9a6661a4b6071cb2f21)
* (add) 
genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/ComplexObject.java
* (add) 
genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/PropertyOrderBean.java
* (add) 
genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/SimpleBean.java
* (add) 
genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/StringSource.java
* (add) 
genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/EnumBean.java
* (add) 
genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/StoogeBean.java
* (add) 
genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/StringHolder.java
* (edit) 
genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/AbstractBeanModelSourceImplTest.java
* (edit) 
genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/GuavaBeanModelSourceImplTest.java
* (add) 
genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/StringHolderBean.java
* (add) 
genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/DataBean.java
* (add) 
genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/ReadOnlyBean.java
* (add) 
genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/SimpleBeanSubclass.java
* (add) 
genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/Bedrock.java
* (add) 
genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/CompositeBean.java
* (add) 
genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/StringArrayBean.java
* (add) 
genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/VisibilityBean.java
* (add) 
genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/WriteOnlyBean.java
* (add) 
genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/NestedObject.java
* (add) 
genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/GenericBean.java
* (add) 
genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/NonVisualBean.java
* (add) 
genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/BeanWithStaticField.java
* (add) 
genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/EchoBean.java
TAP5-2560: fixing JavaDoc errors and adding one test for TAP5-2032 (thiago: rev 
a02bf98bcaa57e471ea472a53e2f4ee08d152676)
* (edit) 
commons/src/main/java/org/apache/tapestry5/services/GenericsResolver.java
* (edit) 
genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/AbstractBeanModelSourceImplTest.java
TAP5-2560: fixing JavaDoc errors again (thiago: rev 
1c23823b9dd068f418ba198ea344e1e74d3bc023)
* (edit) 

[jira] [Commented] (TAP5-2560) Error in GenericsUtils affecting property access

2019-01-16 Thread Hudson (JIRA)


[ 
https://issues.apache.org/jira/browse/TAP5-2560?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16744671#comment-16744671
 ] 

Hudson commented on TAP5-2560:
--

SUCCESS: Integrated in Jenkins build tapestry-trunk-freestyle #1731 (See 
[https://builds.apache.org/job/tapestry-trunk-freestyle/1731/])
TAP5-2560: fixing JavaDoc errors again (thiago: rev 
1c23823b9dd068f418ba198ea344e1e74d3bc023)
* (edit) 
commons/src/main/java/org/apache/tapestry5/ioc/internal/util/GenericsUtils.java


> Error in GenericsUtils affecting property access
> 
>
> Key: TAP5-2560
> URL: https://issues.apache.org/jira/browse/TAP5-2560
> Project: Tapestry 5
>  Issue Type: Bug
>Affects Versions: 5.4.1
>Reporter: Chris Poulsen
>Assignee: Thiago H. de Paula Figueiredo
>Priority: Major
> Attachments: generics-utils.patch
>
>
> There is an error somewhere in the GenericsUtils.resolve( TypeVariable 
> typeVariable, Type containingType ) method.
> It resolves some type variables to their lower bound instead of the correct 
> version.
> We have model classes that uses lots of generics and in some cases tapestry 
> reports that a given property expression is invalid because some lower bound 
> interface does not contain the property in the expression.
> I tried to see if I could find an easy fix, but ended up running out of time 
> and simply replaced the bodies of the 5 resolution methods in the 
> GenericsUtils with guava reflect code and then things started working as 
> expected.
> The interface setup that gives the error looks like this:
> {code}
> public interface NonTranslatableContentUnit {
> T getContent();
> }
> public interface BinaryContentUnit extends 
> NonTranslatableContentUnit {}
> public interface FileContentUnit extends BinaryContentUnit {}
> public interface ContentData {
> isEmpty();
> ...
> }
> public interface BinaryContent extends ContentData {
> String getMimeType();
> ...
> }   
> public interface FileContent extends BinaryContent {}
> {code}
> Then we have a property expression on a FileContentUnit like: 
> "content.mimeType" and that fails with an error that says something like 
> ContentData does not have a property MimeType.
> As far as I can tell the resolve(TypeVariable, ..) method fails to do 
> anything sensible if the Type of the "containing class" is not an instance of 
> ParameterizedType



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


[jira] [Commented] (TAP5-2032) GenericsUtils does not handle generics properly when extracting the actual type

2019-01-16 Thread Hudson (JIRA)


[ 
https://issues.apache.org/jira/browse/TAP5-2032?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16744636#comment-16744636
 ] 

Hudson commented on TAP5-2032:
--

FAILURE: Integrated in Jenkins build tapestry-trunk-freestyle #1730 (See 
[https://builds.apache.org/job/tapestry-trunk-freestyle/1730/])
TAP5-2560: fixing JavaDoc errors and adding one test for TAP5-2032 (thiago: rev 
a02bf98bcaa57e471ea472a53e2f4ee08d152676)
* (edit) 
genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/AbstractBeanModelSourceImplTest.java
* (edit) 
commons/src/main/java/org/apache/tapestry5/services/GenericsResolver.java


> GenericsUtils does not handle generics properly when extracting the actual 
> type
> ---
>
> Key: TAP5-2032
> URL: https://issues.apache.org/jira/browse/TAP5-2032
> Project: Tapestry 5
>  Issue Type: Bug
>  Components: tapestry-ioc
>Affects Versions: 5.3.6, 5.5.0, 5.4.3
>Reporter: DI Florian Hackenberger
>Assignee: Thiago H. de Paula Figueiredo
>Priority: Major
>  Labels: desired_for_5.5
>
> We have the following interfaces / classes
> {code:java}
> public interface IPersonWithRoleAssociation extends 
> IEntityAssociationWithInfo {
>   PersonRole getRole();
>   void setRole(PersonRole role);
> }
> public interface IEntityAssociationWithInfo {
>   P getParent();
>   void setParent(P parent);
>   C getChild();
>   void setChild(C child);
> }
> public class Person implements Serializable {
>   
>   String name;
>   public String getName() {
>   return name;
>   }
> }
> {code}
> and the page:
> {code:java}
> public class EditPersonsWithRoles {
>   @Property(write=false) IPersonWithRoleAssociation personWithRole;
> }
> {code}
> and the template snippet:
> {code:html}
> 
> {code}
> Leads to the following exception:
> {noformat}
> Exception generating conduit for expression 'personWithRole.child.name': ...
> ...
> Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
>   at 
> org.apache.tapestry5.ioc.internal.util.GenericsUtils.resolve(GenericsUtils.java:388)
>  ~[tapestry-ioc-5.3.6.jar:na]
>   at 
> org.apache.tapestry5.ioc.internal.util.GenericsUtils.resolve(GenericsUtils.java:128)
>  ~[tapestry-ioc-5.3.6.jar:na]
>   at 
> org.apache.tapestry5.ioc.internal.util.GenericsUtils.extractActualType(GenericsUtils.java:74)
>  ~[tapestry-ioc-5.3.6.jar:na]
>   at 
> org.apache.tapestry5.internal.services.PropertyConduitSourceImpl$PropertyConduitBuilder.buildGetterMethodAccessTerm(PropertyConduitSourceImpl.java:1119)
>  ~[tapestry-core-5.3.6.jar:na]
> {noformat}
> At GenericsUtils.java:388 we have:
> {code:java}
> resolved = ((ParameterizedType) t).getActualTypeArguments()[i];
> {code}
> where:
> {code:java}
> i = 1
> resolved = C
> ((ParameterizedType) t).getActualTypeArguments() = 
> [org.topfive.entities.IPersonWithRoleAssociation]
> {code}
> so the problem seems to be that the code assumes that it can find the type 
> information for C as the second generic parameter for 
> IPersonWithRoleAssociation, when in fact is is the second generic parameter 
> for the superclass IEntityAssociationWithInfo which 
> IPersonWithRoleAssociation extends and passes C explicitly (Person). 
> Everything is fine, if I use a marker interface for Person (IPerson) and 
> declare:
> {code:java}
> public interface IPersonWithRoleAssociation extends 
> IEntityAssociationWithInfo
> {code}



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


[jira] [Commented] (TAP5-2560) Error in GenericsUtils affecting property access

2019-01-16 Thread ASF subversion and git services (JIRA)


[ 
https://issues.apache.org/jira/browse/TAP5-2560?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16744637#comment-16744637
 ] 

ASF subversion and git services commented on TAP5-2560:
---

Commit 1c23823b9dd068f418ba198ea344e1e74d3bc023 in tapestry-5's branch 
refs/heads/master from Thiago H. de Paula Figueiredo
[ https://git-wip-us.apache.org/repos/asf?p=tapestry-5.git;h=1c23823 ]

TAP5-2560: fixing JavaDoc errors again

> Error in GenericsUtils affecting property access
> 
>
> Key: TAP5-2560
> URL: https://issues.apache.org/jira/browse/TAP5-2560
> Project: Tapestry 5
>  Issue Type: Bug
>Affects Versions: 5.4.1
>Reporter: Chris Poulsen
>Assignee: Thiago H. de Paula Figueiredo
>Priority: Major
> Attachments: generics-utils.patch
>
>
> There is an error somewhere in the GenericsUtils.resolve( TypeVariable 
> typeVariable, Type containingType ) method.
> It resolves some type variables to their lower bound instead of the correct 
> version.
> We have model classes that uses lots of generics and in some cases tapestry 
> reports that a given property expression is invalid because some lower bound 
> interface does not contain the property in the expression.
> I tried to see if I could find an easy fix, but ended up running out of time 
> and simply replaced the bodies of the 5 resolution methods in the 
> GenericsUtils with guava reflect code and then things started working as 
> expected.
> The interface setup that gives the error looks like this:
> {code}
> public interface NonTranslatableContentUnit {
> T getContent();
> }
> public interface BinaryContentUnit extends 
> NonTranslatableContentUnit {}
> public interface FileContentUnit extends BinaryContentUnit {}
> public interface ContentData {
> isEmpty();
> ...
> }
> public interface BinaryContent extends ContentData {
> String getMimeType();
> ...
> }   
> public interface FileContent extends BinaryContent {}
> {code}
> Then we have a property expression on a FileContentUnit like: 
> "content.mimeType" and that fails with an error that says something like 
> ContentData does not have a property MimeType.
> As far as I can tell the resolve(TypeVariable, ..) method fails to do 
> anything sensible if the Type of the "containing class" is not an instance of 
> ParameterizedType



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


[jira] [Commented] (TAP5-2560) Error in GenericsUtils affecting property access

2019-01-16 Thread Hudson (JIRA)


[ 
https://issues.apache.org/jira/browse/TAP5-2560?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16744635#comment-16744635
 ] 

Hudson commented on TAP5-2560:
--

FAILURE: Integrated in Jenkins build tapestry-trunk-freestyle #1730 (See 
[https://builds.apache.org/job/tapestry-trunk-freestyle/1730/])
TAP5-2560: fixing JavaDoc errors and adding one test for TAP5-2032 (thiago: rev 
a02bf98bcaa57e471ea472a53e2f4ee08d152676)
* (edit) 
genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/AbstractBeanModelSourceImplTest.java
* (edit) 
commons/src/main/java/org/apache/tapestry5/services/GenericsResolver.java


> Error in GenericsUtils affecting property access
> 
>
> Key: TAP5-2560
> URL: https://issues.apache.org/jira/browse/TAP5-2560
> Project: Tapestry 5
>  Issue Type: Bug
>Affects Versions: 5.4.1
>Reporter: Chris Poulsen
>Assignee: Thiago H. de Paula Figueiredo
>Priority: Major
> Attachments: generics-utils.patch
>
>
> There is an error somewhere in the GenericsUtils.resolve( TypeVariable 
> typeVariable, Type containingType ) method.
> It resolves some type variables to their lower bound instead of the correct 
> version.
> We have model classes that uses lots of generics and in some cases tapestry 
> reports that a given property expression is invalid because some lower bound 
> interface does not contain the property in the expression.
> I tried to see if I could find an easy fix, but ended up running out of time 
> and simply replaced the bodies of the 5 resolution methods in the 
> GenericsUtils with guava reflect code and then things started working as 
> expected.
> The interface setup that gives the error looks like this:
> {code}
> public interface NonTranslatableContentUnit {
> T getContent();
> }
> public interface BinaryContentUnit extends 
> NonTranslatableContentUnit {}
> public interface FileContentUnit extends BinaryContentUnit {}
> public interface ContentData {
> isEmpty();
> ...
> }
> public interface BinaryContent extends ContentData {
> String getMimeType();
> ...
> }   
> public interface FileContent extends BinaryContent {}
> {code}
> Then we have a property expression on a FileContentUnit like: 
> "content.mimeType" and that fails with an error that says something like 
> ContentData does not have a property MimeType.
> As far as I can tell the resolve(TypeVariable, ..) method fails to do 
> anything sensible if the Type of the "containing class" is not an instance of 
> ParameterizedType



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


[jira] [Commented] (TAP5-2032) GenericsUtils does not handle generics properly when extracting the actual type

2019-01-16 Thread ASF subversion and git services (JIRA)


[ 
https://issues.apache.org/jira/browse/TAP5-2032?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16744633#comment-16744633
 ] 

ASF subversion and git services commented on TAP5-2032:
---

Commit a02bf98bcaa57e471ea472a53e2f4ee08d152676 in tapestry-5's branch 
refs/heads/master from Thiago H. de Paula Figueiredo
[ https://git-wip-us.apache.org/repos/asf?p=tapestry-5.git;h=a02bf98 ]

TAP5-2560: fixing JavaDoc errors and adding one test for TAP5-2032

> GenericsUtils does not handle generics properly when extracting the actual 
> type
> ---
>
> Key: TAP5-2032
> URL: https://issues.apache.org/jira/browse/TAP5-2032
> Project: Tapestry 5
>  Issue Type: Bug
>  Components: tapestry-ioc
>Affects Versions: 5.3.6, 5.5.0, 5.4.3
>Reporter: DI Florian Hackenberger
>Assignee: Thiago H. de Paula Figueiredo
>Priority: Major
>  Labels: desired_for_5.5
>
> We have the following interfaces / classes
> {code:java}
> public interface IPersonWithRoleAssociation extends 
> IEntityAssociationWithInfo {
>   PersonRole getRole();
>   void setRole(PersonRole role);
> }
> public interface IEntityAssociationWithInfo {
>   P getParent();
>   void setParent(P parent);
>   C getChild();
>   void setChild(C child);
> }
> public class Person implements Serializable {
>   
>   String name;
>   public String getName() {
>   return name;
>   }
> }
> {code}
> and the page:
> {code:java}
> public class EditPersonsWithRoles {
>   @Property(write=false) IPersonWithRoleAssociation personWithRole;
> }
> {code}
> and the template snippet:
> {code:html}
> 
> {code}
> Leads to the following exception:
> {noformat}
> Exception generating conduit for expression 'personWithRole.child.name': ...
> ...
> Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
>   at 
> org.apache.tapestry5.ioc.internal.util.GenericsUtils.resolve(GenericsUtils.java:388)
>  ~[tapestry-ioc-5.3.6.jar:na]
>   at 
> org.apache.tapestry5.ioc.internal.util.GenericsUtils.resolve(GenericsUtils.java:128)
>  ~[tapestry-ioc-5.3.6.jar:na]
>   at 
> org.apache.tapestry5.ioc.internal.util.GenericsUtils.extractActualType(GenericsUtils.java:74)
>  ~[tapestry-ioc-5.3.6.jar:na]
>   at 
> org.apache.tapestry5.internal.services.PropertyConduitSourceImpl$PropertyConduitBuilder.buildGetterMethodAccessTerm(PropertyConduitSourceImpl.java:1119)
>  ~[tapestry-core-5.3.6.jar:na]
> {noformat}
> At GenericsUtils.java:388 we have:
> {code:java}
> resolved = ((ParameterizedType) t).getActualTypeArguments()[i];
> {code}
> where:
> {code:java}
> i = 1
> resolved = C
> ((ParameterizedType) t).getActualTypeArguments() = 
> [org.topfive.entities.IPersonWithRoleAssociation]
> {code}
> so the problem seems to be that the code assumes that it can find the type 
> information for C as the second generic parameter for 
> IPersonWithRoleAssociation, when in fact is is the second generic parameter 
> for the superclass IEntityAssociationWithInfo which 
> IPersonWithRoleAssociation extends and passes C explicitly (Person). 
> Everything is fine, if I use a marker interface for Person (IPerson) and 
> declare:
> {code:java}
> public interface IPersonWithRoleAssociation extends 
> IEntityAssociationWithInfo
> {code}



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


[jira] [Commented] (TAP5-2560) Error in GenericsUtils affecting property access

2019-01-16 Thread ASF subversion and git services (JIRA)


[ 
https://issues.apache.org/jira/browse/TAP5-2560?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16744632#comment-16744632
 ] 

ASF subversion and git services commented on TAP5-2560:
---

Commit a02bf98bcaa57e471ea472a53e2f4ee08d152676 in tapestry-5's branch 
refs/heads/master from Thiago H. de Paula Figueiredo
[ https://git-wip-us.apache.org/repos/asf?p=tapestry-5.git;h=a02bf98 ]

TAP5-2560: fixing JavaDoc errors and adding one test for TAP5-2032

> Error in GenericsUtils affecting property access
> 
>
> Key: TAP5-2560
> URL: https://issues.apache.org/jira/browse/TAP5-2560
> Project: Tapestry 5
>  Issue Type: Bug
>Affects Versions: 5.4.1
>Reporter: Chris Poulsen
>Assignee: Thiago H. de Paula Figueiredo
>Priority: Major
> Attachments: generics-utils.patch
>
>
> There is an error somewhere in the GenericsUtils.resolve( TypeVariable 
> typeVariable, Type containingType ) method.
> It resolves some type variables to their lower bound instead of the correct 
> version.
> We have model classes that uses lots of generics and in some cases tapestry 
> reports that a given property expression is invalid because some lower bound 
> interface does not contain the property in the expression.
> I tried to see if I could find an easy fix, but ended up running out of time 
> and simply replaced the bodies of the 5 resolution methods in the 
> GenericsUtils with guava reflect code and then things started working as 
> expected.
> The interface setup that gives the error looks like this:
> {code}
> public interface NonTranslatableContentUnit {
> T getContent();
> }
> public interface BinaryContentUnit extends 
> NonTranslatableContentUnit {}
> public interface FileContentUnit extends BinaryContentUnit {}
> public interface ContentData {
> isEmpty();
> ...
> }
> public interface BinaryContent extends ContentData {
> String getMimeType();
> ...
> }   
> public interface FileContent extends BinaryContent {}
> {code}
> Then we have a property expression on a FileContentUnit like: 
> "content.mimeType" and that fails with an error that says something like 
> ContentData does not have a property MimeType.
> As far as I can tell the resolve(TypeVariable, ..) method fails to do 
> anything sensible if the Type of the "containing class" is not an instance of 
> ParameterizedType



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


tapestry-5 git commit: TAP5-2560: fixing JavaDoc errors and adding one test for TAP5-2032

2019-01-16 Thread thiagohp
Repository: tapestry-5
Updated Branches:
  refs/heads/master 7590909a2 -> a02bf98bc


TAP5-2560: fixing JavaDoc errors and adding one test for TAP5-2032

Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/a02bf98b
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/a02bf98b
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/a02bf98b

Branch: refs/heads/master
Commit: a02bf98bcaa57e471ea472a53e2f4ee08d152676
Parents: 7590909
Author: Thiago H. de Paula Figueiredo 
Authored: Thu Jan 17 00:56:39 2019 -0200
Committer: Thiago H. de Paula Figueiredo 
Committed: Thu Jan 17 00:56:39 2019 -0200

--
 .../tapestry5/services/GenericsResolver.java|  5 ++---
 .../AbstractBeanModelSourceImplTest.java| 22 
 2 files changed, 24 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/a02bf98b/commons/src/main/java/org/apache/tapestry5/services/GenericsResolver.java
--
diff --git 
a/commons/src/main/java/org/apache/tapestry5/services/GenericsResolver.java 
b/commons/src/main/java/org/apache/tapestry5/services/GenericsResolver.java
index aa1e8de..4d9766b 100644
--- a/commons/src/main/java/org/apache/tapestry5/services/GenericsResolver.java
+++ b/commons/src/main/java/org/apache/tapestry5/services/GenericsResolver.java
@@ -27,7 +27,7 @@ import 
org.apache.tapestry5.internal.services.GenericsResolverImpl;
  * 
  * If you have exceptions or bad results with classes using Generics, such as 
exceptions
  * or missing BeanModel properties,
- * you should try adding the genericsresolver-guava Tapestry 
subproject to our classpath.
+ * you should try adding the genericsresolver-guava Tapestry 
subproject to our classpath.
  * 
  * 
  * @since 5.5.0
@@ -44,7 +44,6 @@ public interface GenericsResolver
  * @param containingClass class which either contains or inherited the 
method
  * @param method  method from which to extract the return type
  * @return the class represented by the methods generic return type, 
resolved based on the context .
- * @see #extractActualType(java.lang.reflect.Type, 
java.lang.reflect.Method)
  * @see #resolve(java.lang.reflect.Type,java.lang.reflect.Type)
  * @see #asClass(java.lang.reflect.Type)
  */
@@ -54,7 +53,7 @@ public interface GenericsResolver
  * Analyzes the field in the context of containingClass and returns the 
Class that is represented by
  * the field's generic type. Any parameter information in the generic type 
is lost, if you want
  * to preserve the type parameters of the return type consider using
- * {@link #getTypeVariableIndex(java.lang.reflect.TypeVariable)}.
+ * #getTypeVariableIndex(java.lang.reflect.TypeVariable).
  *
  * @param containingClass class which either contains or inherited the 
field
  * @param field   field from which to extract the type

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/a02bf98b/genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/AbstractBeanModelSourceImplTest.java
--
diff --git 
a/genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/AbstractBeanModelSourceImplTest.java
 
b/genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/AbstractBeanModelSourceImplTest.java
index 61608b2..48927f9 100644
--- 
a/genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/AbstractBeanModelSourceImplTest.java
+++ 
b/genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/AbstractBeanModelSourceImplTest.java
@@ -25,6 +25,7 @@ import org.apache.tapestry5.ioc.AnnotationProvider;
 import org.apache.tapestry5.ioc.Messages;
 import org.apache.tapestry5.ioc.Registry;
 import org.apache.tapestry5.ioc.RegistryBuilder;
+import org.apache.tapestry5.ioc.internal.services.PropertyAccessImpl;
 import org.apache.tapestry5.ioc.test.IOCTestCase;
 import org.apache.tapestry5.ioc.util.UnknownValueException;
 import org.apache.tapestry5.modules.TapestryModule;
@@ -766,6 +767,27 @@ public abstract class AbstractBeanModelSourceImplTest 
extends IOCTestCase
 
  }
  
+// https://issues.apache.org/jira/browse/TAP5-2032
+@Test
+public void tap5_2032() 
+{
+// explodes without fix
+new PropertyAccessImpl().getAdapter(ById.class);
+}
+ 
+public interface IdentifiableEnum, ID extends Number> 
+{
+ID getId();
+}
+
+public enum ById implements IdentifiableEnum 
+{
+;
+public Byte getId() 
+{
+return null;
+}
+

[jira] [Commented] (TAP5-2032) GenericsUtils does not handle generics properly when extracting the actual type

2019-01-16 Thread Thiago H. de Paula Figueiredo (JIRA)


[ 
https://issues.apache.org/jira/browse/TAP5-2032?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16744629#comment-16744629
 ] 

Thiago H. de Paula Figueiredo commented on TAP5-2032:
-

This should be fixed by TAP5-2560 and its new \{{genericsresolver-guava}} JAR.

> GenericsUtils does not handle generics properly when extracting the actual 
> type
> ---
>
> Key: TAP5-2032
> URL: https://issues.apache.org/jira/browse/TAP5-2032
> Project: Tapestry 5
>  Issue Type: Bug
>  Components: tapestry-ioc
>Affects Versions: 5.3.6, 5.5.0, 5.4.3
>Reporter: DI Florian Hackenberger
>Assignee: Thiago H. de Paula Figueiredo
>Priority: Major
>  Labels: desired_for_5.5
>
> We have the following interfaces / classes
> {code:java}
> public interface IPersonWithRoleAssociation extends 
> IEntityAssociationWithInfo {
>   PersonRole getRole();
>   void setRole(PersonRole role);
> }
> public interface IEntityAssociationWithInfo {
>   P getParent();
>   void setParent(P parent);
>   C getChild();
>   void setChild(C child);
> }
> public class Person implements Serializable {
>   
>   String name;
>   public String getName() {
>   return name;
>   }
> }
> {code}
> and the page:
> {code:java}
> public class EditPersonsWithRoles {
>   @Property(write=false) IPersonWithRoleAssociation personWithRole;
> }
> {code}
> and the template snippet:
> {code:html}
> 
> {code}
> Leads to the following exception:
> {noformat}
> Exception generating conduit for expression 'personWithRole.child.name': ...
> ...
> Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
>   at 
> org.apache.tapestry5.ioc.internal.util.GenericsUtils.resolve(GenericsUtils.java:388)
>  ~[tapestry-ioc-5.3.6.jar:na]
>   at 
> org.apache.tapestry5.ioc.internal.util.GenericsUtils.resolve(GenericsUtils.java:128)
>  ~[tapestry-ioc-5.3.6.jar:na]
>   at 
> org.apache.tapestry5.ioc.internal.util.GenericsUtils.extractActualType(GenericsUtils.java:74)
>  ~[tapestry-ioc-5.3.6.jar:na]
>   at 
> org.apache.tapestry5.internal.services.PropertyConduitSourceImpl$PropertyConduitBuilder.buildGetterMethodAccessTerm(PropertyConduitSourceImpl.java:1119)
>  ~[tapestry-core-5.3.6.jar:na]
> {noformat}
> At GenericsUtils.java:388 we have:
> {code:java}
> resolved = ((ParameterizedType) t).getActualTypeArguments()[i];
> {code}
> where:
> {code:java}
> i = 1
> resolved = C
> ((ParameterizedType) t).getActualTypeArguments() = 
> [org.topfive.entities.IPersonWithRoleAssociation]
> {code}
> so the problem seems to be that the code assumes that it can find the type 
> information for C as the second generic parameter for 
> IPersonWithRoleAssociation, when in fact is is the second generic parameter 
> for the superclass IEntityAssociationWithInfo which 
> IPersonWithRoleAssociation extends and passes C explicitly (Person). 
> Everything is fine, if I use a marker interface for Person (IPerson) and 
> declare:
> {code:java}
> public interface IPersonWithRoleAssociation extends 
> IEntityAssociationWithInfo
> {code}



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


[jira] [Commented] (TAP5-2560) Error in GenericsUtils affecting property access

2019-01-16 Thread Hudson (JIRA)


[ 
https://issues.apache.org/jira/browse/TAP5-2560?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16744623#comment-16744623
 ] 

Hudson commented on TAP5-2560:
--

FAILURE: Integrated in Jenkins build tapestry-trunk-freestyle #1729 (See 
[https://builds.apache.org/job/tapestry-trunk-freestyle/1729/])
TAP5-2560: fixing build errors (thiago: rev 
7590909a2882f75e2272c9a6661a4b6071cb2f21)
* (add) 
genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/SimpleBean.java
* (add) 
genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/Bedrock.java
* (add) 
genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/BeanWithStaticField.java
* (add) 
genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/WriteOnlyBean.java
* (add) 
genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/StoogeBean.java
* (add) 
genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/StringHolder.java
* (add) 
genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/VisibilityBean.java
* (add) 
genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/StringSource.java
* (add) 
genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/NestedObject.java
* (edit) 
genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/AbstractBeanModelSourceImplTest.java
* (add) 
genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/ComplexObject.java
* (add) 
genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/CompositeBean.java
* (edit) 
genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/GuavaBeanModelSourceImplTest.java
* (add) 
genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/EchoBean.java
* (add) 
genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/NonVisualBean.java
* (add) 
genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/ReadOnlyBean.java
* (add) 
genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/SimpleBeanSubclass.java
* (add) 
genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/StringHolderBean.java
* (add) 
genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/EnumBean.java
* (add) 
genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/DataBean.java
* (add) 
genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/StringArrayBean.java
* (add) 
genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/GenericBean.java
* (add) 
genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/PropertyOrderBean.java


> Error in GenericsUtils affecting property access
> 
>
> Key: TAP5-2560
> URL: https://issues.apache.org/jira/browse/TAP5-2560
> Project: Tapestry 5
>  Issue Type: Bug
>Affects Versions: 5.4.1
>Reporter: Chris Poulsen
>Assignee: Thiago H. de Paula Figueiredo
>Priority: Major
> Attachments: generics-utils.patch
>
>
> There is an error somewhere in the GenericsUtils.resolve( TypeVariable 
> typeVariable, Type containingType ) method.
> It resolves some type variables to their lower bound instead of the correct 
> version.
> We have model classes that uses lots of generics and in some cases tapestry 
> reports that a given property expression is invalid because some lower bound 
> interface does not contain the property in the expression.
> I tried to see if I could find an easy fix, but ended up running out of time 
> and simply replaced the bodies of the 5 resolution methods in the 
> GenericsUtils with guava reflect code and then things started working as 
> expected.
> The interface setup that gives the error looks like this:
> {code}
> public interface NonTranslatableContentUnit {
> T getContent();
> }
> public interface BinaryContentUnit extends 
> NonTranslatableContentUnit {}
> public interface FileContentUnit extends BinaryContentUnit {}
> public interface ContentData {
> isEmpty();
> ...
> }
> public interface BinaryContent extends ContentData {
> String getMimeType();
> ...
> }   
> public interface FileContent extends BinaryContent {}
> {code}
> Then we have a property expression on a FileContentUnit like: 
> "content.mimeType" and that fails with an error that says something like 
> ContentData does not have a property MimeType.

[jira] [Commented] (TAP5-2560) Error in GenericsUtils affecting property access

2019-01-16 Thread ASF subversion and git services (JIRA)


[ 
https://issues.apache.org/jira/browse/TAP5-2560?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16744622#comment-16744622
 ] 

ASF subversion and git services commented on TAP5-2560:
---

Commit 7590909a2882f75e2272c9a6661a4b6071cb2f21 in tapestry-5's branch 
refs/heads/master from Thiago H. de Paula Figueiredo
[ https://git-wip-us.apache.org/repos/asf?p=tapestry-5.git;h=7590909 ]

TAP5-2560: fixing build errors

> Error in GenericsUtils affecting property access
> 
>
> Key: TAP5-2560
> URL: https://issues.apache.org/jira/browse/TAP5-2560
> Project: Tapestry 5
>  Issue Type: Bug
>Affects Versions: 5.4.1
>Reporter: Chris Poulsen
>Assignee: Thiago H. de Paula Figueiredo
>Priority: Major
> Attachments: generics-utils.patch
>
>
> There is an error somewhere in the GenericsUtils.resolve( TypeVariable 
> typeVariable, Type containingType ) method.
> It resolves some type variables to their lower bound instead of the correct 
> version.
> We have model classes that uses lots of generics and in some cases tapestry 
> reports that a given property expression is invalid because some lower bound 
> interface does not contain the property in the expression.
> I tried to see if I could find an easy fix, but ended up running out of time 
> and simply replaced the bodies of the 5 resolution methods in the 
> GenericsUtils with guava reflect code and then things started working as 
> expected.
> The interface setup that gives the error looks like this:
> {code}
> public interface NonTranslatableContentUnit {
> T getContent();
> }
> public interface BinaryContentUnit extends 
> NonTranslatableContentUnit {}
> public interface FileContentUnit extends BinaryContentUnit {}
> public interface ContentData {
> isEmpty();
> ...
> }
> public interface BinaryContent extends ContentData {
> String getMimeType();
> ...
> }   
> public interface FileContent extends BinaryContent {}
> {code}
> Then we have a property expression on a FileContentUnit like: 
> "content.mimeType" and that fails with an error that says something like 
> ContentData does not have a property MimeType.
> As far as I can tell the resolve(TypeVariable, ..) method fails to do 
> anything sensible if the Type of the "containing class" is not an instance of 
> ParameterizedType



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


tapestry-5 git commit: TAP5-2560: fixing build errors

2019-01-16 Thread thiagohp
Repository: tapestry-5
Updated Branches:
  refs/heads/master 9a4dd3245 -> 7590909a2


TAP5-2560: fixing build errors

Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/7590909a
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/7590909a
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/7590909a

Branch: refs/heads/master
Commit: 7590909a2882f75e2272c9a6661a4b6071cb2f21
Parents: 9a4dd32
Author: Thiago H. de Paula Figueiredo 
Authored: Thu Jan 17 00:43:06 2019 -0200
Committer: Thiago H. de Paula Figueiredo 
Committed: Thu Jan 17 00:43:06 2019 -0200

--
 .../AbstractBeanModelSourceImplTest.java|  47 
 .../BeanWithStaticField.java|   8 ++
 .../internal/genericsresolverguava/Bedrock.java |  23 
 .../genericsresolverguava/ComplexObject.java|  43 +++
 .../genericsresolverguava/CompositeBean.java|  30 +
 .../genericsresolverguava/DataBean.java |  57 ++
 .../genericsresolverguava/EchoBean.java | 112 +++
 .../genericsresolverguava/EnumBean.java |  33 ++
 .../genericsresolverguava/GenericBean.java  |  30 +
 .../GuavaBeanModelSourceImplTest.java   |   3 +-
 .../genericsresolverguava/NestedObject.java |  30 +
 .../genericsresolverguava/NonVisualBean.java|  45 
 .../PropertyOrderBean.java  |  57 ++
 .../genericsresolverguava/ReadOnlyBean.java |  35 ++
 .../genericsresolverguava/SimpleBean.java   |  60 ++
 .../SimpleBeanSubclass.java |  28 +
 .../genericsresolverguava/StoogeBean.java   |  64 +++
 .../genericsresolverguava/StringArrayBean.java  |  30 +
 .../genericsresolverguava/StringHolder.java |  21 
 .../genericsresolverguava/StringHolderBean.java |  19 
 .../genericsresolverguava/StringSource.java |  30 +
 .../genericsresolverguava/VisibilityBean.java   |  51 +
 .../genericsresolverguava/WriteOnlyBean.java|  36 ++
 23 files changed, 867 insertions(+), 25 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/7590909a/genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/AbstractBeanModelSourceImplTest.java
--
diff --git 
a/genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/AbstractBeanModelSourceImplTest.java
 
b/genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/AbstractBeanModelSourceImplTest.java
index 96ea169..61608b2 100644
--- 
a/genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/AbstractBeanModelSourceImplTest.java
+++ 
b/genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/AbstractBeanModelSourceImplTest.java
@@ -13,44 +13,38 @@ package org.apache.tapestry5.internal.genericsresolverguava;
 //See the License for the specific language governing permissions and
 //limitations under the License.
 
+import java.util.Arrays;
+import java.util.Collections;
+
 import org.apache.tapestry5.PropertyConduit;
 import org.apache.tapestry5.beaneditor.BeanModel;
-import org.apache.tapestry5.beaneditor.BeanModelSourceBuilder;
 import org.apache.tapestry5.beaneditor.PropertyModel;
 import org.apache.tapestry5.beaneditor.RelativePosition;
 import org.apache.tapestry5.beaneditor.Sortable;
-import org.apache.tapestry5.internal.PropertyOrderBean;
-import org.apache.tapestry5.internal.services.BeanWithStaticField;
-import org.apache.tapestry5.internal.services.CompositeBean;
-import org.apache.tapestry5.internal.services.EnumBean;
-import org.apache.tapestry5.internal.services.NonVisualBean;
-import org.apache.tapestry5.internal.services.PropertyExpressionException;
-import org.apache.tapestry5.internal.services.SimpleBean;
-import org.apache.tapestry5.internal.services.StoogeBean;
-import org.apache.tapestry5.internal.services.StringArrayBean;
-import org.apache.tapestry5.internal.services.WriteOnlyBean;
-import org.apache.tapestry5.internal.test.InternalBaseTestCase;
-import org.apache.tapestry5.internal.transform.pages.ReadOnlyBean;
+import org.apache.tapestry5.ioc.AnnotationProvider;
 import org.apache.tapestry5.ioc.Messages;
+import org.apache.tapestry5.ioc.Registry;
+import org.apache.tapestry5.ioc.RegistryBuilder;
+import org.apache.tapestry5.ioc.test.IOCTestCase;
 import org.apache.tapestry5.ioc.util.UnknownValueException;
+import org.apache.tapestry5.modules.TapestryModule;
 import org.apache.tapestry5.services.BeanModelSource;
 import org.easymock.EasyMock;
+import org.testng.annotations.AfterSuite;
 import org.testng.annotations.BeforeClass;
+import 

[jira] [Commented] (TAP5-2560) Error in GenericsUtils affecting property access

2019-01-16 Thread Hudson (JIRA)


[ 
https://issues.apache.org/jira/browse/TAP5-2560?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16744611#comment-16744611
 ] 

Hudson commented on TAP5-2560:
--

FAILURE: Integrated in Jenkins build tapestry-trunk-freestyle #1728 (See 
[https://builds.apache.org/job/tapestry-trunk-freestyle/1728/])
TAP5-2560: Error in GenericsUtils affecting property access (thiago: rev 
9a4dd324549ff637d3cb021f16d28239393d7941)
* (add) 
genericsresolver-guava/src/main/resources/META-INF/services/org.apache.tapestry5.services.GenericsResolver
* (add) 
commons/src/main/java/org/apache/tapestry5/internal/services/GenericsResolverImpl.java
* (add) genericsresolver-guava/src/test/conf/.gitignore
* (edit) 55_RELEASE_NOTES.md
* (add) genericsresolver-guava/NOTICE.txt
* (add) 
genericsresolver-guava/src/main/java/org/apache/tapestry5/internal/genericsresolverguava/GuavaGenericsResolver.java
* (add) 
commons/src/main/java/org/apache/tapestry5/services/GenericsResolver.java
* (add) 
genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/AbstractBeanModelSourceImplTest.java
* (edit) 
tapestry-core/src/test/java/org/apache/tapestry5/internal/services/AbstractBeanModelSourceImplTest.java
* (add) genericsresolver-guava/src/test/resources/log4j.properties
* (edit) settings.gradle
* (edit) 
commons/src/main/java/org/apache/tapestry5/ioc/internal/util/GenericsUtils.java
* (add) 
genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/GuavaBeanModelSourceImplTest.java
* (add) genericsresolver-guava/build.gradle
* (add) genericsresolver-guava/LICENSE.txt


> Error in GenericsUtils affecting property access
> 
>
> Key: TAP5-2560
> URL: https://issues.apache.org/jira/browse/TAP5-2560
> Project: Tapestry 5
>  Issue Type: Bug
>Affects Versions: 5.4.1
>Reporter: Chris Poulsen
>Assignee: Thiago H. de Paula Figueiredo
>Priority: Major
> Attachments: generics-utils.patch
>
>
> There is an error somewhere in the GenericsUtils.resolve( TypeVariable 
> typeVariable, Type containingType ) method.
> It resolves some type variables to their lower bound instead of the correct 
> version.
> We have model classes that uses lots of generics and in some cases tapestry 
> reports that a given property expression is invalid because some lower bound 
> interface does not contain the property in the expression.
> I tried to see if I could find an easy fix, but ended up running out of time 
> and simply replaced the bodies of the 5 resolution methods in the 
> GenericsUtils with guava reflect code and then things started working as 
> expected.
> The interface setup that gives the error looks like this:
> {code}
> public interface NonTranslatableContentUnit {
> T getContent();
> }
> public interface BinaryContentUnit extends 
> NonTranslatableContentUnit {}
> public interface FileContentUnit extends BinaryContentUnit {}
> public interface ContentData {
> isEmpty();
> ...
> }
> public interface BinaryContent extends ContentData {
> String getMimeType();
> ...
> }   
> public interface FileContent extends BinaryContent {}
> {code}
> Then we have a property expression on a FileContentUnit like: 
> "content.mimeType" and that fails with an error that says something like 
> ContentData does not have a property MimeType.
> As far as I can tell the resolve(TypeVariable, ..) method fails to do 
> anything sensible if the Type of the "containing class" is not an instance of 
> ParameterizedType



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


[jira] [Commented] (TAP5-2560) Error in GenericsUtils affecting property access

2019-01-16 Thread ASF subversion and git services (JIRA)


[ 
https://issues.apache.org/jira/browse/TAP5-2560?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16744610#comment-16744610
 ] 

ASF subversion and git services commented on TAP5-2560:
---

Commit 9a4dd324549ff637d3cb021f16d28239393d7941 in tapestry-5's branch 
refs/heads/master from Thiago H. de Paula Figueiredo
[ https://git-wip-us.apache.org/repos/asf?p=tapestry-5.git;h=9a4dd32 ]

TAP5-2560: Error in GenericsUtils affecting property access

> Error in GenericsUtils affecting property access
> 
>
> Key: TAP5-2560
> URL: https://issues.apache.org/jira/browse/TAP5-2560
> Project: Tapestry 5
>  Issue Type: Bug
>Affects Versions: 5.4.1
>Reporter: Chris Poulsen
>Assignee: Thiago H. de Paula Figueiredo
>Priority: Major
> Attachments: generics-utils.patch
>
>
> There is an error somewhere in the GenericsUtils.resolve( TypeVariable 
> typeVariable, Type containingType ) method.
> It resolves some type variables to their lower bound instead of the correct 
> version.
> We have model classes that uses lots of generics and in some cases tapestry 
> reports that a given property expression is invalid because some lower bound 
> interface does not contain the property in the expression.
> I tried to see if I could find an easy fix, but ended up running out of time 
> and simply replaced the bodies of the 5 resolution methods in the 
> GenericsUtils with guava reflect code and then things started working as 
> expected.
> The interface setup that gives the error looks like this:
> {code}
> public interface NonTranslatableContentUnit {
> T getContent();
> }
> public interface BinaryContentUnit extends 
> NonTranslatableContentUnit {}
> public interface FileContentUnit extends BinaryContentUnit {}
> public interface ContentData {
> isEmpty();
> ...
> }
> public interface BinaryContent extends ContentData {
> String getMimeType();
> ...
> }   
> public interface FileContent extends BinaryContent {}
> {code}
> Then we have a property expression on a FileContentUnit like: 
> "content.mimeType" and that fails with an error that says something like 
> ContentData does not have a property MimeType.
> As far as I can tell the resolve(TypeVariable, ..) method fails to do 
> anything sensible if the Type of the "containing class" is not an instance of 
> ParameterizedType



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


[1/2] tapestry-5 git commit: TAP5-2560: Error in GenericsUtils affecting property access

2019-01-16 Thread thiagohp
Repository: tapestry-5
Updated Branches:
  refs/heads/master efd7eaedd -> 9a4dd3245


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/9a4dd324/genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/AbstractBeanModelSourceImplTest.java
--
diff --git 
a/genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/AbstractBeanModelSourceImplTest.java
 
b/genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/AbstractBeanModelSourceImplTest.java
new file mode 100644
index 000..96ea169
--- /dev/null
+++ 
b/genericsresolver-guava/src/test/java/org/apache/tapestry5/internal/genericsresolverguava/AbstractBeanModelSourceImplTest.java
@@ -0,0 +1,872 @@
+package org.apache.tapestry5.internal.genericsresolverguava;
+//Copyright 2007, 2008, 2009, 2010, 2011 The Apache Software Foundation
+//
+//Licensed under the Apache License, Version 2.0 (the "License");
+//you may not use this file except in compliance with the License.
+//You may obtain a copy of the License at
+//
+//http://www.apache.org/licenses/LICENSE-2.0
+//
+//Unless required by applicable law or agreed to in writing, software
+//distributed under the License is distributed on an "AS IS" BASIS,
+//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//See the License for the specific language governing permissions and
+//limitations under the License.
+
+import org.apache.tapestry5.PropertyConduit;
+import org.apache.tapestry5.beaneditor.BeanModel;
+import org.apache.tapestry5.beaneditor.BeanModelSourceBuilder;
+import org.apache.tapestry5.beaneditor.PropertyModel;
+import org.apache.tapestry5.beaneditor.RelativePosition;
+import org.apache.tapestry5.beaneditor.Sortable;
+import org.apache.tapestry5.internal.PropertyOrderBean;
+import org.apache.tapestry5.internal.services.BeanWithStaticField;
+import org.apache.tapestry5.internal.services.CompositeBean;
+import org.apache.tapestry5.internal.services.EnumBean;
+import org.apache.tapestry5.internal.services.NonVisualBean;
+import org.apache.tapestry5.internal.services.PropertyExpressionException;
+import org.apache.tapestry5.internal.services.SimpleBean;
+import org.apache.tapestry5.internal.services.StoogeBean;
+import org.apache.tapestry5.internal.services.StringArrayBean;
+import org.apache.tapestry5.internal.services.WriteOnlyBean;
+import org.apache.tapestry5.internal.test.InternalBaseTestCase;
+import org.apache.tapestry5.internal.transform.pages.ReadOnlyBean;
+import org.apache.tapestry5.ioc.Messages;
+import org.apache.tapestry5.ioc.util.UnknownValueException;
+import org.apache.tapestry5.services.BeanModelSource;
+import org.easymock.EasyMock;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import java.util.Arrays;
+import java.util.Collections;
+
+/**
+ * Copied from tapestry-core's tests due to the lack of a better option.
+* Tests for the bean editor model source itself, as well as the model classes.
+*/
+public abstract class AbstractBeanModelSourceImplTest extends 
InternalBaseTestCase
+{
+ private BeanModelSource source;
+
+ protected abstract BeanModelSource create();
+
+ @BeforeClass
+ public void setup()
+ {
+ source = create();
+ }
+
+ /**
+  * Tests defaults for property names, labels and conduits.
+  */
+ @Test
+ public void default_model_for_bean()
+ {
+ Messages messages = mockMessages();
+
+ stub_contains(messages, false);
+
+ replay();
+
+ BeanModel model = source.create(SimpleBean.class, true, messages);
+
+ assertSame(model.getBeanType(), SimpleBean.class);
+
+ // Based on order of the getter methods (no longer alphabetical)
+
+ assertEquals(model.getPropertyNames(), Arrays.asList("firstName", 
"lastName", "age"));
+
+ assertEquals(model.toString(),
+ "BeanModel[org.apache.tapestry5.internal.services.SimpleBean 
properties:firstName, lastName, age]");
+
+ PropertyModel age = model.get("age");
+
+ assertEquals(age.getLabel(), "Age");
+ assertSame(age.getPropertyType(), int.class);
+ assertEquals(age.getDataType(), "number");
+
+ PropertyModel firstName = model.get("firstName");
+
+ assertEquals(firstName.getLabel(), "First Name");
+ assertEquals(firstName.getPropertyType(), String.class);
+ assertEquals(firstName.getDataType(), "text");
+
+ assertEquals(model.get("lastName").getLabel(), "Last Name");
+
+ PropertyConduit conduit = model.get("lastName").getConduit();
+
+ SimpleBean instance = new SimpleBean();
+
+ instance.setLastName("Lewis Ship");
+
+ assertEquals(conduit.get(instance), "Lewis Ship");
+
+ conduit.set(instance, "TapestryDude");
+
+ assertEquals(instance.getLastName(), "TapestryDude");
+
+ // Now, one with some type coercion.
+
+ age.getConduit().set(instance, "40");
+
+ assertEquals(instance.getAge(), 40);
+
+ 

[2/2] tapestry-5 git commit: TAP5-2560: Error in GenericsUtils affecting property access

2019-01-16 Thread thiagohp
TAP5-2560: Error in GenericsUtils affecting property access

Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/9a4dd324
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/9a4dd324
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/9a4dd324

Branch: refs/heads/master
Commit: 9a4dd324549ff637d3cb021f16d28239393d7941
Parents: efd7eae
Author: Thiago H. de Paula Figueiredo 
Authored: Thu Jan 17 00:13:47 2019 -0200
Committer: Thiago H. de Paula Figueiredo 
Committed: Thu Jan 17 00:13:47 2019 -0200

--
 55_RELEASE_NOTES.md |  11 +-
 .../internal/services/GenericsResolverImpl.java | 627 +
 .../ioc/internal/util/GenericsUtils.java| 513 +--
 .../tapestry5/services/GenericsResolver.java| 160 
 genericsresolver-guava/LICENSE.txt  | 202 +
 genericsresolver-guava/NOTICE.txt   |   2 +
 genericsresolver-guava/build.gradle |   8 +
 .../GuavaGenericsResolver.java  |  63 ++
 ...g.apache.tapestry5.services.GenericsResolver |   1 +
 genericsresolver-guava/src/test/conf/.gitignore |   1 +
 .../AbstractBeanModelSourceImplTest.java| 872 +++
 .../GuavaBeanModelSourceImplTest.java   |  24 +
 .../src/test/resources/log4j.properties |  10 +
 settings.gradle |   2 +-
 .../AbstractBeanModelSourceImplTest.java|   3 +-
 15 files changed, 2000 insertions(+), 499 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/9a4dd324/55_RELEASE_NOTES.md
--
diff --git a/55_RELEASE_NOTES.md b/55_RELEASE_NOTES.md
index 3dd11bd..b754fec 100644
--- a/55_RELEASE_NOTES.md
+++ b/55_RELEASE_NOTES.md
@@ -4,6 +4,7 @@ Scratch pad for changes destined for the 5.5 release notes page.
 The minimum Java release required to run apps created with Tapestry 5.5 is 
Java 8.
 
 # Java 8, 9, 10 and 11 supported
+With the ASM upgrade, now code compiled with Java 8 to 11 is supported.
 
 # Updates to embedded Tomcat and Jetty versions (TAP5-2548)
 With Java 8, we made the switch to servlet-api 3.0. We updated the embedded 
Tomcat and Jetty containers to the respective versions. Unfortunately, we had 
to rename Jetty7Runner to JettyRunner and Tomcat6Runner to TomcatRunner in the 
tapestry-runner package.
@@ -15,4 +16,12 @@ security needs. Three rules are added
 out-of-the-box and may be overriden:
 * `ClassFile`: blocks access to assets with `.class` endings (case 
insensitive).
 * `PropertiesFile`: blocks access to assets with `.properties` endings (case 
insensitive).
-* `XMLFile`: blocks access to assets with `.xml` endings (case insensitive).
\ No newline at end of file
+* `XMLFile`: blocks access to assets with `.xml` endings (case insensitive).
+
+# New subproject/JAR: genericsresolver-guava
+Tapestry's own code to resolve the bound types of generic types and methods, 
based around GenericsUtils,
+couldn't handle some cases, as discovered in TAP5-2560. Fixing the code to 
handle these cases
+turned out to not be feasible, so we introduced a new JAR, 
genericsresolver-java, 
+which replaces GenericsUtils with Google Guava's TypeResolver and associated 
classes.
+To use it, just add genericsresolver-java, which is versioned in the same way 
as the other Tapestry JARs,
+to the classpath of your projects and make sure a not too-old version of 
Google Guava is also in the classpath.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/9a4dd324/commons/src/main/java/org/apache/tapestry5/internal/services/GenericsResolverImpl.java
--
diff --git 
a/commons/src/main/java/org/apache/tapestry5/internal/services/GenericsResolverImpl.java
 
b/commons/src/main/java/org/apache/tapestry5/internal/services/GenericsResolverImpl.java
new file mode 100644
index 000..c0abfaf
--- /dev/null
+++ 
b/commons/src/main/java/org/apache/tapestry5/internal/services/GenericsResolverImpl.java
@@ -0,0 +1,627 @@
+// Copyright 2007 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry5.internal.services;
+
+import 

[jira] [Commented] (TAP5-2560) Error in GenericsUtils affecting property access

2019-01-16 Thread Hudson (JIRA)


[ 
https://issues.apache.org/jira/browse/TAP5-2560?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16744404#comment-16744404
 ] 

Hudson commented on TAP5-2560:
--

FAILURE: Integrated in Jenkins build tapestry-trunk-freestyle #1727 (See 
[https://builds.apache.org/job/tapestry-trunk-freestyle/1727/])
Revert "TAP5-2560: Error in GenericsUtils affecting property access" (thiago: 
rev efd7eaedd2e9322b0dca1102bb8fe41534b6eaa4)
* (edit) 
commons/src/main/java/org/apache/tapestry5/ioc/internal/util/GenericsUtils.java


> Error in GenericsUtils affecting property access
> 
>
> Key: TAP5-2560
> URL: https://issues.apache.org/jira/browse/TAP5-2560
> Project: Tapestry 5
>  Issue Type: Bug
>Affects Versions: 5.4.1
>Reporter: Chris Poulsen
>Assignee: Thiago H. de Paula Figueiredo
>Priority: Major
> Attachments: generics-utils.patch
>
>
> There is an error somewhere in the GenericsUtils.resolve( TypeVariable 
> typeVariable, Type containingType ) method.
> It resolves some type variables to their lower bound instead of the correct 
> version.
> We have model classes that uses lots of generics and in some cases tapestry 
> reports that a given property expression is invalid because some lower bound 
> interface does not contain the property in the expression.
> I tried to see if I could find an easy fix, but ended up running out of time 
> and simply replaced the bodies of the 5 resolution methods in the 
> GenericsUtils with guava reflect code and then things started working as 
> expected.
> The interface setup that gives the error looks like this:
> {code}
> public interface NonTranslatableContentUnit {
> T getContent();
> }
> public interface BinaryContentUnit extends 
> NonTranslatableContentUnit {}
> public interface FileContentUnit extends BinaryContentUnit {}
> public interface ContentData {
> isEmpty();
> ...
> }
> public interface BinaryContent extends ContentData {
> String getMimeType();
> ...
> }   
> public interface FileContent extends BinaryContent {}
> {code}
> Then we have a property expression on a FileContentUnit like: 
> "content.mimeType" and that fails with an error that says something like 
> ContentData does not have a property MimeType.
> As far as I can tell the resolve(TypeVariable, ..) method fails to do 
> anything sensible if the Type of the "containing class" is not an instance of 
> ParameterizedType



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


[jira] [Commented] (TAP5-2453) Generic List not fully supported

2019-01-16 Thread Hudson (JIRA)


[ 
https://issues.apache.org/jira/browse/TAP5-2453?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16744366#comment-16744366
 ] 

Hudson commented on TAP5-2453:
--

SUCCESS: Integrated in Jenkins build tapestry-trunk-freestyle #1726 (See 
[https://builds.apache.org/job/tapestry-trunk-freestyle/1726/])
Revert "TAP5-2453: move GenericsUtils (and tests) to plastic" (thiago: rev 
faf3b20c9c8f59e890bea4eff5ce8e42df083815)
* (add) 
tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/util/NonGenericBean.java
* (delete) 
plastic/src/test/java/org/apache/tapestry5/ioc/internal/util/Pair.java
* (add) tapestry-ioc/src/test/groovy/ioc/specs/GenericUtilsSpec.groovy
* (delete) 
plastic/src/main/java/org/apache/tapestry5/ioc/internal/util/GenericsUtils.java
* (add) 
tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/util/BaseGenericBean.java
* (add) 
commons/src/main/java/org/apache/tapestry5/ioc/internal/util/GenericsUtils.java
* (delete) 
plastic/src/test/java/org/apache/tapestry5/ioc/internal/util/StringLongPair.java
* (delete) 
plastic/src/test/java/org/apache/tapestry5/ioc/internal/util/NonGenericBean.java
* (delete) 
plastic/src/test/java/org/apache/tapestry5/ioc/internal/util/StringBean.java
* (delete) 
plastic/src/test/java/org/apache/tapestry5/ioc/internal/util/BaseGenericBean.java
* (delete) plastic/src/test/groovy/ioc/specs/GenericUtilsSpec.groovy
* (add) 
tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/util/StringBean.java


> Generic List not fully supported
> ---
>
> Key: TAP5-2453
> URL: https://issues.apache.org/jira/browse/TAP5-2453
> Project: Tapestry 5
>  Issue Type: Bug
>  Components: tapestry-ioc
>Affects Versions: 5.4, 5.3.8
>Reporter: Jan Mynařík
>Priority: Major
>  Labels: desired_for_5.5, generics, help-wanted
> Attachments: TapestryGenericsTest.java
>
>
> I've created an abstract generic CRUD implementation. When binding 
> implementations resulting proxies doesn't fully report parametrized type via 
> reflections.
> See attached test. In 5.3.8 it fails in all asserts,  in 5.4 only in the last 
> one.



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


[jira] [Commented] (TAP5-2560) Error in GenericsUtils affecting property access

2019-01-16 Thread Hudson (JIRA)


[ 
https://issues.apache.org/jira/browse/TAP5-2560?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16744371#comment-16744371
 ] 

Hudson commented on TAP5-2560:
--

FAILURE: Integrated in Jenkins build tapestry-trunk-freestyle-java-9 #15 (See 
[https://builds.apache.org/job/tapestry-trunk-freestyle-java-9/15/])
Revert "TAP5-2560: Error in GenericsUtils affecting property access" (thiago: 
rev efd7eaedd2e9322b0dca1102bb8fe41534b6eaa4)
* (edit) 
commons/src/main/java/org/apache/tapestry5/ioc/internal/util/GenericsUtils.java


> Error in GenericsUtils affecting property access
> 
>
> Key: TAP5-2560
> URL: https://issues.apache.org/jira/browse/TAP5-2560
> Project: Tapestry 5
>  Issue Type: Bug
>Affects Versions: 5.4.1
>Reporter: Chris Poulsen
>Assignee: Thiago H. de Paula Figueiredo
>Priority: Major
> Attachments: generics-utils.patch
>
>
> There is an error somewhere in the GenericsUtils.resolve( TypeVariable 
> typeVariable, Type containingType ) method.
> It resolves some type variables to their lower bound instead of the correct 
> version.
> We have model classes that uses lots of generics and in some cases tapestry 
> reports that a given property expression is invalid because some lower bound 
> interface does not contain the property in the expression.
> I tried to see if I could find an easy fix, but ended up running out of time 
> and simply replaced the bodies of the 5 resolution methods in the 
> GenericsUtils with guava reflect code and then things started working as 
> expected.
> The interface setup that gives the error looks like this:
> {code}
> public interface NonTranslatableContentUnit {
> T getContent();
> }
> public interface BinaryContentUnit extends 
> NonTranslatableContentUnit {}
> public interface FileContentUnit extends BinaryContentUnit {}
> public interface ContentData {
> isEmpty();
> ...
> }
> public interface BinaryContent extends ContentData {
> String getMimeType();
> ...
> }   
> public interface FileContent extends BinaryContent {}
> {code}
> Then we have a property expression on a FileContentUnit like: 
> "content.mimeType" and that fails with an error that says something like 
> ContentData does not have a property MimeType.
> As far as I can tell the resolve(TypeVariable, ..) method fails to do 
> anything sensible if the Type of the "containing class" is not an instance of 
> ParameterizedType



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


[jira] [Commented] (TAP5-2560) Error in GenericsUtils affecting property access

2019-01-16 Thread ASF subversion and git services (JIRA)


[ 
https://issues.apache.org/jira/browse/TAP5-2560?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16744363#comment-16744363
 ] 

ASF subversion and git services commented on TAP5-2560:
---

Commit efd7eaedd2e9322b0dca1102bb8fe41534b6eaa4 in tapestry-5's branch 
refs/heads/master from Thiago H. de Paula Figueiredo
[ https://git-wip-us.apache.org/repos/asf?p=tapestry-5.git;h=efd7eae ]

Revert "TAP5-2560: Error in GenericsUtils affecting property access"

This reverts commit 310d9f997a605fc006ce5a03595c9d3ec71a282e.


> Error in GenericsUtils affecting property access
> 
>
> Key: TAP5-2560
> URL: https://issues.apache.org/jira/browse/TAP5-2560
> Project: Tapestry 5
>  Issue Type: Bug
>Affects Versions: 5.4.1
>Reporter: Chris Poulsen
>Assignee: Thiago H. de Paula Figueiredo
>Priority: Major
> Attachments: generics-utils.patch
>
>
> There is an error somewhere in the GenericsUtils.resolve( TypeVariable 
> typeVariable, Type containingType ) method.
> It resolves some type variables to their lower bound instead of the correct 
> version.
> We have model classes that uses lots of generics and in some cases tapestry 
> reports that a given property expression is invalid because some lower bound 
> interface does not contain the property in the expression.
> I tried to see if I could find an easy fix, but ended up running out of time 
> and simply replaced the bodies of the 5 resolution methods in the 
> GenericsUtils with guava reflect code and then things started working as 
> expected.
> The interface setup that gives the error looks like this:
> {code}
> public interface NonTranslatableContentUnit {
> T getContent();
> }
> public interface BinaryContentUnit extends 
> NonTranslatableContentUnit {}
> public interface FileContentUnit extends BinaryContentUnit {}
> public interface ContentData {
> isEmpty();
> ...
> }
> public interface BinaryContent extends ContentData {
> String getMimeType();
> ...
> }   
> public interface FileContent extends BinaryContent {}
> {code}
> Then we have a property expression on a FileContentUnit like: 
> "content.mimeType" and that fails with an error that says something like 
> ContentData does not have a property MimeType.
> As far as I can tell the resolve(TypeVariable, ..) method fails to do 
> anything sensible if the Type of the "containing class" is not an instance of 
> ParameterizedType



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


tapestry-5 git commit: Revert "TAP5-2560: Error in GenericsUtils affecting property access"

2019-01-16 Thread thiagohp
Repository: tapestry-5
Updated Branches:
  refs/heads/master faf3b20c9 -> efd7eaedd


Revert "TAP5-2560: Error in GenericsUtils affecting property access"

This reverts commit 310d9f997a605fc006ce5a03595c9d3ec71a282e.


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/efd7eaed
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/efd7eaed
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/efd7eaed

Branch: refs/heads/master
Commit: efd7eaedd2e9322b0dca1102bb8fe41534b6eaa4
Parents: faf3b20
Author: Thiago H. de Paula Figueiredo 
Authored: Wed Jan 16 16:46:20 2019 -0200
Committer: Thiago H. de Paula Figueiredo 
Committed: Wed Jan 16 16:46:20 2019 -0200

--
 .../ioc/internal/util/GenericsUtils.java| 50 
 1 file changed, 10 insertions(+), 40 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/efd7eaed/commons/src/main/java/org/apache/tapestry5/ioc/internal/util/GenericsUtils.java
--
diff --git 
a/commons/src/main/java/org/apache/tapestry5/ioc/internal/util/GenericsUtils.java
 
b/commons/src/main/java/org/apache/tapestry5/ioc/internal/util/GenericsUtils.java
index abbb767..9bf4d00 100644
--- 
a/commons/src/main/java/org/apache/tapestry5/ioc/internal/util/GenericsUtils.java
+++ 
b/commons/src/main/java/org/apache/tapestry5/ioc/internal/util/GenericsUtils.java
@@ -12,18 +12,8 @@
 
 package org.apache.tapestry5.ioc.internal.util;
 
-import java.lang.reflect.Array;
-import java.lang.reflect.Field;
-import java.lang.reflect.GenericArrayType;
-import java.lang.reflect.GenericDeclaration;
-import java.lang.reflect.Method;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.lang.reflect.TypeVariable;
-import java.lang.reflect.WildcardType;
-import java.util.ArrayList;
+import java.lang.reflect.*;
 import java.util.LinkedList;
-import java.util.List;
 
 /**
  * Static methods related to the use of JDK 1.5 generics.
@@ -377,7 +367,15 @@ public class GenericsUtils
 }
 
 Class theClass = asClass(containingType);
-addGenericSuperclasses(theClass, typeVariableOwner, stack);
+Type genericSuperclass = theClass.getGenericSuperclass();
+while (genericSuperclass != null && // true for interfaces with no 
superclass
+!theClass.equals(Object.class) &&
+!theClass.equals(typeVariableOwner))
+{
+stack.addFirst(genericSuperclass);
+theClass = asClass(genericSuperclass);
+genericSuperclass = theClass.getGenericSuperclass();
+}
 
 int i = getTypeVariableIndex(typeVariable);
 Type resolved = typeVariable;
@@ -402,34 +400,6 @@ public class GenericsUtils
 return ((TypeVariable) resolved).getBounds()[0];
 }
 
-
-private static void addGenericSuperclasses(Class theClass, final Class 
typeVariableOwner, final LinkedList stack) {
-Type genericSuperclass = theClass.getGenericSuperclass();
-while (genericSuperclass != null && // true for interfaces with no 
superclass
-!theClass.equals(Object.class) &&
-!theClass.equals(typeVariableOwner))
-{
-stack.addFirst(genericSuperclass);
-theClass = asClass(genericSuperclass);
-genericSuperclass = theClass.getGenericSuperclass();
-}
-for (Type type : theClass.getGenericInterfaces()) {
-stack.add(type);
-}
-for (Class implementedInterface : 
getAllImplementedInterfaces(theClass)) {
-addGenericSuperclasses(implementedInterface, typeVariableOwner, 
stack);
-}
-}
-
-private static List getAllImplementedInterfaces(Class theClass) {
-List list = new ArrayList<>();
-for (Class implementedInterface : theClass.getInterfaces()) {
-list.add(implementedInterface);
-list.addAll(getAllImplementedInterfaces(implementedInterface));
-}
-return list;
-}
-
 /**
  * @param type   - something like ListT>[] or List? 
extends T>[] or T[]
  * @param containingType - the shallowest type in the hierarchy where type 
is defined.



[jira] [Commented] (TAP5-2453) Generic List not fully supported

2019-01-16 Thread ASF subversion and git services (JIRA)


[ 
https://issues.apache.org/jira/browse/TAP5-2453?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16744308#comment-16744308
 ] 

ASF subversion and git services commented on TAP5-2453:
---

Commit faf3b20c9c8f59e890bea4eff5ce8e42df083815 in tapestry-5's branch 
refs/heads/master from Thiago H. de Paula Figueiredo
[ https://git-wip-us.apache.org/repos/asf?p=tapestry-5.git;h=faf3b20 ]

Revert "TAP5-2453: move GenericsUtils (and tests) to plastic"

This reverts commit 5c617af6b3bfef81d79c573aec0acf29e1d0eb8c.


> Generic List not fully supported
> ---
>
> Key: TAP5-2453
> URL: https://issues.apache.org/jira/browse/TAP5-2453
> Project: Tapestry 5
>  Issue Type: Bug
>  Components: tapestry-ioc
>Affects Versions: 5.4, 5.3.8
>Reporter: Jan Mynařík
>Priority: Major
>  Labels: desired_for_5.5, generics, help-wanted
> Attachments: TapestryGenericsTest.java
>
>
> I've created an abstract generic CRUD implementation. When binding 
> implementations resulting proxies doesn't fully report parametrized type via 
> reflections.
> See attached test. In 5.3.8 it fails in all asserts,  in 5.4 only in the last 
> one.



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


tapestry-5 git commit: Revert "TAP5-2453: move GenericsUtils (and tests) to plastic"

2019-01-16 Thread thiagohp
Repository: tapestry-5
Updated Branches:
  refs/heads/master ebdb52a19 -> faf3b20c9


Revert "TAP5-2453: move GenericsUtils (and tests) to plastic"

This reverts commit 5c617af6b3bfef81d79c573aec0acf29e1d0eb8c.


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/faf3b20c
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/faf3b20c
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/faf3b20c

Branch: refs/heads/master
Commit: faf3b20c9c8f59e890bea4eff5ce8e42df083815
Parents: ebdb52a
Author: Thiago H. de Paula Figueiredo 
Authored: Wed Jan 16 16:06:45 2019 -0200
Committer: Thiago H. de Paula Figueiredo 
Committed: Wed Jan 16 16:06:45 2019 -0200

--
 .../ioc/internal/util/GenericsUtils.java| 643 +++
 .../ioc/internal/util/GenericsUtils.java| 643 ---
 .../groovy/ioc/specs/GenericUtilsSpec.groovy|  40 --
 .../ioc/internal/util/BaseGenericBean.java  |  30 -
 .../ioc/internal/util/NonGenericBean.java   |  30 -
 .../tapestry5/ioc/internal/util/Pair.java   |  42 --
 .../tapestry5/ioc/internal/util/StringBean.java |  20 -
 .../ioc/internal/util/StringLongPair.java   |  19 -
 .../groovy/ioc/specs/GenericUtilsSpec.groovy|  40 ++
 .../ioc/internal/util/BaseGenericBean.java  |  30 +
 .../ioc/internal/util/NonGenericBean.java   |  30 +
 .../tapestry5/ioc/internal/util/StringBean.java |  20 +
 12 files changed, 763 insertions(+), 824 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/faf3b20c/commons/src/main/java/org/apache/tapestry5/ioc/internal/util/GenericsUtils.java
--
diff --git 
a/commons/src/main/java/org/apache/tapestry5/ioc/internal/util/GenericsUtils.java
 
b/commons/src/main/java/org/apache/tapestry5/ioc/internal/util/GenericsUtils.java
new file mode 100644
index 000..abbb767
--- /dev/null
+++ 
b/commons/src/main/java/org/apache/tapestry5/ioc/internal/util/GenericsUtils.java
@@ -0,0 +1,643 @@
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry5.ioc.internal.util;
+
+import java.lang.reflect.Array;
+import java.lang.reflect.Field;
+import java.lang.reflect.GenericArrayType;
+import java.lang.reflect.GenericDeclaration;
+import java.lang.reflect.Method;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.lang.reflect.TypeVariable;
+import java.lang.reflect.WildcardType;
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * Static methods related to the use of JDK 1.5 generics.
+ */
+@SuppressWarnings("unchecked")
+public class GenericsUtils
+{
+/**
+ * Analyzes the method in the context of containingClass and returns the 
Class that is represented by
+ * the method's generic return type. Any parameter information in the 
generic return type is lost. If you want
+ * to preserve the type parameters of the return type consider using
+ * {@link #extractActualType(java.lang.reflect.Type, 
java.lang.reflect.Method)}.
+ *
+ * @param containingClass class which either contains or inherited the 
method
+ * @param method  method from which to extract the return type
+ * @return the class represented by the methods generic return type, 
resolved based on the context .
+ * @see #extractActualType(java.lang.reflect.Type, 
java.lang.reflect.Method)
+ * @see #resolve(java.lang.reflect.Type,java.lang.reflect.Type)
+ * @see #asClass(java.lang.reflect.Type)
+ */
+public static Class extractGenericReturnType(Class containingClass, 
Method method)
+{
+return asClass(resolve(method.getGenericReturnType(), 
containingClass));
+}
+
+
+/**
+ * Analyzes the field in the context of containingClass and returns the 
Class that is represented by
+ * the field's generic type. Any parameter information in the generic type 
is lost, if you want
+ * to preserve the type parameters of the return type consider using
+ * {@link #getTypeVariableIndex(java.lang.reflect.TypeVariable)}.
+ *
+ * @param containingClass class which either contains or inherited the 
field
+ * @param field   field from which to extract the type
+