You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Henri Biestro (JIRA)" <ji...@apache.org> on 2018/08/21 15:39:00 UTC

[jira] [Commented] (JEXL-268) Jexl lambdas as parameters to new Java8 methods

    [ https://issues.apache.org/jira/browse/JEXL-268?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16587603#comment-16587603 ] 

Henri Biestro commented on JEXL-268:
------------------------------------

Prefer delegation to inheritance :-) You can encapsulate the script and the context in objects that expose the aforementioned interfaces. 
Anyhow, jexl3 is so far compatible with Java6; dropping support can only occur on a major release and probably a new package name.

> Jexl lambdas as parameters to new Java8 methods
> -----------------------------------------------
>
>                 Key: JEXL-268
>                 URL: https://issues.apache.org/jira/browse/JEXL-268
>             Project: Commons JEXL
>          Issue Type: New Feature
>    Affects Versions: 3.1
>            Reporter: Dmitri Blinov
>            Priority: Minor
>
> Java8 introduced functional interfaces, among them {{Function}} and {{BiFunction}} interfaces which are used as parameters to method calls, for example, {{Map.computeIfAbsent()}} or {{Map.computeIfPresent()}}. In Jexl we have lambdas which in theory are good candidates to construct a {{Function}} for lambda with one parameter, and a {{BiFunction}} for lambda with two parameters.
> The problem is Jexl can not currently support Java8 features and all instances of lambda are of single {{internal.Closure}} class, which should not try to implement both interfaces at once. One of the solutions, IMO, is to have a feature to overload lamda creations to construct custom lambda classes without shaking Jexl code tree.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)