diff options
author | Stephan Herrmann | 2014-02-16 20:54:49 +0000 |
---|---|---|
committer | ssankaran | 2014-02-16 20:54:49 +0000 |
commit | 511ebb0693daff19b87539c181be8ce8c5d1d9f3 (patch) | |
tree | 427f997231046a1ae0b5e03fac0e4cc4800247db | |
parent | 0b27309efdaba54bffa19e81e0f1e5ae6f176884 (diff) | |
download | eclipse.jdt.core-511ebb0693daff19b87539c181be8ce8c5d1d9f3.tar.gz eclipse.jdt.core-511ebb0693daff19b87539c181be8ce8c5d1d9f3.tar.xz eclipse.jdt.core-511ebb0693daff19b87539c181be8ce8c5d1d9f3.zip |
Fixed Bug 428275 - [1.8][compiler] CCE in InferenceContext18.varArgTypes P20140216-1600
2 files changed, 41 insertions, 2 deletions
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest_1_8.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest_1_8.java index 5db06fd4ee..dc61bcce27 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest_1_8.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest_1_8.java @@ -2257,4 +2257,43 @@ public void testBug428291() { "}\n" }); } +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=428275, [1.8][compiler] CCE in InferenceContext18.varArgTypes +public void testBug428275() { + runConformTest( + new String[] { + "p1/C1.java", + "package p1;\n" + + "\n" + + "import java.util.List;\n" + + "\n" + + "public class C1<T1> {\n" + + "\n" + + " public static class CInner<T2A,T2B> {\n" + + " public CInner(T2A a, T2B b) {}\n" + + " }\n" + + " \n" + + " public static class CInner2<T3A,T3B> {\n" + + " public CInner2(String n, List<CInner<T3A,T3B>> arg) {}\n" + + " }\n" + + " \n" + + " public static <E> List<E> getList1(E... items) {\n" + + " return null;\n" + + " }\n" + + "}\n", + "Test.java", + "import java.util.List;\n" + + "\n" + + "import p1.C1;\n" + + "\n" + + "public class Test {\n" + + " void test2(List<C1.CInner2> l) {\n" + + " l.add(\n" + + " new C1.CInner2<>(\"a\",\n" + + " C1.getList1(new C1.CInner<>(\"b\", 13))\n" + + " )\n" + + " );\n" + + " }\n" + + "}\n" + }); +} } diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java index 171ee74ae0..a150754962 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java @@ -715,8 +715,8 @@ public Expression[] arguments() { public boolean updateBindings(MethodBinding updatedBinding, TypeBinding targetType) { boolean hasUpdate = this.binding != updatedBinding; - if (this.inferenceContexts != null) { - InferenceContext18 ctx = (InferenceContext18)this.inferenceContexts.removeKey(this.binding); + if (this.inferenceContexts != null && this.binding.original() == updatedBinding.original()) { + InferenceContext18 ctx = (InferenceContext18)this.inferenceContexts.get(this.binding); if (ctx != null && updatedBinding instanceof ParameterizedGenericMethodBinding) { this.inferenceContexts.put(updatedBinding, ctx); // solution may have come from an outer inference, mark now that this (inner) is done (but not deep inners): |