[jira] [Commented] (OFBIZ-4427) Possible runtime errors with UtilValidate.isEmpty(Object) should be rather caught during compilation

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (OFBIZ-4427) Possible runtime errors with UtilValidate.isEmpty(Object) should be rather caught during compilation

Nicolas Malin (Jira)

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

Paul Foxworthy commented on OFBIZ-4427:
---------------------------------------

Jacques says in the description: "Scripting languages should use a facade class that provides methods for working with generic Objects or providing default behaviors"

Are you suggesting that UtilValidate.isEmpty( Object ) should be available to scripting languages, but not to Java?

The whole point of this issue is to enable isEmpty for types where emptiness is relevant , and not for other types where isEmpty is misleading and we should just use == null. I'd argue that is "emptiness" does not make sense, the isEmpty should not work, even from a scripting language.

In Groovy you can retrofit an interface onto a class using metaclasses without rewriting the code for that class. So we can add the org.apache.ofbiz.base.lang.IsEmpty interface to everything we need, and still deprecate it for Objects in general.

> Possible runtime errors with UtilValidate.isEmpty(Object) should be rather caught during compilation
> ----------------------------------------------------------------------------------------------------
>
>                 Key: OFBIZ-4427
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-4427
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: framework
>    Affects Versions: Trunk
>            Reporter: Jacques Le Roux
>            Assignee: Jacques Le Roux
>            Priority: Minor
>              Labels: UtilValidate.isEmpty
>         Attachments: OFBIZ-4427.patch, OFBIZ-4427_isEmpty.patch
>
>
> Hence we need to remove the UtilValidate.isEmpty(Object) method and provide methods that accept explicit types.  
> Scripting languages should use a facade class that provides methods for working with generic Objects or providing default behaviors.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)