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

Dmitri Blinov commented on JEXL-298:
------------------------------------

I think I have found a regression on the current implementation. Now the 
{{empty}} operator returns {{true}} for any non-null object that is not 
explicitly covered by {{JexlArithmetic.isEmpty()}} method when there is *any* 
overloaded {{empty()}} method in the custom arithmetic class. The old behaviour 
was to return {{false}} when object was non-null. This stems from addition of 
{{JexlArithmetic.empty(Object)}} method, that can always be resolved by 
{{tryOverload()}} part of empty operator. The suggestion is to change 
{{JexlArithmetic.empty(Object)}} to something like this:
{code:java}
    public Boolean empty(Object object) {
        if (object == null)
            return Boolean.TRUE;
        Boolean e = isEmpty(object);
        return e == null ? Boolean.FALSE : e;
    }
{code}

> Unable to call 'empty' and 'size' member methods with parameters
> ----------------------------------------------------------------
>
>                 Key: JEXL-298
>                 URL: https://issues.apache.org/jira/browse/JEXL-298
>             Project: Commons JEXL
>          Issue Type: Improvement
>    Affects Versions: 3.1
>            Reporter: Dmitri Blinov
>            Assignee: Henri Biestro
>            Priority: Major
>
> It's not possible to parse scripts like
> {code:java}
> x.size(0){code}
> or
> {code:java}
> x.empty(0){code}
> because of current syntax restrictions.
> {{empty}} and {{size}} are perfectly valid method identifiers in java, and 
> though uncommon, can be declared with arguments. As of now Jexl allows only 
> to call parameterless {{empty()}} and {{size()}} methods



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

Reply via email to