Skip to content

Commit 06da123

Browse files
author
zhourenjian
committed
Fixed bug#1843521 Stack overflow on evaluating instanceof operator
https://sourceforge.net/tracker/index.php?func=detail&aid=1843521&group_id=155436&atid=795800
1 parent adc0092 commit 06da123

File tree

6 files changed

+12
-0
lines changed

6 files changed

+12
-0
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ Byte.prototype.valueOf = function () { return 0; };
77
Byte.toString = Byte.prototype.toString = function () {
88
if (arguments.length != 0) {
99
return "" + arguments[0];
10+
} else if (this == Byte) {
11+
return "[Byte]"; // Byte.toString
1012
}
1113
return "" + this.valueOf ();
1214
};

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ Double.prototype.valueOf = function () { return 0; };
77
Double.toString = Double.prototype.toString = function () {
88
if (arguments.length != 0) {
99
return "" + arguments[0];
10+
} else if (this == Double) {
11+
return "[Double]"; // Double.toString
1012
}
1113
return "" + this.valueOf ();
1214
};

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ Float.prototype.valueOf = function () { return 0; };
77
Float.toString = Float.prototype.toString = function () {
88
if (arguments.length != 0) {
99
return "" + arguments[0];
10+
} else if (this == Float) {
11+
return "[Float]"; // Float.toString
1012
}
1113
return "" + this.valueOf ();
1214
};

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ Integer.prototype.valueOf = function () { return 0; };
77
Integer.toString = Integer.prototype.toString = function () {
88
if (arguments.length != 0) {
99
return "" + arguments[0];
10+
} else if (this == Integer) {
11+
return "[Integer]"; // Integer.toString
1012
}
1113
return "" + this.valueOf ();
1214
};

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ Long.prototype.valueOf = function () { return 0; };
77
Long.toString = Long.prototype.toString = function () {
88
if (arguments.length != 0) {
99
return "" + arguments[0];
10+
} else if (this == Long) {
11+
return "[Long]"; // Long.toString
1012
}
1113
return "" + this.valueOf ();
1214
};

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ Short.prototype.valueOf = function () { return 0; };
77
Short.toString = Short.prototype.toString = function () {
88
if (arguments.length != 0) {
99
return "" + arguments[0];
10+
} else if (this == Short) {
11+
return "[Short]"; // Short.toString
1012
}
1113
return "" + this.valueOf ();
1214
};

0 commit comments

Comments
 (0)