Skip to content

Commit 960a68d

Browse files
author
soheil_h_y
committed
1. paserXXX should return an object of Type XXX not just an object
1 parent 13ad50b commit 960a68d

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ var doubleVal = parseFloat (s);
5353
if(isNaN(doubleVal)){
5454
throw new NumberFormatException ("Not a Number : " + s);
5555
}
56-
return doubleVal;
56+
return new Double(doubleVal);
5757
}, "String");
5858
Double.$valueOf = Double.parseDouble = Double.prototype.parseDouble;
5959

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ var floatVal = parseFloat (s);
4747
if(isNaN(floatVal)){
4848
throw new NumberFormatException ("Not a Number : " + s);
4949
}
50-
return floatVal;
50+
return new Float(floatVal);
5151
}, "String");
5252
Float.$valueOf = Float.parseFloat = Float.prototype.parseFloat;
5353
Clazz.defineMethod (Float, "isNaN",

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ var integer = parseInt (s, radix);
4444
if(isNaN(integer)){
4545
throw new NumberFormatException ("Not a Number : " + s);
4646
}
47-
return integer;
47+
return new Integer(integer);
4848
}, "String, Number");
4949
Integer.parseInt = Integer.prototype.parseInt;
5050
Clazz.defineMethod (Integer, "parseInt",

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ var longVal = parseInt (s, radix);
4444
if(isNaN(longVal)){
4545
throw new NumberFormatException ("Not a Number : " + s);
4646
}
47-
return longVal;
47+
return new Long(longVal);
4848
}, "String, Number");
4949
Long.$valueOf = Long.parseLong = Long.prototype.parseLong;
5050
Clazz.defineMethod (Long, "parseLong",

0 commit comments

Comments
 (0)