Skip to content

Commit fa071e8

Browse files
hansonrhansonr
authored andcommitted
various java, j2sClazz.js, j2sApplet, and transpiler fixes
viewerOptions adds "fullName" return (short)++ not working String.toCharArr() must return Clazz array, not just []. Clazz.setTVer was Clazz.setVer in coretop/bottom adds javax.swing.text.DefaultStyledDocument. Untested. enum must set name and ordinal in $init$, not after constructor runs // BH 8/20/2018 3.2.2.04 adds character.isJavaIdentifierPart$C and several Character...$I equivalents // BH 8/19/2018 3.2.2.04 fixes Enum .name being .$name // BH 8/16/2018 3.2.2.04 fixes Character.toTitleCase$C, [Integer,Long,Short,Byte].toString(i,radix)
1 parent 601516d commit fa071e8

File tree

17 files changed

+2866
-102
lines changed

17 files changed

+2866
-102
lines changed
4.01 MB
Binary file not shown.
21 Bytes
Binary file not shown.
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
1-
<<<<<<< HEAD
2-
20180820100423
3-
=======
4-
20180819230621
5-
>>>>>>> branch 'yadav1' of https://github.com/BobHanson/java2script.git
1+
20180820200147
4.01 MB
Binary file not shown.
21 Bytes
Binary file not shown.
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
1-
<<<<<<< HEAD
2-
20180820100423
3-
=======
4-
20180819230621
5-
>>>>>>> branch 'yadav1' of https://github.com/BobHanson/java2script.git
1+
20180820200147

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@
132132
import org.eclipse.jdt.core.dom.WhileStatement;
133133
import org.eclipse.jdt.core.dom.WildcardType;
134134

135+
// BH 8/20/2018 -- fix for return (short)++;
136+
135137
// BH 8/19/2018 -- refactored to simplify $finals$
136138
// BH 8/12/2018 -- refactored to simplify naming issues
137139
// BH 8/6/2018 -- additional Java 8 fixes; enum $valueOf$S to valueOf$S
@@ -2795,8 +2797,6 @@ private boolean fixAssignArray(ArrayAccess leftArray, int ptArray, int ptArray2,
27952797
buffer.setLength(ptArray);
27962798
String name = left.substring(0, ptIndex1);
27972799
if (name.indexOf("(") >= 0) {
2798-
// test/Test_Static: getByteArray()[p++] += (byte) ++p;
2799-
// ($j$=C$.getByteArray())[$k$=p++]=($j$[$k$]+((++p|0))|0);
28002800
buffer.append("($j$=" + name + ")");
28012801
name = "$j$";
28022802
trailingBuffer.addType("j");
@@ -3513,7 +3513,7 @@ private void addPrePostFix(Expression left, ASTNode parent, IVariableBinding var
35133513
boolean isChar = (type == 'c');
35143514
if (isChar)
35153515
type = 'p';
3516-
boolean isStatement = (parent instanceof Statement);
3516+
boolean isStatement = (parent instanceof Statement && !(parent instanceof ReturnStatement));
35173517
boolean addAnonymousWrapper = (!isChar || !isPrefix && !isStatement);
35183518
String key = "$" + type + (isChar ? "$" : "$[0]");
35193519
if (addAnonymousWrapper) {
@@ -3555,8 +3555,9 @@ private void addPrePostFix(Expression left, ASTNode parent, IVariableBinding var
35553555
// ($b$[0]=++b,b=$b$[0]);
35563556
buffer.append(key);
35573557
} else {
3558-
// i = ($b$[0]=b,b=(++$b$[0],$b$[0]),--$b$[0],$b$[0]);
3559-
// ($b$[0]=b,b=(++$b$[0],$b$[0]));
3558+
// postfix
3559+
// statement: ($b$[0]=b,b=(++$b$[0] ,$b$[0]))
3560+
// not statement: i = ($b$[0]=b,b=(++$b$[0] ,$b$[0]),--$b$[0],$b$[0]);
35603561
buffer.append("(");
35613562
buffer.append(op);
35623563
buffer.append(key);
4 MB
Binary file not shown.

sources/net.sf.j2s.java.core/src/java/awt/Font.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,7 @@ private Font(AttributeValues values, String oldName, int oldStyle,
670670
* <code>Font</code>, or <code>null</code>
671671
*/
672672
public Font(Map<? extends Attribute, ?> attributes) {
673+
initMasks();
673674
initFromValues(AttributeValues.fromMap(attributes, RECOGNIZED_MASK));
674675
}
675676

0 commit comments

Comments
 (0)