@@ -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 );
0 commit comments