JAL-3223 - update swingjs to 3.2.9-j11 Jalview-JS/develop_j2s_v3_2_9_j11
authorJim Procter <jprocter@issues.jalview.org>
Thu, 10 Dec 2020 17:50:05 +0000 (17:50 +0000)
committerJim Procter <jprocter@issues.jalview.org>
Thu, 10 Dec 2020 17:50:05 +0000 (17:50 +0000)
15 files changed:
swingjs/SwingJS-site.zip
swingjs/differences.txt
swingjs/net.sf.j2s.core-j11.jar
swingjs/net.sf.j2s.core.jar
swingjs/timestamp
swingjs/ver/3.2.7/SwingJS-site.zip
swingjs/ver/3.2.8/SwingJS-site.zip
swingjs/ver/3.2.9-j11/SwingJS-site.zip
swingjs/ver/3.2.9-j11/differences.txt
swingjs/ver/3.2.9-j11/net.sf.j2s.core-j11.jar
swingjs/ver/3.2.9-j11/timestamp
swingjs/ver/3.2.9/SwingJS-site.zip
swingjs/ver/3.2.9/differences.txt
swingjs/ver/3.2.9/net.sf.j2s.core.jar
swingjs/ver/3.2.9/timestamp

index a1b1cf6..52b640a 100644 (file)
Binary files a/swingjs/SwingJS-site.zip and b/swingjs/SwingJS-site.zip differ
index 70eabbc..60f5fcc 100644 (file)
@@ -31,6 +31,7 @@ ever be shadowed or overridden by subclasses. For example, we see in java.lang.T
 ----------------------------------
 
 
 ----------------------------------
 
 
+updated 12/6/2020 -- note about restrictions on long, including BitSet and Scanner
 updated 3/21/2020 -- adds note about HashMap, Hashtable, and HashSet iterator ordering
 updated 3/20/2020 -- adds note about interning, new String("xxx"), and "xxx"
 updated 2/26/2020 -- adds Graphics.setClip issue
 updated 3/21/2020 -- adds note about HashMap, Hashtable, and HashSet iterator ordering
 updated 3/20/2020 -- adds note about interning, new String("xxx"), and "xxx"
 updated 2/26/2020 -- adds Graphics.setClip issue
@@ -480,6 +481,8 @@ MINOR ISSUES--requiring some rewriting/refactoring outside of SwingJS
 
 See below for a full discussion.
 
 
 See below for a full discussion.
 
+Restrictions on long
+Restriction on BitSet and Scanner
 HashMap, Hashtable, and HashSet iterator ordering
 interning, new String("xxx") vs "xxx"
 Names with "$" and "_"
 HashMap, Hashtable, and HashSet iterator ordering
 interning, new String("xxx") vs "xxx"
 Names with "$" and "_"
@@ -586,6 +589,60 @@ changed to JSToolkit.isDispatchThread()
 MINOR ISSUES--requiring some rewriting/refactoring outside of SwingJS  
 =====================================================================
 
 MINOR ISSUES--requiring some rewriting/refactoring outside of SwingJS  
 =====================================================================
 
+restrictions on long
+--------------------
+
+Java's 64-bit long type is not supported in JavaScript. There is no Int64Array in JavaScript,
+and 0x20000000000000 + 1 evaluates to 0x20000000000000, not 0x20000000000001. 
+(Likewise, -0x20000000000000 - 1 is left unchanged.) 
+
+The largest "integer" value in JavaScript is 9007199254740991 (9.007199254740991E13, or 0x1FFFFFFFFFFFFFF).
+Effectively, you get to use only 53 bits of the long, not 64. Trying to set a long larger than
+0x1FFFFFFFFFFFFFF or smaller than -0x1FFFFFFFFFFFFFF will result in a NumberFormatException.
+
+The transpiler handles conversion to long the same as Java for all cases other than from double. 
+
+For small double values, there is no problem, and, in fact, this is a known trick used to round 
+doubles and floats toward zero:
+
+double d;
+d = (long) 3.8;
+assert(d == 3);
+d = (long) -3.8;
+assert(d == -3);
+
+SwingJS will evaluate (long) d as 0 for d > 9007199254740991 
+or d < -9007199254740991, same as Java returns for Double.NaN.
+So, in Java we have:
+
+               assert(((long) Double.NaN) == 0);
+               assert(((int) Double.NaN) == 0);
+               assert(((long) Float.NaN) == 0);
+               assert(((int) Float.NaN) == 0);
+
+and also, in JavaScript only, we also have:
+
+               double d = 0x2000000000000L;
+               assert(((long) d) == 0);
+
+
+restrictions on BitSet and Scanner
+----------------------------------
+
+Because of the issue of long being only 53 bits, any time a method returns a long value, considerations must
+be made as to whether this will work in JavaScript. In particular, BitSet and Scanner have issues. 
+
+In SwingJS, java.util.BitSet has been implemented as a 32-bit integer-based bitset. This was no problem in
+Java 6, but starting with Java 7, a method was added to BitSet that allows for the extraction of the 
+underlying long[] word data. This is not work in JavaScript. Instead, SwingJS java.util.Bitset.toLongArray() will deliver 
+32-bit int[] data.
+
+SwingJS Scanner has hasNextLong() and nextLong(), and although it will scan through long numbers,
+Scanner will choke on long numbers greater than the JavaScript 53-bit limit. hasNextLong() will 
+return false, and nextLong() will throw an InputMismatchException triggered by the NumberFormatException
+thrown by Long.parseLong(). 
+
+
 HashMap, Hashtable, and HashSet iterator ordering
 -------------------------------------------------
 
 HashMap, Hashtable, and HashSet iterator ordering
 -------------------------------------------------
 
@@ -1432,6 +1489,10 @@ and so are not implmented. javax.swing.text.View and its subclasses are not impl
 
 The JS document model does not allow two text fields to address the same underlying document. 
 
 
 The JS document model does not allow two text fields to address the same underlying document. 
 
+JavaScript is slightly different from Java in that the field value is changed asynchronously after
+the keypressed event, so Java actions that are keyed to KEY_PRESSED may not pick up the new 
+key value even after SwingUtilities.invokeLater() is called. Thus, key pressed actions may need
+to be recorded after a key released event instead. 
 
 Formatter/Regex limitations
 ---------------------------
 
 Formatter/Regex limitations
 ---------------------------
index 928a835..8cae046 100644 (file)
Binary files a/swingjs/net.sf.j2s.core-j11.jar and b/swingjs/net.sf.j2s.core-j11.jar differ
index 6e3c4f0..ab277a9 100644 (file)
Binary files a/swingjs/net.sf.j2s.core.jar and b/swingjs/net.sf.j2s.core.jar differ
index 89e1eb4..df5be44 100644 (file)
@@ -1 +1 @@
-20200615125203 
+20201206115202 
index 763362e..dd6765a 100644 (file)
Binary files a/swingjs/ver/3.2.7/SwingJS-site.zip and b/swingjs/ver/3.2.7/SwingJS-site.zip differ
index 46f33d8..dd6765a 100644 (file)
Binary files a/swingjs/ver/3.2.8/SwingJS-site.zip and b/swingjs/ver/3.2.8/SwingJS-site.zip differ
index a1b1cf6..dd6765a 100644 (file)
Binary files a/swingjs/ver/3.2.9-j11/SwingJS-site.zip and b/swingjs/ver/3.2.9-j11/SwingJS-site.zip differ
index 70eabbc..46e49ec 100644 (file)
@@ -1432,6 +1432,10 @@ and so are not implmented. javax.swing.text.View and its subclasses are not impl
 
 The JS document model does not allow two text fields to address the same underlying document. 
 
 
 The JS document model does not allow two text fields to address the same underlying document. 
 
+JavaScript is slightly different from Java in that the field value is changed asynchronously after
+the keypressed event, so Java actions that are keyed to KEY_PRESSED may not pick up the new 
+key value even after SwingUtilities.invokeLater() is called. Thus, key pressed actions may need
+to be recorded after a key released event instead. 
 
 Formatter/Regex limitations
 ---------------------------
 
 Formatter/Regex limitations
 ---------------------------
index 928a835..8cae046 100644 (file)
Binary files a/swingjs/ver/3.2.9-j11/net.sf.j2s.core-j11.jar and b/swingjs/ver/3.2.9-j11/net.sf.j2s.core-j11.jar differ
index a1b1cf6..52b640a 100644 (file)
Binary files a/swingjs/ver/3.2.9/SwingJS-site.zip and b/swingjs/ver/3.2.9/SwingJS-site.zip differ
index 70eabbc..60f5fcc 100644 (file)
@@ -31,6 +31,7 @@ ever be shadowed or overridden by subclasses. For example, we see in java.lang.T
 ----------------------------------
 
 
 ----------------------------------
 
 
+updated 12/6/2020 -- note about restrictions on long, including BitSet and Scanner
 updated 3/21/2020 -- adds note about HashMap, Hashtable, and HashSet iterator ordering
 updated 3/20/2020 -- adds note about interning, new String("xxx"), and "xxx"
 updated 2/26/2020 -- adds Graphics.setClip issue
 updated 3/21/2020 -- adds note about HashMap, Hashtable, and HashSet iterator ordering
 updated 3/20/2020 -- adds note about interning, new String("xxx"), and "xxx"
 updated 2/26/2020 -- adds Graphics.setClip issue
