Skip to content

Commit 7629a65

Browse files
committed
j2sClazz update for Clazz.loadClass() and Class.forName not fully
initializing static field
1 parent f86989f commit 7629a65

File tree

10 files changed

+30
-48
lines changed

10 files changed

+30
-48
lines changed
227 KB
Binary file not shown.
30 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20191208152303
1+
20191214114427
227 KB
Binary file not shown.
30 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20191208152303
1+
20191214114427
227 KB
Binary file not shown.

sources/net.sf.j2s.java.core/srcjs/js/devnotes.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,26 @@ j2sClazz and j2sApplet older development notes
33
j2sClazz.js (formerly j2s.lib.js)
44
-----------
55

6+
// BH 2019.12.03 3.2.5.v2 Object.class instanceof java.lang.Class
7+
// BH 2019.11.26 3.2.5.v1 errant if (args) in newInstance
8+
// BH 2019.11.07 3.2.5.v0 full encapsulation
9+
// BH 2019.11.07 3.2.5.v0 adds encapsulation for window
10+
// BH 2019.11.07 3.2.5.v0 splitting off $static$ from $clinit$ (see Java2ScriptVisitor notes)
11+
// BH 2019.10.30 Foo.parseFoo not Foo.parseFooRadix
12+
// BH 2019.10.26 subclass def should exclude __PARAMCODE
13+
// BH 2019.09.24 missing isArray$() in Integer.class
14+
// BH 2019.09.26 superfast byte[] -> String using TextDecoder
15+
// BH 2019.08.16 adds cache for instanceof
16+
// BH 2019.07.27 fixes array(intArray).clone
17+
// BH 2019.07.09 adds Java String.trim()
18+
// BH 2019.05.21 changes Clazz.isClassDefined to Clazz._isClassDefined for compression
19+
// BH 2019.05.13 fixes for Math.getExponent, Math.IEEERemainder, Array.equals(Object)
20+
// BH 2019.02.16 fixes typo in Integer.parseInt(s,radix)
21+
// BH 2019.02.07 fixes radix|10 should be radix||10
22+
// BH 2019.01.29 adds String.join$CharSequence$Iterable, String.join$CharSequence$CharSequenceA
23+
// BH 2019.01.13 3.2.4.07 adds Character.to[Title|Lower|Upper]Case(int)
24+
// BH 2019.01.08 3.2.4.07 fixes String.prototype.to[Upper|Lower]Case$java_util_Locale - using toLocal[Upper|Lower]Case()
25+
// BH 2019.01.03 3.2.4.07 adds ByteBuffer/CharBuffer support, proper CharSet encoding, including GBK (Standard Chinese)
626
// BH 12/30/2018 3.2.4.05 adds Class.forName("[XXX")
727
// BH 12/20/2018 3.2.4.05 fixes synthetic reference issue
828
// BH 12/13/2018 3.2.4.05 fixes Class.js field reflection, inner anonymous class of outer class creates wrong synthetic pointer

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

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,9 @@
77

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

