Uploaded image for project: 'OpenWebBeans'
  1. OpenWebBeans
  2. OWB-1122

InjectionPoint.getQualifiers does not return the list of selected qualifiers with programmatic lookup

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.6.3
    • 1.7.0
    • Core
    • None

    Description

      With a @Dependent producer method retrieving the InjectionPoint instance in case of a programmatic lookup, the method InjectionPoint.getQualifiers does not return the subset of qualifiers specified in during the lookup with Instance.select.

      The following test case:

      @RunWith(Arquillian.class)
      public class OwbTest {
      
          @Deployment
          public static Archive<?> deployment() {
              return ShrinkWrap.create(JavaArchive.class)
                  // Test class
                  .addClass(Beans.class)
                  // Bean archive deployment descriptor
                  .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
          }
      
          @Any
          @Inject
          Instance<String> strings;
      
          @Test
          public void test() {
              System.out.println(strings.select(new AnnotationLiteral<MyQualifier>() {
              }).get());
          }
      }
      
      class Beans {
      
          @Produces
          @MyQualifier
          String producer(InjectionPoint ip) {
              return Objects.toString(ip.getQualifiers());
          }
      }
      
      @Qualifier
      @Retention(RetentionPolicy.RUNTIME)
      @interface MyQualifier {
      
      }
      

      Outputs:

      [@javax.enterprise.inject.Any()]
      

      While it would be expected to outputs:

      [@MyQualifier(), @javax.enterprise.inject.Any()]
      

      Attachments

        Issue Links

          Activity

            People

              romain.manni-bucau Romain Manni-Bucau
              antonin.stefanutti Antonin Stefanutti
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: