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 195636 - Code completion for EL is not working for classes with @Named
Summary: Code completion for EL is not working for classes with @Named
Status: VERIFIED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: CDI (show other bugs)
Version: 7.0
Hardware: PC Other
: P2 normal with 2 votes (vote)
Assignee: Denis Anisimov
URL:
Keywords:
: 196064 198042 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-02-18 00:48 UTC by averri
Modified: 2011-07-27 11:18 UTC (History)
8 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Comment #6 test case (4.65 KB, application/octet-stream)
2011-03-31 14:40 UTC, sumnulu
Details
Maven based web project, with mentioned defect. (10.73 KB, application/octet-stream)
2011-05-04 14:45 UTC, averri
Details

Note You need to log in before you can comment on or make changes to this bug.
Description averri 2011-02-18 00:48:10 UTC
This issue is for Netbeans 7.0 beta2.

The code completion for expression language is not working for classes anotated with @Named. For example, suppose the class 

@Named
class Messages {
 public String getMessage() { return "Hello"; }
}

and the XHTML file containing the following code:

<h:outputText value="#{messages.message}"  />

The code completion does not show the message property above.
Comment 1 Marek Fukala 2011-02-24 14:41:07 UTC
Works fine for me, I've tried the described scenario in a web project. Does it work in a new web project? Or is it a project specific? If so, can you attach the project here? Thanks.
Comment 2 averri 2011-02-24 16:26:39 UTC
Sorry, I forgot to mention that it's a Maven based WEB project.

Please, recheck it.
Comment 3 Marek Fukala 2011-02-28 14:16:31 UTC
*** Bug 196064 has been marked as a duplicate of this bug. ***
Comment 4 Marek Fukala 2011-03-02 09:15:35 UTC
I've checked it in a maven web project and it does work well either. Does it work for you if you do following:

1) create new maven web project
2) in the project properties add jsf framework
3) create a java class MyBean
4) add @Named ann to the bean and add a getX() method
5) open the index.xhtml 
6) type #{ and invoke the completion
7) complete MyBean
8) type . and invoke cc again
=> x property is offered

Do you have all the dependencies of the maven project resolved? 

If it doesn't work for you only in a specific project, can you attach it here packed? Or send it to me by email if confidential. Then please also reopen the bug again. Thanks for understanding.
Comment 5 Marek Fukala 2011-03-02 09:21:48 UTC
reverting accidental priority change
Comment 6 sumnulu 2011-03-31 14:29:14 UTC
I have the same issue. Using 7.0 rc1.
I did those instructions but didn't worked for me.

Operating System windows 7 64bit
Also some settings in windows "region and language"
Format = English
Display Language = English
Turkish Q keyboard
Language for non-unicode programs = English (US)

thanks


(In reply to comment #4)
> I've checked it in a maven web project and it does work well either. Does it
> work for you if you do following:
> 
> 1) create new maven web project
> 2) in the project properties add jsf framework
> 3) create a java class MyBean
> 4) add @Named ann to the bean and add a getX() method
> 5) open the index.xhtml 
> 6) type #{ and invoke the completion
> 7) complete MyBean
> 8) type . and invoke cc again
> => x property is offered
> 
> Do you have all the dependencies of the maven project resolved? 
> 
> If it doesn't work for you only in a specific project, can you attach it here
> packed? Or send it to me by email if confidential. Then please also reopen the
> bug again. Thanks for understanding.
Comment 7 sumnulu 2011-03-31 14:40:18 UTC
Created attachment 107409 [details]
Comment #6 test case

Test case for comment 6
Comment 8 averri 2011-03-31 18:30:15 UTC
Thanks for information. 

Yes, it's working. In order to make it work, we must add a JSF framework in project properties. 

Netbeans 6.9.1 does not require you to do that.

After that, I believe that it's not a bug.




