You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Paul Stanton <pa...@mapshed.com.au> on 2012/04/17 01:42:27 UTC

parameter generic type not respected

Hi all,

I have a component with a parameter using a generic type eg:

public class MyComponent
{
     @Parameter
     private List<MyType> collectionParameter;
}

However I can set the parameter with a List of any generic type:

public class MyPage
{
     @Property
     private List<OtherType> otherCollection;
}

<t:myComponent collectionParameter="otherCollection" />

... and no exception is thrown.

Is this expected behaviour? Shouldn't the generic type be checked in 
this case?

Cheers, p.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: parameter generic type not respected

Posted by Lenny Primak <lp...@hope.nyc.ny.us>.
Java generics are compile-time only.  They are lost at run-time,
Tapestry has no way to check this.

On Apr 16, 2012, at 7:42 PM, Paul Stanton wrote:

> Hi all,
> 
> I have a component with a parameter using a generic type eg:
> 
> public class MyComponent
> {
>    @Parameter
>    private List<MyType> collectionParameter;
> }
> 
> However I can set the parameter with a List of any generic type:
> 
> public class MyPage
> {
>    @Property
>    private List<OtherType> otherCollection;
> }
> 
> <t:myComponent collectionParameter="otherCollection" />
> 
> ... and no exception is thrown.
> 
> Is this expected behaviour? Shouldn't the generic type be checked in this case?
> 
> Cheers, p.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org