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/swingjs/SwingJS-site.zip
Binary file not shown.
Binary file modified sources/net.sf.j2s.core/dist/swingjs/net.sf.j2s.core.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion sources/net.sf.j2s.core/dist/swingjs/timestamp
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20180915215829
20180916165130
Binary file modified sources/net.sf.j2s.core/dist/swingjs/ver/3.2.2/SwingJS-site.zip
Binary file not shown.
Binary file modified sources/net.sf.j2s.core/dist/swingjs/ver/3.2.2/net.sf.j2s.core.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion sources/net.sf.j2s.core/dist/swingjs/ver/3.2.2/timestamp
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20180915215829
20180916165130
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class CorePlugin extends Plugin {
* register the bundle version properly. So we use VERSION here instead.
*
*/
public static String VERSION = "3.2.2.04";
public static String VERSION = "3.2.2.06";
// 3.2.2.04 2018.08.15 fixing Java->JavaScript "getFinal" code for class names.
// 3.2.2.04 adds support for window-level applets, such as JmolApplet
// 3.2.2.03 adds Java 8 function and stream
Expand Down
34 changes: 22 additions & 12 deletions sources/net.sf.j2s.core/src/net/sf/j2s/core/Java2ScriptVisitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@
import org.eclipse.jdt.core.dom.WhileStatement;
import org.eclipse.jdt.core.dom.WildcardType;

// BH 9/16/2018 -- 3.2.2.06 removes "$" in JApplet public method alternative name
// BH 8/20/2018 -- fix for return (short)++;

// BH 8/19/2018 -- refactored to simplify $finals$
// BH 8/12/2018 -- refactored to simplify naming issues
// BH 8/6/2018 -- additional Java 8 fixes; enum $valueOf$S to valueOf$S
Expand Down Expand Up @@ -975,6 +975,10 @@ public boolean visit(MethodDeclaration node) {
return false;
}

private final static int METHOD_FULLY_QUALIFIED = 0;
private final static int METHOD_$_QUALIFIED = 1;
private final static int METHOD_UNQUALIFIED = 2;

/**
* Called by visit(MethodDeclaration) as well as addLambdaMethod().
*
Expand All @@ -996,12 +1000,17 @@ private void processMethodDeclaration(IMethodBinding mBinding, List<ASTNode> par
boolean isPublic = Modifier.isPublic(mods);
boolean isPrivate = !isPublic && !isConstructor && isPrivate(mBinding);
boolean isStatic = isStatic(mBinding);
boolean addUnqualified = lambdaType == NOT_LAMBDA && (temp_addUnqualifiedMethod // method call to lambda
|| isUserApplet && !isConstructor && !isStatic && isPublic
// public applet methods could never be overloaded in
// JavaScript anyway.
);
String finalName = getFinalMethodNameOrArrayForDeclaration(mBinding, isConstructor, addUnqualified);
int qualification = (lambdaType != NOT_LAMBDA ? METHOD_FULLY_QUALIFIED
: temp_addUnqualifiedMethod ? METHOD_$_QUALIFIED
: isUserApplet && !isConstructor && !isStatic && isPublic ? METHOD_UNQUALIFIED
: METHOD_FULLY_QUALIFIED);

// boolean addUnqualified = lambdaType == NOT_LAMBDA && (temp_addUnqualifiedMethod // method call to lambda
// || isUserApplet && !isConstructor && !isStatic && isPublic
// // public applet methods could never be overloaded in
// // JavaScript anyway.
// );
String finalName = getFinalMethodNameOrArrayForDeclaration(mBinding, isConstructor, qualification);
boolean isMain = isStatic && isPublic && mBinding.getName().equals("main")
&& mBinding.getKey().endsWith(";.main([Ljava/lang/String;)V");
if (isMain) {
Expand Down Expand Up @@ -4827,10 +4836,11 @@ private static void addGenericClassMethod(String classKey, String methodName, St
* @param node
* @param mBinding
* @param isConstructor
* @param qualification
* @return j2s-qualified name or an array of j2s-qualified names
*/
private String getFinalMethodNameOrArrayForDeclaration(IMethodBinding mBinding, boolean isConstructor,
boolean addUnqualified) {
int qualification) {
String nodeName = mBinding.getName();
String methodName = (isConstructor ? "c$" : nodeName);
String qname = getFinalMethodNameWith$Params(methodName, null, mBinding, null, false, METHOD_NOTSPECIAL);
Expand All @@ -4844,12 +4854,12 @@ private String getFinalMethodNameOrArrayForDeclaration(IMethodBinding mBinding,
METHOD_NOTSPECIAL);
if (pname != null)
names.add(pname);
if (addUnqualified)
if (qualification == METHOD_FULLY_QUALIFIED)
names.add(ensureMethod$Name(methodName, mBinding, getJavaClassNameQualified(methodClass)));
}
} else if (addUnqualified && !methodName.equals(qname) && !classHasMethod(methodClass, methodName)) {
} else if (qualification != METHOD_FULLY_QUALIFIED && !methodName.equals(qname) && !classHasMethod(methodClass, methodName)) {
names = new ArrayList<String>();
names.add(methodName + (methodName.indexOf("$") >= 0 ? "" : "$"));
names.add(methodName + (qualification == METHOD_UNQUALIFIED || methodName.indexOf("$") >= 0 ? "" : "$"));
}
if (names == null || names.size() == 0)
return "'" + qname + "'";
Expand Down Expand Up @@ -6311,7 +6321,7 @@ private boolean addLambdaMethodReference(MethodReference node, Expression exp) {
buffer.append("Clazz.newLambda(");
appendFinalMethodQualifier(exp, declaringlassJavaName, null, FINAL_ESCAPECACHE | FINAL_LAMBDA);
buffer.append(",");
buffer.append(getFinalMethodNameOrArrayForDeclaration(mBinding, false, false));
buffer.append(getFinalMethodNameOrArrayForDeclaration(mBinding, false, METHOD_FULLY_QUALIFIED));
buffer.append(",'" + lambdaType + "')");
}
break;
Expand Down
Binary file modified sources/net.sf.j2s.java.core/dist/SwingJS-site.zip
Binary file not shown.
22 changes: 11 additions & 11 deletions sources/net.sf.j2s.java.core/src/javajs/util/PT.java
Original file line number Diff line number Diff line change
Expand Up @@ -313,18 +313,18 @@ public static float parseFloat(String str) {
}

