Code style fixes

This commit is contained in:
Alexey Andreev 2017-05-30 22:44:33 +03:00
parent 5ecfb3620c
commit 933a5c3efc
2 changed files with 14 additions and 10 deletions

View File

@ -991,9 +991,12 @@ class JSClassProcessor {
}
private boolean isProperFunctor(ClassReader type) {
return type.hasModifier(ElementModifier.INTERFACE)
&& type.getMethods().stream().filter(it->it.hasModifier(ElementModifier.ABSTRACT))
.toArray().length == 1;
if (!type.hasModifier(ElementModifier.INTERFACE)) {
return false;
}
return type.getMethods().stream()
.filter(method -> method.hasModifier(ElementModifier.ABSTRACT))
.count() == 1;
}
private Variable wrapFunctor(CallLocation location, Variable var, ClassReader type) {
@ -1002,7 +1005,8 @@ class JSClassProcessor {
return var;
}
String name = type.getMethods().stream()
.filter(it->it.hasModifier(ElementModifier.ABSTRACT)).findFirst().get().getName();
.filter(method -> method.hasModifier(ElementModifier.ABSTRACT))
.findFirst().get().getName();
Variable functor = program.createVariable();
Variable nameVar = addStringWrap(addString(name, location.getSourceLocation()), location.getSourceLocation());
InvokeInstruction insn = new InvokeInstruction();

View File

@ -94,7 +94,7 @@ public class FunctorTest {
interface JSFunctionWithStaticMethod extends JSObject {
String apply(String a);
public static String staticMethod(){
static String staticMethod() {
return "Content";
}
}