### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core.tests.model Index: src/org/eclipse/jdt/core/tests/model/TypeHierarchyTests.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/TypeHierarchyTests.java,v retrieving revision 1.54 diff -u -r1.54 TypeHierarchyTests.java --- src/org/eclipse/jdt/core/tests/model/TypeHierarchyTests.java 26 Apr 2006 12:56:29 -0000 1.54 +++ src/org/eclipse/jdt/core/tests/model/TypeHierarchyTests.java 2 May 2006 13:06:52 -0000 @@ -14,6 +14,7 @@ import java.io.IOException; import java.util.HashMap; +import org.eclipse.core.resources.IncrementalProjectBuilder; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.OperationCanceledException; import org.eclipse.core.runtime.Path; @@ -401,6 +402,34 @@ } } /* + * Ensures that the hierarchy lookup mechanism get the right binary if it is missplaced. + * (regression test for bug 139279 Fup of bug 134110, got CCE changing an external jar contents and refreshing the project) + */ +public void testBinaryInWrongPackage() throws CoreException { + try { + createJavaProject("P", new String[] {"src"}, new String[] {"JCL_LIB", "lib"}, "bin"); + createFolder("/P/src/p"); + createFile( + "/P/src/p/X.java", + "pakage p;\n" + + "public class X {\n" + + "}" + ); + getProject("P").build(IncrementalProjectBuilder.FULL_BUILD, null); + waitForAutoBuild(); + getFile("/P/bin/p/X.class").copy(new Path("/P/lib/X.class"), false, null); + ITypeHierarchy hierarchy = getClassFile("P", "/P/lib", "", "X.class").getType().newSupertypeHierarchy(null); + assertHierarchyEquals( + "Focus: X [in X.class [in [in lib [in P]]]]\n" + + "Super types:\n" + + "Sub types:\n" + + "Root classes:\n", + hierarchy); + } finally { + deleteProject("P"); + } +} +/* * Ensures that a hierarchy with a binary subclass that is also referenced can be computed * (regression test for bug 48459 NPE in Type hierarchy) */ #P org.eclipse.jdt.core Index: model/org/eclipse/jdt/internal/core/hierarchy/HierarchyBuilder.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/HierarchyBuilder.java,v retrieving revision 1.63 diff -u -r1.63 HierarchyBuilder.java --- model/org/eclipse/jdt/internal/core/hierarchy/HierarchyBuilder.java 29 Mar 2006 03:14:01 -0000 1.63 +++ model/org/eclipse/jdt/internal/core/hierarchy/HierarchyBuilder.java 2 May 2006 13:06:53 -0000 @@ -243,7 +243,7 @@ false/* do NOT wait for indexes */, false/*don't check restrictions*/, null); - return answer == null ? null : answer.type; + return answer == null || answer.type == null || !answer.type.isBinary() ? null : answer.type; } protected void worked(IProgressMonitor monitor, int work) {