File tree Expand file tree Collapse file tree 3 files changed +38
-16
lines changed
sources/net.sf.j2s.java.core/src/java/lang Expand file tree Collapse file tree 3 files changed +38
-16
lines changed Original file line number Diff line number Diff line change @@ -1948,7 +1948,10 @@ Clazz.exceptionOf=function(e, clazz) {
19481948 }
19491949 else
19501950 return false ;
1951- } ;
1951+ } ;
1952+
1953+ /* sgurin: preserve Number.prototype.toString */
1954+ Number . prototype . _numberToString = Number . prototype . toString ;
19521955
19531956Clazz . declarePackage ( "java.io" ) ;
19541957//Clazz.declarePackage ("java.lang");
Original file line number Diff line number Diff line change @@ -83,14 +83,17 @@ if(s == null || ! Clazz.instanceOf(s, Integer) ){
8383}
8484return s . valueOf ( ) == this . valueOf ( ) ;
8585} , "Object" ) ;
86- Integer . toHexString = Integer . prototype . toHexString = function ( i ) {
87- return i . toString ( 16 ) ;
86+ Integer . toHexString = Integer . prototype . toHexString = function ( d ) {
87+ if ( d . valueOf ) d = d . valueOf ( ) ;
88+ return d . _numberToString ( 16 ) ;
8889} ;
89- Integer . toOctalString = Integer . prototype . toOctalString = function ( i ) {
90- return i . toString ( 8 ) ;
90+ Integer . toOctalString = Integer . prototype . toOctalString = function ( d ) {
91+ if ( d . valueOf ) d = d . valueOf ( ) ;
92+ return d . _numberToString ( 8 ) ;
9193} ;
92- Integer . toBinaryString = Integer . prototype . toBinaryString = function ( i ) {
93- return i . toString ( 2 ) ;
94+ Integer . toBinaryString = Integer . prototype . toBinaryString = function ( d ) {
95+ if ( d . valueOf ) d = d . valueOf ( ) ;
96+ return d . _numberToString ( 2 ) ;
9497} ;
9598Integer . decode = Clazz . defineMethod ( Integer , "decode" ,
9699function ( nm ) {
Original file line number Diff line number Diff line change @@ -83,15 +83,31 @@ if(s == null || !Clazz.instanceOf(s, Long) ){
8383}
8484return s . valueOf ( ) == this . valueOf ( ) ;
8585} , "Object" ) ;
86- Long . toHexString = Long . prototype . toHexString = function ( i ) {
87- return i . toString ( 16 ) ;
88- } ;
89- Long . toOctalString = Long . prototype . toOctalString = function ( i ) {
90- return i . toString ( 8 ) ;
91- } ;
92- Long . toBinaryString = Long . prototype . toBinaryString = function ( i ) {
93- return i . toString ( 2 ) ;
94- } ;
86+
87+ Clazz . defineMethod ( Long , "toHexString" ,
88+ function ( d ) {
89+ if ( d . valueOf ) d = d . valueOf ( ) ;
90+ var r = d . _numberToString ( 16 ) ;
91+ return r ;
92+ } , "Number" ) ;
93+ Long . toHexString = Long . prototype . toHexString ;
94+
95+ Clazz . defineMethod ( Long , "toOctalString" ,
96+ function ( d ) {
97+ if ( d . valueOf ) d = d . valueOf ( ) ;
98+ var r = d . _numberToString ( 8 ) ;
99+ return r ;
100+ } , "Number" ) ;
101+ Long . toOctalString = Long . prototype . toOctalString ;
102+
103+ Clazz . defineMethod ( Long , "toBinaryString" ,
104+ function ( d ) {
105+ if ( d . valueOf ) d = d . valueOf ( ) ;
106+ var r = d . _numberToString ( 2 ) ;
107+ return r ;
108+ } , "Number" ) ;
109+ Long . toBinaryString = Long . prototype . toBinaryString ;
110+
95111Long . decode = Clazz . defineMethod ( Long , "decode" ,
96112function ( nm ) {
97113var radix = 10 ;
You can’t perform that action at this time.
0 commit comments