[cdi-dev] Events and Type Variables in CDI 1.1

Jozef Hartinger jharting at redhat.com
Fri May 2 10:20:43 EDT 2014


I think this is a spec issue. The spec should make it clearer that a 
"resolvable type variable" means a type variable that can be resolved to 
a reference type other than a type variable.


On 04/30/2014 09:32 PM, Arne Limburg wrote:
> Hi,
> I found an issue in either the spec or the tck, which I would like to 
> discuss:
> The 
> TCK-Test org.jboss.cdi.tck.tests.event.fires.FireEventTest.testTypeVariableEventTypeFails
> uses the following bean to fire an event by calling the method 
> fireWithTypeVariable()
> publicclassBar {
> @Inject
> private Event<Foo<? extends Number>> event;
> public <T extends Number> void fireWithTypeVariable() {
> event.fire(new Foo<T>());
>   }
> }
> The TCK expects this test to fail because of the type variable in the 
> instance created by new Foo<T>()
> However, the spec states in 10.3.1 "If the container is unable to 
> resolve the parameterized type of the event object, it uses the 
> specified type to infer the parameterized type of the event types."
> Imho in this case the container is able to resolve T to "? extends 
> Number" and the spec does not prohibit an event to have a wildcard 
> type. So since T is not unresolvable, this test case should not expect 
> the container to throw an exception. If we consider T not to be 
> resolved, because it resolves to a wildcard type, we should mention 
> this somewhere in the spec. Or am I missing something?
> Cheers,
> Arne
> _______________________________________________
> cdi-dev mailing list
> cdi-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/cdi-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/cdi-dev/attachments/20140502/84cf523b/attachment.html 

More information about the cdi-dev mailing list