### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java,v retrieving revision 1.170 diff -u -r1.170 SourceTypeBinding.java --- compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java 14 Nov 2008 20:28:06 -0000 1.170 +++ compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java 27 Apr 2009 14:52:01 -0000 @@ -1096,6 +1096,7 @@ // find & report collision cases boolean complyTo15 = this.scope.compilerOptions().sourceLevel >= ClassFileConstants.JDK1_5; + boolean complyTo17 = this.scope.compilerOptions().sourceLevel >= ClassFileConstants.JDK1_7; for (int i = 0, length = this.methods.length; i < length; i++) { MethodBinding method = resolvedMethods[i]; if (method == null) @@ -1133,8 +1134,12 @@ boolean equalParams = method.areParametersEqual(subMethod); if (equalParams && equalTypeVars) { // duplicates regardless of return types - } else if (method.returnType.erasure() == subMethod.returnType.erasure() && (equalParams || method.areParameterErasuresEqual(method2))) { + } else if ((complyTo17 || method.returnType.erasure() == subMethod.returnType.erasure()) + && (equalParams || method.areParameterErasuresEqual(method2))) { + // with fix for http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6182950 + // we now ignore return types when detecting duplicates, just as we did before 1.5 // name clash for sure if not duplicates, report as duplicates + // FYI for now we will only make this change when compliance is set to 1.7 or higher } else if (!equalTypeVars && vars != Binding.NO_TYPE_VARIABLES && vars2 != Binding.NO_TYPE_VARIABLES) { // type variables are different so we can distinguish between methods continue nextSibling; Index: compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier15.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier15.java,v retrieving revision 1.98 diff -u -r1.98 MethodVerifier15.java --- compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier15.java 7 Mar 2009 00:59:02 -0000 1.98 +++ compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier15.java 27 Apr 2009 14:52:01 -0000 @@ -11,6 +11,7 @@ package org.eclipse.jdt.internal.compiler.lookup; import org.eclipse.jdt.internal.compiler.ast.TypeParameter; +import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.util.HashtableOfObject; import org.eclipse.jdt.internal.compiler.util.SimpleSet; @@ -546,8 +547,15 @@ return substitute; } boolean detectInheritedNameClash(MethodBinding inherited, MethodBinding otherInherited) { - if (!inherited.areParameterErasuresEqual(otherInherited) || inherited.returnType.erasure() != otherInherited.returnType.erasure()) + if (!inherited.areParameterErasuresEqual(otherInherited)) return false; + if (this.environment.globalOptions.sourceLevel < ClassFileConstants.JDK1_7) { + // with fix for http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6182950 + // we now ignore return types when detecting name clashes + // FYI for now we will only make this change when compliance is set to 1.7 or higher + if (inherited.returnType.erasure() != otherInherited.returnType.erasure()) + return false; + } // skip it if otherInherited is defined by a subtype of inherited's declaringClass if (inherited.declaringClass.erasure() != otherInherited.declaringClass.erasure()) if (inherited.declaringClass.findSuperTypeOriginatingFrom(otherInherited.declaringClass) != null) @@ -558,8 +566,15 @@ } boolean detectNameClash(MethodBinding current, MethodBinding inherited) { MethodBinding original = inherited.original(); // can be the same as inherited - if (!current.areParameterErasuresEqual(original) || current.returnType.erasure() != original.returnType.erasure()) + if (!current.areParameterErasuresEqual(original)) return false; + if (this.environment.globalOptions.sourceLevel < ClassFileConstants.JDK1_7) { + // with fix for http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6182950 + // we now ignore return types when detecting name clashes + // FYI for now we will only make this change when compliance is set to 1.7 or higher + if (current.returnType.erasure() != original.returnType.erasure()) + return false; + } problemReporter(current).methodNameClash(current, inherited.declaringClass.isRawType() ? inherited : original); return true; #P org.eclipse.jdt.core.tests.compiler Index: src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java,v retrieving revision 1.177 diff -u -r1.177 MethodVerifyTest.java --- src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java 6 Apr 2009 19:23:46 -0000 1.177 +++ src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java 27 Apr 2009 14:52:07 -0000 @@ -3223,6 +3223,7 @@ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=85900 public void test048() { + if (new CompilerOptions(getCompilerOptions()).complianceLevel >= ClassFileConstants.JDK1_7) return; // see test187() this.runConformTest( new String[] { "X1.java", @@ -3236,6 +3237,7 @@ } // https://bugs.eclipse.org/bugs/show_bug.cgi?id=85900 public void test048a() { + if (new CompilerOptions(getCompilerOptions()).complianceLevel >= ClassFileConstants.JDK1_7) return; // see test187() this.runConformTest( new String[] { "X2.java", @@ -3278,6 +3280,7 @@ } // https://bugs.eclipse.org/bugs/show_bug.cgi?id=85900 public void test048c() { + if (new CompilerOptions(getCompilerOptions()).complianceLevel >= ClassFileConstants.JDK1_7) return; // see test187() this.runConformTest( new String[] { "X4.java", @@ -3296,6 +3299,7 @@ } // https://bugs.eclipse.org/bugs/show_bug.cgi?id=85900 public void test048d() { + if (new CompilerOptions(getCompilerOptions()).complianceLevel >= ClassFileConstants.JDK1_7) return; // see test187() this.runConformTest( new String[] { "X5.java", @@ -3314,6 +3318,7 @@ } // https://bugs.eclipse.org/bugs/show_bug.cgi?id=85900 public void test048e() { + if (new CompilerOptions(getCompilerOptions()).complianceLevel >= ClassFileConstants.JDK1_7) return; // see test187() this.runConformTest( new String[] { "X6.java", @@ -3332,6 +3337,7 @@ } // https://bugs.eclipse.org/bugs/show_bug.cgi?id=85900 public void test048f() { + if (new CompilerOptions(getCompilerOptions()).complianceLevel >= ClassFileConstants.JDK1_7) return; // see test187() this.runConformTest( new String[] { "X7.java", @@ -3433,6 +3439,7 @@ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=94754 public void test050() { + if (new CompilerOptions(getCompilerOptions()).complianceLevel >= ClassFileConstants.JDK1_7) return; // see test187() this.runConformTest( new String[] { "X.java", @@ -3453,6 +3460,7 @@ } // https://bugs.eclipse.org/bugs/show_bug.cgi?id=94754 public void test050a() { + if (new CompilerOptions(getCompilerOptions()).complianceLevel >= ClassFileConstants.JDK1_7) return; // see test187() this.runNegativeTest( new String[] { "X.java", @@ -3484,6 +3492,7 @@ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=90423 - variation public void test050b() { + if (new CompilerOptions(getCompilerOptions()).complianceLevel >= ClassFileConstants.JDK1_7) return; // see test187() this.runNegativeTest( new String[] { "X.java", @@ -3547,6 +3556,7 @@ } // https://bugs.eclipse.org/bugs/show_bug.cgi?id=90423 - variation public void test050c() { + if (new CompilerOptions(getCompilerOptions()).complianceLevel >= ClassFileConstants.JDK1_7) return; // see test187() this.runNegativeTest( new String[] { "X.java", @@ -3580,6 +3590,7 @@ } // https://bugs.eclipse.org/bugs/show_bug.cgi?id=90423 - variation public void test050d() { + if (new CompilerOptions(getCompilerOptions()).complianceLevel >= ClassFileConstants.JDK1_7) return; // see test187() this.runConformTest( new String[] { "X.java", @@ -3599,6 +3610,7 @@ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=90423 public void test050e() { + if (new CompilerOptions(getCompilerOptions()).complianceLevel >= ClassFileConstants.JDK1_7) return; // see test187() this.runConformTest( new String[] { "X.java", @@ -3697,6 +3709,7 @@ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=90423 public void test050i() { + if (new CompilerOptions(getCompilerOptions()).complianceLevel >= ClassFileConstants.JDK1_7) return; // see test187() this.runConformTest( new String[] { "X.java", @@ -3878,6 +3891,7 @@ } // https://bugs.eclipse.org/bugs/show_bug.cgi?id=89470 public void test051b() { + if (new CompilerOptions(getCompilerOptions()).complianceLevel >= ClassFileConstants.JDK1_7) return; // see test187() this.runConformTest( new String[] { "X.java", @@ -4028,6 +4042,7 @@ } // more duplicate tests, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=94897 public void test054a() { + if (new CompilerOptions(getCompilerOptions()).complianceLevel >= ClassFileConstants.JDK1_7) return; // see test187() this.runNegativeTest( new String[] { "X.java", @@ -4059,6 +4074,7 @@ } // more duplicate tests, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=94897 public void test054b() { + if (new CompilerOptions(getCompilerOptions()).complianceLevel >= ClassFileConstants.JDK1_7) return; // see test187() this.runConformTest( new String[] { "X.java", @@ -4096,6 +4112,7 @@ } // more duplicate tests, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=94897 public void test054d() { + if (new CompilerOptions(getCompilerOptions()).complianceLevel >= ClassFileConstants.JDK1_7) return; // see test187() this.runConformTest( new String[] { "X.java", @@ -4216,6 +4233,7 @@ } // https://bugs.eclipse.org/bugs/show_bug.cgi?id=94898 public void test058a() { + if (new CompilerOptions(getCompilerOptions()).complianceLevel >= ClassFileConstants.JDK1_7) return; // see test187() this.runNegativeTest( new String[] { "X.java", @@ -4246,6 +4264,7 @@ } // https://bugs.eclipse.org/bugs/show_bug.cgi?id=94898 public void test058b() { + if (new CompilerOptions(getCompilerOptions()).complianceLevel >= ClassFileConstants.JDK1_7) return; // see test187() this.runNegativeTest( new String[] { "X.java", @@ -6209,6 +6228,7 @@ // name conflict public void test101() { + if (new CompilerOptions(getCompilerOptions()).complianceLevel >= ClassFileConstants.JDK1_7) return; // see test187() this.runNegativeTest( new String[] { "X.java", @@ -7293,6 +7313,7 @@ } //https://bugs.eclipse.org/bugs/show_bug.cgi?id=202830 public void test120a() { + if (new CompilerOptions(getCompilerOptions()).complianceLevel >= ClassFileConstants.JDK1_7) return; // see test187() this.runConformTest( new String[] { "Bar.java", @@ -8992,7 +9013,52 @@ //https://bugs.eclipse.org/bugs/show_bug.cgi?id=251091 public void test177() { - if (new CompilerOptions(getCompilerOptions()).sourceLevel >= ClassFileConstants.JDK1_6) { + if (new CompilerOptions(getCompilerOptions()).complianceLevel >= ClassFileConstants.JDK1_7) { // see test187() + this.runNegativeTest( + new String[] { + "X.java", + "import java.util.*;\n" + + "interface I { I foo(Collection c); }\n" + + "class A extends LinkedHashMap {\n" + + " public A foo(Collection c) { return this; }\n" + + "}\n" + + "class X extends A implements I {\n" + + " @Override public X foo(Collection c) { return this; }\n" + + "}" + }, + "----------\n" + + "1. WARNING in X.java (at line 3)\n" + + " class A extends LinkedHashMap {\n" + + " ^\n" + + "The serializable class A does not declare a static final serialVersionUID field of type long\n" + + "----------\n" + + "2. WARNING in X.java (at line 3)\n" + + " class A extends LinkedHashMap {\n" + + " ^^^^^^^^^^^^^\n" + + "LinkedHashMap is a raw type. References to generic type LinkedHashMap should be parameterized\n" + + "----------\n" + + "3. WARNING in X.java (at line 4)\n" + + " public A foo(Collection c) { return this; }\n" + + " ^^^^^^^^^^\n" + + "Collection is a raw type. References to generic type Collection should be parameterized\n" + + "----------\n" + + "4. ERROR in X.java (at line 6)\n" + + " class X extends A implements I {\n" + + " ^\n" + + "Name clash: The method foo(Collection) of type I has the same erasure as foo(Collection) of type A but does not override it\n" + + "----------\n" + + "5. WARNING in X.java (at line 6)\n" + + " class X extends A implements I {\n" + + " ^\n" + + "The serializable class X does not declare a static final serialVersionUID field of type long\n" + + "----------\n" + + "6. ERROR in X.java (at line 7)\n" + + " @Override public X foo(Collection c) { return this; }\n" + + " ^^^^^^^^^^^^^^^^^^^^\n" + + "Name clash: The method foo(Collection) of type X has the same erasure as foo(Collection) of type A but does not override it\n" + + "----------\n" + ); + } else if (new CompilerOptions(getCompilerOptions()).sourceLevel == ClassFileConstants.JDK1_6) { this.runConformTest( new String[] { "X.java", @@ -9506,4 +9572,51 @@ "----------\n" ); } +// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6182950 +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=? +public void test187() { + this.runNegativeTest( + new String[] { + "X.java", + "import java.util.*;\n" + + "class X {\n" + + " int f(List l) {return 0;}\n" + + "}\n" + + "class Y extends X {\n" + + " double f(List l) {return 0;}\n" + + "}\n" + + "interface I {\n" + + " double f(List l);\n" + + "}\n" + + "abstract class Z extends X implements I {}\n" + + "class XX {\n" + + " int f(List l) {return 0;}\n" + + "double f(List l) {return 0;}\n" + + "}" + }, + new CompilerOptions(getCompilerOptions()).complianceLevel < ClassFileConstants.JDK1_7 + ? "" + : "----------\n" + + "1. ERROR in X.java (at line 6)\n" + + " double f(List l) {return 0;}\n" + + " ^^^^^^^^^^^^^^^^^^\n" + + "Name clash: The method f(List) of type Y has the same erasure as f(List) of type X but does not override it\n" + + "----------\n" + + "2. ERROR in X.java (at line 11)\n" + + " abstract class Z extends X implements I {}\n" + + " ^\n" + + "Name clash: The method f(List) of type X has the same erasure as f(List) of type I but does not override it\n" + + "----------\n" + + "3. ERROR in X.java (at line 13)\n" + + " int f(List l) {return 0;}\n" + + " ^^^^^^^^^^^^^^^^^\n" + + "Method f(List) has the same erasure f(List) as another method in type XX\n" + + "----------\n" + + "4. ERROR in X.java (at line 14)\n" + + " double f(List l) {return 0;}\n" + + " ^^^^^^^^^^^^^^^^^^\n" + + "Method f(List) has the same erasure f(List) as another method in type XX\n" + + "----------\n" + ); +} } 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.794 diff -u -r1.794 GenericTypeTest.java --- src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java 1 Apr 2009 15:15:08 -0000 1.794 +++ src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java 27 Apr 2009 14:52:06 -0000 @@ -17605,6 +17605,8 @@ //https://bugs.eclipse.org/bugs/show_bug.cgi?id=87956 public void test0561() { + // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6182950 + if (new CompilerOptions(getCompilerOptions()).complianceLevel >= ClassFileConstants.JDK1_7) return; this.runConformTest( new String[] { "X.java", @@ -17937,6 +17939,8 @@ } // https://bugs.eclipse.org/bugs/show_bug.cgi?id=90423 - variation public void test0574() { + // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6182950 + if (new CompilerOptions(getCompilerOptions()).complianceLevel >= ClassFileConstants.JDK1_7) return; this.runNegativeTest( new String[] { "X.java", @@ -22371,10 +22375,17 @@ " bb.test();\r\n" + " ^^^^\n" + "The method test() is ambiguous for the type BB\n" + + "----------\n" + + "2. ERROR in X.java (at line 9)\n" + + " class BB extends AA { BB test() {return null;} }\n" + + " ^^^^^^\n" + + "Name clash: The method test() of type BB has the same erasure as test() of type AA but does not override it\n" + "----------\n"); } //https://bugs.eclipse.org/bugs/show_bug.cgi?id=97219 public void test0706a() { + // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6182950 + if (new CompilerOptions(getCompilerOptions()).complianceLevel >= ClassFileConstants.JDK1_7) return; this.runNegativeTest( new String[] { "X.java", @@ -22411,6 +22422,8 @@ } //https://bugs.eclipse.org/bugs/show_bug.cgi?id=97219 public void test0706b() { + // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6182950 + if (new CompilerOptions(getCompilerOptions()).complianceLevel >= ClassFileConstants.JDK1_7) return; this.runNegativeTest( new String[] { "X.java", @@ -23596,6 +23609,8 @@ } //https://bugs.eclipse.org/bugs/show_bug.cgi?id=100007 public void test0748() { + // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6182950 + if (new CompilerOptions(getCompilerOptions()).complianceLevel >= ClassFileConstants.JDK1_7) return; this.runNegativeTest( new String[] { "X.java", @@ -40008,6 +40023,8 @@ } //https://bugs.eclipse.org/bugs/show_bug.cgi?id=204534 public void test1181() { + // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6182950 + if (new CompilerOptions(getCompilerOptions()).complianceLevel >= ClassFileConstants.JDK1_7) return; this.runNegativeTest( new String[] { "X.java", Index: src/org/eclipse/jdt/core/tests/compiler/regression/AmbiguousMethodTest.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AmbiguousMethodTest.java,v retrieving revision 1.64 diff -u -r1.64 AmbiguousMethodTest.java --- src/org/eclipse/jdt/core/tests/compiler/regression/AmbiguousMethodTest.java 27 Mar 2009 19:33:57 -0000 1.64 +++ src/org/eclipse/jdt/core/tests/compiler/regression/AmbiguousMethodTest.java 27 Apr 2009 14:52:02 -0000 @@ -11,6 +11,8 @@ package org.eclipse.jdt.core.tests.compiler.regression; import junit.framework.*; +import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; +import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; public class AmbiguousMethodTest extends AbstractComparableTest { @@ -228,6 +230,8 @@ ); } public void test005() { + // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6182950 + if (new CompilerOptions(getCompilerOptions()).complianceLevel >= ClassFileConstants.JDK1_7) return; this.runNegativeTest( new String[] { "X.java", @@ -250,6 +254,8 @@ ); } public void test006() { + // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6182950 + if (new CompilerOptions(getCompilerOptions()).complianceLevel >= ClassFileConstants.JDK1_7) return; this.runNegativeTest( new String[] { "X.java", @@ -473,6 +479,8 @@ } // https://bugs.eclipse.org/bugs/show_bug.cgi?id=106090 public void test011a() { + // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6182950 + if (new CompilerOptions(getCompilerOptions()).complianceLevel >= ClassFileConstants.JDK1_7) return; this.runConformTest( new String[] { "Combined.java", @@ -492,6 +500,8 @@ } // https://bugs.eclipse.org/bugs/show_bug.cgi?id=106090 public void test011b() { + // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6182950 + if (new CompilerOptions(getCompilerOptions()).complianceLevel >= ClassFileConstants.JDK1_7) return; this.runNegativeTest( new String[] { "Test1.java", @@ -1454,34 +1464,38 @@ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=147647 // variant: having both methods in the same class should not change anything public void test021() { - this.runConformTest( - new String[] { - "Y.java", - "class X {\n" + - "}\n" + - "public class Y extends X {\n" + - " public static Y make(Class clazz) {\n" + - " System.out.print(true);\n" + - " return new Y();\n" + - " }\n" + - " public static X make(Class clazz) {\n" + - " System.out.print(false);\n" + - " return new X();\n" + - " }\n" + - " public static void main(String[] args) throws Exception {\n" + - " Y.make(getClazz());\n" + - " }\n" + - " public static Class getClazz() {\n" + - " return String.class;\n" + - " }\n" + - "}" - }, - "true"); + // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6182950 + if (new CompilerOptions(getCompilerOptions()).complianceLevel >= ClassFileConstants.JDK1_7) return; + this.runConformTest( + new String[] { + "Y.java", + "class X {\n" + + "}\n" + + "public class Y extends X {\n" + + " public static Y make(Class clazz) {\n" + + " System.out.print(true);\n" + + " return new Y();\n" + + " }\n" + + " public static X make(Class clazz) {\n" + + " System.out.print(false);\n" + + " return new X();\n" + + " }\n" + + " public static void main(String[] args) throws Exception {\n" + + " Y.make(getClazz());\n" + + " }\n" + + " public static Class getClazz() {\n" + + " return String.class;\n" + + " }\n" + + "}" + }, + "true"); } // https://bugs.eclipse.org/bugs/show_bug.cgi?id=147647 // variant: using instances triggers raw methods, which are ambiguous public void test022() { - this.runNegativeTest( + // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6182950 + if (new CompilerOptions(getCompilerOptions()).complianceLevel >= ClassFileConstants.JDK1_7) return; + this.runNegativeTest( new String[] { "X.java", "public class X {\n" + @@ -1548,68 +1562,68 @@ } // https://bugs.eclipse.org/bugs/show_bug.cgi?id=159711 public void test023() { -this.runConformTest( - new String[] { - "X.java", - "import java.util.*;\n" + - "public class X {\n" + - " public static void staticFoo(Collection p) {\n" + - " System.out.print(1);\n" + - " }\n" + - " public static > void staticFoo(T p) {\n" + - " System.out.print(2);\n" + - " }\n" + - " public void foo(Collection p) {\n" + - " System.out.print(1);\n" + - " }\n" + - " public > void foo(T p) {\n" + - " System.out.print(2);\n" + - " }\n" + - " public void foo2(Collection p) {\n" + - " System.out.print(1);\n" + - " }\n" + - " public void foo2(List p) {\n" + - " System.out.print(2);\n" + - " }\n" + - " public static void main(String[] args) {\n" + - " staticFoo(new ArrayList(Arrays.asList(\"\")));\n" + - " new X().foo(new ArrayList(Arrays.asList(\"\")));\n" + - " new X().foo2(new ArrayList(Arrays.asList(\"\")));\n" + - " }\n" + - "}" - }, - "222"); + this.runConformTest( + new String[] { + "X.java", + "import java.util.*;\n" + + "public class X {\n" + + " public static void staticFoo(Collection p) {\n" + + " System.out.print(1);\n" + + " }\n" + + " public static > void staticFoo(T p) {\n" + + " System.out.print(2);\n" + + " }\n" + + " public void foo(Collection p) {\n" + + " System.out.print(1);\n" + + " }\n" + + " public > void foo(T p) {\n" + + " System.out.print(2);\n" + + " }\n" + + " public void foo2(Collection p) {\n" + + " System.out.print(1);\n" + + " }\n" + + " public void foo2(List p) {\n" + + " System.out.print(2);\n" + + " }\n" + + " public static void main(String[] args) {\n" + + " staticFoo(new ArrayList(Arrays.asList(\"\")));\n" + + " new X().foo(new ArrayList(Arrays.asList(\"\")));\n" + + " new X().foo2(new ArrayList(Arrays.asList(\"\")));\n" + + " }\n" + + "}" + }, + "222"); } // https://bugs.eclipse.org/bugs/show_bug.cgi?id=159711 // self contained variant public void test024() { -this.runConformTest( - new String[] { - "X.java", - "public class X {\n" + - " public static void foo(L1 p) {\n" + - " System.out.println(1);\n" + - " }\n" + - " public static > void foo(T p) {\n" + - " System.out.println(2);\n" + - " }\n" + - " public static void main(String[] args) {\n" + - " foo(new L3());\n" + - " }\n" + - "}", - "L1.java", - "public interface L1 {\n" + - "}", - "L2.java", - "public interface L2 extends L1 {\n" + - "}", - "L3.java", - "public class L3 implements L2 {\n" + - " public L3() {\n" + - " }\n" + - "}", - }, - "2"); + this.runConformTest( + new String[] { + "X.java", + "public class X {\n" + + " public static void foo(L1 p) {\n" + + " System.out.println(1);\n" + + " }\n" + + " public static > void foo(T p) {\n" + + " System.out.println(2);\n" + + " }\n" + + " public static void main(String[] args) {\n" + + " foo(new L3());\n" + + " }\n" + + "}", + "L1.java", + "public interface L1 {\n" + + "}", + "L2.java", + "public interface L2 extends L1 {\n" + + "}", + "L3.java", + "public class L3 implements L2 {\n" + + " public L3() {\n" + + " }\n" + + "}", + }, + "2"); } // https://bugs.eclipse.org/bugs/show_bug.cgi?id=162026 public void test025() {