[
https://issues.apache.org/jira/browse/LANG-1520?focusedWorklogId=395639&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-395639
]
ASF GitHub Bot logged work on LANG-1520:
----------------------------------------
Author: ASF GitHub Bot
Created on: 01/Mar/20 17:33
Start Date: 01/Mar/20 17:33
Worklog Time Spent: 10m
Work Description: SscSPs commented on issue #498: LANG-1520 spring clean
.gitignore
URL: https://github.com/apache/commons-lang/pull/498#issuecomment-593122611
I think you tagged won't ticket
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 395639)
Time Spent: 20m (was: 10m)
> ObjectUtils.equals can use comparable if that's present.
> --------------------------------------------------------
>
> Key: LANG-1520
> URL: https://issues.apache.org/jira/browse/LANG-1520
> Project: Commons Lang
> Issue Type: Improvement
> Components: lang.*
> Affects Versions: 3.9
> Reporter: Sahil Soni
> Priority: Minor
> Time Spent: 20m
> Remaining Estimate: 0h
>
> {{ObjectUtils.equals(Object, Object)}} is marked for deprecation in favour of
> {{java.util.Objects.equals(Object, Object)}}
> We can improve {{ObjectUtils.equals}} to handle comparable objects,
> For example, class A does not implement equals method, but does implements
> Comparable interface. ObjectUtils.equals() will say its different, but
> compareTo will say they are equal.
> To handle this, we can change the implementation to something like:
> {code:java}
> //instanceof checks for null, `null instanceof Comparable` is false, so this
> condition is null safe
> if (firstValue instanceof Comparable && secondValue instanceof
> Comparable) {
> return ((Comparable) firstValue).compareTo(secondValue) == 0;
> }
> return Objects.equals(firstValue, secondValue);
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)