@@ -480,6 +481,8 @@ MINOR ISSUES--requiring some rewriting/refactoring outside of SwingJS
 
 See below for a full discussion.
 
 
 See below for a full discussion.
 
+Restrictions on long
+Restriction on BitSet and Scanner
 HashMap, Hashtable, and HashSet iterator ordering
 interning, new String("xxx") vs "xxx"
 Names with "$" and "_"
 HashMap, Hashtable, and HashSet iterator ordering
 interning, new String("xxx") vs "xxx"
 Names with "$" and "_"
@@ -586,6 +589,60 @@ changed to JSToolkit.isDispatchThread()
 MINOR ISSUES--requiring some rewriting/refactoring outside of SwingJS  
 =====================================================================
 
 MINOR ISSUES--requiring some rewriting/refactoring outside of SwingJS  
 =====================================================================
 
+restrictions on long
+--------------------
+
+Java's 64-bit long type is not supported in JavaScript. There is no Int64Array in JavaScript,
+and 0x20000000000000 + 1 evaluates to 0x20000000000000, not 0x20000000000001. 
+(Likewise, -0x20000000000000 - 1 is left unchanged.) 
+
+The largest "integer" value in JavaScript is 9007199254740991 (9.007199254740991E13, or 0x1FFFFFFFFFFFFFF).
+Effectively, you get to use only 53 bits of the long, not 64. Trying to set a long larger than
+0x1FFFFFFFFFFFFFF or smaller than -0x1FFFFFFFFFFFFFF will result in a NumberFormatException.
+
+The transpiler handles conversion to long the same as Java for all cases other than from double. 
+
+For small double values, there is no problem, and, in fact, this is a known trick used to round 
+doubles and floats toward zero:
+
+double d;
+d = (long) 3.8;
+assert(d == 3);
+d = (long) -3.8;
+assert(d == -3);
+
+SwingJS will evaluate (long) d as 0 for d > 9007199254740991 
+or d < -9007199254740991, same as Java returns for Double.NaN.
+So, in Java we have:
+
+               assert(((long) Double.NaN) == 0);
+               assert(((int) Double.NaN) == 0);
+               assert(((long) Float.NaN) == 0);
+               assert(((int) Float.NaN) == 0);
+
+and also, in JavaScript only, we also have:
+
+               double d = 0x2000000000000L;
+               assert(((long) d) == 0);
+
+
+restrictions on BitSet and Scanner
+----------------------------------
+
+Because of the issue of long being only 53 bits, any time a method returns a long value, considerations must
+be made as to whether this will work in JavaScript. In particular, BitSet and Scanner have issues. 
+
+In SwingJS, java.util.BitSet has been implemented as a 32-bit integer-based bitset. This was no problem in
+Java 6, but starting with Java 7, a method was added to BitSet that allows for the extraction of the 
+underlying long[] word data. This is not work in JavaScript. Instead, SwingJS java.util.Bitset.toLongArray() will deliver 
+32-bit int[] data.
+
+SwingJS Scanner has hasNextLong() and nextLong(), and although it will scan through long numbers,
+Scanner will choke on long numbers greater than the JavaScript 53-bit limit. hasNextLong() will 
+return false, and nextLong() will throw an InputMismatchException triggered by the NumberFormatException
+thrown by Long.parseLong(). 
+
+
 HashMap, Hashtable, and HashSet iterator ordering
 -------------------------------------------------
 
 HashMap, Hashtable, and HashSet iterator ordering
 -------------------------------------------------
 
@@ -1432,6 +1489,10 @@ and so are not implmented. javax.swing.text.View and its subclasses are not impl
 
 The JS document model does not allow two text fields to address the same underlying document. 
 
 
 The JS document model does not allow two text fields to address the same underlying document. 
 
+JavaScript is slightly different from Java in that the field value is changed asynchronously after
+the keypressed event, so Java actions that are keyed to KEY_PRESSED may not pick up the new 
+key value even after SwingUtilities.invokeLater() is called. Thus, key pressed actions may need
+to be recorded after a key released event instead. 
 
 Formatter/Regex limitations
 ---------------------------
 
 Formatter/Regex limitations
 ---------------------------
index 6e3c4f0..ab277a9 100644 (file)
Binary files a/swingjs/ver/3.2.9/net.sf.j2s.core.jar and b/swingjs/ver/3.2.9/net.sf.j2s.core.jar differ
index d7eef9d..df5be44 100644 (file)
@@ -1 +1 @@
-20200615125140 
+20201206115202