diff options
author | Stephan Herrmann | 2017-09-13 21:43:22 +0000 |
---|---|---|
committer | Stephan Herrmann | 2017-09-14 08:39:34 +0000 |
commit | c69652f3e7caaf4e36831167fc026505ce073e86 (patch) | |
tree | ebbe3ee7f77ac4ec7b6e668f465e8d18a84d456a /org.eclipse.jdt.core.tests.compiler/src | |
parent | d555c9ba218897ec172187878b3425f137ecdfcb (diff) | |
download | eclipse.jdt.core-c69652f3e7caaf4e36831167fc026505ce073e86.tar.gz eclipse.jdt.core-c69652f3e7caaf4e36831167fc026505ce073e86.tar.xz eclipse.jdt.core-c69652f3e7caaf4e36831167fc026505ce073e86.zip |
Bug 521212: [compiler] generic type bound compilation - ecj passesY20170915-1000Y20170914-1000
Change-Id: Ib080877356b8a84d38cbed1d507185769fe2f634
Diffstat (limited to 'org.eclipse.jdt.core.tests.compiler/src')
3 files changed, 46 insertions, 11 deletions
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java index 288f391d71..2fcca7e09a 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java @@ -196,6 +196,9 @@ static class JavacCompiler { if ("1.6.0_10-beta".equals(rawVersion)) { // b24 return 1010; } + if ("1.6.0_45".equals(rawVersion)) { + return 1045; + } } if (version == JavaCore.VERSION_1_7) { if ("1.7.0-ea".equals(rawVersion)) { @@ -207,6 +210,9 @@ static class JavacCompiler { if ("1.7.0_25".equals(rawVersion)) { return 2500; } + if ("1.7.0_80".equals(rawVersion)) { + return 8000; + } } if (version == JavaCore.VERSION_1_8) { if ("1.8.0-ea".equals(rawVersion) || ("1.8.0".equals(rawVersion))) { diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java index 94b05400cf..6b1cc57c02 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java @@ -21875,6 +21875,11 @@ public void test0675() { " Store<? extends Key<T>> store1;\n" + " ^\n" + "Bound mismatch: The type T is not a valid substitute for the bounded parameter <E extends Key<E>> of the type Key<E>\n" + + "----------\n" + + "2. ERROR in X.java (at line 6)\n" + + " Store<? extends Key<? extends T>> store2;\n" + + " ^^^^^^^^^^^\n" + + "Bound mismatch: The type ? extends T is not a valid substitute for the bounded parameter <E extends Key<E>> of the type Key<E>\n" + "----------\n", // javac options JavacTestOptions.JavacHasABug.JavacBugFixed_6_10 /* javac test options */); @@ -40821,9 +40826,8 @@ public void test1166() { ""); } //https://bugs.eclipse.org/bugs/show_bug.cgi?id=179902 -// FIXME javac8 rejects public void test1167() { - this.runConformTest( + this.runNegativeTest( new String[] { "Foo.java", "public class Foo<F extends Enum<F>> {\n" + @@ -40832,7 +40836,12 @@ public void test1167() { " }\n" + "}\n", // ================= }, - ""); + "----------\n" + + "1. ERROR in Foo.java (at line 3)\n" + + " Bar(Foo<? extends B> bar) {}\n" + + " ^^^^^^^^^^^\n" + + "Bound mismatch: The type ? extends B is not a valid substitute for the bounded parameter <F extends Enum<F>> of the type Foo<F>\n" + + "----------\n"); } //https://bugs.eclipse.org/bugs/show_bug.cgi?id=169049 public void test1168() { 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 1a014e7b42..4f53f63250 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 @@ -5659,8 +5659,6 @@ public void testBug454644() { // original test case, documenting existing compiler behavior public void testBug456459a() { runNegativeTest( - false /*skipJavac */, - JavacTestOptions.Excuse.JavacHasErrorsEclipseHasWarnings, new String[] { "EnumTest.java", "import java.util.EnumSet;\n" + @@ -5682,22 +5680,25 @@ public void testBug456459a() { " ^^^^^\n" + "Class is a raw type. References to generic type Class<T> should be parameterized\n" + "----------\n" + - "2. WARNING in EnumTest.java (at line 9)\n" + + "2. ERROR in EnumTest.java (at line 9)\n" + + " EnumSet<? extends T> set = EnumSet.allOf(enumType);\n" + + " ^^^^^^^^^^^\n" + + "Bound mismatch: The type ? extends T is not a valid substitute for the bounded parameter <E extends Enum<E>> of the type EnumSet<E>\n" + + "----------\n" + + "3. WARNING in EnumTest.java (at line 9)\n" + " EnumSet<? extends T> set = EnumSet.allOf(enumType);\n" + " ^^^^^^^^^^^^^^^^^^^^^^^\n" + "Type safety: Unchecked invocation allOf(Class) of the generic method allOf(Class<E>) of type EnumSet\n" + "----------\n" + - "3. WARNING in EnumTest.java (at line 9)\n" + + "4. WARNING in EnumTest.java (at line 9)\n" + " EnumSet<? extends T> set = EnumSet.allOf(enumType);\n" + " ^^^^^^^^^^^^^^^^^^^^^^^\n" + "Type safety: The expression of type EnumSet needs unchecked conversion to conform to EnumSet<? extends T>\n" + "----------\n" + - "4. WARNING in EnumTest.java (at line 9)\n" + + "5. WARNING in EnumTest.java (at line 9)\n" + " EnumSet<? extends T> set = EnumSet.allOf(enumType);\n" + " ^^^^^^^^\n" + - (this.complianceLevel < ClassFileConstants.JDK1_8 - ? "Type safety: The expression of type Class needs unchecked conversion to conform to Class<T&Enum<T&Enum<E>>>\n" - : "Type safety: The expression of type Class needs unchecked conversion to conform to Class<Enum<Enum<E>>>\n") + + "Type safety: The expression of type Class needs unchecked conversion to conform to Class<Enum<Enum<E>>>\n" + "----------\n"); } // simple conflict introduced by additional wildcard bound @@ -6125,5 +6126,24 @@ public void testBug515614() { } ); } +public void testBug521212() { + runNegativeTest( + new String[] { + "X.java", + "class Y<U extends Z> {}\n" + + "class Z {}\n" + + "public class X<T> {\n" + + " public static <V> Y<? extends V> one() {\n" + + " return null;\n" + + " }\n" + + "}\n" + }, + "----------\n" + + "1. ERROR in X.java (at line 4)\n" + + " public static <V> Y<? extends V> one() {\n" + + " ^^^^^^^^^^^\n" + + "Bound mismatch: The type ? extends V is not a valid substitute for the bounded parameter <U extends Z> of the type Y<U>\n" + + "----------\n"); +} } |