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

TCK test failure: ResolutionByNameTest#testFieldNameUsedAsBeanName()

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Critical
    • 1.1.3.Final
    • 1.1.2.Final
    • None
    • None
    • Hide

      Change bean definition to:

      @Named("carp")
      public class Carp implements Animal
      

      (do not rely on default bean EL assignment)

      Show
      Change bean definition to: @Named( "carp" ) public class Carp implements Animal (do not rely on default bean EL assignment)

    Description

      Running org.jboss.jsr299.tck.tests.lookup.byname.ResolutionByNameTest#testFieldNameUsedAsBeanName() in CDI TCK 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:

      @Inject @Named
      private Animal carp;
      

      The original qualifier is replaced if no value is specified (@Named => @Named(value="carp")). See org.jboss.weld.resolution.ResolvableBuilder(InjectionPoint).

      Bean definition:

      @Named
      public class Carp implements Animal
      

      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

      Attachments

        Issue Links

          Activity

            People

              ajustin@redhat.com Ales Justin
              mkouba@redhat.com Martin Kouba
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: