Skip to content

Commit 6201878

Browse files
authored
Merge pull request #53 from BobHanson/yadav1
fixing Character.toTitleCase, [Long,Integer,Short,Byte].toString(n,radix)
2 parents d72fc06 + ec0aade commit 6201878

File tree

11 files changed

+90
-68
lines changed

11 files changed

+90
-68
lines changed
1.57 KB
Binary file not shown.
0 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20180815205622
1+
20180816081255
1.57 KB
Binary file not shown.
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20180815205622
1+
20180816081255

sources/net.sf.j2s.core/src/net/sf/j2s/core/CorePlugin.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ public class CorePlugin extends Plugin {
2020
*
2121
*/
2222
public static String VERSION = "3.2.2.04";
23-
24-
// 3.1.1 last Zhou Renjian unqualified name version
25-
// 3.2.1.01 original SwingJS version through 2017 adds $-signatures for methods
26-
// 3.2.2.02 adds $-qualified names for all methods
23+
// 3.2.2.04 2018.08.15 fixing Java->JavaScript "getFinal" code for class names.
24+
// 3.2.2.04 adds support for window-level applets, such as JmolApplet
2725
// 3.2.2.03 adds Java 8 function and stream
28-
// 3.2.2.04 adds support for window-level applets, such as JmolApplet
26+
// 3.2.2.02 adds $-qualified names for all methods
27+
// 3.2.1.01 original SwingJS version through 2017 adds $-signatures for methods
28+
// 3.1.1 last Zhou Renjian unqualified name version
2929
/**
3030
* The constructor.
3131
*/
1.56 KB
Binary file not shown.

sources/net.sf.j2s.java.core/src/test/Test_Format.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ public static void main(String[] args) {
55

66
String s;
77

8+
s = String.format("%s %d", "testing", 3);
9+
assert(s.equals("testing 3"));
10+
11+
assert(String.format("%s %d-%d", "testing", 3, 4).equals("testing 3-4"));
12+
13+
814
s = test(100 * Math.pow(10, -6), 2);
915
System.out.println(s);
1016
assert s.equals("prec=2 0.00 0.00010 1.00e-04");

sources/net.sf.j2s.java.core/srcjs/js/j2sClazz.js

Lines changed: 39 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
// TODO: CharacterSequence does not implement Java 8 default methods chars() or codePoints()
1111
// It is possible that these might be loaded dynamically.
1212

13+
// BH 8/16/2018 3.2.2.04 fixes Character.toTitleCase$C, [Integer,Long,Short,Byte].toString(i,radix)
1314
// BH 8/13/2018 3.2.2.04 $finals to $finals$ -- basically variables are $xxx, methods are xxx$, and special values are $xxx$
1415
// BH 8/12/2018 3.2.2 adding J2S.onClazzLoaded hook for Clazz loaded
1516
// BH 8/11/2018 3.2.2 Clazz.newLambda removed
@@ -98,7 +99,7 @@ window["j2s.clazzloaded"] = true;
9899
_debugging: false,
99100
_loadcore: true,
100101
_nooutput: 0,
101-
_VERSION: "3.2.2.03",
102+
_VERSION_R: "3.2.2.05",
102103
_VERSION_T: "unknown",
103104
};
104105

@@ -3477,14 +3478,15 @@ var decorateAsNumber = function (clazz, qClazzName, type, PARAMCODE) {
34773478

34783479
decorateAsNumber(Integer, "Integer", "int", "I");
34793480

3480-
Integer.toString=Integer.toString$I=Integer.prototype.toString=function(){
3481-
if(arguments.length!=0){
3482-
return "" + arguments[0];
3483-
}
3484-
if(this===Integer){
3485-
return "class java.lang.Integer";
3486-
}
3487-
return "" + this.valueOf();
3481+
Integer.toString=Integer.toString$I=Integer.toString$I$I=Integer.prototype.toString=function(i,radix){
3482+
switch(arguments.length) {
3483+
case 2:
3484+
return i.toString(radix);
3485+
case 1:
3486+
return "" +i;
3487+
case 0:
3488+
return (this===Integer ? "class java.lang.Integer" : ""+this.valueOf());
3489+
}
34883490
};
34893491

34903492
m$(Integer, ["c$", "c$$S", "c$$I"], function(v){
@@ -3668,13 +3670,15 @@ if (typeof arguments[0] != "object")this.c$(arguments[0]);
36683670
});
36693671

36703672
decorateAsNumber(Long, "Long", "long", "L");
3671-
Long.toString=Long.toString$J=Long.prototype.toString=function(){
3672-
if(arguments.length!=0){
3673-
return""+arguments[0];
3674-
}else if(this===Long){
3675-
return"class java.lang.Long";
3676-
}
3677-
return""+this.valueOf();
3673+
Long.toString=Long.toString$J=Long.toString$J$I = Long.prototype.toString=function(i, radix){
3674+
switch(arguments.length) {
3675+
case 2:
3676+
return i.toString(radix);
3677+
case 1:
3678+
return "" +i;
3679+
case 0:
3680+
return (this===Long ? "class java.lang.Long" : ""+this.valueOf());
3681+
}
36783682
};
36793683

36803684
m$(Long, ["c$", "c$$S", "c$$J"], function(v){
@@ -3742,13 +3746,15 @@ function (v,radix) {
37423746
this.valueOf = function () {return v;};
37433747
}, 1);
37443748

3745-
Short.toString = Short.prototype.toString = function () {
3746-
if (arguments.length != 0) {
3747-
return "" + arguments[0];
3748-
} else if (this === Short) {
3749-
return "class java.lang.Short"; // Short.class.toString
3750-
}
3751-
return "" + this.valueOf();
3749+
Short.toString = Short.toString$H = Short.toString$H$I = Short.prototype.toString = function (i,radix) {
3750+
switch(arguments.length) {
3751+
case 2:
3752+
return i.toString(radix);
3753+
case 1:
3754+
return "" +i;
3755+
case 0:
3756+
return (this===Short ? "class java.lang.Short" : ""+this.valueOf());
3757+
}
37523758
};
37533759

37543760
Short.MIN_VALUE = Short.prototype.MIN_VALUE = -32768;
@@ -3804,13 +3810,15 @@ this.valueOf=function(){return v;};
38043810
this.byteValue = function(){return v};
38053811
}, 1);
38063812

3807-
Byte.toString=Byte.toString$B=Byte.prototype.toString=function(){
3808-
if(arguments.length!=0){
3809-
return""+arguments[0];
3810-
}else if(this===Byte){
3811-
return"class java.lang.Byte";
3812-
}
3813-
return""+this.valueOf();
3813+
Byte.toString=Byte.toString$B=Byte.toString$B$I=Byte.prototype.toString=function(i,radix){
3814+
switch(arguments.length) {
3815+
case 2:
3816+
return i.toString(radix);
3817+
case 1:
3818+
return "" +i;
3819+
case 0:
3820+
return (this===Byte ? "class java.lang.Byte" : ""+this.valueOf());
3821+
}
38143822
};
38153823

38163824
Byte.serialVersionUID=Byte.prototype.serialVersionUID=-7183698231559129828;
@@ -4788,7 +4796,7 @@ return(""+c).toLowerCase().charAt(0);
47884796
}, 1);
47894797
m$(C$,"toTitleCase$C",
47904798
function(c){
4791-
return Character.toUpperCase(c);
4799+
return Character.toUpperCase$C(c);
47924800
}, 1);
47934801
m$(C$,"toUpperCase$C",
47944802
function(c){

0 commit comments

Comments
 (0)