(In reply to comment #6)
> I have the same issue. Using 7.0 rc1.
> I did those instructions but didn't worked for me.
> 
> Operating System windows 7 64bit
> Also some settings in windows "region and language"
> Format = English
> Display Language = English
> Turkish Q keyboard
> Language for non-unicode programs = English (US)
> 
> thanks
> 
> 
> (In reply to comment #4)
> > I've checked it in a maven web project and it does work well either. Does it
> > work for you if you do following:
> > 
> > 1) create new maven web project
> > 2) in the project properties add jsf framework
> > 3) create a java class MyBean
> > 4) add @Named ann to the bean and add a getX() method
> > 5) open the index.xhtml 
> > 6) type #{ and invoke the completion
> > 7) complete MyBean
> > 8) type . and invoke cc again
> > => x property is offered
> > 
> > Do you have all the dependencies of the maven project resolved? 
> > 
> > If it doesn't work for you only in a specific project, can you attach it here
> > packed? Or send it to me by email if confidential. Then please also reopen the
> > bug again. Thanks for understanding.
Comment 9 Marek Fukala 2011-03-31 19:12:28 UTC
closing then...
Comment 10 eratzlaff 2011-04-04 03:22:04 UTC
I have make some test If you make a new project and add JavaServer Faces its work.

But if you add a new Maven Module like Project-api add this module to your ejb module, and your web module depend on your ejb module. 

And add one clase to your api module annotated with @ManagedBean and one class to your web module with annotation @Named, the autocomplete on your xhtml file dont work animore for the @Named annotation.

Testet on:
Ubuntu 10.04
Java 1.6.0_24-b07
Netbeans RC1
Comment 11 Marian Mirilovic 2011-04-04 06:55:51 UTC
Marek, please evaluate for stopper status (and fix), if not considered as stopper I would waive it for 7.0 .
Comment 12 Marek Fukala 2011-04-05 15:43:03 UTC
This is not a stopper issue.
Comment 13 Marek Fukala 2011-04-05 15:55:18 UTC
I still cannot reproduce. 

Reporter, please make some testing environment for me - create all those mentioned projects, set the dependencies, pack them all and attach it here. Thanks.
Comment 14 averri 2011-04-05 16:11:52 UTC
Hi, 

I reproduced the steps with success.

But the problem occurs when I open a project created with Netbeans 6.9.1 with Netbeans 7.0 RC1. 

If I create a new class and anotate it with @Named, the code completion works fine in expression language. But it doesn't work for 'old' classes anotated with @Named!

It's a very strange behavior.





