diff options
author | Kent Johnson | 2005-09-27 17:18:25 +0000 |
---|---|---|
committer | Kent Johnson | 2005-09-27 17:18:25 +0000 |
commit | cff2b8465481125045dc3f834a1434cbd8018f1a (patch) | |
tree | 379cd519704bf8f6121516186c5834d23e0eb145 | |
parent | acbec6aed838ef9d1858cf4f73a90bf74cfaeeda (diff) | |
download | eclipse.jdt.core-v_579_R31x.tar.gz eclipse.jdt.core-v_579_R31x.tar.xz eclipse.jdt.core-v_579_R31x.zip |
110783v_579_R31xR3_1_1
3 files changed, 63 insertions, 3 deletions
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/VarargsTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/VarargsTest.java index 1afd2ead99..03bbb0ee29 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/VarargsTest.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/VarargsTest.java @@ -1321,5 +1321,63 @@ public class VarargsTest extends AbstractComparableTest { "}\n", }, ""); - } + } + //https://bugs.eclipse.org/bugs/show_bug.cgi?id=110783 + public void test037() { + this.runConformTest( + new String[] { + "V.java", + "public class V {\n" + + " public static void main(String[] s) {\n" + + " V v = new V();\n" + + " v.foo(\"\", v, null, \"\");\n" + + " v.foo(\"\", v, null, \"\", 1);\n" + + " v.foo2(\"\");\n" + + " v.foo2(\"\", null);\n" + + " v.foo2(\"\", null, null);\n" + + " v.foo3(\"\", v, null, \"\", null);\n" + + " }\n" + + " void foo(String s, V v, Object... obs) {System.out.print(1);}\n" + + " void foo(String s, V v, String r, Object o, Object... obs) {System.out.print(2);}\n" + + " void foo2(Object... a) {System.out.print(1);}\n" + + " void foo2(String s, Object... a) {System.out.print(2);}\n" + + " void foo2(String s, Object o, Object... a) {System.out.print(3);}\n" + + " void foo3(String s, V v, String... obs) {System.out.print(1);}\n" + + " void foo3(String s, V v, String r, Object o, Object... obs) {System.out.print(2);}\n" + + "}\n", + }, + "222232"); + this.runNegativeTest( + new String[] { + "V.java", + "public class V {\n" + + " public static void main(String[] s) {\n" + + " V v = new V();\n" + + " v.foo2(null, \"\");\n" + + " v.foo2(null, \"\", \"\");\n" + + " v.foo3(\"\", v, null, \"\");\n" + + " }\n" + + " void foo2(String s, Object... a) {System.out.print(2);}\n" + + " void foo2(String s, Object o, Object... a) {System.out.print(3);}\n" + + " void foo3(String s, V v, String... obs) {System.out.print(1);}\n" + + " void foo3(String s, V v, String r, Object o, Object... obs) {System.out.print(2);}\n" + + "}\n", + }, + "----------\n" + + "1. ERROR in V.java (at line 4)\r\n" + + " v.foo2(null, \"\");\r\n" + + " ^^^^\n" + + "The method foo2(String, Object[]) is ambiguous for the type V\n" + + "----------\n" + + "2. ERROR in V.java (at line 5)\r\n" + + " v.foo2(null, \"\", \"\");\r\n" + + " ^^^^\n" + + "The method foo2(String, Object[]) is ambiguous for the type V\n" + + "----------\n" + + "3. ERROR in V.java (at line 6)\r\n" + + " v.foo3(\"\", v, null, \"\");\r\n" + + " ^^^^\n" + + "The method foo3(String, V, String[]) is ambiguous for the type V\n" + + "----------\n"); + } } diff --git a/org.eclipse.jdt.core/buildnotes_jdt-core.html b/org.eclipse.jdt.core/buildnotes_jdt-core.html index dd94867c42..99e57a159a 100644 --- a/org.eclipse.jdt.core/buildnotes_jdt-core.html +++ b/org.eclipse.jdt.core/buildnotes_jdt-core.html @@ -50,7 +50,9 @@ What's new in this drop</h2> </ul> <h3>Problem Reports Fixed</h3> -<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=110826">110826</a> +<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=110738">110738</a> +[1.5][compiler] Internal compiler error while processing Currency +<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=110826">110826</a> [compiler] Batch compiler doesn't work when set on the bootclasspath <br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=105430">105430</a> ecj chokes when classpath has leading separator diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java index 5d425a71b8..07653f3cc7 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java @@ -2798,7 +2798,7 @@ public abstract class Scope return true; } - if (one.isVarargs() && two.isVarargs() && oneParamsLength - 1 == twoParamsLength) { + if (one.isVarargs() && two.isVarargs() && oneParamsLength > twoParamsLength) { // special case when autoboxing makes (int, int...) better than (Object...) but not (int...) or (Integer, int...) if (((ArrayBinding) twoParams[twoParamsLength - 1]).elementsType().id != TypeIds.T_JavaLangObject) return false; |