Skip to content

Commit b05f78f

Browse files
committed
Transpiler upgrade 5.0.1-v7
alls default @j2sAlias to define unqualified method name as the alias.
1 parent decc38a commit b05f78f

File tree

9 files changed

+14
-5
lines changed

9 files changed

+14
-5
lines changed
Binary file not shown.
94 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20250318122834
1+
20250321182335
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-
20250318122834
1+
20250321182335

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

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
// TODO: superclass inheritance for JAXB XmlAccessorType
3232
// TODO: Transpiler bug allows static String name, but JavaScript function().name is read-only and will be "clazz"
3333

34+
//BH 2025.03.21 -- 5.0.1-v7 adds @j2sAlias with no name as "strip $"; does not account for multiple versions (could be done at runtime)
3435
//BH 2025.03.05 -- 5.0.1-v6 adds native interface methods for WASM
3536
//BH 2025.02.22 -- 5.0.1-v5 fixes Iterable<IAtom> AtomIterator::new missing [this,null] in generator
3637
//BH 2024.07.14 -- 5.0.1-v4 fixes numerical array initializer using characters ['a','b',...], but not new int[] { "test".charAt(3) }
@@ -5706,8 +5707,15 @@ String getMethodNameWithSyntheticBridgeForDeclaration(IMethodBinding mBinding, b
57065707
// $O$O$O for lambda as well
57075708
names.add(getFinalMethodNameWith$Params(methodName, mBinding, null, false, mtype));
57085709
}
5709-
if (alias != null)
5710-
names.add(alias);
5710+
if (alias != null) {
5711+
if (alias.length() == 0) {
5712+
int pt = methodName.indexOf("$");
5713+
if (pt != 0)
5714+
names.add(pt < 0 ? methodName : methodName.substring(0, pt));
5715+
} else {
5716+
names.add(alias);
5717+
}
5718+
}
57115719
if ((mode & METHOD_ADD_GENERIC) != 0) {
57125720
// interesting case of this in Test_ClassBase, where different interfaces and
57135721
// the superclass
@@ -6236,7 +6244,7 @@ private String checkJ2SMethodDoc(MethodDeclaration node) {
62366244
if (tags == null || tags.size() == 0 || (tag = NativeDoc.getTag(tags, "@j2sAlias")) == null)
62376245
continue;
62386246
List<?> fragments = tag.fragments();
6239-
return (fragments == null || fragments.size() == 0 ? null : fragments.get(0).toString().trim());
6247+
return (fragments == null ? null : fragments.size() == 0 ? "" : fragments.get(0).toString().trim());
62406248
}
62416249
return null;
62426250
}
Binary file not shown.

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15037,6 +15037,7 @@ Clazz._loadWasm = function(cls, lib){
1503715037
funcs[i].apply(null, [module]);
1503815038
}
1503915039
cls.wasmInitialized = true;
15040+
J2S.wasm[libName].$ready = true;
1504015041
}
1504115042
// may have been preloaded by other JavaScript
1504215043
var module = J2S[libName + "_module"]

0 commit comments

Comments
 (0)