public static int parseIntRadix(String s, int i) throws NumberFormatException {
/**
*
* JavaScript uses parseIntRadix
*
* @j2sNative
*
* return Integer.parseIntRadix(s, i);
*
*/
{
// /**
// *
// * JavaScript uses parseIntRadix
// *
// * @j2sNative
// *
// * return Integer.parseIntRadix(s, i);
// *
// */
// {
return Integer.parseInt(s, i);
}
// }
}

public static String[] getTokens(String line) {
Expand Down
7 changes: 0 additions & 7 deletions sources/net.sf.j2s.java.core/srcjs/js/SwingJSApplet.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,13 +281,6 @@ if (typeof(SwingJS) == "undefined") {
return; // ignore -- page is closing
J2S._setDestroy(this);
this._ready = true;
var script = this._readyScript;
if (this._defaultModel)
J2S._search(this, this._defaultModel, (script ? ";" + script : ""));
else if (script)
this._script(script);
else if (this._src)
this._script('load "' + this._src + '"');
this._showInfo(true);
this._showInfo(false);
J2S.Cache.setDragDrop(this);
Expand Down
7 changes: 0 additions & 7 deletions sources/net.sf.j2s.java.core/srcjs/swingjs2.js
Original file line number Diff line number Diff line change
Expand Up @@ -19499,13 +19499,6 @@ if (typeof(SwingJS) == "undefined") {
return; // ignore -- page is closing
J2S._setDestroy(this);
this._ready = true;
var script = this._readyScript;
if (this._defaultModel)
J2S._search(this, this._defaultModel, (script ? ";" + script : ""));
else if (script)
this._script(script);
else if (this._src)
this._script('load "' + this._src + '"');
this._showInfo(true);
this._showInfo(false);
J2S.Cache.setDragDrop(this);
Expand Down