Skip to content

Commit fbd83d8

Browse files
authored
Merge pull request #42 from BobHanson/master
byte and short array upgrade -- full compatibility with Java for all operations
2 parents fca9228 + a774ed0 commit fbd83d8

File tree

8 files changed

+5292
-169
lines changed

8 files changed

+5292
-169
lines changed
1.15 KB
Binary file not shown.
1.15 KB
Binary file not shown.

sources/net.sf.j2s.core/src/net/sf/j2s/core/astvisitors/Java2ScriptVisitor.java

Lines changed: 289 additions & 163 deletions
Large diffs are not rendered by default.
50.4 KB
Binary file not shown.

sources/net.sf.j2s.java.core/srcjs/js/SwingJSApplet.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// SwingJSApplet.js
22

33
// generic SwingJS Applet
4-
4+
// BH 3/14/2018 8:42:33 PM adds applet._window for JSObject
55
// BH 12/18/2016 8:09:56 AM added SwingJS.Loaded and SwingJS.isLoaded
66
// BH 7/24/2015 9:09:39 AM allows setting Info.resourcePath
77
// BH 4/28/2015 10:15:32 PM adds getAppletHtml
@@ -37,6 +37,7 @@ if (typeof(SwingJS) == "undefined") {
3737
this._appletType = "SwingJS._Applet" + (Info.isSigned ? " (signed)" : "");
3838
this._isJava = true;
3939
this._availableParams = null; // all allowed
40+
this._window = window;
4041
if (checkOnly)
4142
return this;
4243
this._isSigned = Info.isSigned;

sources/net.sf.j2s.java.core/srcjs/js/j2sClazz.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
// Google closure compiler cannot handle Clazz.new or Clazz.super
99

10+
// BH 5/19/2018 8:22:25 PM fix for new int[] {'a'}
1011
// BH 4/16/2018 6:14:10 PM msie flag in monitor
1112
// BH 2/22/2018 12:34:07 AM array.clone() fix
1213
// BH 2/20/2018 12:59:28 AM adds Character.isISOControl
@@ -853,10 +854,14 @@ var newTypedA = function(baseClass, args, nBits, ndims) {
853854
// Clazz.newA(5 ,null, "SA") new String[5] val = null
854855
// Clazz.newA(-1, ["A","B"], "SA") new String[] val = {"A", "B"}
855856
// Clazz.newA(3, 5, 0, "IAA") new int[3][5] (second pass, so now args = [5, 0, "IA"])
856-
if (val == null)
857+
if (val == null) {
857858
nBits = 0;
858-
else if (nBits > 0 && dim < 0)
859+
} else if (nBits > 0 && dim < 0) {
860+
// make sure this is not a character
861+
for (var i = val.length; --i >= 0;)
862+
val[i].charAt && (val[i] = val[i].charAt(0));
859863
dim = val; // because we can initialize an array using new Int32Array([...])
864+
}
860865
if (nBits > 0)
861866
ndims = 1;
862867
var atype;

0 commit comments

Comments
 (0)