Skip to content

Commit 1982cad

Browse files
committed
compiler 5.0.1.v2 4.2 legacy transpiler refactored extensively
clarification of "Helpers" vs "Visitors" better subclassing consolidation of code for accessing Helpers removes @j2sSuffix and @j2sPrefix removed (never used in Jmol) swaths of comments removed.
1 parent bc69e4e commit 1982cad

23 files changed

+624
-1102
lines changed
-338 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20231122080006
1+
20231122230517
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20231122080006
1+
20231122230517

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,13 @@ public abstract class Java2ScriptCompiler {
8484

8585
abstract public boolean compileToJavaScript(IFile javaSource, String trailer);
8686

87-
abstract protected String getDefaultJ2SFile();
88-
8987
abstract public void finalizeProject();
9088

89+
/*
90+
* To save a default file with comments specific to this transpiler.
91+
*/
92+
abstract protected String getDefaultJ2SFileContents();
93+
9194
/**
9295
* The name of the J2S options file, aka as the "Dot-j2s" file. Please do not
9396
* change this value.
@@ -99,7 +102,6 @@ public abstract class Java2ScriptCompiler {
99102
protected Properties props;
100103

101104
protected String projectFolder;
102-
// protected String outputPath;
103105
protected String siteFolder;
104106
protected String j2sPath;
105107
protected String excludedPaths;
@@ -271,7 +273,7 @@ protected boolean initializeProject(IJavaProject project, boolean isCleanBuild,
271273
return false;
272274
}
273275
if (getFileContents(activeJ2SFile).trim().length() == 0) {
274-
writeToFile(activeJ2SFile, getDefaultJ2SFile());
276+
writeToFile(activeJ2SFile, getDefaultJ2SFileContents());
275277
}
276278
int jslLevel = javaLanguageLevel;
277279
if (isSwingJS) {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ public boolean compileToJavaScript(IFile javaSource, String trailer) {
149149

150150
private void outputJavaScript(Java2ScriptScriptVisitor visitor, Java2ScriptDependencyVisitor dvisitor, CompilationUnit fRoot,
151151
String outputPath, String trailer, String sourceLocation) {
152-
String js = finalFixes(dvisitor.getDependencyScript(visitor.getBuffer()));
152+
String js = finalFixes(dvisitor.cleanLoadCalls(visitor.getBuffer()));
153153
String elementName = fRoot.getJavaElement().getElementName();
154154
elementName = elementName.substring(0, elementName.lastIndexOf('.'));
155155
String packageName = visitor.getPackageName();
@@ -182,7 +182,7 @@ private String finalFixes(String js) {
182182
}
183183

184184
@Override
185-
protected String getDefaultJ2SFile() {
185+
protected String getDefaultJ2SFileContents() {
186186
return "#j2sjmol default configuration file created by j2s.core plugin " + CorePlugin.VERSION + " " + new Date()
187187
+ "\n\n" + "#enable the Java2Script transpiler -- set to \"disabled\" to disable\n"
188188
+ "# default is \"enabled\".\n" + "j2s.compiler.status=enabled\n\n"

sources/net.sf.j2s.core/src/j2s/jmol/common/Bindings.java renamed to sources/net.sf.j2s.core/src/j2s/jmol/common/BindingHelper.java

Lines changed: 76 additions & 79 deletions
Large diffs are not rendered by default.

sources/net.sf.j2s.core/src/j2s/jmol/common/FinalVariable.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
* 2006-12-6
1010
*/
11-
public class FinalVariable {
11+
class FinalVariable {
1212

1313
/**
1414
* Level of the block

sources/net.sf.j2s.core/src/j2s/jmol/common/IHelper.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*******************************************************************************
22
* Copyright (c) 2007 java2script.org and others.
33
* All rights reserved. This program and the accompanying materials
4-
* are made available under the terms of the Eclipse Public License v1.0
4+
* are made available under the terms of the Eclipse License v1.0
55
* which accompanies this distribution, and is available at
66
* http://www.eclipse.org/legal/epl-v10.html
77
*
@@ -17,6 +17,7 @@
1717
*
1818
* 2006-12-27
1919
*/
20+
2021
public interface IHelper {
2122
public StringBuffer getBuffer();
2223
public J2SASTVisitor getVisitor();

0 commit comments

Comments
 (0)