Uploaded image for project: 'Tools (JBoss Tools)'
  1. Tools (JBoss Tools)
  2. JBIDE-9722

Injection point annotated with @New should be resolved even if bean class does not belong to a bean archive.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 3.3.0.M4
    • 3.3.0.M3
    • cdi
    • None
    • Hide

      EXECUTE: Add to a bean initializing method:

      @Inject
      public void initialize(@New(HashSet.class) Set<String> children) {
      }
      

      ASSERT: There is no error marker on the method, and open-on suggest 'Open @Inject Bean HashSet'.
      EXECUTE: Modify method as follows

      @Inject
      public void initialize(@New Set<String> children) {
      }
      

      ASSERT: Error marker 'No bean is eligible for injection...' appeared, and open-on suggests no bean to open. That is correct because no concrete class implementing interface Set is specified.
      EXECUTE: Modify method as follows

      @Inject
      public void initialize(@New(ArrayList.class) Set<String> children) {
      }
      

      ASSERT: Error marker 'No bean is eligible for injection...' appeared, and open-on suggests no bean to open. That is correct because concrete class specified does not implement interface Set.

      Show
      EXECUTE: Add to a bean initializing method: @Inject public void initialize(@New(HashSet.class) Set< String > children) { } ASSERT: There is no error marker on the method, and open-on suggest 'Open @Inject Bean HashSet'. EXECUTE: Modify method as follows @Inject public void initialize(@New Set< String > children) { } ASSERT: Error marker 'No bean is eligible for injection...' appeared, and open-on suggests no bean to open. That is correct because no concrete class implementing interface Set is specified. EXECUTE: Modify method as follows @Inject public void initialize(@New(ArrayList.class) Set< String > children) { } ASSERT: Error marker 'No bean is eligible for injection...' appeared, and open-on suggests no bean to open. That is correct because concrete class specified does not implement interface Set.

      See JSR-299 3.12. @New qualified beans.

      For each managed bean, and for each session bean, a second bean exists which:
      • has the same bean class,
      • has the same bean types,
      • has the same bean constructor, initializer methods and injected fields, and
      • has the same interceptor bindings.
      However, this second bean:
      • has scope @Dependent,
      • has a exactly one qualifier: @javax.enterprise.inject.New(X.class) where X is the bean class,
      • has no bean EL name,
      • has no stereotypes,
      • has no observer methods, producer methods or fields or disposer methods, and
      • is not an alternative, and
      • is enabled, in the sense of Section 5.1.2, "Enabled and disabled beans", if and only if some other enabled bean has an
      injection point with the qualifier @New(X.class) where X is the bean class.
      This bean is called the @New qualified bean for the class X.
      Note that this second bean exists—and may be enabled and available for injection—even if the first bean is disabled.

            alexeykazakov Alexey Kazakov
            scabanovich Viacheslav Kabanovich (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: