3 Replies Latest reply on Dec 20, 2015 2:44 PM by chrisjr

    NetBeans Bug #244173

    chrisjr

      Hi,

       

      I noticed last year that NetBeans was flagging some of my @Produces methods as "invalid", although WELD itself accepted them all without any problem and has always executed them as I expected. So I raised this bug in NetBeans to remove what I regarded as a spurious warning:

       

      https://netbeans.org/bugzilla/show_bug.cgi?id=244173

       

      Unfortunately, the NetBeans people don't seem to agree that this is a bug and I am struggling to grasp whatever their argument is. Can someone please tell me whether I have understood the WELD spec correctly so that we can finally resolve this bug? (It's already dragged on for over a year!)

       

      Thanks,

      Chris

        • 1. Re: NetBeans Bug #244173
          mkouba

          Hi Chris,

           

          you are correct and it's a NetBeans bug. In your case, SampleBean.getValue() is a producer method with @Dependent scope and so it is possible to use the injection point metadata. It wouldn't be possible for any other scope because we couldn't guarantee there's only one injection point per bean instance. See also 5.5.7. Injection point metadata.

           

          Martin

          • 2. Re: NetBeans Bug #244173
            meetoblivion

            It looks like the netbeans team may be misinterpreting Chapter 8.1 of this doc Chapter 8. Producer methods

             

            Its like the producer method as app scoped, even though it should be dependent.  Maybe try adding an explicit @Dependent to the method to see if that fixes it?

            • 3. Re: NetBeans Bug #244173
              chrisjr

              Actually, the NetBeans team's misunderstanding is so great that they don't realise that the scope of the method is even relevant. So adding an explicit @Dependent to the method makes no difference: the only way that I've found to remove the warning is to replace @ApplicationScoped with @Dependent on the bean itself. Which is wrong, of course.