Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorshankha banerjee2014-08-21 07:18:09 +0000
committerJayaprakash Arthanareeswaran2014-10-31 08:38:37 +0000
commit285958546e91d3ef171805501e57328918b69492 (patch)
treeeede46827f3a14caab48b7add0765e1bfed74127
parent9596ae6738dc97993d5238f6f65e0ecaeb634ef7 (diff)
downloadeclipse.jdt.core-285958546e91d3ef171805501e57328918b69492.tar.gz
eclipse.jdt.core-285958546e91d3ef171805501e57328918b69492.tar.xz
eclipse.jdt.core-285958546e91d3ef171805501e57328918b69492.zip
Fixed Bug 422832 - Class file triggers StackOverflowError when creating
type hierarchy Signed-off-by: shankha banerjee <shankhba@in.ibm.com>
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest.java22
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java7
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java5
3 files changed, 34 insertions, 0 deletions
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest.java
index cb3c6f054b..b49cea0f70 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest.java
@@ -32,6 +32,7 @@
*******************************************************************************/
package org.eclipse.jdt.core.tests.compiler.regression;
+import java.io.File;
import java.util.Map;
import junit.framework.Test;
@@ -5416,5 +5417,26 @@ public void test416480() {
},
"CCE");
}
+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=422832, Class file triggers StackOverflowError when creating type hierarchy
+public void testBug422832() {
+ String path = getCompilerTestsPluginDirectoryPath() + File.separator + "workspace" + File.separator +
+ "Bug422832ClassFile" + File.separator + "aspose.pdf.jar";
+ String[] libs = getDefaultClassPaths();
+ int len = libs.length;
+ System.arraycopy(libs, 0, libs = new String[len+1], 0, len);
+ libs[len] = path;
+ runNegativeTest(
+ new String[] {
+ "ExampleClass.java",
+ "public class ExampleClass extends aspose.b.a.a {}\n",
+ },
+ "----------\n" +
+ "1. ERROR in ExampleClass.java (at line 1)\n" +
+ " public class ExampleClass extends aspose.b.a.a {}\n" +
+ " ^^^^^^^^^^^^\n" +
+ "The hierarchy of the type ExampleClass is inconsistent\n" +
+ "----------\n",
+ libs, false);
+}
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java
index bfe7fcb74d..049d248528 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java
@@ -1802,6 +1802,13 @@ public ReferenceBinding[] superInterfaces() {
this.environment.mayTolerateMissingType = true; // https://bugs.eclipse.org/bugs/show_bug.cgi?id=360164
try {
this.superInterfaces[i].superclass();
+ if (this.superInterfaces[i].isParameterizedType()) {
+ ReferenceBinding superType = this.superInterfaces[i].actualType();
+ if (TypeBinding.equalsEquals(superType, this)) {
+ this.tagBits |= TagBits.HierarchyHasProblems;
+ continue;
+ }
+ }
this.superInterfaces[i].superInterfaces();
} finally {
this.environment.mayTolerateMissingType = wasToleratingMissingTypeProcessingAnnotations;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java
index 7f7a17c5d5..1aae733852 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java
@@ -1203,6 +1203,11 @@ public class ClassScope extends Scope {
// force its superclass & superinterfaces to be found... 2 possibilities exist - the source type is included in the hierarchy of:
// - a binary type... this case MUST be caught & reported here
// - another source type... this case is reported against the other source type
+ if ((superType.tagBits & TagBits.HierarchyHasProblems) != 0) {
+ sourceType.tagBits |= TagBits.HierarchyHasProblems;
+ problemReporter().hierarchyHasProblems(sourceType);
+ return true;
+ }
boolean hasCycle = false;
ReferenceBinding parentType = superType.superclass();
if (parentType != null) {

Back to the top