Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified sources/net.sf.j2s.core/dist/dropins/net.sf.j2s.core.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion sources/net.sf.j2s.core/dist/dropins/timestamp
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2018-07-19_0557 AM
2018_07_22__14_28_50
Binary file modified sources/net.sf.j2s.core/dist/dropins/ver/net.sf.j2s.core_3.2.1.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@

import net.sf.j2s.core.CorePlugin;

// BH 7/22/2018 -- fixes improper use of charCodeAt() to replace charCode().$c() when not java.lang.String.charAt
// BH 7/20/2018 -- removes qualifications for single-abstract method overrides
// BH 7/19/2018 -- fixes Enum.Enum
// BH 7/18/2018 -- addw Java 8 try without catch or finally
Expand Down Expand Up @@ -1661,14 +1662,12 @@ private boolean addClassOrInterface(ASTNode node, ITypeBinding binding, List<?>
// methods are not to be qualified

for (int i = unqualifiedMethods.size(); --i >= 0;) {
//buffer.append(">>" + method.getKey() + " " + unqualifiedMethods.get(i).getKey() + "<<\r\n");
if (method.overrides(unqualifiedMethods.get(i))) {
dontQualifyMethod = true;
break;
}
}
}
//buffer.append("<<" + dontQualifyMethod + "<<");
element.accept(this);
dontQualifyMethod = dontQualifyCurrent;
}
Expand Down Expand Up @@ -2346,7 +2345,7 @@ public boolean visit(Assignment node) {
left.accept(this);
int ptArray2 = (isArray ? buffer.length() : -1);
if (!"char".equals(leftName)) {
if (isIntegerType(leftName) || "booelean".equals(leftName)) {
if (isIntegerType(leftName) || "boolean".equals(leftName)) {
// can't just use a |= b because that ends up as 1 or 0, not true or false.
// byte|short|int|long += ...
if (!addPrimitiveTypedExpression(left, toBinding, leftName, opType, right, rightName, null, true))
Expand Down Expand Up @@ -2997,7 +2996,6 @@ private String getQualifiedSimpleName(SimpleName node) {
return simpleNameInMethodBinding(node, isQualified, (IMethodBinding) binding);

ITypeBinding typeBinding = node.resolveTypeBinding();
// >>Math<<.max
return NameMapper.get$QualifiedJ2SFieldName(typeBinding == null ? node.getFullyQualifiedName()
: assureQualifiedNameAllowP$(typeBinding.getQualifiedName()), true);
}
Expand Down Expand Up @@ -3476,9 +3474,9 @@ private void addCharCodeAt(Expression right, int pt) {
if (right instanceof MethodInvocation) {
// if possible, just replace "charAt" with "charCodeAt"
MethodInvocation m = (MethodInvocation) right;
if ("charAt".equals(m.getName().toString())) {
if (m.resolveMethodBinding().getKey().equals("Ljava/lang/String;.charAt(I)C")) {
if ((pt = buffer.indexOf(".charAt", pt)) >= 0) {
charCodeAt0 = "Code" + buffer.substring(pt + 5); // At....
charCodeAt0 = "Code" + buffer.substring(pt + 5);
buffer.setLength(pt + 5);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ public class Java2ScriptCompiler {
// BH: added "true".equals(getProperty(props,
// "j2s.compiler.allow.compression")) to ensure compression only occurs when
// desired
private static final int JSL_LEVEL = AST.JLS8; // not handling lampda functions

private static final int JSL_LEVEL = AST.JLS8; // deprecation just because Java has moved on
private boolean showJ2SSettings = true;

// We copy all non .java files from any directory from which we loaded a
Expand Down
Binary file modified sources/net.sf.j2s.java.core/dist/SwingJS-site.zip
Binary file not shown.
Empty file.
12 changes: 11 additions & 1 deletion sources/net.sf.j2s.java.core/src/swingjs/JSGraphics2D.java
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,15 @@ public void fillRect(int x, int y, int width, int height) {
ctx.fillRect(x, y, width, height);
}

public void draw3DRect(int x, int y, int width, int height, boolean raised) {
do3DRect(x, y, width, height, raised, false);
}

public void fill3DRect(int x, int y, int width, int height, boolean raised) {
do3DRect(x, y, width, height, raised, true);
}

private void do3DRect(int x, int y, int width2, int height2, boolean raised, boolean isFill) {
if (width <= 0 || height <= 0)
return;
Paint p = getPaint();
Expand All @@ -261,7 +269,9 @@ public void fill3DRect(int x, int y, int width, int height, boolean raised) {
} else if (p != c) {
setColor(c);
}
fillRect(x + 1, y + 1, width - 2, height - 2);
if (isFill) {
fillRect(x + 1, y + 1, width - 2, height - 2);
}
setColor(raised ? brighter : darker);
// drawLine(x, y, x, y + height - 1);
fillRect(x, y, 1, height);
Expand Down
19 changes: 17 additions & 2 deletions sources/net.sf.j2s.java.core/srcjs/js/j2sClazz.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
// TODO: CharacterSequence does not implement Java 8 default methods chars() or codePoints()
// It is possible that these might be loaded dynamically.

// BH 7/22/2018 adds System.getProperty("java.vendor") == "SwingJS/OpenJDK"
// BH 7/22/2018 adds Math.IEEEremainder
// BH 7/20/2018 removes def of Closeable, DataInput, DataOutput, Iterable, Comparator
// BH 7/19/2018 removes Constructor, Method, and Field code here -- now in their .js files
// BH 7/18/2018 adds Java 8 default interface method support
Expand Down Expand Up @@ -2660,8 +2662,10 @@ java.lang.System = System = {
case "java.class.version":
v = "50";
break;
case "java.vendor":
v = "SwingJS/OpenJDK";
case "java.version":
v = "1.6";
v = "1.6-1.8";
break;
case "file.separator":
case "path.separator":
Expand Down Expand Up @@ -2808,7 +2812,18 @@ Math.nextAfter||(Math.nextAfter=function(start,direction){return 0});
Math.nextUp||(Math.nextUp=function(d){return 0});
Math.ulp||(Math.ulp=function(d){return 0});
Math.getExponent||(Math.getExponent=function(d){return 0});
Math.getIEEEremainder||(Math.getIEEEremainder=function(f1,f2){return 0});
Math.IEEEremainder||(Math.IEEEremainder=function (x, y) {
if (y == 0 || Double.isNaN(x) || Double.isInfinite(y) && !Double.isInfinite(x) ) return NaN;
var modxy = x % y;
if (modxy == 0 ) return modxy;
var rem = modxy - (Math.abs(y) * Math.signum(x));
if (Math.abs(rem) == Math.abs(modxy) ) {
var div = x / y;
return (Math.abs(Math.round(div)) > Math.abs(div) ? rem : modxy);
}
return (Math.abs(rem) < Math.abs(modxy) ? rem : modxy);
});

//end datatype reliant math declarations

Clazz._setDeclared("java.lang.Number", java.lang.Number=Number);
Expand Down
19 changes: 17 additions & 2 deletions sources/net.sf.j2s.java.core/srcjs/swingjs2.js
Original file line number Diff line number Diff line change
Expand Up @@ -13440,6 +13440,8 @@ if (!J2S._version)
// TODO: CharacterSequence does not implement Java 8 default methods chars() or codePoints()
// It is possible that these might be loaded dynamically.

// BH 7/22/2018 adds System.getProperty("java.vendor") == "SwingJS/OpenJDK"
// BH 7/22/2018 adds Math.IEEEremainder
// BH 7/20/2018 removes def of Closeable, DataInput, DataOutput, Iterable, Comparator
// BH 7/19/2018 removes Constructor, Method, and Field code here -- now in their .js files
// BH 7/18/2018 adds Java 8 default interface method support
Expand Down Expand Up @@ -16090,8 +16092,10 @@ java.lang.System = System = {
case "java.class.version":
v = "50";
break;
case "java.vendor":
v = "SwingJS/OpenJDK";
case "java.version":
v = "1.6";
v = "1.6-1.8";
break;
case "file.separator":
case "path.separator":
Expand Down Expand Up @@ -16238,7 +16242,18 @@ Math.nextAfter||(Math.nextAfter=function(start,direction){return 0});
Math.nextUp||(Math.nextUp=function(d){return 0});
Math.ulp||(Math.ulp=function(d){return 0});
Math.getExponent||(Math.getExponent=function(d){return 0});
Math.getIEEEremainder||(Math.getIEEEremainder=function(f1,f2){return 0});
Math.IEEEremainder||(Math.IEEEremainder=function (x, y) {
if (y == 0 || Double.isNaN(x) || Double.isInfinite(y) && !Double.isInfinite(x) ) return NaN;
var modxy = x % y;
if (modxy == 0 ) return modxy;
var rem = modxy - (Math.abs(y) * Math.signum(x));
if (Math.abs(rem) == Math.abs(modxy) ) {
var div = x / y;
return (Math.abs(Math.round(div)) > Math.abs(div) ? rem : modxy);
}
return (Math.abs(rem) < Math.abs(modxy) ? rem : modxy);
});

//end datatype reliant math declarations

Clazz._setDeclared("java.lang.Number", java.lang.Number=Number);
Expand Down