Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-435

@Named as a qualifier doesn't default correctly

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Critical
    • 1.0.1.Final
    • 1.0.0.GA
    • Resolution
    • None

    Description

      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.

      Attachments

        Activity

          People

            pmuiratbleepbleep Pete Muir (Inactive)
            chasetec_jira Matthieu Chase Heimer (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: