|
From: SourceForge.net <no...@so...> - 2008-06-12 20:41:33
|
Bugs item #1992394, was opened at 2008-06-12 15:41 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=438935&aid=1992394&group_id=44253 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: DynamicJava Group: 4: Serious Status: Open Resolution: None Priority: 7 Private: No Submitted By: Mathias Ricken (mgricken) Assigned to: Dan Smith (dlsmith) Summary: Interpreter does not support methods with varargs Initial Comment: The DynamicJava interpreter does not allow calls to methods that have varargs using the varargs syntax. This is true both for methods defined in the Definitions Pane as well as in the Interactions Pane: // In Definitions Pane public class VarArgsTest { public void test(Object...x) { System.out.println("test:"+ java.util.Arrays.toString(x)); } public static void stest(Object...x) { System.out.println("stest "+ java.util.Arrays.toString(x)); } public static void main(String[] args) { // this all works, as expected stest("x", "y", "z"); stest(null, "x", "y"); VarArgsTest v = new VarArgsTest(); v.stest("x", "y", "z"); v.stest(null, "x", "y"); v.test("x", "y", "z"); v.test(null, "x", "y"); } } // In Interactions Pane > VarArgsTest.stest("x", "y", "z") Static Error: No method in VarArgsTest with name 'stest' accepts arguments (String, String, String) > VarArgsTest.stest(null, "y", "z") Static Error: No method in VarArgsTest with name 'stest' accepts arguments ((null), String, String) > VarArgsTest v = new VarArgsTest() > v.test("x", "y", "z") Static Error: No method in VarArgsTest with name 'test' accepts arguments (String, String, String) > v.test(null, "y", "z") Static Error: No method in VarArgsTest with name 'test' accepts arguments ((null), String, String) As already stated, the problem also occurs for local methods defined in the Interactions Pane: > void itest(Object...x) { System.out.println("itest: "+java.util.Arrays.toString(x)); } > itest("x", "y", "z") Static Error: No method in FunctionWrapperClass.Overload1 with name 'itest' accepts arguments (String, String, String) > itest(null, "y", "z") Static Error: No method in FunctionWrapperClass.Overload2 with name 'itest' accepts arguments ((null), String, String) And for classes defined in the Interactions Pane: > public class IVarArgsTest { public void test(Object...x) { System.out.println("test: "+java.util.Arrays.toString(x)); } public static void stest(Object...x) { System.out.println("stest "+java.util.Arrays.toString(x)); } public static void main(String[] args) { stest("x", "y", "z"); stest(null, "x", "y"); IVarArgsTest v = new IVarArgsTest(); v.stest("x", "y", "z"); v.stest(null, "x", "y"); v.test("x", "y", "z"); v.test(null, "x", "y"); } } Static Error: No method in IVarArgsTest with name 'stest' accepts arguments (String, String, String) The methods can be called using the array syntax: > VarArgsTest.stest(new Object[] {"x", "y", "z"}) stest [x, y, z] > v.test(new Object[] {"x", "y", "z"}) test: [x, y, z] > itest(new Object[] {"x", "y", "z"}) itest: [x, y, z] Please also take a look at a previous bug report that did not allow null values in varargs, and make sure the problem does not reappear when this bug has been fixed: [ 1151966 ] Interactions pane doesn't process nulls in varargs correctly https://sourceforge.net/tracker/index.php?func=detail&aid=1151966&group_id=44253&atid=438935 ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=438935&aid=1992394&group_id=44253 |