DecimalFormat.equals() may not be symmetric

Description

From a colleague:

I think this method violates the requirement for equals() implementations to be symmetric because it contains this snippet:

If I see it right, think this means that for two NFRuleSet instances A and B with:

  • A.style != NumberFormat.PLURALCURRENCYSTYLE

  • B.style == NumberFormat.PLURALCURRENCYSTYLE

  • A.posPrefixPattern not equal to B.posPrefixPattern

  • all other fields equal
    then A.equals(B) is true but B.equals(A) is false.

Check C++ as well.

Activity

Show:

UnicodeBot 
June 30, 2018 at 11:45 PM

Trac Comment 18 by —2018-05-22T20:48:16.880Z

Yep, this is fixed with a follow-up in #11626 (r41431)

UnicodeBot 
June 30, 2018 at 11:45 PM

Trac Comment 17 by —2018-05-22T18:09:18.914Z

LGTM

close this one?

UnicodeBot 
June 30, 2018 at 11:45 PM

Trac Comment 15 by —2018-05-19T07:34:45.154Z

TODOs are being fixed in follow-up to #11626.

UnicodeBot 
June 30, 2018 at 11:45 PM

Trac Comment 14 by —2018-05-07T22:10:04.490Z

I ported the Java test to C++, but the equality does not work like in Java. I commented out the failing lines with `TODO(shane)`.

I found and fixed a bug in setCurrencyPluralInfo().

UnicodeBot 
June 30, 2018 at 11:45 PM

Trac Comment 12 by —2018-04-28T01:42:29.695Z

Needs a test in ICU4C.

Fixed

Details

Assignee

Reporter

Components

Priority

Time Needed

Hours

Fix versions

Created June 28, 2018 at 5:25 PM
Updated October 3, 2018 at 10:53 PM
Resolved July 1, 2018 at 8:41 PM