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.

Bug 222099 - Don't show beans from Mojarra in IDE auto complete
Summary: Don't show beans from Mojarra in IDE auto complete
Status: RESOLVED INCOMPLETE
Alias: None
Product: javaee
Classification: Unclassified
Component: CDI (show other bugs)
Version: 7.3
Hardware: PC Linux
: P2 normal with 1 vote (vote)
Assignee: Denis Anisimov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-11-14 10:46 UTC by Petr Pisl
Modified: 2012-11-21 07:01 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Pisl 2012-11-14 10:46:05 UTC
This issue was noticed by Edward Burns. From his mail:

I recently had cause to use a CDI @ApplicationScoped managed bean in the course of implementing a new feature in JSF 2.2.  After doing this, I now see that this bean is offered as a code-completion suggestion when filling out the EL in a JSF page!  This bean should not be offered in code-completion.  

I expect that as more of our implementations take advantage of CDI, this might be a bigger problem than just this one case.

A cheap fix, of course, would be to not offer beans with packages starting with "com.sun.faces", "org.glassfish" or "com.oracle" as code-completion suggestions.
Comment 1 edburns 2012-11-14 14:26:25 UTC
Because this will impact any platform-provided code I think it deserves P2.
Comment 2 Denis Anisimov 2012-11-21 07:01:26 UTC
There are two ApplicationScoped annotations:
javax.faces.bean.ApplicationScoped
javax.enterprise.context.ApplicationScoped

Which one do you mean ?
Actually both shouldn't have no any relation to the managed beans 
autocompletion (which is actually is not CDI functionality).
Autocompletion uses CDI as a model to get @Named CDI managed beans. It is 
just one source of data. There are number other sources for autocompletion,
which I don't know.

So the autocompletion issue is not CDI issue unless there is proof that 
CDI model returns wrong bean names.
The presence of @ApplicationScoped annotation doesn't produce managed bean
eligible for autocompletion. I've just check it.
So the only way to get managed bean in autocompletion in respect of CDI source
is add @javax.inject.Named annotation.
In the latter case CDI model returns the bean as @Named bean.
I don't see any reason to filter such beans based on package name or anything
else. There is no any mentions about this in the CDI spec.
So the issue looks like INVALID for me.
I guess you have created your @ApplicationScoped along with @Named and faced to 
the issue. But this is not an issue. This is expected behavior.
By the way NB Managed Bean wizard created @ApplicationScoped beans with 
@Named annotation.
Just remove @Named if you don't want to have bean in the autocompletion.

Otherwise please provide exact steps to reproduce the issue: how have you 
created @ApplicationScoped bean ? ( as I already said @ApplicationScoped 
annotation  presence should not be a reason for autocompletion and this is 
an issue without need to restrict package names ).