Skip to content

Commit f10a8ca

Browse files
committed
new 4.2 compiler allows Java 8 syntax
switch(String) try(resource)
1 parent 82a09fc commit f10a8ca

21 files changed

+2831
-274
lines changed
-264 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20231117083556
1+
20231119163724
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20231117083556
1+
20231119163724

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ protected boolean initializeProject(IJavaProject project, boolean isCleanBuild,
274274
writeToFile(activeJ2SFile, getDefaultJ2SFile());
275275
}
276276
int jslLevel = javaLanguageLevel;
277-
if (jslLevel == 8) {
277+
if (isSwingJS) {
278278
// SwingJS allows 8 or 11
279279
try {
280280
String ver = getProperty(J2S_COMPILER_JAVA_VERSION, "" + jslLevel);
@@ -345,14 +345,17 @@ boolean excludeFile(IFile javaSource) {
345345
return excludeFile(javaSource.getFullPath().toString());
346346
}
347347

348-
private boolean excludeFile(String filePath) {
348+
public boolean excludeFile(String filePath) {
349349
if (lstExcludedPaths != null) {
350+
if (filePath == null)
351+
return true;
350352
if (filePath.indexOf('\\') >= 0)
351353
filePath = filePath.replace('\\', '/');
352-
for (int i = lstExcludedPaths.size(); --i >= 0;)
354+
for (int i = lstExcludedPaths.size(); --i >= 0;) {
353355
if (filePath.indexOf(lstExcludedPaths.get(i)) >= 0) {
354356
return true;
355357
}
358+
}
356359
}
357360
return false;
358361
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public Java2ScriptLegacyCompiler(File f) {
4040

4141
@SuppressWarnings("deprecation")
4242
public boolean initializeProject(IJavaProject project, boolean isCleanBuild) {
43-
if (!super.initializeProject(project, isCleanBuild, AST.JLS4)) {
43+
if (!super.initializeProject(project, isCleanBuild, AST.JLS8)) {
4444
return false;
4545
}
4646
String s = getProperty(J2S_STRING_FIXES, null);

0 commit comments

Comments
 (0)