Community
Participate
Working Groups
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)
Forgot to mention that the lib.jar contains the source and the binary for jkohen.B.
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.
Created attachment 39907 [details] Library with the structure A/jkohen/B.class
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 ?
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.
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
Created attachment 40027 [details] Proposed patch and regression test
+1 for 3.2RC3 Markus - pls cast your vote
+1 for 3.2 RC3
Released patch and regression test
Verified using N20060503-0010 for 3.2RC3
Double-checked using build N20060504-0010