diff options
author | Jayaprakash Arthanareeswaran | 2014-06-03 12:35:00 +0000 |
---|---|---|
committer | Markus Keller | 2014-06-03 12:35:00 +0000 |
commit | fa1b4dd537bd7a82cd2ae8dc7ab09a5696b58180 (patch) | |
tree | ba6fdc2106fd6be43ee69ea8f08637eed2ea2a34 | |
parent | e34fea35f775affe686777806e78d4b4b98ae8ab (diff) | |
download | eclipse.jdt.core-fa1b4dd537bd7a82cd2ae8dc7ab09a5696b58180.tar.gz eclipse.jdt.core-fa1b4dd537bd7a82cd2ae8dc7ab09a5696b58180.tar.xz eclipse.jdt.core-fa1b4dd537bd7a82cd2ae8dc7ab09a5696b58180.zip |
Bug 436155: [type hierarchy] No type hierarchy shown for org.eclipse.swt.widgets.Text
2 files changed, 53 insertions, 3 deletions
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/TypeHierarchyTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/TypeHierarchyTests.java index b24bf98ad6..1005721ed4 100644 --- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/TypeHierarchyTests.java +++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/TypeHierarchyTests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2013 IBM Corporation and others. + * Copyright (c) 2000, 2014 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -2703,4 +2703,50 @@ public void testBug393192() throws CoreException { if (prj != null) deleteProject(prj); } -}}
\ No newline at end of file +} +public void testBug436155() throws CoreException, IOException { + try { + IJavaProject project = createJavaProject("P", new String[] {"src"}, new String[] {"JCL_LIB"}, "bin"); + createFolder("/P/abc/p"); + addLibrary(project, "lib.jar", "libsrc.zip", new String[] { + "p/I.java", + "package p;\n" + + "public abstract class I {}", + "p/I2.java", + "package p;\n" + + "public abstract class I2 extends I {}", + "p/Text.java", + "package p;\n"+ + "public class Text extends I2 {}", + }, "1.4"); + + createFolder("/P/src/q"); + String source = "package q;\n" + + "import p.Text;\n" + + "class A {\n" + + " Text text = null;\n" + + "}\n"; + createFile("/P/src/q/A.java", source); + + int start = source.lastIndexOf("Text"); + ICompilationUnit unit = getCompilationUnit("P", "src", "q", "A.java"); + unit.becomeWorkingCopy(null); + unit.getBuffer().setContents(source); + unit.makeConsistent(null); + + IJavaElement[] elements = unit.codeSelect(start, "Text".length()); + IType focus = (IType) elements[0]; + ITypeHierarchy hierarchy = focus.newTypeHierarchy(null); + assertHierarchyEquals( + "Focus: Text [in Text.class [in p [in lib.jar [in P]]]]\n" + + "Super types:\n" + + " I2 [in I2.class [in p [in lib.jar [in P]]]]\n" + + " I [in I.class [in p [in lib.jar [in P]]]]\n" + + " Object [in Object.class [in java.lang [in "+ getExternalJCLPathString() + "]]]\n" + + "Sub types:\n", + hierarchy); + } finally { + deleteProject("P"); + } +} +}
\ No newline at end of file diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/HierarchyResolver.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/HierarchyResolver.java index 09df4a7337..4a29fa615f 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/HierarchyResolver.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/HierarchyResolver.java @@ -840,7 +840,11 @@ public void resolve(Openable[] openables, HashSet localTypes, IProgressMonitor m if (focusBinaryBinding == null && focus != null && focus.isBinary()) { char[] fullyQualifiedName = focus.getFullyQualifiedName().toCharArray(); focusBinaryBinding = this.lookupEnvironment.getCachedType(CharOperation.splitOn('.', fullyQualifiedName)); - if (focusBinaryBinding == null) + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=436155 + // When local types are requested, it's likely a type is found from cache without + // the hierarchy being resolved completely, so consider that factor too + if (focusBinaryBinding == null || + (focusBinaryBinding.tagBits & TagBits.HasUnresolvedSuperclass) != 0) return; } |