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-j11.jar
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 @@
20200617130212
20200625205024
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20200617120936
20200623075216
Binary file modified sources/net.sf.j2s.core/dist/swingjs/ver/3.2.9/SwingJS-site.zip
Binary file not shown.
Binary file modified sources/net.sf.j2s.core/dist/swingjs/ver/3.2.9/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.9/timestamp
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20200617130212
20200625205024
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public class CorePlugin extends Plugin {
// j2sApplet.js and also (Bob only) update.bat, update-clean.bat


// BH 2020.06.22 -- 3.2.9.v1k fix for varargs not proper qualified arrays
// BH 2020.06.17 -- 3.2.9-v1j fix for functional interface this::privateMethod
// BH 2020.05.01 -- 3.2.9-v1i fix for nested lambda methods
// BH 2020.04.26 -- 3.2.9-v1h fix for inner classes of interfaces duplicated; fix for api.js inner class method names unqualified
Expand Down
66 changes: 17 additions & 49 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 @@ -135,6 +135,7 @@

// TODO: superclass inheritance for JAXB XmlAccessorType

//BH 2020.06.22 -- 3.2.9.v1k fix for varargs not proper qualified arrays
//BH 2020.06.17 -- 3.2.9-v1j fix for functional interface this::privateMethod
//BH 2020.05.01 -- 3.2.9-v1i fix for nested lambda methods
//BH 2020.04.26 -- 3.2.9-v1h fix for inner classes of interfaces duplicated; fix for api.js inner class method names unqualified
Expand Down Expand Up @@ -2515,25 +2516,12 @@ && checkAnnotations(element, CHECK_J2S_IGNORE_AND_ANNOTATIONS)) {
// log("default method " + method.getKey());
defpt = buffer.length();
}
// boolean addUnqualifiedCurrent = temp_add$UnqualifiedMethod;
// if (unqualifiedMethods != null) {
// // check for all methods that override a functional interface abstract method,
// // as those methods are to be qualified only with $
//
// for (int i = unqualifiedMethods.size(); --i >= 0;) {
// if (method.overrides(unqualifiedMethods.get(i))) {
// temp_add$UnqualifiedMethod = true;
// break;
// }
// }
// }
processMethodDeclaration(mnode, method, mnode.parameters(), mnode.getBody(), mnode.isConstructor(),
abstractMethodList, NOT_LAMBDA);
if (defpt >= 0) {
defaults.append(buffer.substring(defpt));
buffer.setLength(defpt);
}
// temp_add$UnqualifiedMethod = addUnqualifiedCurrent;
} else if (element instanceof AnnotationTypeMemberDeclaration) {
processAnnotationTypeMemberDeclaration((AnnotationTypeMemberDeclaration) element);
}
Expand Down Expand Up @@ -2689,35 +2677,6 @@ private void processAnnotationTypeMemberDeclaration(AnnotationTypeMemberDeclarat
buffer.setLength(pt);
}

// /**
// * Collect all names of all functional interface abstract methods that this
// * class might refer to so that their unqualified. This is not perfect, as it is
// * possible to have implementations of specific subtypes of parameterized
// * methods. However, it will have to do for now.
// *
// * @param type
// * @param unqualifiedMethods
// * @return List of methods that should have raw unparameterized alias
// */
// private List<IMethodBinding> getUnqualifiedMethods(ITypeBinding type, List<IMethodBinding> unqualifiedMethods) {
// if (type.isArray() || type.isPrimitive()) {
// return unqualifiedMethods;
// }
// ITypeBinding superClass = type.getSuperclass();
// if (superClass != null)
// unqualifiedMethods = getUnqualifiedMethods(superClass, unqualifiedMethods);
// ITypeBinding[] superInterfaces = type.getInterfaces();
// for (int i = 0; i < superInterfaces.length; i++)
// unqualifiedMethods = getUnqualifiedMethods(superInterfaces[i], unqualifiedMethods);
// IMethodBinding functionalMethod = type.getFunctionalInterfaceMethod();
// if (functionalMethod != null) {
// if (unqualifiedMethods == null)
// unqualifiedMethods = new ArrayList<IMethodBinding>();
// unqualifiedMethods.add(functionalMethod);
// }
// return unqualifiedMethods;
// }

/**
* If there is no Foo() or Foo(xxx... array), then we need to provide our own
* constructor.
Expand Down Expand Up @@ -2906,7 +2865,7 @@ private void addMethodParameterList(List<?> arguments, IMethodBinding methodDecl
buffer.append(prefix);
prefix = null;
}
addMethodArguments(parameterTypes, methodIsVarArgs, arguments, flags);
addMethodArguments(methodDeclaration, parameterTypes, methodIsVarArgs, arguments, flags);
}
if (prefix == null && suffix != null)
buffer.append(suffix);
Expand Down Expand Up @@ -4388,13 +4347,14 @@ private void addLeftSidePrefixName(Expression left) {

/**
*
* @param methodDeclaration
* @param parameterTypes
* @param methodIsVarArgs
* @param arguments
* @param flags METHOD_INDEXOF | 0
*/
@SuppressWarnings("null")
private void addMethodArguments(ITypeBinding[] parameterTypes, boolean methodIsVarArgs, List<?> arguments,
private void addMethodArguments(IMethodBinding methodDeclaration, ITypeBinding[] parameterTypes, boolean methodIsVarArgs, List<?> arguments,
int flags) {
String post = ", ";
int nparam = parameterTypes.length;
Expand Down Expand Up @@ -4422,6 +4382,17 @@ private void addMethodArguments(ITypeBinding[] parameterTypes, boolean methodIsV
.isAssignmentCompatible(paramType.getComponentType().getErasure()))
// or it is not compatible
) {
String close;
if (NameMapper.isPackageOrClassNonqualified(methodDeclaration.getDeclaringClass().getQualifiedName())) {
// calls to DOMNode.setAttrs(DOMNode node, Object... attr) need not be wrapped by a Java array type
close = "";
} else {
buffer.append(clazzArray(paramType.getComponentType(), ARRAY_DIM_ONLY));
buffer.append(", -1, ");
close = ")";
}


buffer.append("[");
//
//
Expand All @@ -4440,7 +4411,7 @@ private void addMethodArguments(ITypeBinding[] parameterTypes, boolean methodIsV
buffer.append(", ");
}
}
buffer.append("]");
buffer.append("]").append(close);
break;
}
post = "";
Expand Down Expand Up @@ -6659,7 +6630,7 @@ public static void setNonQualifiedNamePackages(String names) {
* @param className
* @return
*/
private static boolean isPackageOrClassNonqualified(String className) {
static boolean isPackageOrClassNonqualified(String className) {
if (className.indexOf("$") >= 0)
return false; // inner class
className += ".";
Expand All @@ -6672,9 +6643,6 @@ private static boolean isPackageOrClassNonqualified(String className) {
return false;
}

/**
* @param methodName not used but could be
*/
static boolean isMethodNonqualified(String className, String methodName) {
if (className.equals("java.lang.Math")) {
switch (methodName) {
Expand Down
Binary file modified sources/net.sf.j2s.java.core/dist/SwingJS-site.zip
Binary file not shown.
Loading