Skip to content

Commit b816360

Browse files
committed
j2s 3.2.4.09 fixes method c() not allowed.
1 parent 9ccd868 commit b816360

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ public class CorePlugin extends Plugin {
1919
* register the bundle version properly. So we use VERSION here instead.
2020
*
2121
*/
22-
public static String VERSION = "3.2.4.08";
22+
public static String VERSION = "3.2.4.09";
23+
// BH 2019.10.27 -- 3.2.4.09 fixes problem with method of name c() becoming c$() -- constructor
2324
// BH 2019.10.25 -- 3.2.4.09 adds j2s.compiler.java.version (default 8)
2425
// BH 2019.10.25 -- 3.2.4.09 adds j2s.break.on.error (default false)
2526
// BH 2019.10.25 -- 3.2.4.09 fixes missing resource copy for git projects

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5014,7 +5014,8 @@ private static boolean classHasNoParameterMethod(ITypeBinding methodClass, Strin
50145014
|| j2sName.indexOf("$", 2) >= 0 || j2sName.equals("c$")
50155015
|| className != null && NameMapper.isMethodNonqualified(className, mBinding.getName()))
50165016
return j2sName;
5017-
return j2sName + "$";
5017+
// c() must be changed to c$$, not c$, which is the constructor
5018+
return (j2sName.equals("c") ? "c$$" : j2sName + "$");
50185019
}
50195020

50205021
/**

sources/net.sf.j2s.java.core/src/test/Test_Class.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,13 @@ class Test_Class extends Test_ {
1313
private void test(String s) {
1414

1515
}
16+
17+
void c() {
18+
19+
}
1620

1721
private void test(Integer i) {
18-
22+
c();
1923
}
2024

2125
int test1 = 0;

0 commit comments

Comments
 (0)