Uploaded image for project: 'NetBeans'
  1. NetBeans
  2. NETBEANS-5246

incorrect Unresolved Ambiguous Dependency warning

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 12.2
    • None
    • javaee - CDI
    • None
    • Windonws / Netbeans 12.2 / Java OpenJDK 11 / Wildfly 21 / Weld / Mojarra 2.3.14.SP01

    Description

      I'm getting an "Unresolved ambiguous dependency" warning when I inject a CDI bean.

      If I simply ignore the warning message. The application runs correctly and WELD does not report any issues when the application is deployed.

      This issue does not happen always. It appears to be when generics are being used. In the example above Car.class is a simple POJO. I've got a SessionScoped CarCatalog.class that @Produces a List<Car>. This reference is sufficient to make it unique to CDI and should not be causing a warning in NetBeans.

      There is a related issue in EL code completion:

      If I reference the same CDI object in EL, no code completion is available, presumably implying no match has been found. Again, if I manually complete the field and ignore the warning triangles, the code deploys and runs OK.

      The suggestions it is generics related, if I use code completion on h:datatable, I get this for the CDI bean:

      and this if I have a similar field in the backing bean for the page (when code completion works ok):

      Code samples are attached.

       

      Attachments

        1. Car.java
          2 kB
          Stephen Brooksbank
        2. CarCatalog.java
          1 kB
          Stephen Brooksbank
        3. CodeCompletion1.png
          10 kB
          Stephen Brooksbank
        4. CodeCompletion2.png
          7 kB
          Stephen Brooksbank
        5. EL lookup failing.png
          7 kB
          Stephen Brooksbank
        6. index.xhtml
          2 kB
          Stephen Brooksbank
        7. IndexController.java
          0.8 kB
          Stephen Brooksbank
        8. Unresolved Ambiguous Dependency.png
          7 kB
          Stephen Brooksbank

        Activity

          People

            Unassigned Unassigned
            Steve B Stephen Brooksbank
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: