Please use the Apache issue tracking system for new NetBeans issues ( !!
Bug 114164 - Java Editor and code completions doesn't recognize the generated classes in the imported/included library project
Java Editor and code completions doesn't recognize the generated classes in t...
Product: webservices
Classification: Unclassified
Component: JAXB
PC Windows XP
: P2 (vote)
: 6.x
Assigned To: _ gmpatil
: 118696 130389 134159 136088 136496 (view as bug list)
Depends on: 105645
  Show dependency treegraph
Reported: 2007-08-29 22:02 UTC by _ hong_lin
Modified: 2009-02-19 23:29 UTC (History)
7 users (show)

See Also:
Issue Type: DEFECT

Sample app, including project JavaLibrary1 and JavaLibrary2 (22.46 KB, application/octet-stream)
2007-08-29 22:26 UTC, _ hong_lin
CVS diff for in 'j2seproject' module (1.29 KB, application/octet-stream)
2007-09-24 22:33 UTC, _ gmpatil

Note You need to log in before you can comment on or make changes to this bug.
Description _ hong_lin 2007-08-29 22:02:58 UTC
This is an issue reported by our customer William M. Saxton (

Editor recognizes generated classes if the jar is copied to directory out side of the Netbeans project folder and then
added as library.

Build happens correctly in the second project even though, Editor and Code-completion features are not recognizing the
generated classes.

Build: NB 6.0 M10 and nightly builds.

Steps to reproduce it:
1. In project "JavaLibrary1", a schema TestSchema.xsd is created under Source Packages.
A class "FooType" is created from the schema using the JAXB wizard. A class called
 "TestFooType" is created within the project, which extends "FooType" and all is

2. Create a new java library "JavaLibrary2".
3. Add "JavaLibrary1" as one of its Compile-time Libraries.
4. Expand "JavaLibrary2 -> Libraries -> JavaLibrary1", no class is shown under JavaLibrary1.
5. If create a class "BillFooType". Can't extend "FooType". 

6. If copy the JavaLibrary1.jar to a different folder. It can be recognized.
Comment 1 _ hong_lin 2007-08-29 22:26:46 UTC
Created attachment 47754 [details]
Sample app, including project JavaLibrary1 and JavaLibrary2
Comment 2 _ gmpatil 2007-08-30 20:40:38 UTC
This is due to optimization in Java project system when jar in library is created thru another Netbeans project.
Code completion and classpath seems to aggregated from the included Project meta-data rather than from the built jar itself.

#105645 requests API to add generated Java source root by other modules.

Till the API is implemented, if 'j2seproject' team agrees we can add JAXB Wizard specific change in 'j2seproject'
project's class  CompiledSourceForBinaryQuery.

Comment 3 Joseph Silber 2007-09-10 13:50:43 UTC
release note added beta 1
Comment 4 _ gmpatil 2007-09-24 22:31:53 UTC
Hi Tomas,
We have an issue where code completion and Java Editor does not recognize JAXB Wizard generated classes, when generated
classes are in
imported Java SE Project/Class library.

I have modified and tested JAXB Wiz specific changes to CompiledSourceForBinaryQuery.
After the change, Editor is recognizing the JAXB generated classes as well as code-completion is working in the target
Let me know if these changes are Ok, I have attached the CVS diff file.

Comment 5 _ gmpatil 2007-09-24 22:33:51 UTC
Created attachment 49391 [details]
CVS diff for in 'j2seproject' module
Comment 6 Tomas Zezula 2007-09-25 10:22:13 UTC
The patch seems good to me, feel free to integrate it. The only minor thing is that the new is created and
not normalized by FileUtil.normalizeFile (), but the wssupport also doesn't do it. It is probably save not to call
FileUtil.normalizeFile () in this case since you created the folder and you know the correct character capitalization.
Comment 7 _ gmpatil 2007-09-26 00:21:17 UTC
Thanks Tomas, I have checked-in the changes.

Please verify using CB #3512 or later.
Comment 8 Milan Kuchtiak 2007-09-26 08:39:03 UTC
Yes, the changes look fine.
Comment 9 _ gmpatil 2007-10-12 16:09:33 UTC
Regressed in recent builds. 
Re-opening the issue.
Comment 10 _ gmpatil 2007-10-12 16:31:26 UTC
*** Issue 118696 has been marked as a duplicate of this issue. ***
Comment 11 _ gmpatil 2007-10-14 18:27:52 UTC
Implemented Classpath provider and registered using lookup merger, similar to Web Services. 

Hong, Michael, fix is in the trunk, once it works for you guys, I will request for check-in to release60_beta2.

Changed files.

Comment 12 Michael Nazarov 2007-10-15 18:56:25 UTC
Build 200710150000

Well it works somehow but not completely as I understood from description.
So I opened both projects and found exclamation mark within both projects.
Opened java files are clear. After some manipulations like Cleanup and Build
some of tree error marks gone. After reopening all marks gone. But I was
unable to find any subnodes under expanded "JavaLibrary2 -> Libraries ->
JavaLibrary1". Not sure is this other issue or no.

So finally editor works fine, libraries looks corrupted.
Comment 13 Michael Nazarov 2007-10-15 19:00:13 UTC
Sometimes exclamation mark comes back but editor still looks normal and compilation works.
Comment 14 _ gmpatil 2007-10-15 19:32:54 UTC
Regarding your first issue is synchronization of error hints between Editor and nodes in explorer. I think it takes some
times few seconds to both synchronize.
Regarding library node expansion, "JavaLibrary2 -> Libraries ->JavaLibrary1" will not expand if library is of project
type. It will expand if you add library as 'Jar/Folder'. 
Comment 15 _ gmpatil 2007-10-15 20:16:25 UTC
Marking as fixed. 
I think issues observed by Michael, especially error hint synchronization between explorer nodes and Editor needs to be
address separately if it is agreed as an issue.
Comment 16 Michael Nazarov 2007-11-12 15:39:33 UTC
Product Version: NetBeans IDE 6.0 RC1 (Build 200711120000)
Java: 1.6.0; Java HotSpot(TM) Client VM 1.6.0-b105
System: Windows XP version 5.1 running on x86; Cp1251; ru_RU (nb)

Looks like issue come back.
Downloaded from

BTW I used our own scenarios as specified in duplicate issue and did not check using these ones.
Comment 17 Michael Nazarov 2007-11-12 16:11:29 UTC
Sorry, I'm unable to establish exact steps to reproduce now while in previous
builds it was pretty easy. I'm not sure is it regression or random error with
unknown nature.

It's better to leave as fixed for a while. I'll try to investigate more.
Comment 18 Michael Nazarov 2008-01-23 14:59:00 UTC
Product Version: NetBeans IDE 6.0.1 dev (Build 200801230000)
Java: 1.6.0_04; Java HotSpot(TM) Client VM 10.0-b19
System: Windows XP version 5.1 running on x86; Cp1251; ru_RU (nb)

Actually issues come back in last build with JDK6u4, but I think
this is due to build not due to JDK. Willl check with previous
JDK as well but this requires some time to reinstall JDK.

Details about steps to reproduce are in issue 118696.
Comment 19 _ gmpatil 2008-01-30 23:15:41 UTC
I am unable to reproduce using the latest build. I had wait 5-6 secs before imports were resolved,

Product Version: NetBeans IDE Dev (Build 20080130185640)
Java: 1.6.0_01; Java HotSpot(TM) Client VM 1.6.0_01-b06
System: Windows XP version 5.1 running on x86; Cp1252; en_US (nb)
Userdir: C:\Documents and Settings\gpatil\.netbeans\dev
Comment 20 Michael Nazarov 2008-02-05 13:59:31 UTC
Product Version: NetBeans IDE Dev (Build 200802050005)
Java: 1.6.0_04; Java HotSpot(TM) Client VM 10.0-b19
System: Windows XP version 5.1 running on x86; Cp1251; ru_RU (nb)

Works for me as well. Okey, this feature looks strange and rises time to time
from random build. I think this is bad behavior, but I know nothing about
reasons of this situation. Possibly this is side effect of code changes.

As for waiting for few seconds -- if this works it works momentarily for me,
if if doesn't it doesn't even after hour of waiting.
Comment 21 _ gmpatil 2008-02-13 01:18:19 UTC
Closing for now, as unable reproduce.
Comment 22 Michael Nazarov 2008-03-28 14:47:02 UTC
Product Version: NetBeans IDE Dev (Build 200803250006)
Java: 1.6.0_04; Java HotSpot(TM) Client VM 10.0-b19
System: Windows XP version 5.1 running on x86; Cp1251; ru_RU (nb)

It doesn't work again. This is one of the issues which work or no under strange conditions.
For example: if I started IDE and created JAXB manually then IDE unable to complete import
statement or class name in code correctly. But after manual import IDE able to complete class
names in code. Fix Imports doesn't work.

If IDE started and JAXB created from automated tests then IDE able to complete class names
and Fix Imports works fine.

I believe we need to spend some more time and fix this one.
Comment 23 Michael Nazarov 2008-03-28 14:50:54 UTC
One more addition: looks like if binding created from "supported" xsd then code completion doesn't work, if used
"unsupported" wsdl file then code completion works.
Comment 24 Michael Nazarov 2008-03-28 14:53:20 UTC
Sorry, one more addition again: completion doesn't work after first binding creation. If one deleted first binding then
created it again -- completion looks workable...
Anyway -- this is very strange behavior.
Comment 25 _ gmpatil 2008-03-29 02:57:07 UTC
With single project I am not able to simulate, but able to with original use case.
1. Create Java Library project - JL.
2. Create JAXB Binding using XSD.
3. Code completion for import works in JL
4. Create Java SE project JSE, add Project JL to Library.
5. In JSE code completion does not work while tryping import statements.

Michael is this what you are seeing?
Comment 26 _ gmpatil 2008-03-31 22:00:59 UTC
Marking "Incomplete". 
NB 6.1 in HRM, working to find solution to the scenario described earlier, assuming Michael is describing the same.
Comment 27 _ gmpatil 2008-04-01 00:18:11 UTC
Seems like issue is not confined to JAXB-Wiz.

Tried with refreshing the "build" folder FileObject in JAXBGenSourceClassPathProvider as well at the end of the JAXB
Wizard. Also hard coding the generated source path J2SE project's SourcePathImplementation did not help.

Code completion works in the project JAXB Binding is created but not in the project using the first project as library.
Tried creating Webservice client in the first project, observed WsImport generated classes are also not available for
code completion in the second project.

Comment 28 Lukas Jungmann 2008-04-14 17:15:57 UTC
moving opened issues where TM != dev to TM=TBD
Comment 29 _ gmpatil 2008-04-29 23:56:26 UTC
*** Issue 134159 has been marked as a duplicate of this issue. ***
Comment 30 _ gmpatil 2008-04-29 23:58:36 UTC
*** Issue 130389 has been marked as a duplicate of this issue. ***
Comment 31 _ gmpatil 2008-05-29 19:41:14 UTC
*** Issue 136088 has been marked as a duplicate of this issue. ***
Comment 32 _ gmpatil 2008-06-24 01:47:15 UTC
*** Issue 136496 has been marked as a duplicate of this issue. ***
Comment 33 _ gmpatil 2008-07-24 00:01:34 UTC
Seems like issue is fixed in latest build. 

Product Version: NetBeans IDE Dev (Build 20080723164810)
Java: 1.5.0_13; Java HotSpot(TM) Client VM 1.5.0_13-b05
System: Windows XP version 5.1 running on x86; Cp1252; en_US (nb)

Comment 34 _ gmpatil 2008-07-24 00:25:06 UTC
*** Issue 140602 has been marked as a duplicate of this issue. ***
Comment 35 _ gmpatil 2008-07-24 00:41:30 UTC
*** Issue 139138 has been marked as a duplicate of this issue. ***
Comment 36 David Konecny 2008-07-24 01:56:22 UTC
This is not INCOMPLETE - issue 139138 gives clear steps how to reproduce the problem.
Comment 37 aperezymadrid 2008-09-11 09:50:38 UTC
I've downladed last updates for NB 6.1 (maybe those named patch 3) and this issue has arised again.

More, if project A has some JAXB bindings and it's libraries are imported to project B and project B serves EJB, then
neither editor nor compiler can see any packages of project A. 

If you take those jaxb bindings to another project and include them, it doesn't works. But if ypu copy the jaxb
generated sources as regular packages and classes and erase that jaxb bindings, the editor can now see all packages also
the compiler.
Comment 38 Milan Kuchtiak 2008-09-23 16:35:29 UTC
If the issue isn't reproducible in 6.5, the bug can be marked as fixed.
I noticed, the SourceForBinaryQuery interface was implemented already.
Comment 39 _ gmpatil 2008-09-23 20:00:06 UTC
With latest NB 6.5 I am not able to simulate the issue. 

Product Version: NetBeans IDE Dev (Build 20080923152338)
Java: 1.5.0_13; Java HotSpot(TM) Client VM 1.5.0_13-b05
System: Windows XP version 5.1 running on x86; Cp1252; en_US (nb)
Userdir: C:\tmp\nb65_0923

Tried below test cases,
- Java SE project importing another Java SE project.
- Web Application project importing Java SE project.
- EJB project importing Java SE project.
- EJB project importing another EJB project.

Could you try latest build and let us know steps to reproduce.
Comment 40 Jaroslav Pospisil 2008-12-01 15:54:01 UTC
Closing as worksforme due to last comment and no reporter feedback for more than two months.
Comment 41 Milan Kuchtiak 2009-02-04 17:04:33 UTC
It should work now without no problem.
Regarding CC, the generated sources are now handled as normal sources.
See the issue 105645.

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo