Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 38408 Details for
Bug 136095
Type Hierarchy incomplete with illegally parameterized superinterfaces
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch and regression test
136095.txt (text/plain), 7.86 KB, created by
Jerome Lanneluc
on 2006-04-12 10:49:14 EDT
(
hide
)
Description:
Proposed patch and regression test
Filename:
MIME Type:
Creator:
Jerome Lanneluc
Created:
2006-04-12 10:49:14 EDT
Size:
7.86 KB
patch
obsolete
>### 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.52 >diff -u -r1.52 TypeHierarchyTests.java >--- src/org/eclipse/jdt/core/tests/model/TypeHierarchyTests.java 10 Apr 2006 18:53:50 -0000 1.52 >+++ src/org/eclipse/jdt/core/tests/model/TypeHierarchyTests.java 12 Apr 2006 14:40:34 -0000 >@@ -974,7 +974,7 @@ > /* > * Ensures that a hierarchy on a generic type can be opened > */ >-public void testGeneric1() throws JavaModelException { >+public void testGeneric01() throws JavaModelException { > IType type = getCompilationUnit("/TypeHierarchy15/src/X.java").getType("X"); > ITypeHierarchy hierarchy = type.newTypeHierarchy(null); > assertHierarchyEquals( >@@ -992,7 +992,7 @@ > /* > * Ensures that a hierarchy on a generic type can be opened > */ >-public void testGeneric2() throws JavaModelException { >+public void testGeneric02() throws JavaModelException { > IType type = getPackageFragmentRoot("/TypeHierarchy15/lib15.jar").getPackageFragment("util").getClassFile("ArrayList.class").getType(); > ITypeHierarchy hierarchy = type.newTypeHierarchy(null); > assertHierarchyEquals( >@@ -1010,7 +1010,7 @@ > /* > * Ensures that a hierarchy on a generic type can be opened > */ >-public void testGeneric3() throws JavaModelException { >+public void testGeneric03() throws JavaModelException { > IType type = getCompilationUnit("/TypeHierarchy15/src/Y.java").getType("Y"); > ITypeHierarchy hierarchy = type.newTypeHierarchy(null); > assertHierarchyEquals( >@@ -1029,7 +1029,7 @@ > * Ensures that a super type hierarchy on a generic type can be opened > * (regression test for bug 72348 [1.5][Type Hierarchy] Super type hierarchy of class extending generic type is empty) > */ >-public void testGeneric4() throws JavaModelException { >+public void testGeneric04() throws JavaModelException { > IType type = getCompilationUnit("/TypeHierarchy15/src/X.java").getType("X"); > ITypeHierarchy hierarchy = type.newSupertypeHierarchy(null); > assertHierarchyEquals( >@@ -1049,7 +1049,7 @@ > * Ensures that a hierarchy on a generic interface can be opened > * (regression test for bug 82004 [model][5.0] 3.1M4 type hierarchy for generic interface) > */ >-public void testGeneric5() throws JavaModelException { >+public void testGeneric05() throws JavaModelException { > IType type = getCompilationUnit("/TypeHierarchy15/src/I.java").getType("I"); > ITypeHierarchy hierarchy = type.newTypeHierarchy(null); > assertHierarchyEquals( >@@ -1064,7 +1064,7 @@ > * Ensure that the key of a binary type in a hierarchy is correct when this type is not part of the Java model cache. > * (regression test for bug 93854 IAE in Util.scanTypeSignature when scanning a signature retrieved from a binding key) > */ >-public void testGeneric6() throws CoreException { >+public void testGeneric06() throws CoreException { > getJavaProject("TypeHierarcht15").close(); > IType type = getClassFile("TypeHierarchy15","lib15.jar", "util", "AbstractList.class").getType(); > ITypeHierarchy hierarchy = type.newTypeHierarchy(null); >@@ -1075,7 +1075,7 @@ > * Ensures that a hierarchy on a generic type that is extended using a member as a type parameter can be opened > * (regression test for bug 99606 Subtype not found if parameterized on inner class) > */ >-public void testGeneric7() throws JavaModelException { >+public void testGeneric07() throws JavaModelException { > IType type = getCompilationUnit("/TypeHierarchy15/src/Y99606.java").getType("Y99606"); > ITypeHierarchy hierarchy = type.newTypeHierarchy(null); > assertHierarchyEquals( >@@ -1088,7 +1088,7 @@ > ); > } > // https://bugs.eclipse.org/bugs/show_bug.cgi?id=108740 >-public void testGeneric8() throws JavaModelException { >+public void testGeneric08() throws JavaModelException { > IType type = getCompilationUnit("/TypeHierarchy15/src/D108740.java").getType("D108740"); > ITypeHierarchy hierarchy = type.newTypeHierarchy(null); > assertHierarchyEquals( >@@ -1101,6 +1101,45 @@ > hierarchy > ); > } >+/* >+ * Ensures that a hierarchy is where a type inherits conflicting paratemerized types is still correctly reported >+ * (regression test for bug 136095 Type Hierarchy incomplete with illegally parameterized superinterfaces) >+ */ >+public void testGeneric09() throws CoreException { >+ try { >+ createFile( >+ "/TypeHierarchy15/src/I1_136095.java", >+ "public interface I1_136095<E> {\n" + >+ "}" >+ ); >+ createFile( >+ "/TypeHierarchy15/src/I2_136095.java", >+ "public interface I2_136095 extends I1_136095<String>{\n" + >+ "}" >+ ); >+ createFile( >+ "/TypeHierarchy15/src/X_136095.java", >+ "public abstract class X_136095 implements I1_136095<Integer>, I2_136095 {\n" + >+ "}" >+ ); >+ IType type = getCompilationUnit("/TypeHierarchy15/src/X_136095.java").getType("X_136095"); >+ ITypeHierarchy hierarchy = type.newTypeHierarchy(null); >+ assertHierarchyEquals( >+ "Focus: X_136095 [in X_136095.java [in <default> [in src [in TypeHierarchy15]]]]\n" + >+ "Super types:\n" + >+ " I1_136095 [in I1_136095.java [in <default> [in src [in TypeHierarchy15]]]]\n" + >+ " I2_136095 [in I2_136095.java [in <default> [in src [in TypeHierarchy15]]]]\n" + >+ " I1_136095 [in I1_136095.java [in <default> [in src [in TypeHierarchy15]]]]\n" + >+ " Object [in Object.class [in java.lang [in "+ getExternalJCLPathString("1.5") + " [in TypeHierarchy15]]]]\n" + >+ "Sub types:\n", >+ hierarchy >+ ); >+ } finally { >+ deleteFile("/TypeHierarchy15/src/I1_136095.java"); >+ deleteFile("/TypeHierarchy15/src/I2_136095.java"); >+ deleteFile("/TypeHierarchy15/src/X_136095.java"); >+ } >+} > /** > * Ensures the correctness of all classes in a type hierarchy based on a region. > */ >#P org.eclipse.jdt.core >Index: model/org/eclipse/jdt/internal/core/hierarchy/HierarchyResolver.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/HierarchyResolver.java,v >retrieving revision 1.64 >diff -u -r1.64 HierarchyResolver.java >--- model/org/eclipse/jdt/internal/core/hierarchy/HierarchyResolver.java 29 Mar 2006 03:14:01 -0000 1.64 >+++ model/org/eclipse/jdt/internal/core/hierarchy/HierarchyResolver.java 12 Apr 2006 14:40:36 -0000 >@@ -233,6 +233,27 @@ > } > > ReferenceBinding[] interfaceBindings = typeBinding.superInterfaces(); >+ ClassScope scope; >+ if (typeBinding instanceof SourceTypeBinding && (scope = ((SourceTypeBinding) typeBinding).scope) != null) { >+ TypeDeclaration typeDeclaration = scope.referenceContext; >+ TypeReference[] superInterfaces = typeDeclaration == null ? null : typeDeclaration.superInterfaces; >+ int length; >+ if (superInterfaces != null && (length = superInterfaces.length) > interfaceBindings.length) { >+ // bindings were removed while resolving (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=136095) >+ interfaceBindings = new ReferenceBinding[length]; >+ int index = 0; >+ for (int i = 0; i < length; i++) { >+ ReferenceBinding superInterface = (ReferenceBinding) superInterfaces[i].resolvedType; >+ if (superInterface instanceof ProblemReferenceBinding) >+ superInterface = ((ProblemReferenceBinding) superInterface).closestMatch; >+ if (superInterface != null) >+ interfaceBindings[index++] = superInterface; >+ } >+ if (index < length) >+ System.arraycopy(interfaceBindings, 0, interfaceBindings = new ReferenceBinding[index], 0 , index); >+ ((SourceTypeBinding) typeBinding).superInterfaces = interfaceBindings; >+ } >+ } > int bindingIndex = 0; > int bindingLength = interfaceBindings == null ? 0 : interfaceBindings.length; > int length = superInterfaceNames == null ? 0 : superInterfaceNames.length;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 136095
:
38408
|
39518