Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 196508 Details for
Bug 242159
[1.7][compiler] type inference with unbounded wildcard in result type
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch under consideration.
patch.txt (text/plain), 26.61 KB, created by
Srikanth Sankaran
on 2011-05-25 01:59:48 EDT
(
hide
)
Description:
Patch under consideration.
Filename:
MIME Type:
Creator:
Srikanth Sankaran
Created:
2011-05-25 01:59:48 EDT
Size:
26.61 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedGenericMethodBinding.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedGenericMethodBinding.java,v >retrieving revision 1.70 >diff -u -r1.70 ParameterizedGenericMethodBinding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedGenericMethodBinding.java 14 Jan 2011 17:02:24 -0000 1.70 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedGenericMethodBinding.java 25 May 2011 05:55:54 -0000 >@@ -5,11 +5,18 @@ > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * >+ * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > *******************************************************************************/ > package org.eclipse.jdt.internal.compiler.lookup; > >+import org.eclipse.jdt.internal.compiler.ast.Wildcard; >+ > /** > * Binding denoting a generic method after type parameter substitutions got performed. > * On parameterized type bindings, all methods got substituted, regardless whether >@@ -32,6 +39,7 @@ > ParameterizedGenericMethodBinding methodSubstitute; > TypeVariableBinding[] typeVariables = originalMethod.typeVariables; > TypeBinding[] substitutes = invocationSite.genericTypeArguments(); >+ final TypeBinding [] savedSubstitutes; // for the under constrained case. > TypeBinding[] uncheckedArguments = null; > computeSubstitutes: { > if (substitutes != null) { >@@ -41,6 +49,7 @@ > return new ProblemMethodBinding(originalMethod, originalMethod.selector, substitutes, ProblemReasons.TypeParameterArityMismatch); > } > methodSubstitute = scope.environment().createParameterizedGenericMethod(originalMethod, substitutes); >+ savedSubstitutes = null; > break computeSubstitutes; > } > // perform type argument inference (15.12.2.7) >@@ -71,15 +80,44 @@ > methodSubstitute = methodSubstitute.inferFromExpectedType(scope, inferenceContext); > if (methodSubstitute == null) > return null; >+ savedSubstitutes = inferenceContext.substitutes; >+ } else { >+ savedSubstitutes = null; > } > } > >- // bounds check >+ /* bounds check: https://bugs.eclipse.org/bugs/show_bug.cgi?id=242159, Inferred types may contain self reference >+ in formal bounds. If "T extends I<T>" is a original type variable and T was inferred to be I<T> due possibly >+ to under constraints and resultant glb application per 15.12.2.8, using this.typeArguments to drive the bounds >+ check against itself is doomed to fail. For, the variable T would after substitution be I<I<T>> and would fail >+ bounds check against I<T>. Use the inferred types from the context directly - see that there is one round of >+ extra substitution that has taken place to properly substitute a remaining unresolved variable which also appears >+ in a formal bound (So we really a bounds mismatch between I<I<T>> and I<I<I<T>>>, in the absence of this fix.) >+ */ >+ final ParameterizedGenericMethodBinding substituteMethod = methodSubstitute; >+ Substitution substitution = savedSubstitutes == null ? null : new Substitution() { >+ >+ public TypeBinding substitute(TypeVariableBinding originalVariable) { >+ TypeVariableBinding[] variables = substituteMethod.originalMethod.typeVariables; >+ int length = variables.length; >+ // check this variable can be substituted given parameterized type >+ if (originalVariable.rank < length && variables[originalVariable.rank] == originalVariable) { >+ return savedSubstitutes[originalVariable.rank]; >+ } >+ return originalVariable; >+ } >+ public boolean isRawSubstitution() { >+ return substituteMethod.isRawSubstitution(); >+ } >+ public LookupEnvironment environment() { >+ return substituteMethod.environment(); >+ } >+ }; > for (int i = 0, length = typeVariables.length; i < length; i++) { > TypeVariableBinding typeVariable = typeVariables[i]; > TypeBinding substitute = methodSubstitute.typeArguments[i]; > if (uncheckedArguments != null && uncheckedArguments[i] == null) continue; // only bound check if inferred through 15.12.2.6 >- switch (typeVariable.boundCheck(methodSubstitute, substitute)) { >+ switch (typeVariable.boundCheck(substitution != null ? substitution : methodSubstitute, substitute)) { > case TypeConstants.MISMATCH : > // incompatible due to bound check > int argLength = arguments.length; >@@ -233,12 +271,21 @@ > if (bounds == null) continue nextTypeParameter; > TypeBinding[] glb = Scope.greaterLowerBound(bounds); > TypeBinding mostSpecificSubstitute = null; >- if (glb != null) mostSpecificSubstitute = glb[0]; // TODO (philippe) need to improve >- //TypeBinding mostSpecificSubstitute = scope.greaterLowerBound(bounds); >- if (mostSpecificSubstitute != null) { >- substitutes[i] = mostSpecificSubstitute; >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=346026, https://bugs.eclipse.org/bugs/show_bug.cgi?id=319436 >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=341795 - Per 15.12.2.8, we should fully apply glb >+ if (glb != null) { >+ if (glb.length == 1) { >+ mostSpecificSubstitute = glb[0]; >+ } else { >+ TypeBinding [] otherBounds = new TypeBinding[glb.length - 1]; >+ System.arraycopy(glb, 1, otherBounds, 0, glb.length - 1); >+ mostSpecificSubstitute = scope.environment().createWildcard(null, 0, glb[0], otherBounds, Wildcard.EXTENDS); > } > } >+ if (mostSpecificSubstitute != null) { >+ substitutes[i] = mostSpecificSubstitute; >+ } >+ } > } > return true; > } >@@ -413,10 +460,10 @@ > for (int i = 0; i < varLength; i++) { > TypeBinding substitute = inferenceContext.substitutes[i]; > if (substitute != null) { >- this.typeArguments[i] = inferenceContext.substitutes[i]; >+ this.typeArguments[i] = substitute; > } else { > // remaining unresolved variable are considered to be Object (or their bound actually) >- this.typeArguments[i] = originalVariables[i].upperBound(); >+ this.typeArguments[i] = inferenceContext.substitutes[i] = originalVariables[i].upperBound(); > } > } > // may still need an extra substitution at the end (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=121369) >#P org.eclipse.jdt.core.tests.compiler >Index: src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java,v >retrieving revision 1.826.2.4 >diff -u -r1.826.2.4 GenericTypeTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java 23 May 2011 09:18:17 -0000 1.826.2.4 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java 25 May 2011 05:56:15 -0000 >@@ -5,6 +5,10 @@ > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > *******************************************************************************/ >@@ -31,7 +35,7 @@ > // Static initializer to specify tests subset using TESTS_* static variables > // All specified tests which does not belong to the class are skipped... > static { >-// TESTS_NAMES = new String[] { "test1203c", "test1203d" }; >+// TESTS_NAMES = new String[] { "test1404" }; > // TESTS_NUMBERS = new int[] { 593, 701, 746, 848, 953, 985, 1029, 1136, 1227, 1295, 1341 }; > // TESTS_RANGE = new int[] { 1097, -1 }; > } >@@ -12734,7 +12738,7 @@ > } > > public void test0423() { >- this.runNegativeTest( >+ this.runConformTest( > new String[] { > "X.java", > "public class X {\n" + >@@ -12753,12 +12757,7 @@ > "\n" + > "}", > }, >- "----------\n" + >- "1. ERROR in X.java (at line 12)\n" + >- " foo();\n" + >- " ^^^\n" + >- "Bound mismatch: The generic method foo() of type X is not applicable for the arguments (). The inferred type X is not a valid substitute for the bounded parameter <U extends X & Runnable>\n" + >- "----------\n"); >+ ""); > } > > public void test0424() { >@@ -28389,11 +28388,6 @@ > " String s = (String) Foo.foo();\n" + > " ^^^^^^^^^^^^^^^^^^\n" + > "Cannot cast from List<List<U>> to String\n" + >- "----------\n" + >- "2. ERROR in X.java (at line 9)\n" + >- " String s = (String) Foo.foo();\n" + >- " ^^^\n" + >- "Bound mismatch: The generic method foo() of type Foo is not applicable for the arguments (). The inferred type List<List<U>> is not a valid substitute for the bounded parameter <U extends List<U>>\n" + > "----------\n"); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=121369 - variation >@@ -31424,17 +31418,12 @@ > " ^\n" + > "X is a raw type. References to generic type X<A> should be parameterized\n" + > "----------\n" + >- "2. ERROR in X.java (at line 7)\n" + >- " X x = newInstance();\n" + >- " ^^^^^^^^^^^\n" + >- "Bound mismatch: The generic method newInstance() of type X<A> is not applicable for the arguments (). The inferred type Comparable<Comparable<B>> is not a valid substitute for the bounded parameter <B extends Comparable<B>>\n" + >- "----------\n" + >- "3. WARNING in X.java (at line 8)\n" + >+ "2. WARNING in X.java (at line 8)\n" + > " return new X[] { x };\n" + > " ^^^^^^^^^^^^^\n" + > "Type safety: The expression of type X[] needs unchecked conversion to conform to X<String>[]\n" + > "----------\n" + >- "4. ERROR in X.java (at line 10)\n" + >+ "3. ERROR in X.java (at line 10)\n" + > " Zork z;\n" + > " ^^^^\n" + > "Zork cannot be resolved to a type\n" + >@@ -34370,16 +34359,6 @@ > " static <M extends String> Comparator<M> baz() {\n" + > " ^^^^^^\n" + > "The type parameter M should not be bounded by the final type String. Final types cannot be further extended\n" + >- "----------\n" + >- "2. ERROR in ComparableComparator.java (at line 25)\n" + >- " static Comparator BAR = ComparableComparator.bar();//0\n" + >- " ^^^\n" + >- "Bound mismatch: The generic method bar() of type ComparableComparator<T> is not applicable for the arguments (). The inferred type Comparable<Comparable<M>> is not a valid substitute for the bounded parameter <M extends Comparable<M>>\n" + >- "----------\n" + >- "3. ERROR in ComparableComparator.java (at line 27)\n" + >- " static Object BAR2 = ComparableComparator.bar();//1a\n" + >- " ^^^\n" + >- "Bound mismatch: The generic method bar() of type ComparableComparator<T> is not applicable for the arguments (). The inferred type Comparable<Comparable<M>> is not a valid substitute for the bounded parameter <M extends Comparable<M>>\n" + > "----------\n"); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=158548 >@@ -41591,11 +41570,16 @@ > " }\n" + > "}\n", // ================= > }, >- "----------\n" + >- "1. ERROR in X.java (at line 6)\n" + >- " Object[] o = throwE(objs);\n" + >- " ^^^^^^\n" + >- "Bound mismatch: The generic method throwE(Object...) of type X is not applicable for the arguments (Object[]). The inferred type Object[] is not a valid substitute for the bounded parameter <E extends Exception>\n" + >+ "----------\n" + >+ "1. ERROR in X.java (at line 6)\n" + >+ " Object[] o = throwE(objs);\n" + >+ " ^^^^^^\n" + >+ "Bound mismatch: The generic method throwE(Object...) of type X is not applicable for the arguments (Object[]). The inferred type Object[]&Exception is not a valid substitute for the bounded parameter <E extends Exception>\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 6)\n" + >+ " Object[] o = throwE(objs);\n" + >+ " ^^^^^^^^^^^^\n" + >+ "Type mismatch: cannot convert from Object[]&Exception to Object[]\n" + > "----------\n"); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=208030 >@@ -45140,26 +45124,31 @@ > " }\n" + > "}\n", // ================= > }, >- "----------\n" + >- "1. ERROR in X.java (at line 8)\n" + >- " <T extends N<T>> T foo3(String name, T value) {}\n" + >- " ^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + >- "This method must return a result of type T\n" + >- "----------\n" + >- "2. ERROR in X.java (at line 15)\n" + >- " new X().foo(\"HI\", null); // correctly report error\n" + >- " ^^^\n" + >- "The method foo(String, String) is ambiguous for the type X\n" + >- "----------\n" + >- "3. ERROR in X.java (at line 18)\n" + >- " Thread t1 = foo3(\"HI\", null);\n" + >- " ^^^^\n" + >- "The method foo3(String, null) is undefined for the type Test\n" + >- "----------\n" + >- "4. ERROR in X.java (at line 19)\n" + >- " Thread t2 = (Thread)foo3(\"HI\", null);\n" + >- " ^^^^\n" + >- "The method foo3(String, null) is undefined for the type Test\n" + >+ "----------\n" + >+ "1. ERROR in X.java (at line 8)\n" + >+ " <T extends N<T>> T foo3(String name, T value) {}\n" + >+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + >+ "This method must return a result of type T\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 15)\n" + >+ " new X().foo(\"HI\", null); // correctly report error\n" + >+ " ^^^\n" + >+ "The method foo(String, String) is ambiguous for the type X\n" + >+ "----------\n" + >+ "3. ERROR in X.java (at line 16)\n" + >+ " new X().foo2(\"HI\", null); // miss ambiguous error\n" + >+ " ^^^^\n" + >+ "The method foo2(String, String) is ambiguous for the type X\n" + >+ "----------\n" + >+ "4. ERROR in X.java (at line 18)\n" + >+ " Thread t1 = foo3(\"HI\", null);\n" + >+ " ^^^^\n" + >+ "The method foo3(String, null) is undefined for the type Test\n" + >+ "----------\n" + >+ "5. ERROR in X.java (at line 19)\n" + >+ " Thread t2 = (Thread)foo3(\"HI\", null);\n" + >+ " ^^^^\n" + >+ "The method foo3(String, null) is undefined for the type Test\n" + > "----------\n"); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=229928 - variation >@@ -45181,17 +45170,12 @@ > "}\n", // ================= > }, > "----------\n" + >- "1. ERROR in X.java (at line 8)\n" + >- " new X().foo2(\"HI\", null);\n" + >- " ^^^^\n" + >- "Bound mismatch: The generic method foo2(String, T) of type X is not applicable for the arguments (String, null). The inferred type N<N<T>> is not a valid substitute for the bounded parameter <T extends N<T>>\n" + >- "----------\n" + >- "2. ERROR in X.java (at line 9)\n" + >+ "1. ERROR in X.java (at line 9)\n" + > " new X().<N<?>>foo2(\"HI\", null);\n" + > " ^^^^\n" + > "Bound mismatch: The generic method foo2(String, T) of type X is not applicable for the arguments (String, null). The inferred type N<?> is not a valid substitute for the bounded parameter <T extends N<T>>\n" + > "----------\n" + >- "3. ERROR in X.java (at line 10)\n" + >+ "2. ERROR in X.java (at line 10)\n" + > " new X().<N<? extends N<?>>>foo2(\"HI\", null);\n" + > " ^^^^\n" + > "Bound mismatch: The generic method foo2(String, T) of type X is not applicable for the arguments (String, null). The inferred type N<? extends N<?>> is not a valid substitute for the bounded parameter <T extends N<T>>\n" + >@@ -45199,7 +45183,7 @@ > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=229928 - variation > public void test1319() { >- this.runNegativeTest( >+ this.runConformTest( > new String[] { > "X.java", // ================= > "import java.util.List;\n" + >@@ -45213,16 +45197,11 @@ > " }\n" + > "}\n", // ================= > }, >- "----------\n" + >- "1. ERROR in X.java (at line 8)\n" + >- " new X().foo2(\"HI\", null, null, null);\n" + >- " ^^^^\n" + >- "Bound mismatch: The generic method foo2(String, U, T, W) of type X is not applicable for the arguments (String, null, null, null). The inferred type List<List<W>> is not a valid substitute for the bounded parameter <T extends List<U>>\n" + >- "----------\n"); >+ ""); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=229928 - variation > public void test1320() { >- this.runNegativeTest( >+ this.runConformTest( > new String[] { > "X.java", // ================= > "import java.util.List;\n" + >@@ -45236,16 +45215,11 @@ > " }\n" + > "}\n", // ================= > }, >- "----------\n" + >- "1. ERROR in X.java (at line 8)\n" + >- " new X().foo2(\"HI\", null, null, null);\n" + >- " ^^^^\n" + >- "Bound mismatch: The generic method foo2(String, U, T, W) of type X is not applicable for the arguments (String, null, null, null). The inferred type List<List<W>> is not a valid substitute for the bounded parameter <T extends List<U>>\n" + >- "----------\n"); >+ ""); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=229928 - variation > public void test1321() { >- this.runNegativeTest( >+ this.runConformTest( > new String[] { > "X.java", // ================= > "import java.util.List;\n" + >@@ -45259,12 +45233,7 @@ > " }\n" + > "}\n", // ================= > }, >- "----------\n" + >- "1. ERROR in X.java (at line 8)\n" + >- " new X().foo2(\"HI\", null, null, null);\n" + >- " ^^^^\n" + >- "Bound mismatch: The generic method foo2(String, U, T, W) of type X is not applicable for the arguments (String, null, null, null). The inferred type List<List<T>> is not a valid substitute for the bounded parameter <W extends List<U>>\n" + >- "----------\n"); >+ ""); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=231094 > public void test1322() { >@@ -47212,7 +47181,7 @@ > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=174447 > public void test1380() { >- this.runNegativeTest( >+ this.runConformTest( > new String[] { > "X.java", //----------------------------------------------------------------------- > "public class X {\n" + >@@ -47223,12 +47192,7 @@ > " }\n" + > "}\n",//----------------------------------------------------------------------- > }, >- "----------\n" + >- "1. ERROR in X.java (at line 5)\n" + >- " f();\n" + >- " ^\n" + >- "Bound mismatch: The generic method f() of type X is not applicable for the arguments (). The inferred type Enum<Enum<E>> is not a valid substitute for the bounded parameter <E extends Enum<E>>\n" + >- "----------\n"); >+ ""); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=247953 > public void test1381() throws Exception { >@@ -48237,8 +48201,8 @@ > "Syntax error, insert \")\" to complete Expression\n" + > "----------\n"); > } >-//https://bugs.eclipse.org/bugs/show_bug.cgi?id=242159 >-public void _test1404() throws Exception { >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=242159 >+public void test1404() throws Exception { > this.runNegativeTest( > new String[] { > "X.java", >@@ -48255,20 +48219,10 @@ > "}\n", > }, > "----------\n" + >- "1. ERROR in X.java (at line 7)\n" + >- " bar(); // 0 rejected\n" + >- " ^^^\n" + >- "Bound mismatch: The generic method bar() of type X<A> is not applicable for the arguments (). The inferred type Comparable<Comparable<B>> is not a valid substitute for the bounded parameter <B extends Comparable<B>>\n" + >- "----------\n" + >- "2. WARNING in X.java (at line 8)\n" + >+ "1. WARNING in X.java (at line 8)\n" + > " X raw = bar(); // 1 accepted\n" + > " ^\n" + > "X is a raw type. References to generic type X<A> should be parameterized\n" + >- "----------\n" + >- "3. ERROR in X.java (at line 9)\n" + >- " X<?> wild = bar(); // 2 rejected\n" + >- " ^^^\n" + >- "Bound mismatch: The generic method bar() of type X<A> is not applicable for the arguments (). The inferred type Comparable<Comparable<B>> is not a valid substitute for the bounded parameter <B extends Comparable<B>>\n" + > "----------\n"); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=240807 >Index: src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest_1_7.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Attic/GenericsRegressionTest_1_7.java,v >retrieving revision 1.1.2.19 >diff -u -r1.1.2.19 GenericsRegressionTest_1_7.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest_1_7.java 24 May 2011 13:15:35 -0000 1.1.2.19 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest_1_7.java 25 May 2011 05:56:15 -0000 >@@ -1170,7 +1170,7 @@ > "----------\n"); > } > // https://bugs.eclipse.org/bugs/show_bug.cgi?id=346026 >-public void _test0030() { >+public void test0030() { > this.runNegativeTest( > new String[] { > "X.java", >@@ -1181,11 +1181,16 @@ > " X f = new X<>();\n" + > "}\n" > }, >- ""); >+ "----------\n" + >+ "1. WARNING in X.java (at line 5)\n" + >+ " X f = new X<>();\n" + >+ " ^\n" + >+ "X is a raw type. References to generic type X<T> should be parameterized\n" + >+ "----------\n"); > } > // https://bugs.eclipse.org/bugs/show_bug.cgi?id=346026 >-public void _test0031() { >- this.runNegativeTest( >+public void test0031() { >+ this.runConformTest( > new String[] { > "X.java", > "class C {}\n" + >@@ -1198,8 +1203,8 @@ > ""); > } > // https://bugs.eclipse.org/bugs/show_bug.cgi?id=346026 >-public void _test0032() { >- this.runNegativeTest( >+public void test0032() { >+ this.runConformTest( > new String[] { > "X.java", > "class C {}\n" + >@@ -1214,7 +1219,7 @@ > ""); > } > // https://bugs.eclipse.org/bugs/show_bug.cgi?id=346026 >-public void _test0033() { >+public void test0033() { > this.runNegativeTest( > new String[] { > "X.java", >@@ -1227,7 +1232,12 @@ > " X f2 = getX();\n" + > "}\n" > }, >- ""); >+ "----------\n" + >+ "1. WARNING in X.java (at line 7)\n" + >+ " X f2 = getX();\n" + >+ " ^\n" + >+ "X is a raw type. References to generic type X<T> should be parameterized\n" + >+ "----------\n"); > } > // https://bugs.eclipse.org/bugs/show_bug.cgi?id=345559 > public void test0034() { >@@ -1574,104 +1584,55 @@ > "Cannot infer elided type(s)\n" + > "----------\n"); > } >-//https://bugs.eclipse.org/bugs/show_bug.cgi?id=346026 >-public void _test0038() { >- this.runNegativeTest( >- new String[] { >- "X.java", >- "class C {}\n" + >- "interface I {}\n" + >- "public class X<T extends C & I> {\n" + >- " X() {}\n" + >- " X f = new X<>();\n" + >- "}\n" >- }, >- "----------\n" + >- "1. WARNING in X.java (at line 5)\n" + >- " X f = new X<>();\n" + >- " ^\n" + >- "X is a raw type. References to generic type X<T> should be parameterized\n" + >- "----------\n"); >-} >-//https://bugs.eclipse.org/bugs/show_bug.cgi?id=346026 >-public void _test0039() { >- this.runNegativeTest( >- new String[] { >- "X.java", >- "class C {}\n" + >- "interface I {}\n" + >- "public class X<T extends C & I> {\n" + >- " X() {}\n" + >- " X<?> f = new X<>();\n" + >- " Zork z;\n" + >- "}\n" >- }, >- "----------\n" + >- "1. ERROR in X.java (at line 6)\n" + >- " Zork z;\n" + >- " ^^^^\n" + >- "Zork cannot be resolved to a type\n" + >- "----------\n"); >-} >-//https://bugs.eclipse.org/bugs/show_bug.cgi?id=346026 >-public void _test0040() { >- this.runNegativeTest( >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=341795 >+public void test0038() { >+ this.runConformTest( > new String[] { > "X.java", >- "class C {}\n" + >- "interface I {}\n" + >- "public class X<T extends C & I> {\n" + >- " static <U extends C & I> X<U> getX() {\n" + >- " return null;\n" + >+ "interface A {\n" + >+ " <T extends B & C> T getaMethod();\n" + >+ " <T extends B & C> void setaMethod(T param);\n" + >+ "}\n" + >+ "class B {\n" + >+ "}\n" + >+ "interface C {\n" + >+ "}\n" + >+ "public class X {\n" + >+ " public void someMethod(A aInstance) {\n" + >+ " aInstance.getaMethod();\n" + > " }\n" + >- " X<?> f2 = getX();\n" + >- " Zork z;\n" + > "}\n" > }, >- "----------\n" + >- "1. ERROR in X.java (at line 8)\n" + >- " Zork z;\n" + >- " ^^^^\n" + >- "Zork cannot be resolved to a type\n" + >- "----------\n"); >+ ""); > } >-//https://bugs.eclipse.org/bugs/show_bug.cgi?id=346026 >-public void _test0041() { >- this.runNegativeTest( >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=319436 >+public void test0039() { >+ this.runConformTest( > new String[] { > "X.java", >- "class C {}\n" + >- "interface I {}\n" + >- "public class X<T extends C & I> {\n" + >- " static <U extends C & I> X<U> getX() {\n" + >- " return null;\n" + >- " }\n" + >- " X f2 = getX();\n" + >- "}\n" >+ "import java.io.Serializable;\n" + >+ "public class X {\n" + >+ " public static void main(String[] args) {\n" + >+ " createObject();\n" + >+ " }\n" + >+ " private static <T extends Comparable<?> & Serializable> T createObject() {\n" + >+ " return null;\n" + >+ " }\n" + >+ "}\n" > }, >- "----------\n" + >- "1. WARNING in X.java (at line 7)\n" + >- " X f2 = getX();\n" + >- " ^\n" + >- "X is a raw type. References to generic type X<T> should be parameterized\n" + >- "----------\n"); >+ ""); > } >-public void _test0042() { >+public void test0042() { > this.runNegativeTest( > new String[] { > "X.java", > "interface I<T> {}\n" + >- "public class X{\n" + >+ "public class X {\n" + > " <T extends I<T>> void m() { }\n" + > " { m(); } \n" + > "}\n" > }, >- "----------\n" + >- "1. WARNING in X.java (at line 7)\n" + >- " X f2 = getX();\n" + >- " ^\n" + >- "X is a raw type. References to generic type X<T> should be parameterized\n" + >- "----------\n"); >+ ""); > } > // https://bugs.eclipse.org/bugs/show_bug.cgi?id=345968 > public void test0043() {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 242159
:
196508
|
196638