[jbosstools-issues] [JBoss JIRA] (JBIDE-16759) Provide assignability of raw bean type to parameterized required type

Viacheslav Kabanovich (JIRA) issues at jboss.org
Fri Mar 14 19:48:10 EDT 2014


    [ https://issues.jboss.org/browse/JBIDE-16759?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12953268#comment-12953268 ] 

Viacheslav Kabanovich commented on JBIDE-16759:
-----------------------------------------------

Steps
1. Create an interface with a type parameter:
{code}
public interface Result<T> {
}
{code}
2. Create a producer method with raw return type:
{code}
public class Result2Producer {

	@Produces
	public Result createResult() {
		return null;
	}
}
{code}
3. Create injection points
{code}
public class AssignabilityOfRawAndParameterizedTypes<T1, T2 extends Object, T3 extends Exception> {
private @Inject Result injection1;  //satisfied - the only case that worked before this fix.
private @Inject Result<?> injection2;  //satisfied - there is no restriction on type parameter.
private @Inject Result<Object> injection3;  //satisfied - any type is derived from Object, hence no restriction.
private @Inject Result<T1> injection4; //satisfied - type parameter T1 is not bound.
private @Inject Result<T2> injection5; //satisfied - type parameter T2 is bound by Object, hence no restriction.
private @Inject Result<Exception> injection6; //unsatisfied - specific type is required.
private @Inject Result<T3> injection7; //unsatisfied - type parameter requires java.lang.Exception.
{code}
ASSERT: Injections are satisfied/unsatisfied as it is described in comments.
                
> Provide assignability of raw bean type to parameterized required type
> ---------------------------------------------------------------------
>
>                 Key: JBIDE-16759
>                 URL: https://issues.jboss.org/browse/JBIDE-16759
>             Project: Tools (JBoss Tools)
>          Issue Type: Bug
>          Components: cdi
>            Reporter: Viacheslav Kabanovich
>            Assignee: Viacheslav Kabanovich
>             Fix For: 4.2.0.Beta1
>
>
> CDI specification 1.1 in 5.2.4 Assignability of raw and parameterized types says:
> "A raw bean type is considered assignable to a parameterized required type if the raw types are identical and all type parameters
> of the required type are either unbounded type variables or java.lang.Object."
> This is a clarification added after discussion in https://issues.jboss.org/browse/CDI-304. It should work the same way in CDI 1.0.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jbosstools-issues mailing list