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 61604 - Fix-imports and import dropdowns cannot see contents of some JARs
Summary: Fix-imports and import dropdowns cannot see contents of some JARs
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Unsupported (show other bugs)
Version: 4.x
Hardware: PC All
: P3 blocker (vote)
Assignee: issues@java
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-01 15:16 UTC by lordpixel
Modified: 2007-09-26 09:14 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
project.properties from sample project (2.04 KB, text/plain)
2005-08-16 16:15 UTC, lordpixel
Details
private.properties from sample project (152 bytes, text/plain)
2005-08-16 16:16 UTC, lordpixel
Details
Screenshot of the problem occuring (5.88 KB, image/png)
2005-12-09 19:06 UTC, lordpixel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description lordpixel 2005-08-01 15:16:58 UTC
With Netbeans 4.1, I'm having an issue where the various features of the IDE
that should be able to resolve classnames for me fail to see some classes in
some JARs.

e.g,
If I hit shift-alt-f to "FIX Imports" OR
if I hit shift-alt-i to "Import class" OR
if I open a new Java file and type "import org." then hit control-space.

Some of the classes that should be in the dropdown are not.

Steps to reproduce:

1. Download Apache Commons Logging from apache.org. Get version 1.0.4, I
happened to use the Zip file distribution.

2. Unzip the distribution, notice there are 2 jars at the top level:
commons-logging.jar and commons-logging-api.jar

3. Create a New Java application project (native, not Ant style)

4. Add commons-logging-api.jar to the project's classpath (either by adding the
JAR directly or by creating a library containing it and adding that - it doesn't
matter)

5. Try to complete anything from the org.apache.commons package (eg, type import
org.apache. into a Java file and hit ctrl-space) -> nothing appears. Fix Imports
cannot find the Log or LogFactory classes from this package either.

6. Remove commons-logging-api.jar from the project classpath and add
commons-logging.jar instead

7. Notice the autocomplete now works correctly.

8. Open both jars, see they have the same classes and roughly similar manifests

9. Look in the IDE log file, see absolutely no reports of any problems

Something is definitely wrong. I'm also having the same problem with local
copies of Apache Commons Collections and an old version of Doug Lea's
conncurrent.jar we have here. There are probably a lot more things missing.

This is particularly annoying because it makes Fix Imports next to useless,
because Fix Imports will *remove* the import statements for Apache Commons
Logging from files were I have entered them manually.

If I can try 4 random JARs and have 3 failures, this must be a pretty widespread
problem (unless I'm incredibly unlucky).
Comment 1 Tomas Zezula 2005-08-15 09:58:34 UTC
Does not seem to be a classpath problem.
Does the compiler resolve the classes during build when having the
commons-logging-api.jar on the classpath?
Comment 2 lordpixel 2005-08-15 19:01:47 UTC
Yes. Everything compiles just fine.
The problem is with all of the "Fix Imports", Autocomplete and code helper
functionality exposes by the editor.

Clearly, if the compiler can see the classes, these tools should be able to see
them too.
Comment 3 Tomas Zezula 2005-08-16 08:13:11 UTC
It seems a problem of javacore, the classpath is correct the project compiles,
but for sure can you attach the project.properties and private.properties files?
Comment 4 lordpixel 2005-08-16 16:15:33 UTC
Created attachment 23953 [details]
project.properties from sample project
Comment 5 lordpixel 2005-08-16 16:16:16 UTC
Created attachment 23954 [details]
private.properties from sample project
Comment 6 Jan Becicka 2005-10-13 14:45:44 UTC
Can you reproduce it in latest 5.0 build? We cannot reproduce it.
Comment 7 lordpixel 2005-10-14 15:45:40 UTC
Confirmed. The same project migrated to 5.0 appears to work fine.

Can you reproduce it in 4.X? I think it would be better if you understood what
caused the problem, otherwise it may come back to haunt us unexpectedly.
Comment 8 lordpixel 2005-10-18 19:41:13 UTC
Scratch that last comment.
As of this afternoon, this is now severely broken on 5.0 also.

I don't know what I might have done today that caused it to stop working, but it
has... it's back to almost the same behaviour as in 4.X - can't find EasyMock or
Spring classes, but for some reason it can find log4j now.

Which leads me to suspect that somehow some index is getting corrupted...?
Comment 9 Jan Becicka 2005-11-09 14:41:22 UTC
I'm sorry I cannot reproduce it. Completion works for me with both
commons-logging-api.jar and commons-logging.jar.
There are not any classes named Spring or EasyMock.
Comment 10 lordpixel 2005-11-10 14:35:26 UTC
Right now I can't reproduce it either.
Since I upgraded to the 5.0 beta I've only seen this happen once and restarting
the IDE fixed it.

I'm actually reasonably convinced there's some kind of subtle problem buried
here, but I also don't have a reproducable case to give you. So it's hard to say
what to do next.
Comment 11 lordpixel 2005-12-09 19:06:34 UTC
Created attachment 27698 [details]
Screenshot of the problem occuring
Comment 12 lordpixel 2005-12-09 19:08:46 UTC
I'm still hitting this problem daily, and I can't figure out why.
Now it's happening with Apache commons chains, as you will see from the
screenshot.
(http://www.netbeans.org/nonav/issues/showattachment.cgi/27698/MissingItems.png)

The code in the file compiles fine - the Chains libraries are on the classpath,
but the IDE resolutely refuses to acknowledge the existance of the
org.apache.commons.chain package in code completion and FIX imports.

Is there a particular cache I could clear to see if it helps with this issue?


Comment 13 zbyszanna 2006-03-30 18:31:09 UTC
I've got the same problem with NB5.0rc2 and now with NB5.0 under Windows XP. I 
added HtmlUnit library to my project (with sources and javadocs) and IDE doesn't 
see classes (packages etc.) that belong to some jars from this library. When I 
had removed sources and javadocs, the NB started "jar scan" and now everything 
seems to be fine. If I manage to isolate this problem, I'll write again.
Comment 14 zbyszanna 2006-03-30 18:36:04 UTC
I've got the same problem with NB5.0rc2 and now with NB5.0 under Windows XP. I 
added HtmlUnit library to my project (with sources and javadocs) and IDE doesn't 
see classes (packages etc.) that belong to some jars from this library. When I 
had removed sources and javadocs, the NB started "jar scan" and now everything 
seems to be fine. If I manage to isolate this problem, I'll write again.
Comment 15 Jan Becicka 2006-10-26 16:28:16 UTC
Javacore module was replaced by Retouche infrastructure. This bug is not valid
in trunk any more.
Comment 16 Quality Engineering 2007-09-20 12:06:14 UTC
Reorganization of java component