diff options
author | Stephan Herrmann | 2016-12-04 12:20:28 +0000 |
---|---|---|
committer | Stephan Herrmann | 2016-12-04 12:20:28 +0000 |
commit | f3cd540781cc84c52048533cc584930aca13e560 (patch) | |
tree | 4fa95f8f10049c28ef1a81f670ff7ff97d9a6fd8 | |
parent | 157306d7120e2ce37d7d11294fab7c1a538877d6 (diff) | |
download | org.eclipse.objectteams-f3cd540781cc84c52048533cc584930aca13e560.tar.gz org.eclipse.objectteams-f3cd540781cc84c52048533cc584930aca13e560.tar.xz org.eclipse.objectteams-f3cd540781cc84c52048533cc584930aca13e560.zip |
update jdt.core to M20161124-1400 for 4.6.2RC4 (=RC3)
2 files changed, 57 insertions, 8 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 be3330ba6..f632841a2 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 @@ -7031,4 +7031,45 @@ public void testBug499725() { "}\n" }); } +public void testBug502350() { + runNegativeTest( + new String[] { + "makeCompilerFreeze/EclipseJava8Bug.java", + "package makeCompilerFreeze;\n" + + "\n" + + "interface Comparable<E> {} \n" + + "\n" + + "interface Comparator<A> {\n" + + " public static <B extends Comparable<B>> Comparator<B> naturalOrder() {\n" + + " return null;\n" + + " }\n" + + "}\n" + + "\n" + + "\n" + + "class Stuff {\n" + + " public static <T, S extends T> Object func(Comparator<T> comparator) {\n" + + " return null;\n" + + " }\n" + + "}\n" + + "\n" + + "public class EclipseJava8Bug {\n" + + " static final Object BORKED =\n" + + " Stuff.func(Comparator.naturalOrder());\n" + + "}\n" + + "\n" + + "", + }, + "----------\n" + + "1. ERROR in makeCompilerFreeze\\EclipseJava8Bug.java (at line 20)\n" + + " Stuff.func(Comparator.naturalOrder());\n" + + " ^^^^\n" + + "The method func(Comparator<T>) in the type Stuff is not applicable for the arguments (Comparator<Comparable<Comparable<B>>>)\n" + + "----------\n" + + "2. ERROR in makeCompilerFreeze\\EclipseJava8Bug.java (at line 20)\n" + + " Stuff.func(Comparator.naturalOrder());\n" + + " ^^^^^^^^^^^^^^^^^^^^^^^^^\n" + + "Type mismatch: cannot convert from Comparator<Comparable<Comparable<B>>> to Comparator<T>\n" + + "----------\n" + ); +} } diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BoundSet.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BoundSet.java index a00415836..b8ebe8398 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BoundSet.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BoundSet.java @@ -849,19 +849,27 @@ class BoundSet { // α = S and T <: α imply ⟨T <: S⟩ InferenceVariable alpha = boundS.left; TypeBinding s = boundS.right; - if (TypeBinding.equalsEquals(alpha,boundT.left)) - return ConstraintTypeFormula.create(s, boundT.right, boundT.relation, boundT.isSoft||boundS.isSoft); - if (TypeBinding.equalsEquals(alpha, boundT.right)) - return ConstraintTypeFormula.create(boundT.right, s, boundT.relation, boundT.isSoft||boundS.isSoft); + if (TypeBinding.equalsEquals(alpha, boundT.left)) { + TypeBinding t = boundT.right; + return ConstraintTypeFormula.create(s, t, boundT.relation, boundT.isSoft||boundS.isSoft); + } + if (TypeBinding.equalsEquals(alpha, boundT.right)) { + TypeBinding t = boundT.left; + return ConstraintTypeFormula.create(t, s, boundT.relation, boundT.isSoft||boundS.isSoft); + } if (boundS.right instanceof InferenceVariable) { // reverse: alpha = (InferenceVariable) boundS.right; s = boundS.left; - if (TypeBinding.equalsEquals(alpha, boundT.left)) - return ConstraintTypeFormula.create(s, boundT.right, boundT.relation, boundT.isSoft||boundS.isSoft); - if (TypeBinding.equalsEquals(alpha, boundT.right)) - return ConstraintTypeFormula.create(boundT.right, s, boundT.relation, boundT.isSoft||boundS.isSoft); + if (TypeBinding.equalsEquals(alpha, boundT.left)) { + TypeBinding t = boundT.right; + return ConstraintTypeFormula.create(s, t, boundT.relation, boundT.isSoft||boundS.isSoft); + } + if (TypeBinding.equalsEquals(alpha, boundT.right)) { + TypeBinding t = boundT.left; + return ConstraintTypeFormula.create(t, s, boundT.relation, boundT.isSoft||boundS.isSoft); + } } // α = U and S <: T imply ⟨S[α:=U] <: T[α:=U]⟩ |