Skip to content

Commit 1af9bc6

Browse files
hansonrhansonr
authored andcommitted
// BH 2/3/2019 -- 3.2.4.07 fixes "final static Float = (float)" missing
definition
1 parent 25d12df commit 1af9bc6

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ 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.06";
22+
public static String VERSION = "3.2.4.07";
23+
// TODO/NOTE final static int FOO = (/**@j2sNative 5 || */3) stated but not recognized when used as its new value
24+
// BH 2/3/2019 -- 3.2.4.07 fixes "final static Float = (float)" missing definition
2325
// BH 1/2/2019 -- 3.2.4.06 fixes try(resources) with more than one resource missing semicolon
2426
// BH 12/13/2018 -- 3.2.4.05 fixes problem with OuterClass.this.foo() not using .apply()
2527
// BH 11/10/2018 -- 3.2.4.04 additional support for JAXB

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2198,13 +2198,13 @@ private boolean addFieldDeclaration(FieldDeclaration field, int mode) {
21982198
VariableDeclarationFragment identifier = (VariableDeclarationFragment) fragments.get(0);
21992199
IVariableBinding var = identifier.resolveBinding();
22002200
Type nodeType = (var != null && var.getType().isArray() ? null : field.getType());
2201-
Code code = (nodeType == null || !nodeType.isPrimitiveType() ? null
2202-
: ((PrimitiveType) nodeType).getPrimitiveTypeCode());
2201+
boolean isPrimitive = (nodeType != null && nodeType.isPrimitiveType());
2202+
Code code = (isPrimitive ? ((PrimitiveType) nodeType).getPrimitiveTypeCode() : null);
22032203
// have to check here for final Object = "foo", as that must not be ignored.
2204-
boolean checkFinalConstant = (isStatic && Modifier.isFinal(field.getModifiers()) && var != null
2205-
&& !var.getType().getQualifiedName().equals("java.lang.Object"));
2204+
boolean checkFinalConstant = ((isPrimitive || var != null && var.getType().getQualifiedName().equals("java.lang.String"))
2205+
&& isStatic && Modifier.isFinal(field.getModifiers()));
22062206
if (needDefault)
2207-
addJ2SDoc(field);
2207+
addJ2SDoc(field);
22082208
int len0 = buffer.length();
22092209
for (Iterator<?> iter = fragments.iterator(); iter.hasNext();) {
22102210
VariableDeclarationFragment fragment = (VariableDeclarationFragment) iter.next();

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ window["j2s.clazzloaded"] = true;
5555
_loadcore: true,
5656
_nooutput: 0,
5757
_VERSION_R: "3.2.4.07", //runtime
58-
_VERSION_T: "3.2.4.06", //transpiler
58+
_VERSION_T: "3.2.4.07", //transpiler
5959
};
6060

6161
;(function(Clazz, J2S) {

0 commit comments

Comments
 (0)