[jbosstools-issues] [JBoss JIRA] Created: (JBIDE-9475) Quick fix should be aware of bean producers in case of ambiguous dependency

Alexey Kazakov (JIRA) jira-events at lists.jboss.org
Thu Aug 4 18:06:35 EDT 2011


Quick fix should be aware of bean producers in case of ambiguous dependency
---------------------------------------------------------------------------

                 Key: JBIDE-9475
                 URL: https://issues.jboss.org/browse/JBIDE-9475
             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.0.M3


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; // Ambiguous
	@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

        


More information about the jbosstools-issues mailing list