Skip to content
Permalink
Browse files

Remove some static imports

  • Loading branch information
octylFractal committed Dec 9, 2019
1 parent cd94146 commit b291159cbd245c167aff31fac41ba9ab32c36072
@@ -72,7 +72,6 @@
import static com.sk89q.worldedit.internal.expression.ExpressionHelper.getArgumentHandleName;
import static com.sk89q.worldedit.internal.expression.ExpressionHelper.resolveFunction;
import static com.sk89q.worldedit.internal.expression.invoke.ExpressionHandles.CALL_BINARY_OP;
import static com.sk89q.worldedit.internal.expression.invoke.ExpressionHandles.COMPILED_EXPRESSION_SIG;
import static com.sk89q.worldedit.internal.expression.invoke.ExpressionHandles.DOUBLE_TO_BOOL;
import static com.sk89q.worldedit.internal.expression.invoke.ExpressionHandles.IS_NULL;
import static com.sk89q.worldedit.internal.expression.invoke.ExpressionHandles.NEW_LS_CONSTANT;
@@ -138,7 +137,7 @@ private ExecNode evaluate(ParserRuleContext ctx) {
}

private void checkHandle(MethodHandle mh, ParserRuleContext ctx) {
check(mh.type().equals(COMPILED_EXPRESSION_SIG), ctx,
check(mh.type().equals(ExpressionHandles.COMPILED_EXPRESSION_SIG), ctx,
"Incorrect type returned from handler for " + ctx.getClass());
}

@@ -593,7 +592,7 @@ public MethodHandle visitFunctionCall(ExpressionParser.FunctionCallContext ctx)
// Collapse every data into one argument
int[] permutation = new int[arguments.length];
return permuteArguments(
manyData, COMPILED_EXPRESSION_SIG, permutation
manyData, ExpressionHandles.COMPILED_EXPRESSION_SIG, permutation
);
}

@@ -29,8 +29,6 @@
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;

import static com.sk89q.worldedit.internal.expression.invoke.ExpressionHandles.COMPILED_EXPRESSION_SIG;
import static com.sk89q.worldedit.internal.expression.invoke.ExpressionHandles.safeInvoke;
import static java.lang.invoke.MethodType.methodType;

/**
@@ -45,7 +43,7 @@
private static final MethodHandle HANDLE_TO_CE_CONVERTER;

static {
MethodHandle handleInvoker = MethodHandles.invoker(COMPILED_EXPRESSION_SIG);
MethodHandle handleInvoker = MethodHandles.invoker(ExpressionHandles.COMPILED_EXPRESSION_SIG);
try {
HANDLE_TO_CE_CONVERTER = LambdaMetafactory.metafactory(
MethodHandles.lookup(),
@@ -54,11 +52,11 @@
// Take a handle, to be converted to CompiledExpression
HANDLE_TO_CE,
// Raw signature for SAM type
COMPILED_EXPRESSION_SIG,
ExpressionHandles.COMPILED_EXPRESSION_SIG,
// Handle to call the captured handle.
handleInvoker,
// Actual signature at invoke time
COMPILED_EXPRESSION_SIG
ExpressionHandles.COMPILED_EXPRESSION_SIG
).dynamicInvoker().asType(HANDLE_TO_CE);
} catch (LambdaConversionException e) {
throw new IllegalStateException("Failed to load ExpressionCompiler MetaFactory", e);
@@ -68,7 +66,7 @@
public CompiledExpression compileExpression(ExpressionParser.AllStatementsContext root,
SetMultimap<String, MethodHandle> functions) {
MethodHandle invokable = root.accept(new CompilingVisitor(functions));
return (CompiledExpression) safeInvoke(
return (CompiledExpression) ExpressionHandles.safeInvoke(
HANDLE_TO_CE_CONVERTER, h -> h.invoke(invokable)
);
}

0 comments on commit b291159

Please sign in to comment.
You can’t perform that action at this time.