This test shows my problem:
public static String testMe(Predicate<String> filter) {
return "yeah!";
}
@Test
public void testPredicateAsArgument() throws ClassNotFoundException, NoSuchMethodException {
final ELProcessor elp = new ELProcessor();
elp.defineFunction("", "", "test.EL3Test", "testMe");
try {
Object result = elp.eval("testMe(o->true)"); // IllegalArgumentException
// ...
} catch (javax.el.ELException ex) {
fail(Exceptions.getCauseMessage(ex));
}
}
It throws: IllegalArgumentException: Cannot convert javax.el.LambdaExpression@511baa65 of type class javax.el.LambdaExpression to interface java.util.function.Predicate
Is this a bug or limitation of EL 3 or do i miss something?
Tested versions: org.glassfish:javax.el:jar:3.0.0 and org.glassfish:javax.el:jar:3.0.1-b08
Also posted as github issue
UPDATE as of 2021-09-06
Implemented via https://github.com/eclipse-ee4j/el-ri/commit/bcd0eeb349af607eb15428c04853a0be0948f80c