diff options
| author | ssankaran | 2014-11-12 06:35:59 +0000 |
|---|---|---|
| committer | ssankaran | 2014-11-12 06:35:59 +0000 |
| commit | 38586fcf09747ed185b551296a6070b2be6702ab (patch) | |
| tree | d78644167263afa2b3b969cada63c8936536f3f2 | |
| parent | aea243be17e329664f276f935fa564c75f6b6985 (diff) | |
| download | eclipse.jdt.core-38586fcf09747ed185b551296a6070b2be6702ab.tar.gz eclipse.jdt.core-38586fcf09747ed185b551296a6070b2be6702ab.tar.xz eclipse.jdt.core-38586fcf09747ed185b551296a6070b2be6702ab.zip | |
Fixed Bug 445669 - java.lang.IllegalStateException atM20141119-0800M20141112-0800
org.eclipse.jdt.internal.compiler.lookup.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 5258ab4337..057cb7dbfe 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 @@ -5886,4 +5886,48 @@ public void testBug440764() { "Contradictory null annotations: method was inferred as \'int compare(@NonNull @Nullable Integer, @NonNull @Nullable Integer)\', but only one of \'@NonNull\' and \'@Nullable\' can be effective at any location\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; |
