Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 40e4fbf

Browse files
committed
update to fix ClassName::new lambda expressions and missing
TYPE.hashCode()
1 parent 27e99dc commit 40e4fbf

File tree

12 files changed

+16
-7
lines changed

12 files changed

+16
-7
lines changed
Binary file not shown.
-149 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20250130183423
1+
20250222160620
Binary file not shown.
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20250130183423
1+
20250222160620

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,12 @@ public class CorePlugin extends Plugin {
2626
* the actual "x.y.z" version is specified in plugin.xml.
2727
*
2828
*/
29-
public static String VERSION = "5.0.1-v4";
29+
public static String VERSION = "5.0.1-v5";
3030

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

34+
// BH 2025.02.22 -- 5.0.1-v5 fixes Iterable<IAtom> AtomIterator::new missing [this,null] in generator
3435
// BH 2024.07.14 -- 5.0.1-v4 fixes numerical array initializer using characters ['a','b',...]
3536
// BH 2024.02.22 -- 5.0.1-v3 fixes long extension issue causing MutableBitInteger to miscalculate subtraction(no change in version #)
3637
// BH 2023.11.27 -- 5.0.1-v2 final refactoring and creatiton of J2SUtil

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
// TODO: superclass inheritance for JAXB XmlAccessorType
3232
// TODO: Transpiler bug allows static String name, but JavaScript function().name is read-only and will be "clazz"
3333

34+
//BH 2025.02.22 -- 5.0.1-v5 fixes Iterable<IAtom> AtomIterator::new missing [this,null] in generator
3435
//BH 2024.07.14 -- 5.0.1-v4 fixes numerical array initializer using characters ['a','b',...], but not new int[] { "test".charAt(3) }
3536
//BH 2024.02.22 -- 5.0.1-v3 fixes long extension issue causing MutableBitInteger to miscalculate subtraction(no change in version #)
3637
//BH 2023.11.27 -- 5.0.1-v2 final refactoring and creatiton of J2SUtil
@@ -796,11 +797,12 @@ private void addConstructor(ITypeBinding javaClass,
796797
// javaClass cannot be a lambda expression, because this is Xxxx::new
797798
String key = javaClass.getKey();
798799
String finals = listFinalVariables(package_htClassKeyToVisitedFinalVars.get(key), package_outerFinalKey);
799-
if (finals != null) {
800+
// for Lambda_C we need [this,null], because maybe there are finals expressed elsewhere
801+
//if (finals != null) {
800802
buffer.append("this,").append(finals);
801803
if (params.length() > 0)
802804
buffer.append(",");
803-
}
805+
//}
804806
buffer.append(params).append("]");
805807
} else if (!isDefault) {
806808
IMethodBinding constructorMethodDeclaration = (constructorMethodBinding == null ? null
Binary file not shown.

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,8 @@ public void setTranslation(T3 trans) {
336336
* @param v
337337
* the new value
338338
*/
339-
public void setElement(int row, int col, double v) {
339+
@Override
340+
public void setElement(int row, int col, double v) {
340341
if (row < 3 && col < 3) {
341342
set33(row, col, v);
342343
return;
@@ -379,7 +380,8 @@ public void setElement(int row, int col, double v) {
379380
* the column number to be retrieved (zero indexed)
380381
* @return the value at the indexed element
381382
*/
382-
public double getElement(int row, int col) {
383+
@Override
384+
public double getElement(int row, int col) {
383385
if (row < 3 && col < 3)
384386
return get33(row, col);
385387
if (row > 3 || col > 3) {

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
// Google closure compiler cannot handle Clazz.new or Clazz.super
99

10+
// BH 2025.02.22 add hashCode$() for Java Integer.TYPE and related types
1011
// BH 2025.01.31 added checks for JavaScript SyntaxError similar to other Error types
1112
// BH 2024.11.23 implementing java.awt.Toolkit.getDefaultToolkit().getDesktopProperty("awt.multiClickInterval")
1213
// BH 2024.06.22 adds Integer.getIngeger(String, int) (returning null)
@@ -3840,6 +3841,7 @@ var setJ2STypeclass = function(cl, type, paramCode) {
38403841
__PARAMCODE:paramCode,
38413842
__PRIMITIVE:1 // referenced in java.lang.Class
38423843
};
3844+
cl.TYPE.hashCode$ = function() {return type.hashCode$()};
38433845
cl.TYPE.isArray$ = cl.TYPE.isEnum$ = cl.TYPE.isAnnotation$ = FALSE;
38443846
cl.TYPE.toString = cl.TYPE.getName$ = cl.TYPE.getTypeName$
38453847
= cl.TYPE.getCanonicalName$ = cl.TYPE.getSimpleName$ = function() {return type};

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14143,6 +14143,7 @@ if (ev.keyCode == 9 && ev.target["data-focuscomponent"]) {
1414314143

1414414144
// Google closure compiler cannot handle Clazz.new or Clazz.super
1414514145

14146+
// BH 2025.02.22 add hashCode$() for Java Integer.TYPE and related types
1414614147
// BH 2025.01.31 added checks for JavaScript SyntaxError similar to other Error types
1414714148
// BH 2024.11.23 implementing java.awt.Toolkit.getDefaultToolkit().getDesktopProperty("awt.multiClickInterval")
1414814149
// BH 2024.06.22 adds Integer.getIngeger(String, int) (returning null)
@@ -17976,6 +17977,7 @@ var setJ2STypeclass = function(cl, type, paramCode) {
1797617977
__PARAMCODE:paramCode,
1797717978
__PRIMITIVE:1 // referenced in java.lang.Class
1797817979
};
17980+
cl.TYPE.hashCode$ = function() {return type.hashCode$()};
1797917981
cl.TYPE.isArray$ = cl.TYPE.isEnum$ = cl.TYPE.isAnnotation$ = FALSE;
1798017982
cl.TYPE.toString = cl.TYPE.getName$ = cl.TYPE.getTypeName$
1798117983
= cl.TYPE.getCanonicalName$ = cl.TYPE.getSimpleName$ = function() {return type};

0 commit comments

Comments
 (0)