Bug 142530

Summary: [hierarchical packages] '.' in folder names confuses package explorer
Product: [Eclipse Project] JDT Reporter: Misko Hevery <misko>
Component: CoreAssignee: Jerome Lanneluc <jerome_lanneluc>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: daniel_megert, martinae
Version: 3.2   
Target Milestone: 3.3 M1   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Example of a JAR file which produces the bug none

Description Misko Hevery CLA 2006-05-18 12:24:59 EDT
Attach the JAR with this bug in your Eclipse Java project (add it to your classpath)

When Package Explorer is in Flat presentation mode you can see the contents of the JAR file.

Now switch the Package Explorer to hierarchical and notice that the contents of the JAR file disapears.
Comment 1 Misko Hevery CLA 2006-05-18 12:26:21 EDT
Created attachment 41903 [details]
Example of a JAR file which produces the bug
Comment 2 Olivier Thomann CLA 2006-05-18 12:58:09 EDT
Move to JDT/UI
Comment 3 Martin Aeschlimann CLA 2006-06-23 13:12:15 EDT
This is a very tricky...
The JAR contains a folder with dots in the name. The Java model returns that folder as a package.
The hierarchical content provider makes the assumption that when it gets a package 'a.b.c', it will also get the package 'a' and 'a.b'
This isn't the case here as there are no such folder.
I didn't find a way to detect this: In a JAR I can't get any information about the underlying resources / jar entries.
I think the Java model is wrong to return this as a package at all. Shouln't this be returned as a folder? Packages aren't allowed to contain '.' in the name.

Moving to jdt.core for comments.
Comment 4 Jerome Lanneluc CLA 2006-06-26 10:19:49 EDT
Changed JarPackageFragmentRoot#computeChildren(...) to add zip entries that have not a valid package name as non-Java resources instead of package fragments.

Updated tests in JavaProjectTests to reflect this change.

Released for 3.3 M1 in HEAD.
Comment 5 Jerome Lanneluc CLA 2006-06-26 10:29:00 EDT
Note that the is still a rendering problem of non-Java directories in .jar files. I entered bug 148657 to capture this.
Comment 6 Jerome Lanneluc CLA 2006-06-26 13:12:58 EDT
Added regression test JavaProjectTests#testPackageFragmentNonJavaResources6() for this very bug.
Comment 7 Frederic Fusier CLA 2006-08-07 06:27:02 EDT
Verified for 3.3 M1 using build I20060807-0010.
Comment 8 Dani Megert CLA 2006-08-08 05:22:11 EDT
NOTE: this is not yet fully fixed, see bug 148944.