Skip to content

Commit 40d21a4

Browse files
authored
Merge pull request BobHanson#258 from BobHanson/hanson1
Hanson1
2 parents 4312bb9 + 13e698f commit 40d21a4

File tree

12 files changed

+110
-11
lines changed

12 files changed

+110
-11
lines changed
Binary file not shown.
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
20230311212845
1+
<<<<<<< HEAD
2+
20230329174944
3+
=======
4+
20230329170441
5+
>>>>>>> branch 'hanson1' of https://github.com/BobHanson/java2script
Binary file not shown.
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
20230311212845
1+
<<<<<<< HEAD
2+
20230329174944
3+
=======
4+
20230329170441
5+
>>>>>>> branch 'hanson1' of https://github.com/BobHanson/java2script

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
@@ -25,11 +25,12 @@ 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.3.1-v6";
28+
public static String VERSION = "3.3.1-v7";
2929

3030
// if you change the x.x.x number, be sure to also indicate that in
3131
// j2sApplet.js and also (Bob only) update.bat, update-clean.bat
3232

33+
// BH 2023.03.29 -- 3.3.1-v7 fixes outer static method call from within lambda expression.
3334
// BH 2023.02.09 -- 3.3.1.v6 fixes j2s.excluded.paths needing /src/xxxx
3435
// BH 2022.06.27 -- 3.3.1-v5 fixes missing method annotations
3536
// BH 2022.01.17 -- 3.3.1-v4 fixes default interface methods referencing their own static fields

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

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@
136136
// TODO: superclass inheritance for JAXB XmlAccessorType
137137
// TODO: Transpiler bug allows static String name, but JavaScript function().name is read-only and will be "clazz"
138138

139+
//BH 2023.03.29 -- 3.3.1-v7 fixes outer static method call from within lambda expression.
140+
//BH 2023.02.09 -- 3.3.1.v6 fixes j2s.excluded.paths needing /src/xxxx
141+
//BH 2022.06.27 -- 3.3.1-v5 fixes missing method annotations
139142
//BH 2022.01.17 -- 3.3.1-v4 fixes default interface methods referencing their own static fields
140143
//BH 2021.01.14 -- 3.3.1-v3 fixes missing finals for nested () -> {...}
141144
//BH 2021.01.03 -- 3.3.1-v2 adds @j2sAsync adds async for function - experimental
@@ -1578,11 +1581,16 @@ private boolean addMethodInvocation(SimpleName javaQualifier, List<?> arguments,
15781581
String privateVar = (isPrivateAndNotStatic ? getPrivateVar(declaringClass, false) : null);
15791582
boolean doLogMethodCalled = (!isPrivate && global_htMethodsCalled != null);
15801583
boolean needBname = (
1581-
1582-
!isStatic && lambdaArity < 0 && (expression == null
1584+
!isStatic
1585+
&& (lambdaArity < 0
1586+
&& (expression == null
15831587
? !areEqual(declaringClass, class_typeBinding)
15841588
&& !class_typeBinding.isAssignmentCompatible(declaringClass)
1585-
: expression instanceof ThisExpression && ((ThisExpression) expression).getQualifier() != null) || class_localType == LAMBDA_EXPRESSION);
1589+
: expression instanceof ThisExpression
1590+
&& ((ThisExpression) expression).getQualifier() != null)
1591+
|| class_localType == LAMBDA_EXPRESSION)
1592+
);
1593+
15861594
String bname = (needBname ? getThisRefOrSyntheticReference(javaQualifier, declaringClass, null) : null);
15871595
// add the qualifier
15881596
int pt = buffer.length();
@@ -4879,7 +4887,7 @@ private void addQualifiedNameForBinding(IVariableBinding varBinding, boolean isS
48794887
*
48804888
* For general fields, this will be "this.".
48814889
*
4882-
* For fields in outer classes, we need a synthetic references,
4890+
* For nonstatic fields in outer classes, we need a synthetic references,
48834891
* this.b$[className] that points to the outer object, which may be one or more
48844892
* levels higher than this one.
48854893
*

sources/net.sf.j2s.java.core/doc/Differences.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
java2script/SwingJS Notes
22
=========================
33

4+
updated 3/11/2023 -- adds support for Java Regex Matcher.start/end(groupID) and .start/end(groupName)
45
updated 12/31/2020 -- full support for 64-bit long
56
updated 12/6/2020 -- note about restrictions on long, including BitSet and Scanner
67
updated 3/21/2020 -- adds note about HashMap, Hashtable, and HashSet iterator ordering

sources/net.sf.j2s.java.core/src/javajs/util/CifDataParser.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,10 +339,11 @@ public String readLine() {
339339
if (line == null)
340340
return null;
341341
if (isHeader) {
342-
if (line.startsWith("#"))
342+
if (line.startsWith("#")) {
343343
fileHeader.append(line).appendC('\n');
344-
else
344+
} else if (line.length() > 0) {
345345
isHeader = false;
346+
}
346347
}
347348
return line;
348349
} catch (Exception e) {

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,15 @@ private static void _test1(String[] args) {
9595

9696
static boolean isBatch = false;
9797

98+
/**
99+
* static public j2sHeadless TRUE
100+
* triggers headless operation in swingjs2.js
101+
*
102+
* Additional way to initiate headless operation:
103+
*
104+
* From URL: ?j2sheadless or &j2sheadless
105+
*
106+
*/
98107
static public boolean j2sHeadless = true;
99108

100109
static public int bhtest = 100;

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,10 +444,12 @@ public static void main(String[] args) {
444444
e1.printStackTrace();
445445
}
446446

447+
String whatever = "whatever";
448+
447449
class LocalClass {
448450

449451
String hello() {
450-
return "LocalClass says hello";
452+
return "LocalClass says hello " + whatever;
451453
}
452454
}
453455

0 commit comments

Comments
 (0)