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 57392 - Code completion doesn't work if library sources are incomplete
Summary: Code completion doesn't work if library sources are incomplete
Alias: None
Product: java
Classification: Unclassified
Component: Source (show other bugs)
Version: 4.x
Hardware: All All
: P2 blocker with 7 votes (vote)
Assignee: Tomas Zezula
Keywords: RELNOTE
: 68699 84556 87545 91956 95869 97783 115657 (view as bug list)
Depends on:
Reported: 2005-04-03 20:27 UTC by Petr Blaha
Modified: 2007-09-24 14:48 UTC (History)
7 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
Description Petr Blaha 2005-04-03 20:27:16 UTC
[Build 20050401]
1) create new Web project
2) add library Hibernate-annotation to project's classpath
3) create new class.
ERROR: code completion doesn't work for annotations. I tested also with EJB and
Java project.
Comment 1 Dusan Balek 2005-04-05 08:24:23 UTC
The problem is in the library setup. Imagine you have a library and you want to
attach sources to it. Believe or not, there is a difference between attaching
sources as a "src" folder and attaching them as a zipped file. In the first
case, MDR takes the attached sources as the primary and the ONLY source of data
for the whole library (if the attached sources do not cover all classes in the
library, classes without sources are not visible to code completion, etc.). In
the later case, the primary sources of data are class files (so all the classes
in the library are visible to code completion, etc.).

Reassigning to javacore. Please consider changing this behavior (or at least
adding a notice to a documentation), since the current behavior is very confusing.
Comment 2 Martin Matula 2005-04-05 09:54:13 UTC
Easy workaround exists -> either zip the sources and attach the zip instead of a
folder to the library, or  attach complete sources. Agreed this should be
John, could this be added somewhere to the documentation? (release notes or help
for Library manager?)
Comment 3 John Jullion-ceccarelli 2005-04-05 11:25:42 UTC
Adding Talley to the cc, since he's documenting the core functionality. Talley,
looks like we need to add a note to some source editor pages (especially any
code completion pages) about how to get this to work. Contact Martin Matula if
you have any questions.
Comment 4 Talley Mulligan 2005-04-13 18:46:09 UTC
i added mention to the "Attaching Source Code to a JAR File" help topic
(debug_source.html) and the library manager's csh page (actually GW did this for me)
Comment 5 Jiri Prox 2005-07-14 10:38:18 UTC
Blaha, can you, please, verify this issue? Thanks.
Comment 6 Petr Blaha 2005-07-20 12:29:36 UTC
Doc was verified in build 20050719.
Comment 7 Dusan Balek 2005-11-15 09:02:08 UTC
*** Issue 68699 has been marked as a duplicate of this issue. ***
Comment 8 claudio4j 2005-11-22 04:42:34 UTC
Sorry to say, but this should be considered a bug and fixed. How many people
read the docs to find a workaround ? Normally the docs are read when someone
doesn't known how to do something. Please consider to reopen this.
Comment 9 tkellerer 2006-05-12 13:43:58 UTC
As this bug is still valid for 5.5, I think this should be fixed. 

An experienced NB user might actually find the correct solution for this. But a
new NB user might well be turn his back on NetBeans ("Not even code-completion
or auto-import is working correctly... I'll go back to Eclipse")

Simply imagine the situation where the full sources are not available at all. In
this case I have the choice between a non-working completion and auto-import or
not having at least the partial sources at all. Not very satisfying.

Comment 10 _ alexlamsl 2006-05-12 16:07:11 UTC
Would you reckon a message dialog or similar indications warning the
user of this conflicting situation would be a good workaround (at
least the user knows that code completion is not working properly
beforehand), before an attempt for a full fix is made?


Yes a message dialog would far better then the current situation. Currently the
user does not have a clue what's going on. Especially as code-completion is
working for parts of the library, so the user's assumption would be that the
Library definition itself is correct at will assume it's a bug in NB.
Comment 11 Jiri Prox 2006-06-08 14:44:28 UTC
Old TM, changing to TBD
Comment 12 Jan Becicka 2006-06-13 09:57:50 UTC
We consider it for 6.0
Comment 13 John Jullion-ceccarelli 2006-08-07 14:37:53 UTC
reassigning to java core
Comment 14 Jiri Prox 2006-09-13 08:40:57 UTC
*** Issue 84556 has been marked as a duplicate of this issue. ***
Comment 15 slashack 2006-11-04 17:13:36 UTC
*** Issue 87545 has been marked as a duplicate of this issue. ***
Comment 16 ghartmann 2007-01-08 12:57:52 UTC
*** Issue 91956 has been marked as a duplicate of this issue. ***
Comment 17 Miloslav Metelka 2007-03-05 16:40:54 UTC
*** Issue 95869 has been marked as a duplicate of this issue. ***
Comment 18 Jiri Prox 2007-03-14 16:59:37 UTC
*** Issue 97783 has been marked as a duplicate of this issue. ***
Comment 19 tprochazka 2007-06-03 20:09:39 UTC
I also think that this big problem. I for example use Velocity in my projet and 
it use commons-collections-3.1.jar and some other jars. For Velocity I have 
source code but for another jars doesn't. And Netbeans mark all import of 
"org.apache.commons.collections." netbeans mark it as error. But When i run it 
all works. I try add also "Library" with source code of commons-collections and 
NB still claim that org.apache.commons.collections. doesn't exist :-(
Comment 20 Jan Becicka 2007-06-08 12:31:35 UTC
Fixed? Probably.
Comment 21 cyrill 2007-07-31 07:43:02 UTC
I had encountered this issue yesterday with 6.0M10. All my org.hibernate classes/packages where not visible in the import code completion suggestions 
and the annotations produced a red signal sign. I have defined a Library containing:
- jboss-seam.jar
- thirdparty-all.jar
- hibernate-all.jar
- jboss-seam-ui.jar
- jboss-commons.jar
- jboss-el.jar

and added it to my project (EJB).

I just removed the source and the issue is solved partly. I can now see parts of the classes in the package org.hibernate, but not all (The ones I use, I can 
not see - Length annotation). Unfortunately, the ant build does not complain and I can see the missing class if I expand the jar hibernate-all.jar in my 
projects Libraries folder.

For me, this is a serious bug. I can send you a small project if you like ...
Comment 22 cyrill 2007-07-31 07:57:38 UTC
Just a follow up to my previous post:

If I restart the IDE after removing the sources from the Library, I can see all classes in org.hibernate.xx and all warnings are gone. But if I only remove the 
sources from the library without restarting the IDE, I can see only parts of the package.
Comment 23 tprochazka 2007-07-31 08:15:39 UTC
I don't understand why Netbeans prefer source code before jar/classes for autocomplete and error scan. If source code 
doesn't exists it use jar/classes, bur when I add source code it forget on it and use only sources. Why?
Comment 24 Tomas Zezula 2007-08-20 18:04:00 UTC
Checking in nbproject/project.xml;
/cvs/java/source/nbproject/project.xml,v  <--  project.xml
new revision: 1.25; previous revision: 1.24
Checking in src/org/netbeans/api/java/source/;
/cvs/java/source/src/org/netbeans/api/java/source/,v  <--
new revision: 1.10; previous revision: 1.9
Checking in src/org/netbeans/modules/java/source/classpath/;
/cvs/java/source/src/org/netbeans/modules/java/source/classpath/,v  <--
new revision: 1.11; previous revision: 1.10
Comment 25 Tomas Zezula 2007-09-24 14:48:48 UTC
*** Issue 115657 has been marked as a duplicate of this issue. ***