You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Thiago H. de Paula Figueiredo (JIRA)" <ji...@apache.org> on 2014/06/06 17:04:02 UTC
[jira] [Assigned] (TAP5-1480) Couldn't create property conduits for
generic interfaces
[ https://issues.apache.org/jira/browse/TAP5-1480?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Thiago H. de Paula Figueiredo reassigned TAP5-1480:
---------------------------------------------------
Assignee: Thiago H. de Paula Figueiredo
> Couldn't create property conduits for generic interfaces
> --------------------------------------------------------
>
> Key: TAP5-1480
> URL: https://issues.apache.org/jira/browse/TAP5-1480
> Project: Tapestry 5
> Issue Type: Bug
> Components: tapestry-ioc
> Affects Versions: 5.2
> Reporter: Ivan Khalopik
> Assignee: Thiago H. de Paula Figueiredo
> Labels: generics
>
> Couldn't create property conduits for generic interfaces.
> public class TestTapestry {
> @Test
> public void test() {
> final PropertyAccess access = new PropertyAccessImpl();
> final ClassPropertyAdapter adapter = access.getAdapter(NamedEntity.class);
> }
> public static interface Entity<T extends Serializable> {
> T getId();
> }
> public static interface NamedEntity extends Entity<Long> {
> String getName();
> }
> }
> This test will throw an exception:
> Caused by: java.lang.NullPointerException
> at org.apache.tapestry5.ioc.internal.util.GenericsUtils.extractActualType(GenericsUtils.java:143)
> at org.apache.tapestry5.ioc.internal.util.GenericsUtils.extractActualTypeAsClass(GenericsUtils.java:174)
> at org.apache.tapestry5.ioc.internal.util.GenericsUtils.extractGenericReturnType(GenericsUtils.java:40)
> at org.apache.tapestry5.ioc.internal.services.ClassPropertyAdapterImpl.<init>(ClassPropertyAdapterImpl.java:50)
> at org.apache.tapestry5.ioc.internal.services.PropertyAccessImpl.buildAdapter(PropertyAccessImpl.java:99)
> ... 33 more
> It is thrown because of this lines (GenericsUtils:140-143)
> final Class descendantClass = asClass(descendant);
> final ParameterizedType parameterizedType = (ParameterizedType) descendantClass.getGenericSuperclass();
> extractedType = parameterizedType.getActualTypeArguments()[typeArgumentIndex];
> It gets generic superclass, but it is null, there are only interfaces.
> So it makes impossible to create property bindings for such beans.
--
This message was sent by Atlassian JIRA
(v6.2#6252)