Skip to content

Commit 99515e7

Browse files
hansonrhansonr
authored andcommitted
adds lambda expressions
1 parent 11f7170 commit 99515e7

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,9 @@
126126

127127
import net.sf.j2s.core.CorePlugin;
128128

129+
130+
// BH 7/15/2018 -- adds Java 8 lambda expressions
131+
// BH 7/14/2018 -- removes java2scriptbuilder; uses CompilationParticipant instead
129132
// BH 7/5/2018 -- fixes int | char
130133
// BH 7/3/2018 -- adds tryWithResource
131134
// BH 7/3/2018 -- adds effectively final -- FINAL keyword no longer necessary
@@ -623,7 +626,7 @@ public boolean visit(EnumConstantDeclaration node) {
623626
// [ Javadoc ] { ExtendedModifier } Identifier
624627
// [ ( [ Expression { , Expression } ] ) ]
625628
// [ AnonymousClassDeclaration ]
626-
return super.visit(node);
629+
return true;
627630
}
628631

629632
public boolean visit(ExpressionStatement node) {
@@ -2749,7 +2752,7 @@ public boolean visit(NullLiteral node) {
27492752
ITypeBinding binding = node.resolveTypeBinding();
27502753
if (binding != null)
27512754
buffer.append("null");
2752-
return false;
2755+
return true;
27532756
}
27542757

27552758
public boolean visit(ParenthesizedExpression node) {
@@ -2791,7 +2794,7 @@ public boolean visit(PrefixExpression node) {
27912794
String op = node.getOperator().toString();
27922795
if ("~".equals(op)) {
27932796
buffer.append(op);
2794-
return false;
2797+
return true;
27952798
}
27962799
return addPrePost(node, node.getOperand(), node.getOperator().toString(), false);
27972800
}

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,11 @@ public class Java2ScriptCompiler {
8080
boolean isCompilationParticipant;
8181

8282
public static boolean isActive(IProject project) {
83-
return new File(project.getProject().getLocation().toOSString(), ".J2S").exists();
83+
try {
84+
return new File(project.getProject().getLocation().toOSString(), ".J2S").exists();
85+
} catch (Exception e) {
86+
return false;
87+
}
8488
}
8589

8690
public Java2ScriptCompiler() {

0 commit comments

Comments
 (0)