This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
With CDI it is possible to use @Inject to inject something that is produced with @produces somewhere else in the source code. It can be seen as "black magic" for many new to CDI, and it can also be hard to discover even for experienced CDI users where things are produced. I would therefor like to propose an enhancement that Netbeans gives a list of possible producers for a given @Inject (if it is possible to do technically though...).
Input from Michael Nascimento (NetCAT mailing list): Not only things from @Produces can be injected, so maybe something like this with a see all? CDI extensions would have to be manually handled though, i.e., NetBeans would have to provide a SPI for extension developers to code an implementation for their own extension.
I think such a feature belong to either the Navigate or Edit (with a new "Find CDI beans" feature) menu, or maybe by right-clicking on a field being annotated with @Inject and Netbeans can give a list of possible things that could be injected (I assume this would be the "black magic" to be implemented;) ). I foresee the usage of CDI to maybe become the same issue as people have with interceptors..they don't see where things are applied...or as with using Spring when declared in XML files...don't see directly in code where the link to other files are. I hope Netbeans can be proactive here and give the user some help before CDI become painful and hard :)
Input to the discussion is also if Netbeans should/must scan external dependencies on the classpath to find other possible CDI beans that can be injected
(In reply to comment #0) > With CDI it is possible to use @Inject to inject something that is produced > with @produces somewhere else in the source code. It can be seen as "black > magic" for many new to CDI, and it can also be hard to discover even for > experienced CDI users where things are produced. I would therefor like to > propose an enhancement that Netbeans gives a list of possible producers for a > given @Inject (if it is possible to do technically though...). This is ALREADY implemented. You are able to use injection point ( f.e. field, method parameter,......) as a context for number of CDI related actions. F.e. you may choose injection point in the editor and invoke popup menu action : Navigate->Go To Injectable/Go To Decorator/Inspect CDI. The last action ( Inspect CDI ) allows to you see ALL available eligible for injection elements. This list includes Java Types, producers (methods and fields) resolved by typesafe resolution specification. It even contains disabled beans (they are looks like disabled in the UI). So I suppose there is already all functionality that you requested here. There is also editor glyph gutter actions with special icons on the left side bar of the editor pane. They duplicate the mentioned actions ( no need to invoke popup menu actions ). They are context dependent. See also http://wiki.netbeans.org/CDIFeatures71 and http://wiki.netbeans.org/NewAndNoteworthyNB71#CDI
(In reply to comment #3) > Input to the discussion is also if Netbeans should/must scan external > dependencies on the classpath to find other possible CDI beans that can be > injected All project's classpath is scanned. There is only one issue which is limitation of Java infrastructure performance: search methods with specified annotation is very time consuming task for binary classpath. So producers from binary classpath is not available in the final result.
(In reply to comment #1) > Input from Michael Nascimento (NetCAT mailing list): > > Not only things from @Produces can be injected, so maybe something > like this with a see all? CDI extensions would have to be manually > handled though, i.e., NetBeans would have to provide a SPI for > extension developers to code an implementation for their own > extension. This is the only thing in the issue which is not implemented. But it seems this feature would be rarely used.
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue. Thanks for your cooperation, NetBeans IDE 8.2 Release Boss