mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 08:14:09 -08:00
Code style fixes
This commit is contained in:
parent
5ecfb3620c
commit
933a5c3efc
|
@ -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();
|
||||
|
|
|
@ -42,8 +42,8 @@ public class FunctorTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void functorWithDefaultMethodPassed(){
|
||||
JSFunctionWithDefaultMethod javaFunction = (s) -> s+" returned";
|
||||
public void functorWithDefaultMethodPassed() {
|
||||
JSFunctionWithDefaultMethod javaFunction = (s) -> s + " returned";
|
||||
|
||||
String returned = javaFunction.defaultMethod();
|
||||
|
||||
|
@ -51,8 +51,8 @@ public class FunctorTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void functorWithStaticMethodPassed(){
|
||||
JSFunctionWithStaticMethod javaFunction = (s) -> s+" returned";
|
||||
public void functorWithStaticMethodPassed() {
|
||||
JSFunctionWithStaticMethod javaFunction = (s) -> s + " returned";
|
||||
|
||||
String returned = javaFunction.apply(JSFunctionWithStaticMethod.staticMethod());
|
||||
|
||||
|
@ -85,7 +85,7 @@ public class FunctorTest {
|
|||
interface JSFunctionWithDefaultMethod extends JSObject {
|
||||
String apply(String a);
|
||||
|
||||
default String defaultMethod(){
|
||||
default String defaultMethod() {
|
||||
return apply("Content");
|
||||
}
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ public class FunctorTest {
|
|||
interface JSFunctionWithStaticMethod extends JSObject {
|
||||
String apply(String a);
|
||||
|
||||
public static String staticMethod(){
|
||||
static String staticMethod() {
|
||||
return "Content";
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user