[weld-issues] [JBoss JIRA] Created: (WELD-435) @Named as a qualifier doesn't default correctly

Matthieu Chase Heimer (JIRA) jira-events at lists.jboss.org
Fri Feb 12 12:24:10 EST 2010


@Named as a qualifier doesn't default correctly
-----------------------------------------------

                 Key: WELD-435
                 URL: https://jira.jboss.org/jira/browse/WELD-435
             Project: Weld
          Issue Type: Bug
          Components: Spec
    Affects Versions: 1.0.0.GA
         Environment: GlassFish v3, Windows XP SP3, JDK 1.6 u17
            Reporter: Matthieu Chase Heimer
            Priority: Minor


I think Weld has a error in the handling of @Named as a qualifier. From section 3.11

If an injected field declares a @Named annotation that does not specify the value member, the name of the field is assumed.

For example, the following field has the qualifier @Named("paymentService"):
@Inject @Named PaymentService paymentService;

However the line: @Inject @Named PaymentService paymentService; will only match a bean class with an empty value in the @Named qualifier. If the @Named qualifier has a string value then the qualifier on the injection point must also have the same string value. You can get a javax.enterprise.inject.UnsatisfiedResolutionException with code the spec implies should function.

However what is less clear is whether or not an empty value in the @Named annotation of a bean class should be creating a default qualifier name or just a default EL name. So there is at least an issue with the handling of empty @Named values on injection points. Section 3.1.5 only mentions that beans with the @Named annotation will get a default EL name. Section 2.7.1.3 says that if @Named is used as part of a sterotype then the default name will be based on the classname however it isn't say if it would only be the EL name or also used as the value of the Named qualifier.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the weld-issues mailing list