-
Notifications
You must be signed in to change notification settings - Fork 212
Open
Description
Example:
DoubleUnaryOperator op = new ExpressionEvaluator().createFastEvaluator("a * 0.9", DoubleUnaryOperator.class, "a");
double value = op.applyAsDouble(100);
System.out.println(value);
We should relax the current check to follow the JLS definition of Functional Interfaces instead:
A functional interface is an interface that has just one abstract method (aside from the methods of Object), and thus represents a single function contract.
for (Method method : interfaceToImplement.getDeclaredMethods()) {
int mod = method.getModifiers();
if (method.isDefault() || Modifier.isStatic(mod) || !Modifier.isPublic(mod)) {
continue;
}
if (methodToImplement != null) {
throw new InternalCompilerException(
"Interface \""
+ interfaceToImplement
+ "\" must declare exactly one abstract method"
);
}
methodToImplement = method;
}
Metadata
Metadata
Assignees
Labels
No labels