Skip to content

Commit 50bb5aa

Browse files
author
jossonsmith
committed
Fixed bug that recursive method calls may break Clazz's simulating calling stacks.
Add LinkedHashMap so that HashSet will work.
1 parent a9323b8 commit 50bb5aa

File tree

3 files changed

+469
-5
lines changed

3 files changed

+469
-5
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ Clazz.getClass = function (clazzHost) {
200200
/*-# extendsProperties -> eP #-*/
201201
Clazz.extendsProperties = function (hostThis, hostSuper) {
202202
for (var o in hostSuper) {
203-
if (o != "prototype" && o != "superClazz"
203+
if (o != "b$" && o != "prototype" && o != "superClazz"
204204
&& o != "__CLASS_NAME__" && o != "implementz"
205205
&& !Clazz.checkInnerFunction (hostSuper, o)) {
206206
hostThis[o] = hostSuper[o];
@@ -227,7 +227,7 @@ Clazz.checkInnerFunction = function (hostSuper, funName) {
227227
/*-# implementsProperties -> ip #-*/
228228
Clazz.implementsProperties = function (hostThis, hostSuper) {
229229
for (var o in hostSuper) {
230-
if (o != "prototype" && o != "superClazz"
230+
if (o != "b$" && o != "prototype" && o != "superClazz"
231231
&& o != "__CLASS_NAME__" && o != "implementz") {
232232
if (typeof hostSuper[o] == "function") {
233233
/*

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,15 @@ Clazz.prepareCallback = function (objThis, args) {
6464
var classThisObj = args[0];
6565
var cbName = "b$"; // "callbacks";
6666
if (objThis != null && classThisObj != null && classThisObj != window) {
67-
var obs = objThis[cbName];
68-
if (obs == null) {
69-
obs = new Array ();
67+
var obs = new Array ();
68+
if (objThis[cbName] == null) {
69+
objThis[cbName] = obs;
70+
} else { // must make a copy!
71+
for (var s in objThis[cbName]) {
72+
if (s != "length") {
73+
obs[s] = objThis[cbName][s];
74+
}
75+
}
7076
objThis[cbName] = obs;
7177
}
7278
var className = Clazz.getClassName (classThisObj, true);

0 commit comments

Comments
 (0)