Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ff3aa7c

Browse files
committed
Fixed bug that Clazz.newArray is not updated to latest Java2Script
compiler for compiling new String[] { "1", "2" }
1 parent 8898da6 commit ff3aa7c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

sources/net.sf.j2s.java.core/src/java/lang/ClassExt.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,12 @@ Clazz.newArray = function () {
313313
dim = dim.charCodeAt (0); // char
314314
}
315315
var val = args[1];
316+
if (dim == -1) {
317+
if (val instanceof Array) {
318+
return val;
319+
}
320+
dim = 0; // fix it, or exceptions should be thrown
321+
}
316322
var arr = new Array (dim);
317323
for (var i = 0; i < dim; i++) {
318324
arr[i] = val;

0 commit comments

Comments
 (0)