### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java,v retrieving revision 1.107 diff -u -r1.107 ASTNode.java --- compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java 8 Feb 2011 05:16:20 -0000 1.107 +++ compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java 15 Feb 2011 09:39:27 -0000 @@ -296,7 +296,7 @@ invocationStatus |= checkInvocationArgument(scope, arguments[i], params[i] , argumentTypes[i], originalRawParam); } int argLength = arguments.length; - if (lastIndex < argLength) { // vararg argument was provided + if (lastIndex <= argLength) { // https://bugs.eclipse.org/bugs/show_bug.cgi?id=337093 TypeBinding parameterType = params[lastIndex]; TypeBinding originalRawParam = null; #P org.eclipse.jdt.core.tests.compiler Index: src/org/eclipse/jdt/core/tests/compiler/regression/VarargsTest.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/VarargsTest.java,v retrieving revision 1.62 diff -u -r1.62 VarargsTest.java --- src/org/eclipse/jdt/core/tests/compiler/regression/VarargsTest.java 20 Oct 2010 14:25:09 -0000 1.62 +++ src/org/eclipse/jdt/core/tests/compiler/regression/VarargsTest.java 15 Feb 2011 09:39:47 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2010 IBM Corporation and others. + * Copyright (c) 2005, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -2196,4 +2196,42 @@ " X$1(X arg0, java.lang.Integer $anonymous0, java.lang.String... $anonymous1, java.lang.Float arg3);\n"; checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X$1.class", "X$1", expectedOutput); } + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=337093 + public void test063() { + Map options = getCompilerOptions(); + options.put(CompilerOptions.OPTION_ReportMissingOverrideAnnotationForInterfaceMethodImplementation, CompilerOptions.DISABLED); + this.runNegativeTest( + new String[] { + "X.java", + "import java.util.Collection;\n" + + "import java.util.Iterator;\n" + + "public class X {\n" + + " public static class IteratorChain implements Iterator {\n" + + " public IteratorChain(Collection a, Collection b, Collection ... collections) {\n" + + " }\n" + + " public boolean hasNext() {\n" + + " return false;\n" + + " }\n" + + " public T next() {\n" + + " return null;\n" + + " }\n" + + " public void remove() {\n" + + " throw new UnsupportedOperationException();\n" + + " }\n" + + " }\n" + + " public static void main(String[] args) {\n" + + " new IteratorChain(null, null);\n" + + " }\n" + + "}\n", // ================= + }, + "----------\n" + + "1. WARNING in X.java (at line 18)\n" + + " new IteratorChain(null, null);\n" + + " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + + "Type safety : A generic array of Collection is created for a varargs parameter\n" + + "----------\n", + null, + true, + options); + } }