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 83443 Details for
Bug 210070
Type hierarchy unpredictable
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Improved fix and new test (from comment 6)
210070.txt (text/plain), 6.09 KB, created by
Jerome Lanneluc
on 2007-11-21 11:43:30 EST
(
hide
)
Description:
Improved fix and new test (from comment 6)
Filename:
MIME Type:
Creator:
Jerome Lanneluc
Created:
2007-11-21 11:43:30 EST
Size:
6.09 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.74 >diff -u -r1.74 TypeHierarchyTests.java >--- src/org/eclipse/jdt/core/tests/model/TypeHierarchyTests.java 15 Nov 2007 15:29:20 -0000 1.74 >+++ src/org/eclipse/jdt/core/tests/model/TypeHierarchyTests.java 21 Nov 2007 16:41:29 -0000 >@@ -333,7 +333,39 @@ > " <anonymous #1> [in foo(X) [in Y [in X.java [in q7 [in src [in TypeHierarchy]]]]]]\n", > hierarchy); > } >-/** >+/* >+ * Ensure that hierarchy contains an anonymous type as a subclass of the focus type, >+ * if the anonymous type is created with a message send to a third type as an argument to >+ * the constructor. >+ * (regression test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=210070) >+ */ >+public void testAnonymousType11() throws CoreException { >+ IType type = getCompilationUnit("TypeHierarchy/src/q8/Y210070.java").getType("Y210070"); >+ ITypeHierarchy hierarchy = type.newTypeHierarchy(null); >+ assertHierarchyEquals( >+ "Focus: Y210070 [in Y210070.java [in q8 [in src [in TypeHierarchy]]]]\n" + >+ "Super types:\n" + >+ " Object [in Object.class [in java.lang [in "+ getExternalJCLPathString() + "]]]\n" + >+ "Sub types:\n" + >+ " <anonymous #1> [in foo(X210070) [in Z210070 [in Z210070.java [in q8 [in src [in TypeHierarchy]]]]]]\n", >+ hierarchy); >+} >+/* >+ * Ensure that hierarchy contains an anonymous type as a subclass of the focus type, >+ * if the anonymous type is created with a problem in its constructor call. >+ * (regression test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=210070) >+ */ >+public void testAnonymousType12() throws CoreException { >+ IType type = getCompilationUnit("TypeHierarchy/src/q8/A210070.java").getType("A210070"); >+ ITypeHierarchy hierarchy = type.newTypeHierarchy(null); >+ assertHierarchyEquals( >+ "Focus: A210070 [in A210070.java [in q8 [in src [in TypeHierarchy]]]]\n" + >+ "Super types:\n" + >+ " Object [in Object.class [in java.lang [in "+ getExternalJCLPathString() + "]]]\n" + >+ "Sub types:\n" + >+ " <anonymous #1> [in foo() [in A210070 [in A210070.java [in q8 [in src [in TypeHierarchy]]]]]]\n", >+ hierarchy); >+}/** > * Ensures that the superclass can be retrieved for a binary inner type. > */ > public void testBinaryInnerTypeGetSuperclass() throws JavaModelException { >Index: workspace/TypeHierarchy/src/q8/Y210070.java >=================================================================== >RCS file: workspace/TypeHierarchy/src/q8/Y210070.java >diff -N workspace/TypeHierarchy/src/q8/Y210070.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/TypeHierarchy/src/q8/Y210070.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,3 @@ >+package q8; >+public class Y210070 { >+} >Index: workspace/TypeHierarchy/src/q8/X210070.java >=================================================================== >RCS file: workspace/TypeHierarchy/src/q8/X210070.java >diff -N workspace/TypeHierarchy/src/q8/X210070.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/TypeHierarchy/src/q8/X210070.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,6 @@ >+package q8; >+public class X210070 { >+ public String foo() { >+ return "abc"; >+ } >+} >Index: workspace/TypeHierarchy/src/q8/A210070.java >=================================================================== >RCS file: workspace/TypeHierarchy/src/q8/A210070.java >diff -N workspace/TypeHierarchy/src/q8/A210070.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/TypeHierarchy/src/q8/A210070.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,9 @@ >+package q8; >+public final class A210070 { >+ A210070(int i) { >+ } >+ void foo() { >+ new A210070(12) { >+ }; >+ } >+} >Index: workspace/TypeHierarchy/src/q8/Z210070.java >=================================================================== >RCS file: workspace/TypeHierarchy/src/q8/Z210070.java >diff -N workspace/TypeHierarchy/src/q8/Z210070.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/TypeHierarchy/src/q8/Z210070.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,7 @@ >+package q8; >+public class Z210070 { >+ void foo(X210070 x) { >+ new Y210070(x.foo()) { >+ }; >+ } >+} >#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.75 >diff -u -r1.75 HierarchyResolver.java >--- model/org/eclipse/jdt/internal/core/hierarchy/HierarchyResolver.java 15 Nov 2007 15:29:16 -0000 1.75 >+++ model/org/eclipse/jdt/internal/core/hierarchy/HierarchyResolver.java 21 Nov 2007 16:41:30 -0000 >@@ -291,12 +291,26 @@ > System.arraycopy(superinterfaces, 0, superinterfaces = new IType[index], 0, index); > return superinterfaces; > } >+/* >+ * For all type bindings that have hierarchy problems, artificially fix their superclass/superInterfaces so that the connection >+ * can be made. >+ */ > private void fixSupertypeBindings() { > for (int current = this.typeIndex; current >= 0; current--) { > ReferenceBinding typeBinding = this.typeBindings[current]; >+ if ((typeBinding.tagBits & TagBits.HierarchyHasProblems) == 0) >+ continue; > >- > if (typeBinding instanceof SourceTypeBinding) { >+ if (typeBinding instanceof LocalTypeBinding) { >+ LocalTypeBinding localTypeBinding = (LocalTypeBinding) typeBinding; >+ QualifiedAllocationExpression allocationExpression = localTypeBinding.scope.referenceContext.allocation; >+ TypeReference type; >+ if (allocationExpression != null && (type = allocationExpression.type) != null && type.resolvedType != null) { >+ localTypeBinding.superclass = (ReferenceBinding) type.resolvedType; >+ continue; >+ } >+ } > ClassScope scope = ((SourceTypeBinding) typeBinding).scope; > if (scope != null) { > TypeDeclaration typeDeclaration = scope.referenceContext;
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 210070
:
83049
|
83246
|
83323
|
83421
| 83443