[ 
https://issues.apache.org/jira/browse/YARN-3765?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Li Lu updated YARN-3765:
------------------------
    Description: 
There is one warning about reversing the return value of comparisons in 
YARN-2928 branch. This is a valid warning. Quoting the findbugs warning message:

RV_NEGATING_RESULT_OF_COMPARETO: Negating the result of compareTo()/compare()

This code negatives the return value of a compareTo or compare method. This is 
a questionable or bad programming practice, since if the return value is 
Integer.MIN_VALUE, negating the return value won't negate the sign of the 
result. You can achieve the same intended result by reversing the order of the 
operands rather than by negating the results.

  was:There is one warning about reversing the return value of comparisons in 
YARN-2928 branch. I believe this is a false alarm since we intentionally said 
the comparator is a "reversed" comparator. 


> Fix findbugs the warning in YARN-2928 branch, TimelineMetric
> ------------------------------------------------------------
>
>                 Key: YARN-3765
>                 URL: https://issues.apache.org/jira/browse/YARN-3765
>             Project: Hadoop YARN
>          Issue Type: Bug
>            Reporter: Li Lu
>            Assignee: Li Lu
>         Attachments: YARN-3765-YARN-2928.001.patch
>
>
> There is one warning about reversing the return value of comparisons in 
> YARN-2928 branch. This is a valid warning. Quoting the findbugs warning 
> message:
> RV_NEGATING_RESULT_OF_COMPARETO: Negating the result of compareTo()/compare()
> This code negatives the return value of a compareTo or compare method. This 
> is a questionable or bad programming practice, since if the return value is 
> Integer.MIN_VALUE, negating the return value won't negate the sign of the 
> result. You can achieve the same intended result by reversing the order of 
> the operands rather than by negating the results.



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

Reply via email to