Skip to content

Commit e5b4842

Browse files
hansonrhansonr
authored andcommitted
fixes innerClass[].getClass().getName() returning "." not "$"
1 parent 9a04df3 commit e5b4842

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

sources/net.sf.j2s.java.core/src/test/Test_Inner.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ public static void main(String[] args) {
8080
System.out.println(inner.t_test);
8181
System.out.println("new Test_Inner(){}.t_test=" + new Test_Inner(7) {}.t_test);
8282
Test_Abstract_a abs = inner.new Test_Abstract_a();
83+
System.out.println(new Test_Abstract_a[] {abs}.getClass().getName());
8384
abs.testing();
8485
new Test_Inner(8) {}.new Test_Abstract_a().testing();
8586

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

Lines changed: 3 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 2020.07.27 fix for inner class array names
1011
// BH 2020.06.18 better test for instanceof Object[]
1112
// BH 2020.06.03 sets user.home and user.dir to /TEMP/swingjs, and user.name to "swingjs"
1213
// BH 2020.04.01 2.2.0-v1e fixes missing C$.superclazz when class loaded from core
@@ -1091,7 +1092,7 @@ var arrayClass = function(baseClass, ndim) {
10911092
break;
10921093
default:
10931094
if (stub.length > 1)
1094-
stub = baseClass.__CLASS_NAME__;
1095+
stub = baseClass.__CLASS_NAME$__ || baseClass.__CLASS_NAME__;
10951096
break;
10961097
}
10971098
if (stub.indexOf(".") >= 0)
@@ -1254,7 +1255,7 @@ var shiftArray = function(a, i0, k) {
12541255

12551256
var getParamCode = Clazz._getParamCode = function(cl) {
12561257
cl.$clazz$ && (cl = cl.$clazz$);
1257-
return cl.__PARAMCODE || (cl.__PARAMCODE = stripJavaLang(cl.__CLASS_NAME__).replace(/\./g, '_'));
1258+
return cl.__PARAMCODE || (cl.__PARAMCODE = stripJavaLang(cl.__CLASS_NAME$__ || cl.__CLASS_NAME__).replace(/\./g, '_'));
12581259
}
12591260

12601261
var newTypedA = function(baseClass, args, nBits, ndims, isClone) {

0 commit comments

Comments
 (0)