Skip to content

various updates #232

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 28 commits into from
Dec 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
cf4480e
updated to show correct resource action with URL->URI->File
BobHanson Feb 25, 2024
847a0d6
Font metrics upgrade
BobHanson Mar 3, 2024
ec5cf1f
JMenuBar height tweak; Clazz fix for strings now in exceptions
BobHanson Mar 3, 2024
a712ed2
Fix for 4.2 Jmol ArrayList and Enum
BobHanson Mar 19, 2024
8dd3a82
fixes for 4.2 j2sjmol.js
BobHanson Apr 10, 2024
3b6b3c9
HTML5Video update for Chrome frame callback
BobHanson May 10, 2024
21ef2ea
BigInt.modPow fix for large int*int overflow
BobHanson May 10, 2024
d89e8df
update HTML5Video
BobHanson May 28, 2024
6c6b9db
impossible match catch
BobHanson Jun 21, 2024
1430ff0
formatting only
BobHanson Jun 21, 2024
f3d8985
supress unlikely target
BobHanson Jun 21, 2024
eaf26f7
adds MediaInfo WASM for getting video metadata
BobHanson Jun 21, 2024
48a7898
adds Integer.getString(String, int)
BobHanson Jun 22, 2024
4bdcdb6
adds Integer.getString(String, int); allows for null applet stub
BobHanson Jun 24, 2024
80a2799
residual Floats in CU and GifEncoder
BobHanson Jun 25, 2024
8ba7785
incorporates j2sComboBox, j2sMenu, and J2sSlider into JQueryUI.java
BobHanson Jun 28, 2024
b807960
fixes in Lst for OpenJDK compliance
BobHanson Jul 17, 2024
ea846db
fixes PT.isMatch
BobHanson Jul 17, 2024
2910a8f
array initialization fix -- SwingJS only
BobHanson Aug 14, 2024
8ca18fb
j2s.core.jar update for new byte[] {'c'}
BobHanson Aug 14, 2024
739ea06
SwingJS-site.zip; JSmouse.java
BobHanson Nov 8, 2024
99386f8
update j2sApplet.js
BobHanson Nov 9, 2024
9d2f277
Jmol-j2s-site.zip, JSmolJavaExt fix
BobHanson Nov 23, 2024
a80e2dc
Fixes for JSTextBoxUI not reporting 4 for min width
BobHanson Nov 25, 2024
ba167cc
Just testing Google's NGram API
BobHanson Nov 27, 2024
84ea1a2
JSTextUI update
BobHanson Dec 2, 2024
970e778
ZipInputStream fix to allow odd zero-length file format; file opener
BobHanson Dec 20, 2024
61b4fc1
Merge pull request #278 from java2script/master
BobHanson Dec 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified sources/net.sf.j2s.core/dist/swingjs/SwingJS-site.zip
Binary file not shown.
Binary file modified sources/net.sf.j2s.core/dist/swingjs/j2s.core.jar
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion sources/net.sf.j2s.core/dist/swingjs/timestamp
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20240225103130
20241217101652
Binary file modified sources/net.sf.j2s.core/dist/swingjs/ver/5.0.1/SwingJS-site.zip
Binary file not shown.
Binary file modified sources/net.sf.j2s.core/dist/swingjs/ver/5.0.1/j2s.core.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion sources/net.sf.j2s.core/dist/swingjs/ver/5.0.1/timestamp
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20240225103130
20241217101652
4 changes: 3 additions & 1 deletion sources/net.sf.j2s.core/src/j2s/CorePlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ public class CorePlugin extends Plugin {
* the actual "x.y.z" version is specified in plugin.xml.
*
*/
public static String VERSION = "5.0.1-v2";
public static String VERSION = "5.0.1-v4";

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

// BH 2024.07.14 -- 5.0.1-v4 fixes numerical array initializer using characters ['a','b',...]
// BH 2024.02.22 -- 5.0.1-v3 fixes long extension issue causing MutableBitInteger to miscalculate subtraction(no change in version #)
// BH 2023.11.27 -- 5.0.1-v2 final refactoring and creatiton of J2SUtil
// BH 2023.11.21 -- 5.0.1-v2 adds Java8 syntaxes for try and switch; removes dependency for instanceOf and exception checking
// BH 2023.11.09 -- 5.0.1-v1 merges Jmol legacy (.j2sjmol) with Java8//11 (.j2s)
Expand Down
4 changes: 3 additions & 1 deletion sources/net.sf.j2s.core/src/j2s/jmol/J2SLegacyVisitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -2100,7 +2100,7 @@ public boolean visit(ArrayCreation node) {
buffer.append(" Clazz.newBooleanArray(");
boxList(dim, ", ");
buffer.append(", false)");
} else {
} else {
if (dim != null && dim.size() > 1) {
buffer.append(" Clazz.newArray(");
boxList(dim, ", ");
Expand Down Expand Up @@ -2140,6 +2140,8 @@ public boolean visit(ArrayInitializer node) {
buffer.append("]");
return false;
}
// note that this does NOT allow for new byte[] {'a', 'b', 'c'}
// only implemented that for SwingJS
if (elementType.isPrimitive()) {
String typeCode = elementType.getName();
if ("int".equals(typeCode)
Expand Down
62 changes: 56 additions & 6 deletions sources/net.sf.j2s.core/src/j2s/swingjs/Java2ScriptVisitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@
// TODO: superclass inheritance for JAXB XmlAccessorType
// TODO: Transpiler bug allows static String name, but JavaScript function().name is read-only and will be "clazz"

//BH 2024.02.22 -- 3.3.1-v7 fixes long extension issue causing MutableBitInteger to miscalculate subtraction(no change in version #)
//BH 2024.07.14 -- 5.0.1-v4 fixes numerical array initializer using characters ['a','b',...], but not new int[] { "test".charAt(3) }
//BH 2024.02.22 -- 5.0.1-v3 fixes long extension issue causing MutableBitInteger to miscalculate subtraction(no change in version #)
//BH 2023.11.27 -- 5.0.1-v2 final refactoring and creatiton of J2SUtil
//BH 2023.11.21 -- 5.0.1-v2 adds Java8 syntaxes for try and switch; removes dependency for instanceOf and exception checking
//BH 2023.11.09 -- 5.0.1-v1 merges Jmol legacy (.j2sjmol) with Java8//11 (.j2s)
//BH 2023.03.29 -- 3.3.1-v7 fixes outer static method call from within lambda expression.
//BH 2023.02.09 -- 3.3.1.v6 fixes j2s.excluded.paths needing /src/xxxx
//BH 2022.06.27 -- 3.3.1-v5 fixes missing method annotations
Expand Down Expand Up @@ -3015,15 +3019,63 @@ private void addArrayConstructor(ITypeBinding binding, List<ASTNode> dim) {

public boolean visit(ArrayInitializer node) {
// as in: public String[] d = {"1", "2"};
buffer.append(clazzArray(node.resolveTypeBinding(), ARRAY_INITIALIZED));
ITypeBinding type = node.resolveTypeBinding();
buffer.append(clazzArray(type, ARRAY_INITIALIZED));
buffer.append(", [");
int toChar = toCharType(type);
@SuppressWarnings("unchecked")
List<ASTNode> expressions = node.expressions();
visitList(expressions, ", ");
List<ASTNode> ex = node.expressions();
if (toChar == 0) {
visitList(ex, ", ");
} else {
fixCharArrayInit(buffer, ex, toChar);
}
buffer.append("])");
return false;
}

private static int toCharType(ITypeBinding type) {
switch (type == null ? "" : type.getName()) {
case "char[]":
return 1;
case "byte[]":
case "short[]":
case "int[]":
case "long[]":
case "float[]":
case "double[]":
return -1;
default:
return 0;
}
}

private void fixCharArrayInit(StringBuffer buffer, List<ASTNode> list, int toChar) {
for (Iterator<ASTNode> iter = list.iterator(); iter.hasNext();) {
int pt = buffer.length();
appendBoxingNode(iter.next(), false, null, false, false);
if (toChar != 0) {
String s = buffer.substring(pt);
// only fix "x" and number
// not fixed: int[] a = new int[] {"test".charAt(0)}
try {
if (pt > 0 && (s.charAt(0) == '"') != (toChar == 1)) {
buffer.replace(pt, buffer.length(),
(toChar == 1 ?
"\"" + ((char) Integer.parseInt(s)) + "\""
: s.length() == 3 ? "" + (byte) s.charAt(1) : s)
);
}
} catch (@SuppressWarnings("unused") Exception e) {
// ignore
}
}
if (!iter.hasNext())
return;
buffer.append(", ");
}
}

public boolean visit(Assignment node) {
// note that this is not
// var x = ..... -- that is a visit(VariableDeclaration)
Expand Down Expand Up @@ -4431,8 +4483,6 @@ private void addNonCharacter(Expression exp) {
switch (name) {
case "char":
case "Character":
addOperand(exp, false);
break;
case "Byte":
case "Short":
case "Integer":
Expand Down
Binary file modified sources/net.sf.j2s.java.core/dist/SwingJS-site.zip
Binary file not shown.
Binary file removed sources/net.sf.j2s.java.core/dist/j2s.core.jar
Binary file not shown.
Binary file modified sources/net.sf.j2s.java.core/dist_to_jsmol/Jmol-j2s-site.zip
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -1002,6 +1002,8 @@ return buf.join('');

if(String.prototype.$replace==null){
java.lang.String=String;
Clazz._setDeclared("String", String);

if(Clazz._supportsNativeObject){
for(var i=0;i<Clazz._extendedObjectMethods.length;i++){
var p=Clazz._extendedObjectMethods[i];
Expand Down Expand Up @@ -1075,9 +1077,7 @@ for(i=0;i<arr.length-1;i++){
funStr+="\""+arr[i]+"\" + $"+orders[i]+" + ";
}
funStr+="\""+arr[i]+"\"; }";
var f=null;
eval(funStr)
return f;
return eval(funStr);
};

sp.replaceAll=function(exp,str){
Expand Down Expand Up @@ -1666,6 +1666,8 @@ c$.get = function(o, i){return o[i]};
javautil.Date=Date;
Date.TYPE="javautil.Date";
Date.__CLASS_NAME__="Date";
Clazz._setDeclared("java.util.Date", Date);
Clazz._setDeclared("Date", Date);
Clazz.implementOf(Date,[java.io.Serializable,java.lang.Comparable]);
Clazz.defineMethod(javautil.Date,"clone",
function(){
Expand Down
Loading