diff options
| author | ssankaran | 2014-10-13 07:33:34 +0000 |
|---|---|---|
| committer | ssankaran | 2014-10-13 08:17:19 +0000 |
| commit | f316b069838038f8089cd2fbc2dd1992644b54d4 (patch) | |
| tree | b7de22d8ce39f8a67bd67608b1ff7463e52a6217 | |
| parent | f0d52ca0b8c8d8867b90baef0e130915b52468cb (diff) | |
| download | eclipse.jdt.core-f316b069838038f8089cd2fbc2dd1992644b54d4.tar.gz eclipse.jdt.core-f316b069838038f8089cd2fbc2dd1992644b54d4.tar.xz eclipse.jdt.core-f316b069838038f8089cd2fbc2dd1992644b54d4.zip | |
Fixed Bug 445669 - java.lang.IllegalStateException at
UnresolvedReferenceBinding.clone
2 files changed, 46 insertions, 2 deletions
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullTypeAnnotationTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullTypeAnnotationTest.java index 4452a3ddd6..6b2bf13246 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullTypeAnnotationTest.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullTypeAnnotationTest.java @@ -6821,4 +6821,48 @@ public void test446715() { "Null type mismatch: required \'Z.ZI @NonNull[]\' but the provided value is null\n" + "----------\n"); } +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=445669, java.lang.IllegalStateException at org.eclipse.jdt.internal.compiler.lookup.UnresolvedReferenceBinding.clone +public void test445669() { + Map options = getCompilerOptions(); + runConformTestWithLibs( + new String[] { + "Y.java", + "import org.eclipse.jdt.annotation.*;\n" + + "@NonNullByDefault(DefaultLocation.FIELD)\n" + + "public class Y {\n" + + " public Z.ZI zzi = new Z().new ZI();\n" + + " public Z z = new Z();\n" + + "}\n", + "Z.java", + "public class Z {\n" + + " public class ZI {\n" + + " }\n" + + "}\n" + }, + options, + ""); + runNegativeTestWithLibs( + new String[] { + "X.java", + "public class X {\n" + + " public static void main(String[] args) {\n" + + " Y y = new Y();\n" + + " y.zzi = null;\n" + + " y.z = null;\n" + + " }\n" + + "}\n" + }, + options, + "----------\n" + + "1. ERROR in X.java (at line 4)\n" + + " y.zzi = null;\n" + + " ^^^^\n" + + "Null type mismatch: required \'Z.@NonNull ZI\' but the provided value is null\n" + + "----------\n" + + "2. ERROR in X.java (at line 5)\n" + + " y.z = null;\n" + + " ^^^^\n" + + "Null type mismatch: required \'@NonNull Z\' but the provided value is null\n" + + "----------\n"); +} } diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/UnresolvedReferenceBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/UnresolvedReferenceBinding.java index 163b79939d..ce4f3d8828 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/UnresolvedReferenceBinding.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/UnresolvedReferenceBinding.java @@ -39,8 +39,8 @@ public UnresolvedReferenceBinding(UnresolvedReferenceBinding prototype) { } public TypeBinding clone(TypeBinding outerType) { - if (this.resolvedType != null || this.depth() > 0) - throw new IllegalStateException(); + if (this.resolvedType != null) + return this.resolvedType.clone(outerType); UnresolvedReferenceBinding copy = new UnresolvedReferenceBinding(this); this.addWrapper(copy, null); return copy; |