10-
// BH 2019.12.03 Object.class instanceof java.lang.Class
11-
// BH 2019.11.26 3.2.5.v1 errant if (args) in newInstance
12-
// BH 2019.11.07 3.2.5.v0 full encapsulation
13-
// BH 2019.11.07 3.2.5.v0 adds encapsulation for window
14-
// BH 2019.11.07 3.2.5.v0 splitting off $static$ from $clinit$ (see Java2ScriptVisitor notes)
15-
// BH 2019.10.30 Foo.parseFoo not Foo.parseFooRadix
16-
// BH 2019.10.26 subclass def should exclude __PARAMCODE
17-
// BH 2019.09.24 missing isArray$() in Integer.class
18-
// BH 2019.09.26 superfast byte[] -> String using TextDecoder
19-
// BH 2019.08.16 adds cache for instanceof
20-
// BH 2019.07.27 fixes array(intArray).clone
21-
// BH 2019.07.09 adds Java String.trim()
22-
// BH 2019.05.21 changes Clazz.isClassDefined to Clazz._isClassDefined for compression
23-
// BH 2019.05.13 fixes for Math.getExponent, Math.IEEERemainder, Array.equals(Object)
24-
// BH 2019.02.16 fixes typo in Integer.parseInt(s,radix)
25-
// BH 2019.02.07 fixes radix|10 should be radix||10
26-
// BH 2019.01.29 adds String.join$CharSequence$Iterable, String.join$CharSequence$CharSequenceA
27-
// BH 2019.01.13 3.2.4.07 adds Character.to[Title|Lower|Upper]Case(int)
28-
// BH 2019.01.08 3.2.4.07 fixes String.prototype.to[Upper|Lower]Case$java_util_Locale - using toLocal[Upper|Lower]Case()
29-
// BH 2019.01.03 3.2.4.07 adds ByteBuffer/CharBuffer support, proper CharSet encoding, including GBK (Standard Chinese)
30-
31-
// see earlier notes at net.sf.j2s.java.core.srcjs/js/devnotes.txt
10+
// BH 2019.12.14 3.2.5.v2 Clazz._4Name initialization should be full static initialization
11+
12+
`// see earlier notes at net.sf.j2s.java.core.srcjs/js/devnotes.txt
3213

3314
//window["j2s.object.native"] = true; // this is not an option
3415

@@ -2367,7 +2348,7 @@ Clazz._4Name = function(clazzName, applet, state, asClazz, initialize, isQuiet)
23672348
clazzName = "java.lang." + clazzName;
23682349
var isok = Clazz._isClassDefined(clazzName);
23692350
if (isok && asClazz) {
2370-
return Clazz._initClass(Clazz.allClasses[clazzName],1);
2351+
return Clazz._initClass(Clazz.allClasses[clazzName],1,1);
23712352
}
23722353
if (!isok) {
23732354
var name2 = null;

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

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -13863,28 +13863,9 @@ if (ev.keyCode == 9 && ev.target["data-focuscomponent"]) {
1386313863

1386413864
// Google closure compiler cannot handle Clazz.new or Clazz.super
1386513865

13866-
// BH 2019.12.03 Object.class instanceof java.lang.Class
13867-
// BH 2019.11.26 3.2.5.v1 errant if (args) in newInstance
13868-
// BH 2019.11.07 3.2.5.v0 full encapsulation
13869-
// BH 2019.11.07 3.2.5.v0 adds encapsulation for window
13870-
// BH 2019.11.07 3.2.5.v0 splitting off $static$ from $clinit$ (see Java2ScriptVisitor notes)
13871-
// BH 2019.10.30 Foo.parseFoo not Foo.parseFooRadix
13872-
// BH 2019.10.26 subclass def should exclude __PARAMCODE
13873-
// BH 2019.09.24 missing isArray$() in Integer.class
13874-
// BH 2019.09.26 superfast byte[] -> String using TextDecoder
13875-
// BH 2019.08.16 adds cache for instanceof
13876-
// BH 2019.07.27 fixes array(intArray).clone
13877-
// BH 2019.07.09 adds Java String.trim()
13878-
// BH 2019.05.21 changes Clazz.isClassDefined to Clazz._isClassDefined for compression
13879-
// BH 2019.05.13 fixes for Math.getExponent, Math.IEEERemainder, Array.equals(Object)
13880-
// BH 2019.02.16 fixes typo in Integer.parseInt(s,radix)
13881-
// BH 2019.02.07 fixes radix|10 should be radix||10
13882-
// BH 2019.01.29 adds String.join$CharSequence$Iterable, String.join$CharSequence$CharSequenceA
13883-
// BH 2019.01.13 3.2.4.07 adds Character.to[Title|Lower|Upper]Case(int)
13884-
// BH 2019.01.08 3.2.4.07 fixes String.prototype.to[Upper|Lower]Case$java_util_Locale - using toLocal[Upper|Lower]Case()
13885-
// BH 2019.01.03 3.2.4.07 adds ByteBuffer/CharBuffer support, proper CharSet encoding, including GBK (Standard Chinese)
13886-
13887-
// see earlier notes at net.sf.j2s.java.core.srcjs/js/devnotes.txt
13866+
// BH 2019.12.14 3.2.5.v2 Clazz._4Name initialization should be full static initialization
13867+
13868+
`// see earlier notes at net.sf.j2s.java.core.srcjs/js/devnotes.txt
1388813869

1388913870
//window["j2s.object.native"] = true; // this is not an option
1389013871

@@ -16223,7 +16204,7 @@ Clazz._4Name = function(clazzName, applet, state, asClazz, initialize, isQuiet)
1622316204
clazzName = "java.lang." + clazzName;
1622416205
var isok = Clazz._isClassDefined(clazzName);
1622516206
if (isok && asClazz) {
16226-
return Clazz._initClass(Clazz.allClasses[clazzName],1);
16207+
return Clazz._initClass(Clazz.allClasses[clazzName],1,1);
1622716208
}
1622816209
if (!isok) {
1622916210
var name2 = null;

0 commit comments

Comments
 (0)