(In reply to comment #13)
> I still cannot reproduce. 
> 
> Reporter, please make some testing environment for me - create all those
> mentioned projects, set the dependencies, pack them all and attach it here.
> Thanks.
Comment 15 Marian Mirilovic 2011-04-05 16:22:41 UTC
I do not consider this issue as a stopper for NB 7.0 -> waiver approved.
Comment 16 eratzlaff 2011-04-10 03:58:14 UTC
Ok..

I have a new testCase.

Make a new EAR project. Add JavaServer Faces too the web project.
Add a newClass annotatec with @Named. Autocomplete works.
Now add to the dependencies the ejb module like. 

...
<scope>provided</scope>
<type>ejb</type>

Now make a Clean and buid from the parend maven project. And try again the 
autocomplete. The autocomple stop working on @Name class.

Its a new EAR project create on Netbeans 7 RC2.
Comment 17 eratzlaff 2011-04-10 13:21:51 UTC
New and more simple test Case

Netbeans Dev 2011040410-8bf8d986179b
Bundled Maven 3.0.3
Ubuntu 10.04
Java build 1.6.0_24-b07

Make a new Maven EAR project.
Add JSF Framefork.
Add beans.xml
Add newClass annotated with @Named.
Test Auto complete on index.xhtml its work.
Now make a clean an build of the entire and test Auto Complete again.
And the the Auto complete stop to work on @Named class.

Tanks for your time.
Comment 18 sebastianovide 2011-04-27 12:58:34 UTC
see Bug 198042
Comment 19 Martin Fousek 2011-05-03 14:47:08 UTC
The case from comment #17 is reproducible and seems to be related to fix for issue #179923.

I debug it a little bit and found out that WebBeansModelProviderImpl.getNamedElements() collect properly all @Named elements for CC but at the end of this method contain filter:
PackagingFilter filter = new PackagingFilter(getModel());
filter.filter(result);

And it seems that searching for beans.xml in Maven Web projects isn't handled there. Reassigning to the module owner.
Comment 20 Denis Anisimov 2011-05-04 08:21:05 UTC
It's not Maven related issue.
This is bug in PackagingFilter class which is added as fix for issue #179923.
It happens because of the same Java element is on the Compile classpath ( as
result of project build ) and also is in the source classpath.
One need to distinguish binary java elements that are result of compilation of
java sources from regular project classpath.
Comment 21 Denis Anisimov 2011-05-04 12:48:21 UTC
*** Bug 198042 has been marked as a duplicate of this bug. ***
Comment 22 Denis Anisimov 2011-05-04 12:54:46 UTC
changeset:   193403:828dedac243a
Comment 23 averri 2011-05-04 14:45:30 UTC
Created attachment 108106 [details]
Maven based web project, with mentioned defect.

Please, check the attached project to see the mentioned behavior.

This project was created with Netbeans 6.9.1, and the code completion in XHTML file works well in this IDE version.

Using Netbeans 7.0, code completion does not work.
Comment 24 sebastianovide 2011-05-04 15:12:12 UTC
this bug is RESOLVED but we can still reproduce it. Can we reopen it ?
Comment 25 Denis Anisimov 2011-05-04 15:24:25 UTC
(In reply to comment #24)
> this bug is RESOLVED but we can still reproduce it. Can we reopen it ?

WHAT do you mean "we can still reproduce it" ?
It is fixed TODAY.
Did you use development version where the fix is available ?
If you are able to reproduce it please reopen .
Provide exact steps to reproduce ( or just mention them if they are already 
in the comments ) .
BUT make sure that fix is in the build what do you use.

Fixes is not available automatically in the NB.
They are integrated in the code repository .
So you need either build NB from recent sources or wait binary with fix.
"Target Milestone" contains the version of NB where fix is available.
Comment 26 sebastianovide 2011-05-04 16:52:12 UTC
sorry... ignore it pls. I was not using the latest version from the repo.
Comment 27 Quality Engineering 2011-05-05 06:01:32 UTC
Integrated into 'main-golden', will be available in build *201105050000* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/828dedac243a
User: Denis Anisimov <ads@netbeans.org>
Log: Fix for BZ#195636 - Code completion for EL is not working for classes with @Named .
Comment 28 averri 2011-05-05 19:25:41 UTC
This issue is not resolved.

Please, check the attached project (Maven based web project, with mentioned defect).
Comment 29 sebastianovide 2011-05-05 19:41:48 UTC
is there any workaround in the mean time ?
Comment 30 tremel 2011-05-06 06:40:40 UTC
(In reply to comment #28)
> This issue is not resolved.
> 
> Please, check the attached project (Maven based web project, with mentioned
> defect).

My CC problem as described in http://netbeans.org/bugzilla/show_bug.cgi?id=198042#c2 seems to be resolved in build 20110505, but now Bug http://netbeans.org/bugzilla/show_bug.cgi?id=198348 makes working with the build not attractive. Are these bugs related at code level?
Comment 31 Denis Anisimov 2011-05-06 06:43:25 UTC
(In reply to comment #30)
> (In reply to comment #28)
> > This issue is not resolved.
> > 
> > Please, check the attached project (Maven based web project, with mentioned
> > defect).
> 
> My CC problem as described in
> http://netbeans.org/bugzilla/show_bug.cgi?id=198042#c2 seems to be resolved in
> build 20110505, but now Bug http://netbeans.org/bugzilla/show_bug.cgi?id=198348
> makes working with the build not attractive. Are these bugs related at code
> level?

No.
The current issue is in CDI area.
The mentioned issue #198042 is inside JSF area.
Comment 32 Denis Anisimov 2011-05-06 06:44:29 UTC
(In reply to comment #31)
> (In reply to comment #30)
> > (In reply to comment #28)
> > > This issue is not resolved.
> > > 
> > > Please, check the attached project (Maven based web project, with mentioned
> > > defect).
> > 
> > My CC problem as described in
> > http://netbeans.org/bugzilla/show_bug.cgi?id=198042#c2 seems to be resolved in
> > build 20110505, but now Bug http://netbeans.org/bugzilla/show_bug.cgi?id=198348
> > makes working with the build not attractive. Are these bugs related at code
> > level?
> 
> No.
> The current issue is in CDI area.
> The mentioned issue #198042 is inside JSF area.

Sorry , its about issue #198348 .
Comment 33 Denis Anisimov 2011-05-06 06:52:10 UTC
Now the issue is specific to Maven.
I can reproduce it after rebuilding the pointed attached project.
Comment 34 tremel 2011-05-06 06:55:26 UTC
(In reply to comment #32)
> (In reply to comment #31)
> > (In reply to comment #30)
> > > (In reply to comment #28)
> > > > This issue is not resolved.
> > > > 
> > > > Please, check the attached project (Maven based web project, with mentioned
> > > > defect).
> > > 
> > > My CC problem as described in
> > > http://netbeans.org/bugzilla/show_bug.cgi?id=198042#c2 seems to be resolved in
> > > build 20110505, but now Bug http://netbeans.org/bugzilla/show_bug.cgi?id=198348
> > > makes working with the build not attractive. Are these bugs related at code
> > > level?
> > 
> > No.
> > The current issue is in CDI area.
> > The mentioned issue #198042 is inside JSF area.
> 
> Sorry , its about issue #198348 .
Thank you. Mostly I wanted to signalize, that for me the CC on @Named beans
seems to be resolved with the first touch of build 20110505.
Comment 35 Denis Anisimov 2011-05-06 06:57:14 UTC
(In reply to comment #34)

> Thank you. Mostly I wanted to signalize, that for me the CC on @Named beans
> seems to be resolved with the first touch of build 20110505.

Thanks for that.
No the problem is specific to Maven projects only.
Comment 36 Denis Anisimov 2011-05-06 07:06:48 UTC
(In reply to comment #29)
> is there any workaround in the mean time ?

I'm investigating the reason of the issue.
Probably it is in the different area.

The workaround is : clean ( not *build* ) your Maven project.
Comment 37 Denis Anisimov 2011-05-06 07:45:43 UTC
The problem is inside "foreign" code which has been introduced into Web Beans model to access it : WebBeansModelSupport.getClassPath() is 
incorrectly written ( copy/pasted ) .

So its not pure CDI problem actually but I've fixed it.
Comment 38 Denis Anisimov 2011-05-06 07:47:46 UTC
changeset:   193518:516b7b84ebeb
Comment 39 Marek Fukala 2011-05-06 07:54:14 UTC
(In reply to comment #30)
> but now Bug http://netbeans.org/bugzilla/show_bug.cgi?id=198348
> makes working with the build not attractive.

The issue has just been fixed. I'm sorry for the annoyance. Marek
Comment 40 sebastianovide 2011-05-06 15:51:55 UTC
(In reply to comment #36)
> (In reply to comment #29)
> > is there any workaround in the mean time ?
> 
> I'm investigating the reason of the issue.
> Probably it is in the different area.
> 
> The workaround is : clean ( not *build* ) your Maven project.

Thanks for that... but sadly it doesn't work all the times... I've noticed that restarting Netbeans would fix it (for a while....)
Comment 41 Quality Engineering 2011-05-07 05:36:35 UTC
Integrated into 'main-golden', will be available in build *201105070000* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/516b7b84ebeb
User: Denis Anisimov <ads@netbeans.org>
Log: Another one fix for BZ#195636 - Code completion for EL is not working for classes with @Named. ( Maven case )
Comment 42 Vladimir Riha 2011-07-25 13:25:55 UTC
I tried to reproduce it with project attached in comment #23 and it works fine, so for me it's verified...

Product Version: NetBeans IDE 7.0.1 (Build 201107211357)
Java: 1.7.0; Java HotSpot(TM) Client VM 21.0-b17
System: Linux version 2.6.38-10-generic running on i386; UTF-8; en_US (nb)