Skip to content

Commit 85ce074

Browse files
author
soheil_h_y
committed
1. $valueOf is implemented for Integer/Long/Float/Double
1 parent 7fd1210 commit 85ce074

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ throw new NumberFormatException ("null");
5151
}
5252
return parseFloat (s);
5353
}, "String");
54-
Double.parseDouble = Double.prototype.parseDouble;
54+
Double.$valueOf = Double.parseDouble = Double.prototype.parseDouble;
5555

5656
Clazz.defineMethod (Double, "equals",
5757
function (s) {
@@ -60,4 +60,5 @@ if(s == null || ! Clazz.instanceOf(s, Double) ){
6060
}
6161
return s.valueOf() == this.valueOf();
6262
}, "Object");
63-
});
63+
});
64+

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ throw new NumberFormatException ("null");
4545
}
4646
return parseFloat (s);
4747
}, "String");
48-
Float.parseFloat = Float.prototype.parseFloat;
48+
Float.$valueOf = Float.parseFloat = Float.prototype.parseFloat;
4949
Clazz.defineMethod (Float, "isNaN",
5050
function (num) {
5151
return isNaN (num);
@@ -64,4 +64,4 @@ if(s == null || ! Clazz.instanceOf(s, Float) ){
6464
}
6565
return s.valueOf() == this.valueOf();
6666
}, "Object");
67-
});
67+
});

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ Clazz.defineMethod (Integer, "parseInt",
4747
function (s) {
4848
return Integer.parseInt (s, 10);
4949
}, "String");
50-
Integer.parseInt = Integer.prototype.parseInt;
50+
51+
Integer.$valueOf = Integer.parseInt = Integer.prototype.parseInt;
5152

5253
Clazz.defineMethod (Integer, "equals",
5354
function (s) {
@@ -65,4 +66,5 @@ Integer.toOctalString = Integer.prototype.toOctalString = function (i) {
6566
Integer.toBinaryString = Integer.prototype.toBinaryString = function (i) {
6667
return i.toString (2);
6768
};
68-
});
69+
});
70+

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ throw new NumberFormatException ("radix " + radix + " greater than Character.MA
4242
}
4343
return parseInt (s, radix);
4444
}, "String, Number");
45-
Long.parseLong = Long.prototype.parseLong;
45+
Long.$valueOf = Long.parseLong = Long.prototype.parseLong;
4646
Clazz.defineMethod (Long, "parseLong",
4747
function (s) {
4848
return Long.parseLong (s, 10);
@@ -56,4 +56,5 @@ if(s == null || ! Clazz.instanceOf(s, Long) ){
5656
}
5757
return s.valueOf() == this.valueOf();
5858
}, "Object");
59-
});
59+
});
60+

0 commit comments

Comments
 (0)