Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
29e498d
Merge pull request #94 from BobHanson/master
BobHanson Dec 16, 2018
021d71f
Merge pull request #95 from BobHanson/master
BobHanson Dec 18, 2018
40f881c
Merge pull request #96 from BobHanson/master
BobHanson Dec 21, 2018
9a6232a
Merge pull request #97 from BobHanson/master
BobHanson Dec 29, 2018
50cd026
fix security alert issues
abego Jan 2, 2019
24c34b6
Merge pull request #98 from BobHanson/master
BobHanson Jan 3, 2019
6ad39ed
fix security alert issue CVE-2018-14404
abego Jan 19, 2019
1d61f3e
Merge pull request #99 from BobHanson/master
BobHanson Jan 21, 2019
4e25f7d
Merge pull request #100 from BobHanson/master
BobHanson Feb 5, 2019
e47365d
Merge pull request #101 from BobHanson/master
BobHanson Feb 5, 2019
63cf479
Merge pull request #102 from BobHanson/master
BobHanson Feb 5, 2019
5a884b2
Merge pull request #103 from BobHanson/master
BobHanson Mar 8, 2019
c212b01
Merge pull request #104 from BobHanson/master
BobHanson Mar 15, 2019
004f7fa
Merge pull request #105 from BobHanson/master
BobHanson Mar 17, 2019
8c7eeb3
Merge pull request #106 from BobHanson/master
BobHanson Mar 20, 2019
e2be5e8
Merge pull request #107 from BobHanson/master
BobHanson Mar 23, 2019
14571de
Merge pull request #108 from BobHanson/master
BobHanson Mar 26, 2019
cf04973
Merge pull request #109 from BobHanson/master
BobHanson Apr 4, 2019
1332e6f
Merge pull request #110 from BobHanson/master
BobHanson Apr 11, 2019
ef4db4d
Merge pull request #111 from BobHanson/master
BobHanson Apr 11, 2019
de6d443
Merge pull request #112 from BobHanson/master
BobHanson Apr 11, 2019
0638a96
Merge pull request #113 from BobHanson/master
BobHanson May 10, 2019
5aba678
Merge pull request #114 from BobHanson/master
BobHanson May 16, 2019
8183511
Merge pull request #115 from BobHanson/master
BobHanson Jun 7, 2019
0e101be
Merge pull request #116 from BobHanson/master
BobHanson Jun 17, 2019
14f4b20
Merge pull request #117 from BobHanson/master
BobHanson Jun 28, 2019
db0aaf1
Merge pull request #118 from BobHanson/master
BobHanson Jul 2, 2019
886006a
Merge pull request #119 from BobHanson/master
BobHanson Jul 3, 2019
6505133
Merge pull request #120 from BobHanson/master
BobHanson Jul 3, 2019
a94e2ef
Merge pull request #121 from BobHanson/master
BobHanson Jul 24, 2019
2cb6c0e
Merge pull request #123 from BobHanson/master
BobHanson Aug 16, 2019
7eab03e
Merge pull request #124 from BobHanson/master
BobHanson Aug 17, 2019
485721a
Update README
BobHanson Aug 20, 2019
dd32e70
Update quickstart.md
BobHanson Aug 20, 2019
8550e31
Merge pull request #125 from BobHanson/master
BobHanson Aug 28, 2019
77392df
Merge pull request #126 from BobHanson/master
BobHanson Aug 29, 2019
4b6c0ae
sets File.isDirectory() to return false, not true
Sep 23, 2019
9705464
java2script compiler adds debugging message for write file locations
Sep 23, 2019
795951c
Test_Path for preferences
Sep 23, 2019
859fd57
// BH 2019.09.13 fixes touchend canceling click
Sep 23, 2019
267453e
noting that Android mobile will not fire keyPressed
Sep 23, 2019
8858c18
javax.json support; ObjectStream work.
Sep 23, 2019
42ac7ef
XMLInputFactory broken; not directing to JSXMLInputFactory.
Sep 23, 2019
ffdc322
transpiler j2s.compiler.mode=debug option
Sep 23, 2019
23e7e8b
Merge pull request #128 from BobHanson/hanson1
BobHanson Sep 23, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 36 additions & 36 deletions docs/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ GEM
execjs (2.7.0)
faraday (0.14.0)
multipart-post (>= 1.2, < 3)
ffi (1.9.23)
ffi (~> 1.9.24)
forwardable-extended (2.6.0)
gemoji (3.0.0)
github-pages (180)
activesupport (= 4.2.9)
github-pages-health-check (= 1.4.0)
jekyll (= 3.7.3)
jekyll (~> 3.7.4)
jekyll-avatar (= 0.5.0)
jekyll-coffeescript (= 1.1.1)
jekyll-commonmark-ghpages (= 0.1.5)
Expand Down Expand Up @@ -70,7 +70,7 @@ GEM
listen (= 3.1.5)
mercenary (~> 0.3)
minima (= 2.4.0)
nokogiri (>= 1.8.1, < 2.0)
nokogiri (>= 1.8.5, < 2.0)
rouge (= 2.2.1)
terminal-table (~> 1.4)
github-pages-health-check (1.4.0)
Expand All @@ -81,11 +81,11 @@ GEM
typhoeus (~> 1.3)
html-pipeline (2.7.1)
activesupport (>= 2)
nokogiri (>= 1.4)
nokogiri (>= 1.8.5)
http_parser.rb (0.6.0)
i18n (0.9.5)
concurrent-ruby (~> 1.0)
jekyll (3.7.3)
jekyll (~> 3.7.4)
addressable (~> 2.4)
colorator (~> 1.0)
em-websocket (~> 0.5)
Expand All @@ -99,99 +99,99 @@ GEM
rouge (>= 1.7, < 4)
safe_yaml (~> 1.0)
jekyll-avatar (0.5.0)
jekyll (~> 3.0)
jekyll (~> 3.7.4)
jekyll-coffeescript (1.1.1)
coffee-script (~> 2.2)
coffee-script-source (~> 1.11.1)
jekyll-commonmark (1.2.0)
commonmarker (~> 0.14)
jekyll (>= 3.0, < 4.0)
jekyll (~> 3.7.4)
jekyll-commonmark-ghpages (0.1.5)
commonmarker (~> 0.17.6)
jekyll-commonmark (~> 1)
rouge (~> 2)
jekyll-default-layout (0.1.4)
jekyll (~> 3.0)
jekyll (~> 3.7.4)
jekyll-feed (0.9.3)
jekyll (~> 3.3)
jekyll (~> 3.7.4)
jekyll-gist (1.5.0)
octokit (~> 4.2)
jekyll-github-metadata (2.9.4)
jekyll (~> 3.1)
jekyll (~> 3.7.4)
octokit (~> 4.0, != 4.4.0)
jekyll-mentions (1.3.0)
activesupport (~> 4.0)
html-pipeline (~> 2.3)
jekyll (~> 3.0)
jekyll (~> 3.7.4)
jekyll-optional-front-matter (0.3.0)
jekyll (~> 3.0)
jekyll (~> 3.7.4)
jekyll-paginate (1.1.0)
jekyll-readme-index (0.2.0)
jekyll (~> 3.0)
jekyll (~> 3.7.4)
jekyll-redirect-from (0.13.0)
jekyll (~> 3.3)
jekyll (~> 3.7.4)
jekyll-relative-links (0.5.3)
jekyll (~> 3.3)
jekyll (~> 3.7.4)
jekyll-remote-theme (0.2.3)
jekyll (~> 3.5)
jekyll (~> 3.7.4)
rubyzip (>= 1.2.1, < 3.0)
typhoeus (>= 0.7, < 2.0)
jekyll-sass-converter (1.5.2)
sass (~> 3.4)
jekyll-seo-tag (2.4.0)
jekyll (~> 3.3)
jekyll (~> 3.7.4)
jekyll-sitemap (1.2.0)
jekyll (~> 3.3)
jekyll (~> 3.7.4)
jekyll-swiss (0.4.0)
jekyll-theme-architect (0.1.0)
jekyll (~> 3.5)
jekyll (~> 3.7.4)
jekyll-seo-tag (~> 2.0)
jekyll-theme-cayman (0.1.0)
jekyll (~> 3.5)
jekyll (~> 3.7.4)
jekyll-seo-tag (~> 2.0)
jekyll-theme-dinky (0.1.0)
jekyll (~> 3.5)
jekyll (~> 3.7.4)
jekyll-seo-tag (~> 2.0)
jekyll-theme-hacker (0.1.0)
jekyll (~> 3.5)
jekyll (~> 3.7.4)
jekyll-seo-tag (~> 2.0)
jekyll-theme-leap-day (0.1.0)
jekyll (~> 3.5)
jekyll (~> 3.7.4)
jekyll-seo-tag (~> 2.0)
jekyll-theme-merlot (0.1.0)
jekyll (~> 3.5)
jekyll (~> 3.7.4)
jekyll-seo-tag (~> 2.0)
jekyll-theme-midnight (0.1.0)
jekyll (~> 3.5)
jekyll (~> 3.7.4)
jekyll-seo-tag (~> 2.0)
jekyll-theme-minimal (0.1.0)
jekyll (~> 3.5)
jekyll (~> 3.7.4)
jekyll-seo-tag (~> 2.0)
jekyll-theme-modernist (0.1.0)
jekyll (~> 3.5)
jekyll (~> 3.7.4)
jekyll-seo-tag (~> 2.0)
jekyll-theme-primer (0.5.2)
jekyll (~> 3.5)
jekyll (~> 3.7.4)
jekyll-github-metadata (~> 2.9)
jekyll-seo-tag (~> 2.2)
jekyll-theme-slate (0.1.0)
jekyll (~> 3.5)
jekyll (~> 3.7.4)
jekyll-seo-tag (~> 2.0)
jekyll-theme-tactile (0.1.0)
jekyll (~> 3.5)
jekyll (~> 3.7.4)
jekyll-seo-tag (~> 2.0)
jekyll-theme-time-machine (0.1.0)
jekyll (~> 3.5)
jekyll (~> 3.7.4)
jekyll-seo-tag (~> 2.0)
jekyll-titles-from-headings (0.5.1)
jekyll (~> 3.3)
jekyll (~> 3.7.4)
jekyll-watch (2.0.0)
listen (~> 3.0)
jemoji (0.9.0)
activesupport (~> 4.0, >= 4.2.9)
gemoji (~> 3.0)
html-pipeline (~> 2.2)
jekyll (~> 3.0)
jekyll (~> 3.7.4)
kramdown (1.16.2)
liquid (4.0.0)
listen (3.1.5)
Expand All @@ -201,13 +201,13 @@ GEM
mercenary (0.3.6)
mini_portile2 (2.3.0)
minima (2.4.0)
jekyll (~> 3.5)
jekyll (~> 3.7.4)
jekyll-feed (~> 0.9)
jekyll-seo-tag (~> 2.1)
minitest (5.11.3)
multipart-post (2.0.0)
net-dns (0.8.0)
nokogiri (1.8.2)
nokogiri (>= 1.8.5)
mini_portile2 (~> 2.3.0)
octokit (4.8.0)
sawyer (~> 0.8.0, >= 0.5.3)
Expand All @@ -221,7 +221,7 @@ GEM
ruby-enum (0.7.2)
i18n
ruby_dep (1.5.0)
rubyzip (1.2.1)
rubyzip (~> 1.2.2)
safe_yaml (1.0.4)
sass (3.5.6)
sass-listen (~> 4.0.0)
Expand Down
10 changes: 1 addition & 9 deletions docs/README
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
This directory contains the content of the Java2Script project website,
implemented through GitHub Pages.

