Bug 139279 - Fup of bug 134110, got CCE changing an external jar contents and refreshing the project
Summary: Fup of bug 134110, got CCE changing an external jar contents and refreshing t...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.2 RC3   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-04-28 15:10 EDT by Olivier Thomann CLA
Modified: 2006-05-04 07:57 EDT (History)
1 user (show)

See Also:


Attachments
Library with the structure A/jkohen/B.class (1.06 KB, application/octet-stream)
2006-04-30 15:20 EDT, Olivier Thomann CLA
no flags Details
Proposed patch and regression test (2.94 KB, patch)
2006-05-02 09:08 EDT, Jerome Lanneluc CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Olivier Thomann CLA 2006-04-28 15:10:36 EDT
Using 20060427-1600, I got this exception.

1) New Java Project "A" with default settings
New Java Class "B" in package jkohen.
Add method "void m1()" to class B.
Export Project A to "lib.jar" JAR File with default settings.

When I exported the lib.jar contained a structure like:
A/jkohen/B.class

2) New Java Project "B" with default settings
Add lib.jar to Project B's Build Path (as an external jar).
New Java Class "C" in package jkohen.impl extending class B.

Got an error saying that the import jkohen.B cannot be resolved. This is when I found out that the structure in lib.jar was wrong.

3) I went to the file system. Zipped jkohen.B.class myself inside lib.jar and refreshed the project B. Then I got this error.

java.lang.ClassCastException: org.eclipse.jdt.internal.core.CompilationUnit
	at org.eclipse.jdt.internal.core.hierarchy.HierarchyBuilder.getHandle(HierarchyBuilder.java:202)
	at org.eclipse.jdt.internal.core.hierarchy.HierarchyResolver.reportHierarchy(HierarchyResolver.java:464)
	at org.eclipse.jdt.internal.core.hierarchy.HierarchyResolver.resolve(HierarchyResolver.java:509)
	at org.eclipse.jdt.internal.core.hierarchy.HierarchyBuilder.buildSupertypes(HierarchyBuilder.java:113)
	at org.eclipse.jdt.internal.core.hierarchy.IndexBasedHierarchyBuilder.build(IndexBasedHierarchyBuilder.java:133)
	at org.eclipse.jdt.internal.core.hierarchy.TypeHierarchy.compute(TypeHierarchy.java:300)
	at org.eclipse.jdt.internal.core.hierarchy.TypeHierarchy.refresh(TypeHierarchy.java:1235)
	at org.eclipse.jdt.internal.core.CreateTypeHierarchyOperation.executeOperation(CreateTypeHierarchyOperation.java:90)
	at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:720)
	at org.eclipse.jdt.internal.core.JavaModelOperation.runOperation(JavaModelOperation.java:779)
	at org.eclipse.jdt.internal.core.BinaryType.newSupertypeHierarchy(BinaryType.java:816)
	at org.eclipse.jdt.internal.core.BinaryType.newSupertypeHierarchy(BinaryType.java:768)
	at org.eclipse.jdt.internal.corext.util.SuperTypeHierarchyCache.getTypeHierarchy(SuperTypeHierarchyCache.java:120)
	at org.eclipse.jdt.internal.corext.util.SuperTypeHierarchyCache.getTypeHierarchy(SuperTypeHierarchyCache.java:80)
	at org.eclipse.jdt.internal.corext.util.SuperTypeHierarchyCache.getMethodOverrideTester(SuperTypeHierarchyCache.java:89)
	at org.eclipse.jdt.ui.OverrideIndicatorLabelDecorator.getOverrideIndicators(OverrideIndicatorLabelDecorator.java:162)
	at org.eclipse.jdt.ui.OverrideIndicatorLabelDecorator.computeAdornmentFlags(OverrideIndicatorLabelDecorator.java:129)
	at org.eclipse.jdt.ui.OverrideIndicatorLabelDecorator.decorate(OverrideIndicatorLabelDecorator.java:261)
	at org.eclipse.ui.internal.decorators.LightweightDecoratorDefinition.decorate(LightweightDecoratorDefinition.java:259)
	at org.eclipse.ui.internal.decorators.LightweightDecoratorManager$LightweightRunnable.run(LightweightDecoratorManager.java:71)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
	at org.eclipse.core.runtime.Platform.run(Platform.java:843)
	at org.eclipse.ui.internal.decorators.LightweightDecoratorManager.decorate(LightweightDecoratorManager.java:336)
	at org.eclipse.ui.internal.decorators.LightweightDecoratorManager.getDecorations(LightweightDecoratorManager.java:322)
	at org.eclipse.ui.internal.decorators.DecorationScheduler$1.ensureResultCached(DecorationScheduler.java:338)
	at org.eclipse.ui.internal.decorators.DecorationScheduler$1.run(DecorationScheduler.java:308)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)
Comment 1 Olivier Thomann CLA 2006-04-28 15:45:09 EDT
Forgot to mention that the lib.jar contains the source and the binary for jkohen.B.
Comment 2 Jerome Lanneluc CLA 2006-04-29 10:23:45 EDT
I'm not sure how to make the JAR export have a structure like A/jkohen/B.class.
When I export with default setting, the structure is jkohen/B.class.
Comment 3 Olivier Thomann CLA 2006-04-30 15:20:16 EDT
Created attachment 39907 [details]
Library with the structure A/jkohen/B.class
Comment 4 Jerome Lanneluc CLA 2006-05-01 06:51:18 EDT
Sorry I still cannot reproduce. Starting with a fresh workspace, and following your steps, I don't get the CCE.

Can you reproduce ? If you can, do you have more details ?
Comment 5 Olivier Thomann CLA 2006-05-01 09:38:36 EDT
Could not reproduce today. I got it twice on Friday.
Could it be possible that the source file (B.java) inside the lib.jar is returned instead of the binary file (B.class)? The library lib.jar contains both B.java and B.class.
Comment 6 Jerome Lanneluc CLA 2006-05-02 09:06:31 EDT
To reproduce A must be a prereq of B.

Exact steps are:
1. Unzip lib,jar from comment 3 in workspace dir
2. New Java Project "A" (it uses the sources that were just unzipped)
3. New Java Project "B" with project "A" and "lib.jar" on the classpath
4. Drill down to "B.class" in lib.jar an open it
Observe: You get the reported ClassCastException in the .log file
Comment 7 Jerome Lanneluc CLA 2006-05-02 09:08:28 EDT
Created attachment 40027 [details]
Proposed patch and regression test
Comment 8 Philipe Mulet CLA 2006-05-02 10:15:14 EDT
+1 for 3.2RC3

Markus - pls cast your vote
Comment 9 Markus Keller CLA 2006-05-02 10:46:34 EDT
+1 for 3.2 RC3
Comment 10 Jerome Lanneluc CLA 2006-05-02 11:07:45 EDT
Released patch and regression test
Comment 11 Olivier Thomann CLA 2006-05-03 11:07:25 EDT
Verified using N20060503-0010 for 3.2RC3
Comment 12 Frederic Fusier CLA 2006-05-04 07:57:06 EDT
Double-checked using build N20060504-0010