Skip to content

Commit bbee773

Browse files
hansonrhansonr
authored andcommitted
net.sf.j2s.core.jar v. 3.2.1
1 parent 0439d86 commit bbee773

File tree

8 files changed

+58
-38
lines changed

8 files changed

+58
-38
lines changed

sources/net.sf.j2s.core/META-INF/MANIFEST.MF

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
22
Bundle-ManifestVersion: 2
33
Bundle-Name: Java2Script Core
44
Bundle-SymbolicName: net.sf.j2s.core;singleton:=true
5-
Bundle-Version: 3.1.1
5+
Bundle-Version: 3.2.1
66
Bundle-Activator: net.sf.j2s.core.CorePlugin
77
Bundle-Vendor: j2s.sourceforge.net
88
Require-Bundle: org.eclipse.core.runtime,

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
Notes
22
=====
3+
4+
update 7/14/2018 -- 3.2.1 removes Java2ScriptJavaBuilder; uses CompilationParticipant instead
5+
-- note that this change requires that the .project builder be set back to org.eclipse.jdt.core.javabuilder
6+
37
updated 9/5/17 -- merge with net.sf.j2s.java.core
48

59
updated 6/5/17 -- reserved package name "window"

sources/net.sf.j2s.core/plugin.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,6 @@
1313
</compilationParticipant>
1414
</extension>
1515

16+
<!-- 3.2.1 now does not use a special builder. This is just for legacy code -->
17+
1618
</plugin>

sources/net.sf.j2s.core/schema/extendedASTScriptVisitor.exsd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
<meta.section type="since"/>
7070
</appInfo>
7171
<documentation>
72-
Java2Script 3.1.1 M4
72+
Java2Script 3.2.1 M4
7373
</documentation>
7474
</annotation>
7575

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,20 @@
77