For details on GitHub Pages see https://pages.github.com.
For details on Jekyll, used by GitHub Pages, see
https://jekyllrb.com and
https://help.github.com/articles/using-jekyll-as-a-static-site-generator-with-github-pages

See https://github.com/BobHanson/java2script/tree/master/sources/net.sf.j2s.core/dist for installation instructions.

If you want to setup site locally with Jekyll see:
https://help.github.com/articles/setting-up-your-github-pages-site-locally-with-jekyll/

4 changes: 4 additions & 0 deletions docs/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

## Installation

see https://github.com/BobHanson/java2script/tree/master/sources/net.sf.j2s.core/dist for installation instructions.

The instructions given here are for a much earlier version.

### Prerequisites

- Eclipse Neon (4.6) or higher.
Expand Down
Binary file modified sources/net.sf.j2s.core/dist/swingjs/SwingJS-site.zip
Binary file not shown.
Binary file modified sources/net.sf.j2s.core/dist/swingjs/net.sf.j2s.core.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion sources/net.sf.j2s.core/dist/swingjs/timestamp
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20190829124003
20190923090813
Binary file modified sources/net.sf.j2s.core/dist/swingjs/ver/3.2.4/SwingJS-site.zip
Binary file not shown.
Binary file modified sources/net.sf.j2s.core/dist/swingjs/ver/3.2.4/net.sf.j2s.core.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion sources/net.sf.j2s.core/dist/swingjs/ver/3.2.4/timestamp
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20190829124003
20190923090813
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ class Java2ScriptCompiler {

private IJavaProject project;

private boolean isDebugging;

static boolean isActive(IJavaProject project) {
try {
return new File(project.getProject().getLocation().toOSString(), J2S_OPTIONS_FILE_NAME).exists();
Expand Down Expand Up @@ -152,6 +154,8 @@ boolean initializeProject(IJavaProject project, boolean isCompilationParticipant
siteFolder = projectFolder + "/" + siteFolder;
j2sPath = siteFolder + "/swingjs/j2s";

if (isDebugging)
System.out.println("Java2ScriptCompiler writing to " + j2sPath);
// method declarations and invocations are only logged
// when the designated files are deleted prior to building

Expand Down Expand Up @@ -199,7 +203,7 @@ boolean initializeProject(IJavaProject project, boolean isCompilationParticipant
if (nonqualifiedPackages.length() == 0)
nonqualifiedPackages = null;
// includes @j2sDebug blocks
boolean isDebugging = "debug".equals(getProperty("j2s.compiler.mode"));
isDebugging = "debug".equals(getProperty("j2s.compiler.mode"));

String classReplacements = getProperty("j2s.class.replacements");

Expand Down Expand Up @@ -375,7 +379,10 @@ private void createJSFile(String j2sPath, String packageName, String elementName
}
}
}
writeToFile(new File(j2sPath, elementName + ".js"), js);
File f = new File(j2sPath, elementName + ".js");
if (isDebugging)
System.out.println("Java2ScriptCompiler creating " + f);
writeToFile(f, js);
}

private String getFileContents(File file) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@
import org.eclipse.jdt.core.dom.WhileStatement;
import org.eclipse.jdt.core.dom.WildcardType;

// BH 2019.09.07 adds optimization for lambda methods that do not have finals
// BH 2019.08.29 fix for boxing of binary representation 0b01... (Google Closure Compiler bug)
// BH 2019.05.13 fix for Math.getExponent, ulp, nextDown, nextUp, nextAfter needing qualification
// BH 2019.05.13 fix for Function reference in new Foo()::test(...)
Expand Down Expand Up @@ -163,6 +164,12 @@ public class Java2ScriptVisitor extends ASTVisitor {
*/
private static final boolean ALLOW_NEW_LAMBDA = false;

/**
* If there are no finals for a lambda method, then we can reuse the object.
* This can be huge for preventing repetitive object creation
*/
private static final boolean ALLOW_LAMBDA_OBJECT_REUSE = true;

private static final int NOT_LAMBDA = 0;
private static final int LAMBDA_METHOD = 1;
private static final int LAMBDA_CREATION = 3;
Expand Down Expand Up @@ -657,8 +664,10 @@ private String getClassJavaNameForType(Type type) {
* anonymous class names
* @param isLambda
* @param isClassTrulyLocal
*
* @return anonymous name only if there are no finals
*/
private void processLocalInstance(ASTNode node, ASTNode anonymousClassDeclaration, ITypeBinding binding,
private String processLocalInstance(ASTNode node, ASTNode anonymousClassDeclaration, ITypeBinding binding,
ITypeBinding innerClass, String javaInnerClassName, int lambdaType, boolean isClassTrulyLocal) {

// In the case of local classes, the declaration is dissociated from the
Expand Down Expand Up @@ -701,6 +710,7 @@ private void processLocalInstance(ASTNode node, ASTNode anonymousClassDeclaratio
anonymousSuperclassName, anonName);
if (lambdaType != LAMBDA_METHOD && !isClassTrulyLocal)
buffer.append(")"); // end of line (..., ...)
return finals == null ? anonName : null;
}

/**
Expand Down Expand Up @@ -6808,15 +6818,19 @@ private boolean addLambdaMethodReference(MethodReference node, Expression exp) {
*/
private boolean addLambda$class$Method(MethodReference node, ITypeBinding binding, Expression exp,
ITypeBinding declaringClass, boolean checkFinals) {


allowClazzNewLambda = (ALLOW_NEW_LAMBDA && getLastCharInBuffer() != '=');
int pt = buffer.length();
buffer.append("(function($class$){");
processLocalInstance(node, null, binding, null, null, LAMBDA_METHOD, false);
String anonName = processLocalInstance(node, null, binding, null, null, LAMBDA_METHOD, false);
buffer.append("})(");
appendFinalMethodQualifier(exp, declaringClass, null, FINAL_ESCAPECACHE | FINAL_LAMBDA);
buffer.append(")");
if (checkFinals && allowClazzNewLambda)
buffer.setLength(pt);
if (anonName != null && ALLOW_LAMBDA_OBJECT_REUSE)
addLambdaReuse(pt, anonName);
return !allowClazzNewLambda;

}
Expand Down Expand Up @@ -6871,12 +6885,28 @@ public boolean visit(LambdaExpression node) {
private boolean addLambda$class$Expr(LambdaExpression node, ITypeBinding binding, boolean checkFinals) {
allowClazzNewLambda = (ALLOW_NEW_LAMBDA && getLastCharInBuffer() != '=');
int pt = buffer.length();
processLocalInstance(node, null, binding, null, null, LAMBDA_EXPRESSION, false);
String anonName = processLocalInstance(node, null, binding, null, null, LAMBDA_EXPRESSION, false);
if (checkFinals && allowClazzNewLambda)
buffer.setLength(pt);
if (anonName != null && ALLOW_LAMBDA_OBJECT_REUSE)
addLambdaReuse(pt, anonName);
return !allowClazzNewLambda;
}

/**
* allow reuse of Lambda method and expression objects when they involve no finals
*
* @param pt
* @param anonName
*/
private void addLambdaReuse(int pt, String anonName) {
String tmp = buffer.substring(pt);
buffer.setLength(pt);
anonName = getFinalJ2SClassName(anonName, FINAL_P);
buffer.append("(" + anonName + "$||(" + anonName + "$=(")
.append(tmp).append(")))");
}

private char getLambdaType(ITypeBinding binding) {
String name = removeBracketsAndFixNullPackageName(getJavaClassNameQualified(binding));
if (!name.startsWith("java.util.function.") || name.indexOf("To") >= 0)
Expand Down
Binary file modified sources/net.sf.j2s.java.core/dist/SwingJS-site.zip
Binary file not shown.
3 changes: 2 additions & 1 deletion sources/net.sf.j2s.java.core/src/java/io/File.java
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,8 @@ public boolean isDirectory() {
// return ((fs.getBooleanAttributes(this) & FileSystem.BA_DIRECTORY)
// != 0);
//
return true;
// BH 2019.09.23 return true;
return false;
}

/**
Expand Down
Loading