Skip to content

Commit 6ae0b6d

Browse files
committed
Fix for boxing/unboing in initializers
1 parent e510c05 commit 6ae0b6d

File tree

23 files changed

+4111
-4164
lines changed

23 files changed

+4111
-4164
lines changed
-13.2 KB
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20231125175756
1+
20231128000108
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20231125175756
1+
20231128000108

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public class CorePlugin extends Plugin {
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 2023.11.27 -- 5.0.1-v2 final refactoring and creatiton of J2SUtil
3435
// BH 2023.11.21 -- 5.0.1-v2 adds Java8 syntaxes for try and switch; removes dependency for instanceOf and exception checking
3536
// BH 2023.11.09 -- 5.0.1-v1 merges Jmol legacy (.j2sjmol) with Java8//11 (.j2s)
3637
// BH 2023.03.29 -- 3.3.1-v7 fixes outer static method call from within lambda expression.

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@ public abstract class Java2ScriptCompiler {
116116

117117
protected IJavaProject project;
118118

119+
protected int nResources;
120+
121+
119122
/**
120123
* This will activate @j2sDebug blocks, at least in SwingJS
121124
*/
@@ -480,25 +483,24 @@ private int copyNonclassFiles(File dir, File target, int n) {
480483
return n;
481484
}
482485

483-
protected int checkCopiedResources(String packageName, String sourceLocation, String outputDir) {
486+
protected void copyAllResources(String packageName, String sourceLocation) {
484487
int pt = packageName.indexOf(".");
485488
if (pt >= 0)
486489
packageName = packageName.substring(0, pt);
487490
if (copiedResourcePackages.contains(packageName))
488-
return 0;
491+
return;
489492
copiedResourcePackages.add(packageName);
490493
pt = sourceLocation.lastIndexOf("/" + packageName + "/");
491494
if (pt <= 0) {
492495
// also don't allow "" root directory
493496
if (!"_".equals(packageName))
494497
System.out.println(
495498
"J2S ignoring bad sourceLocation for package \"" + packageName + "\": " + sourceLocation);
496-
return 0;
499+
return;
497500
}
498-
String sourceDir = sourceLocation.substring(0, pt);
499-
File src = new File(sourceDir, packageName);
500-
File dest = new File(outputDir, packageName);
501-
return copySiteResources(src, dest);
501+
File src = new File(sourceLocation.substring(0, pt), packageName);
502+
File dest = new File(j2sPath, packageName);
503+
nResources += copySiteResources(src, dest);
502504
}
503505

504506
protected String fixPackageName(String name) {

sources/net.sf.j2s.core/src/j2s/jmol/J2SASTVisitor.java

Lines changed: 1 addition & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -38,25 +38,12 @@
3838
import org.eclipse.jdt.core.dom.TextElement;
3939

4040
/**
41-
*
42-
* ASTVisitor > J2SASTVisitor > J2SDependencyVisitor
43-
*
44-
* ASTVisitor > J2SASTVisitor > J2SKeywordVisitor > Java2ScriptLegacyVisitor
41+
* Superclass for J2SDependencyVisitor and Java2ScriptLegacyVisitor
4542
*
4643
* @author zhou renjian
4744
*/
4845
abstract class J2SASTVisitor extends ASTVisitor {
4946

50-
protected final static String[] preDeclaredPackages = { //
51-
"java.lang", //publicfinal refactoring -- Helpers to inner static classes
52-
"java.lang.ref", //
53-
"java.lang.ref.reflect", //
54-
"java.lang.reflect", //
55-
"java.lang.annotation", //
56-
"java.io", //
57-
"java.util" //
58-
};
59-
6047
protected Javadoc[] nativeJavadoc = null;
6148
protected ASTNode javadocRoot = null;
6249

@@ -207,45 +194,6 @@ private static int getPreviousStartPosition(Block node) {
207194
return previousStart;
208195
}
209196

210-
/**
211-
* Check for given tag in JavaDoc or annotations.
212-
*
213-
* @param node
214-
* @return
215-
*/
216-
static Object getJ2STag(BodyDeclaration node, String tagName) {
217-
Javadoc javadoc = node.getJavadoc();
218-
if (javadoc != null) {
219-
List<?> tags = javadoc.tags();
220-
if (tags.size() != 0) {
221-
for (Iterator<?> iter = tags.iterator(); iter.hasNext();) {
222-
TagElement tagEl = (TagElement) iter.next();
223-
if (tagName.equals(tagEl.getTagName())) {
224-
return tagEl;
225-
}
226-
}
227-
}
228-
}
229-
List<?> modifiers = node.modifiers();
230-
String tag = null;
231-
for (Iterator<?> iter = modifiers.iterator(); iter.hasNext();) {
232-
Object obj = iter.next();
233-
if (obj instanceof Annotation) {
234-
Annotation annotation = (Annotation) obj;
235-
String qName = annotation.getTypeName().getFullyQualifiedName();
236-
int idx = qName.indexOf("J2S");
237-
if (idx >= 0) {
238-
if (tag == null)
239-
tag = tagName.substring(4); // drop @j2s
240-
if (qName.indexOf(tag, idx) == idx + 3) {
241-
return annotation;
242-
}
243-
}
244-
}
245-
}
246-
return null;
247-
}
248-
249197
protected void checkJavadocs(ASTNode root) {
250198
if (root != javadocRoot) {
251199
nativeJavadoc = null;
@@ -413,6 +361,4 @@ protected boolean writeJ2SSources(BodyDeclaration node, String tagName, String p
413361
return existed;
414362
}
415363

416-
417-
418364
}

0 commit comments

Comments
 (0)