diff --git a/.gitignore b/.gitignore index c9a3e54a..3556f505 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ sources/net.sf.j2s.lib/j2slib docs/_site .jekyll-metadata +/.gradle/ diff --git a/sources/net.sf.j2s.core/src/net/sf/j2s/core/Java2ScriptCompilationParticipant.java b/sources/net.sf.j2s.core/src/net/sf/j2s/core/Java2ScriptCompilationParticipant.java index 5e8e92c7..f58c259f 100644 --- a/sources/net.sf.j2s.core/src/net/sf/j2s/core/Java2ScriptCompilationParticipant.java +++ b/sources/net.sf.j2s.core/src/net/sf/j2s/core/Java2ScriptCompilationParticipant.java @@ -1,5 +1,8 @@ package net.sf.j2s.core; +import java.util.Arrays; +import java.util.Properties; + import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jdt.core.compiler.BuildContext; import org.eclipse.jdt.core.compiler.ReconcileContext; @@ -86,7 +89,13 @@ public class Java2ScriptCompilationParticipant extends org.eclipse.jdt.core.comp * identifies when the build is a batch build */ public void buildStarting(BuildContext[] files, boolean isBatch) { - javaFiles = files; + if (javaFiles != null) { + BuildContext[] concat = Arrays.copyOf(javaFiles, javaFiles.length + files.length); + System.arraycopy(files, 0, concat , javaFiles.length, files.length); + javaFiles = concat; + } else { + javaFiles = files; + } System.out.println("buildStarting " + files.length + " files, isBatch=" + isBatch); } @@ -110,7 +119,7 @@ public class Java2ScriptCompilationParticipant extends org.eclipse.jdt.core.comp } System.out.println("building JavaScript " + project.getProject().getLocation()); for (int i = 0; i < javaFiles.length; i++) { - System.out.println("transpiling " + javaFiles[i]); + System.out.println("[" + (i+1) + "/" + javaFiles.length + "] transpiling " + javaFiles[i]); // trying to keep the progess monitor running - didn't work // try { // Thread.currentThread().sleep(1); diff --git a/sources/net.sf.j2s.core/src/net/sf/j2s/core/Java2ScriptCompiler.java b/sources/net.sf.j2s.core/src/net/sf/j2s/core/Java2ScriptCompiler.java index f16acda2..ce31b524 100644 --- a/sources/net.sf.j2s.core/src/net/sf/j2s/core/Java2ScriptCompiler.java +++ b/sources/net.sf.j2s.core/src/net/sf/j2s/core/Java2ScriptCompiler.java @@ -12,6 +12,7 @@ import java.nio.file.Files; import java.nio.file.StandardCopyOption; import java.util.ArrayList; import java.util.Date; +import java.util.Enumeration; import java.util.HashSet; import java.util.Hashtable; import java.util.List; @@ -20,6 +21,7 @@ import java.util.Properties; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.IProduct; import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jdt.core.JavaCore; import org.eclipse.jdt.core.dom.AST; @@ -194,7 +196,7 @@ class Java2ScriptCompiler { } testing = "true".equals(getProperty("j2s.testing")); - + String prop = getProperty("j2s.compiler.nonqualified.packages"); // older version of the name String nonqualifiedPackages = getProperty("j2s.compiler.nonqualified.classes"); @@ -243,12 +245,12 @@ class Java2ScriptCompiler { * @param javaSource */ boolean compileToJavaScript(IFile javaSource) { - - String fileName = new String(javaSource.getName()); + String fileName = new String(javaSource.getFullPath().removeFirstSegments(1).toPortableString()); if (lstExcludedPaths != null) { for (int i = lstExcludedPaths.size(); --i >= 0;) - if (fileName.startsWith(lstExcludedPaths.get(i))) + if (fileName.startsWith(lstExcludedPaths.get(i))) { return true; + } } org.eclipse.jdt.core.ICompilationUnit createdUnit = JavaCore.createCompilationUnitFrom(javaSource); astParser.setSource(createdUnit); diff --git a/sources/net.sf.j2s.java.core/src/javax/xml/validation/SchemaFactoryFinder.java b/sources/net.sf.j2s.java.core/src/javax/xml/validation/SchemaFactoryFinder.java index 8157b6bd..85ab518e 100644 --- a/sources/net.sf.j2s.java.core/src/javax/xml/validation/SchemaFactoryFinder.java +++ b/sources/net.sf.j2s.java.core/src/javax/xml/validation/SchemaFactoryFinder.java @@ -68,7 +68,7 @@ class SchemaFactoryFinder { // Use try/catch block to support applets try { debug = ss.getSystemProperty("jaxp.debug") != null; - } catch (Exception _) { + } catch (Exception e) { debug = false; } } @@ -113,7 +113,7 @@ class SchemaFactoryFinder { debugPrintln("using thread context class loader ("+classLoader+") for search"); return; } - } catch( Throwable _ ) { + } catch( Throwable t ) { ; // getContextClassLoader() undefined in JDK1.1 } diff --git a/sources/net.sf.j2s.java.core/src/javax/xml/xpath/XPathFactoryFinder.java b/sources/net.sf.j2s.java.core/src/javax/xml/xpath/XPathFactoryFinder.java index 2833a588..4b88b340 100644 --- a/sources/net.sf.j2s.java.core/src/javax/xml/xpath/XPathFactoryFinder.java +++ b/sources/net.sf.j2s.java.core/src/javax/xml/xpath/XPathFactoryFinder.java @@ -56,7 +56,7 @@ class XPathFactoryFinder { // Use try/catch block to support applets try { debug = ss.getSystemProperty("jaxp.debug") != null; - } catch (Exception _) { + } catch (Exception e) { debug = false; } } @@ -111,7 +111,7 @@ class XPathFactoryFinder { debugPrintln("using thread context class loader ("+classLoader+") for search"); return; } - } catch( Throwable _ ) { + } catch( Throwable t ) { ; // getContextClassLoader() undefined in JDK1.1 } diff --git a/sources/net.sf.j2s.java.core/src/swingjs/JSGraphics2D.java b/sources/net.sf.j2s.java.core/src/swingjs/JSGraphics2D.java index 75073f6d..6b2b0d98 100644 --- a/sources/net.sf.j2s.java.core/src/swingjs/JSGraphics2D.java +++ b/sources/net.sf.j2s.java.core/src/swingjs/JSGraphics2D.java @@ -620,7 +620,7 @@ public class JSGraphics2D implements buf8[pt++] = argb & 0xFF; buf8[pt++] = (isRGB ? 0xFF : (argb >> 24) & 0xFF); } - double[] m = HTML5CanvasContext2D.getMatrix(ctx, transform); + m = HTML5CanvasContext2D.getMatrix(ctx, transform); if (m[0] != 1 || m[1] != 0 || m[2] != 0 || m[3] != 1) System.err.println("Unsupported transform"); x += m[4];