Community
Participate
Working Groups
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.
Moving to JDT/UI for comment.
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.
We should be filtering out JAVA entries from the JAR file opening. The rest should just work.
Fixed by filtering out .java files from the non-java resources in a jar.