TCK test failure: ResolutionByNameTest#testFieldNameUsedAsBeanName()
--------------------------------------------------------------------
Key: WELD-966
URL:
https://issues.jboss.org/browse/WELD-966
Project: Weld
Issue Type: Bug
Affects Versions: 1.1.2.Final
Environment: JBoss AS 7
Arquillian/TestNG
Reporter: Martin Kouba
Running
org.jboss.jsr299.tck.tests.lookup.byname.ResolutionByNameTest#testFieldNameUsedAsBeanName()
in CDI 1.1 branch fails on deployment validation:
WELD-001408 Unsatisfied dependencies for type [Animal] with qualifiers [@Named] at
injection point [[field] @Named @Inject private
org.jboss.jsr299.tck.tests.lookup.byname.FishingNet.carp]"}}
After some debugging I found out that the problem is very likely related to the way
default names are handled on injection point and bean definition.
Injection point:
{code}
@Inject @Named
private Animal carp;
{code}
The original qualifier is replaced if no value is specified (@Named =>
@Named(value="carp")). See
org.jboss.weld.resolution.ResolvableBuilder(InjectionPoint).
Bean definition:
{code}
@Named
public class Carp implements Animal
{code}
The qualifier remains the same (without value; see AbstractBean#initName()) only EL name
on definition is changed.
Later in org.jboss.weld.util.Beans#containsAllQualifiers() comparing the injection point
new qualifier to the one on bean definition no match is found (value on @Named is binding)
and thus validation fails with error message above.
Related CDI spec chapters:
2.5.2 Default bean EL names
3.1.5 Default name for a managed bean
3.11 The qualifier @Named at injection points
--
This message is automatically generated by JIRA.
For more information on JIRA, see:
http://www.atlassian.com/software/jira