Bug 12246 - Packages view shows .class and .java files when JAR has source
Summary: Packages view shows .class and .java files when JAR has source
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: All All
: P2 normal (vote)
Target Milestone: 2.0 M5   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-03-25 16:33 EST by Ritchie Schacher CLA
Modified: 2002-04-16 07:47 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ritchie Schacher CLA 2002-03-25 16:33:57 EST
If a JAR is on the java build path, and the JAR contains source, and the JAR 
is the source attachment for itself, the packages view displays both the .class
file and the .java file.  The user can open a .class file editor, which shows
the outline, or a .java file editor, which does not.  This is confusing.

To recreate, do the following:
1)  Create a java project with classes
2)  Export a JAR file with source
3)  Import the JAR file using the file system import
4)  Add the JAR file to the classpath of a java project; add the JAR itself as
the source attachment.
5)  Open the java perspective and view the JAR contents from the packages view.

The correct behavior, since the JAR is the source attachment, is to show only 
the .class files and filter the .java files for which the .class file exists.  
This scenario is not uncommon, since this is the format in which both eclipse 
and VAJ export JARs with source.  In fact, some tools may want to use this 
format as well for custom import/export wizards.
Comment 1 DJ Houghton CLA 2002-03-25 17:39:28 EST
Moving to JDT/UI for comment.
Comment 2 Erich Gamma CLA 2002-03-30 07:48:50 EST
packages view surfaces Java model view of JAR contents.
We should handle this case more gracefully. However, the common practice is 
bundle the classes and source separately and this is supported well. So this 
has lower priority.

Moving to JDT CORE for comment.
Comment 3 Philipe Mulet CLA 2002-04-02 02:43:04 EST
We should be filtering out JAVA entries from the JAR file opening.
The rest should just work.
Comment 4 Jerome Lanneluc CLA 2002-04-08 09:02:06 EDT
Fixed by filtering out .java files from the non-java resources in a jar.