Skip to content

Commit b56d3d0

Browse files
hansonrhansonr
authored andcommitted
Transpiler 3.2.4.06 fixes problem with Java 9 multiple resource
1 parent 703d997 commit b56d3d0

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
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.05";
22+
public static String VERSION = "3.2.4.06";
23+
// BH 1/2/2019 -- 3.2.4.06 fixes try(resources) with more than one resource missing semicolon
2324
// BH 12/13/2018 -- 3.2.4.05 fixes problem with OuterClass.this.foo() not using .apply()
2425
// BH 11/10/2018 -- 3.2.4.04 additional support for JAXB
2526
// BH 11/4/2018 -- 3.2.4.02 broad JAXB support

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1419,6 +1419,7 @@ public boolean visit(TryStatement node) {
14191419
ASTNode resource = resources.get(i);
14201420
if (resource instanceof VariableDeclarationExpression) {
14211421
resource.accept(this);
1422+
buffer.append(";");
14221423
} else {
14231424
// Java 9 -- just a Name.
14241425
buffer.append("/* Java 9 resource " + resource + "*/\r\n");
@@ -4560,13 +4561,13 @@ private String getFinalInnerClassList(String javaClassName) {
45604561
String s = getFinalInnerClassList(javaClassName);
45614562
if (doCache) {
45624563
Integer n = package_htIncludeNames.get(s);
4563-
if (n != null)
4564-
return "$I$(" + n + ")";
4565-
if (!s.endsWith("Exception'")) {
4564+
if (n == null && !s.endsWith("Exception'")) {
45664565
// count starts at 1, because i$[0] is the list
45674566
package_htIncludeNames.put(s, n = new Integer(++package_includeCount[0]));
45684567
package_includes.append(package_includeCount[0] == 1 ? ",I$=[[0," : ",").append(s);
45694568
}
4569+
if (n != null)
4570+
return "$I$(" + n + ")";
45704571
}
45714572
return "Clazz.load(" + s + ")";
45724573
}

0 commit comments

Comments
 (0)