@Named beans should be taken into account during dependency resolution
----------------------------------------------------------------------
Key: JBIDE-9452
URL:
https://issues.jboss.org/browse/JBIDE-9452
Project: Tools (JBoss Tools)
Issue Type: Bug
Components: cdi
Affects Versions: 3.3.0.M3
Reporter: Alexey Kazakov
Assignee: Viacheslav Kabanovich
Fix For: 3.3.x
EXECUTE: Create a CDI project
EXECUTE: Add the following code to the project:
{code}
@Stereotype
@Named
@Target({ TYPE, METHOD, FIELD })
@Retention(RUNTIME)
@Documented
public @interface TestS {
}
{code}
{code}
import javax.enterprise.inject.Produces;
import javax.inject.Inject;
import javax.inject.Named;
public class MyBean {
@Inject String s; // OK
@Inject @Named String foo3; // OK
@Inject @Named("foo3") String s1; // OK
@Inject @Named String xyz; // OK
@Inject @Named("xyz") String s2; // OK
@Inject @Named String abc; // OK
@Inject @Named("abc") String s3; // OK
@Inject @Named String foo; // OK
@Inject @Named("foo") String s4; // OK
@Inject @Named String unknownName; // Unsatisfied
@Inject @Named("unknownName") String unknownName1; // Unsatisfied
@Inject public void doSmth(@Named("foo4") String foo8) {} // Ambiguous: foo4,
foo4(), foo5(), foo6()
@Inject @Named("foo4") String s5; // Ambiguous: foo4, foo4(), foo5(), foo6()
@Produces @TestS // OK
public String foo() {return "";}
@Produces @TestS @Named("abc") // OK
public String foo1;
@Produces @Named("xyz") // OK
public String foo2;
@Produces @Named // OK
public String foo3() {return "";}
@Produces @Named // Duplicate EL name
public String foo4() {return "";}
@Produces @Named("foo4") // Duplicate EL name
public String foo5() {return "";}
@Produces @TestS @Named("foo4") // Duplicate EL name
public String foo6() {return "";}
@Produces @TestS // Duplicate EL name
public String foo4;
@Produces // OK
public String foo7() {return "";}
}
{code}
ASSERT: See comments in MyBean.java. There should be all the mentioned validation
problems.
--
This message is automatically generated by JIRA.
For more information on JIRA, see:
http://www.atlassian.com/software/jira