88
/**
99
* The main plugin class to be used in the desktop.
10+
*
1011
*/
1112
public class CorePlugin extends Plugin {
1213

1314
//The shared instance.
1415
private static CorePlugin plugin;
1516

17+
/**
18+
* Note that Eclipse must be started with the -clean flag if it is to
19+
* register the bundle version properly. So we use VERSION here instead.
20+
*
21+
*/
22+
public static String VERSION = "3.2.1";
23+
1624
/**
1725
* The constructor.
1826
*/
@@ -25,7 +33,7 @@ public CorePlugin() {
2533
*/
2634
public void start(BundleContext context) throws Exception {
2735
super.start(context);
28-
System.out.println("Java2Script CorePlugin started");
36+
System.out.println("net.sf.j2s.core." + context.getBundle().getVersion() + "/" + VERSION + " started");
2937
// if (!InnerHotspotServer.isServerStarted()) {
3038
// InnerHotspotServer.getSingletonServer().startServer();
3139
// }

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

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@
122122
import org.eclipse.jdt.core.dom.WhileStatement;
123123
import org.eclipse.jdt.core.dom.WildcardType;
124124

125+
import net.sf.j2s.core.CorePlugin;
126+
125127
// BH 7/5/2018 -- fixes int | char
126128
// BH 7/3/2018 -- adds tryWithResource
127129
// BH 7/3/2018 -- adds effectively final -- FINAL keyword no longer necessary
@@ -4708,9 +4710,9 @@ private void setMapJavaDoc(PackageDeclaration node) {
47084710
// normal termination from item after last j2sjavadoc
47094711
}
47104712

4711-
for (int i = 0, n = list.size(); i < n; i++) {
4712-
System.err.println(i + " " + (list.get(i) == null ? null : list.get(i).getClass().getName() + " " + list.get(i).getStartPosition() + "..." + (list.get(i).getStartPosition() + list.get(i).getLength())));
4713-
}
4713+
// for (int i = 0, n = list.size(); i < n; i++) {
4714+
// System.err.println(i + " " + (list.get(i) == null ? null : list.get(i).getClass().getName() + " " + list.get(i).getStartPosition() + "..." + (list.get(i).getStartPosition() + list.get(i).getLength())));
4715+
// }
47144716

47154717
// and link javadoc to its closest block
47164718

@@ -4731,7 +4733,7 @@ private void setMapJavaDoc(PackageDeclaration node) {
47314733
List<Javadoc> docs = global_mapBlockJavadoc.get(pt);
47324734
if (docs == null)
47334735
global_mapBlockJavadoc.put(pt, docs = new ArrayList<Javadoc>());
4734-
System.err.println(pt + " " + item.getClass().getName() + " " + doc);
4736+
//System.err.println(pt + " " + item.getClass().getName() + " " + doc);
47354737
docs.add(doc);
47364738
}
47374739
}
@@ -4754,7 +4756,8 @@ public boolean preVisit2(ASTNode node) {
47544756
}
47554757

47564758
private List<Javadoc> getJ2sJavadoc(ASTNode node, boolean isPre) {
4757-
List<Javadoc> docs = global_mapBlockJavadoc.remove(Integer.valueOf((isPre ? 1 : -1) * node.getStartPosition()));
4759+
// global_mapBlockJavadoc will be null for a no-package class like VARNA.java
4760+
List<Javadoc> docs = (global_mapBlockJavadoc == null ? null : global_mapBlockJavadoc.remove(Integer.valueOf((isPre ? 1 : -1) * node.getStartPosition())));
47584761
if (!isPre && docs != null)
47594762
NativeDoc.checkJ2sJavadocs(buffer, docs, false, global_j2sFlag_isDebugging);
47604763
return docs;
@@ -4960,7 +4963,7 @@ private String getNestedClazzLoads(String className, boolean doCache) {
49604963
* @return List {elementName, js, elementName, js, ....}
49614964
*/
49624965
public List<String> getElementList() {
4963-
String trailer = "//Created " + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()) + " j2s ver. " + ver + "\n";
4966+
String trailer = "//Created " + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()) + " net.sf.j2s.core.jar v. " + CorePlugin.VERSION + "\n";
49644967
List<String> elements = new ArrayList<String>();
49654968
String js = buffer.toString();
49664969
String eq = "="; // because we might be operating on this file

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

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,18 @@ public class Java2ScriptCompiler {
4444
// BH: added "true".equals(getProperty(props,
4545
// "j2s.compiler.allow.compression")) to ensure compression only occurs when
4646
// desired
47-
static final int JSL_LEVEL = AST.JLS8; // BH can we go to JSL 8?
47+
private static final int JSL_LEVEL = AST.JLS8; // BH can we go to JSL 8?
4848

49-
private static boolean showJ2SSettings = true;
49+
private boolean showJ2SSettings = true;
5050

5151
// We copy all non .java files from any directory from which we loaded a
5252
// java file into the site directory
53-
private final static HashSet<String> copyResources = new HashSet<String>();
54-
private static Map<String, String> htMethodsCalled;
55-
private static List<String> lstMethodsDeclared;
53+
private final HashSet<String> copyResources = new HashSet<String>();
54+
private Map<String, String> htMethodsCalled;
55+
private List<String> lstMethodsDeclared;
5656

57-
private static Properties props;
58-
private static String htmlTemplate = null;
57+
private Properties props;
58+
private String htmlTemplate = null;
5959

6060
private String projectFolder;
6161

@@ -95,26 +95,27 @@ public void startBuild(boolean isClean) {
9595
isCleanBuild = isClean;
9696
htmlTemplate = null;
9797
if (isClean) {
98-
// we can make these nonstatic if this works
9998
copyResources.clear();
10099
lstMethodsDeclared = null;
101100
htMethodsCalled = null;
102101
}
103102
}
104103

105-
/**
106-
* old way from original builder
107-
*
108-
*/
109-
public void process(ICompilationUnit sourceUnit, IContainer binaryFolder) {
110-
if (!(sourceUnit instanceof SourceFile))
111-
return;
112-
if (!initializeProject(binaryFolder.getProject(), false))
113-
return;
114-
compileToJavaScript(((SourceFile) sourceUnit).resource);
115-
}
104+
// /**
105+
// * old way from original builder
106+
// *
107+
// */
108+
// public void process(ICompilationUnit sourceUnit, IContainer binaryFolder) {
109+
// if (!(sourceUnit instanceof SourceFile))
110+
// return;
111+
// if (!initializeProject(binaryFolder.getProject(), false))
112+
// return;
113+
// compileToJavaScript(((SourceFile) sourceUnit).resource);
114+
// }
116115

117116
/**
117+
* from Java2ScriptCompilationParticipant.java
118+
*
118119
* get all necessary .j2s params for a build
119120
*
120121
* @param project
@@ -222,6 +223,8 @@ public boolean initializeProject(IProject project, boolean isCompilationParticip
222223
}
223224

224225
/**
226+
* from Java2ScriptCompilationParticipant.java
227+
*
225228
* process the source file into JavaScript using the JDT abstract syntax
226229
* tree parser and visitor
227230
*
@@ -292,7 +295,7 @@ public void compileToJavaScript(IFile javaSource) {
292295
}
293296
}
294297

295-
private static void logMethods(String logCalled, String logDeclared, boolean doAppend) {
298+
private void logMethods(String logCalled, String logDeclared, boolean doAppend) {
296299
if (htMethodsCalled != null)
297300
try {
298301
File file = new File(logCalled);
@@ -326,14 +329,14 @@ private static void logMethods(String logCalled, String logDeclared, boolean doA
326329
}
327330
}
328331

329-
private static String getProperty(String key) {
332+
private String getProperty(String key) {
330333
String val = props.getProperty(key);
331334
if (showJ2SSettings)
332335
System.err.println(key + " = " + val);
333336
return val;
334337
}
335338

336-
public static void outputJavaScript(Java2ScriptVisitor visitor,
339+
public void outputJavaScript(Java2ScriptVisitor visitor,
337340
// DependencyASTVisitor dvisitor, CompilationUnit fRoot,
338341
String j2sPath) {
339342

@@ -351,7 +354,7 @@ public static void outputJavaScript(Java2ScriptVisitor visitor,
351354
showJ2SSettings = false; // just once per compilation run
352355
}
353356

354-
private static void createJSFile(String j2sPath, String packageName, String elementName, String js) {
357+
private void createJSFile(String j2sPath, String packageName, String elementName, String js) {
355358
if (packageName != null) {
356359
File folder = new File(j2sPath, packageName.replace('.', File.separatorChar));
357360
j2sPath = folder.getAbsolutePath();
@@ -385,7 +388,7 @@ private String getFileContents(File file) {
385388
return null;
386389
}
387390

388-
private static void writeToFile(File file, String data) {
391+
private void writeToFile(File file, String data) {
389392
if (data == null)
390393
return;
391394
try {
@@ -429,7 +432,7 @@ private String getDefaultHTMLTemplate() {
429432
* @param template
430433
* @param isApplet
431434
*/
432-
private static void addHTML(ArrayList<String> appList, String siteFolder, String template, boolean isApplet) {
435+
private void addHTML(ArrayList<String> appList, String siteFolder, String template, boolean isApplet) {
433436
if (appList == null || template == null)
434437
return;
435438
for (int i = appList.size(); --i >= 0;) {
@@ -445,7 +448,7 @@ private static void addHTML(ArrayList<String> appList, String siteFolder, String
445448
}
446449
}
447450

448-
private static FileFilter filter = new FileFilter() {
451+
private FileFilter filter = new FileFilter() {
449452

450453
@Override
451454
public boolean accept(File pathname) {
@@ -454,11 +457,11 @@ public boolean accept(File pathname) {
454457

455458
};
456459

457-
private static void copySiteResources(File from, File dest) {
460+
private void copySiteResources(File from, File dest) {
458461
copyNonclassFiles(from, dest);
459462
}
460463

461-
private static void copyNonclassFiles(File dir, File target) {
464+
private void copyNonclassFiles(File dir, File target) {
462465
if (dir.equals(target))
463466
return;
464467
File[] files = dir.listFiles(filter);

sources/net.sf.j2s.java.core/.project

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
</projects>
77
<buildSpec>
88
<buildCommand>
9-
<name>net.sf.j2s.core.java2scriptbuilder</name>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
1010
<arguments>
1111
</arguments>
1212
</buildCommand>

0 commit comments

Comments
 (0)