Skip to content

Commit f86989f

Browse files
committed
transpiler fix for @xml annotations in Enum not processing no-class
package creation
1 parent ed563a1 commit f86989f

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ public class CorePlugin extends Plugin {
2525
* "net.sf.j2s.core.jar" not "net.sf.j2s.core.3.2.5"
2626
*
2727
*/
28-
public static String VERSION = "3.2.5-v2";
29-
// BH 2019.12.06 -- 3.2.5.v2 fix for try(resources) not closing those
28+
public static String VERSION = "3.2.5-v3";
29+
// BH 2019.12.12 -- 3.2.5-v3 fix for enums == null in annotations
30+
// BH 2019.12.06 -- 3.2.5-v2 fix for try(resources) not closing those
3031
// BH 2019.11.12 -- 3.2.5-v0 fix for string literals with \n \nn \nnn octals, but "use strict" does not allow for this.
3132
// BH 2019.11.13 -- 3.2.5-v0 fixes static initialization timing. See note in Java2ScriptVisitor
3233
// BH 2019.10.30 -- 3.2.4.09 fixes problem with team...show history...compare having null project.getProject().getLocation()

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6414,7 +6414,8 @@ public static void addClassAnnotations(int accessType, List<ClassAnnotation> cla
64146414
type = ((TypeDeclaration) a.node).resolveBinding();
64156415
} else if (a.node instanceof FieldDeclaration) {
64166416
FieldDeclaration field = (FieldDeclaration) a.node;
6417-
fields.remove(field);
6417+
if (fields != null)
6418+
fields.remove(field);
64186419
fragments = field.fragments();
64196420
VariableDeclarationFragment identifier = (VariableDeclarationFragment) fragments.get(0);
64206421
IVariableBinding var = identifier.resolveBinding();
@@ -6423,7 +6424,8 @@ public static void addClassAnnotations(int accessType, List<ClassAnnotation> cla
64236424
} else if (a.node instanceof MethodDeclaration) {
64246425
MethodDeclaration method = (MethodDeclaration) a.node;
64256426
IMethodBinding var = method.resolveBinding();
6426-
if (methods.contains(var))
6427+
if (methods != null)
6428+
if (methods.contains(var))
64276429
methods.remove(var);
64286430
if (accessType != TEST_TYPE)
64296431
var = getJAXBGetMethod(var, methods, false);
@@ -6433,7 +6435,8 @@ public static void addClassAnnotations(int accessType, List<ClassAnnotation> cla
64336435
type = var.getReturnType();
64346436
} else if (a.node instanceof EnumConstantDeclaration) {
64356437
EnumConstantDeclaration con = (EnumConstantDeclaration) a.node;
6436-
enums.remove(con);
6438+
if (enums != null)
6439+
enums.remove(con);
64376440
IVariableBinding var = con.resolveVariable();
64386441
varName = var.getName();
64396442
type = var.getType();

0 commit comments

Comments
 (0)