Skip to content

Commit b1e65b0

Browse files
joefernerjimlloyd
authored andcommitted
initial work on varargs
1 parent 2a1ca00 commit b1e65b0

8 files changed

Lines changed: 22 additions & 1 deletion

commons-lang3-node-java.jar

857 Bytes
Binary file not shown.

test/Test$StaticEnum.class

0 Bytes
Binary file not shown.

test/Test$SubClass.class

0 Bytes
Binary file not shown.

test/Test$SuperClass.class

0 Bytes
Binary file not shown.

test/Test.class

436 Bytes
Binary file not shown.

test/Test.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,15 @@ public Test() {}
4444
public int methodAmbiguous(Double a) { return 1; }
4545
public int methodAmbiguous(Integer a) { return 2; }
4646

47+
public static String staticVarargs(Integer i, String... args) {
48+
java.lang.StringBuilder result = new java.lang.StringBuilder();
49+
result.append(i);
50+
for(String arg : args) {
51+
result.append(arg);
52+
}
53+
return result.toString();
54+
}
55+
4756
public static String staticBigDecimalToString(java.math.BigDecimal bigDecimal) { return bigDecimal.toString(); }
4857

4958
public static int staticChar(char ch) { return (int)ch; }

test/java-callStaticMethod-test.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,18 @@ exports['Java - Call Static Method'] = nodeunit.testCase({
266266
Test.staticEnumToStringSync(Test.StaticEnum.Value1);
267267
var str = Test.staticEnumToStringSync(Test.StaticEnum.Value1); // call it twice to ensure memo-ize is working
268268
test.equal(str, "Value1");
269+
test.done();
270+
},
271+
272+
"Call static method with varargs": function(test) {
273+
var Test = java.import("Test");
274+
275+
var str = Test.staticVarargsSync(5, java.newArray('java.lang.String', ['a', 'b', 'c']));
276+
test.equal(str, "5abc");
277+
278+
str = Test.staticVarargsSync(5, 'a', 'b', 'c');
279+
test.equal(str, "5abc");
280+
269281
test.done();
270282
}
271283

update-commons-lang.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ if [ -d build/commons-lang ]; then
66
else
77
mkdir -p build
88
cd build
9-
git clone --depth 1 git@github.com:apache/commons-lang.git
9+
git clone --depth 1 git@github.com:joeferner/commons-lang.git
1010
cd commons-lang
1111
fi
1212

0 commit comments

Comments
 (0)