mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
5066247: Refine the spec of equals() and hashCode() for j.text.Format classes
Reviewed-by: naoto, darcy
This commit is contained in:
parent
93f662f4fc
commit
8fcf70e931
9 changed files with 141 additions and 25 deletions
|
@ -572,7 +572,11 @@ public class ChoiceFormat extends NumberFormat {
|
|||
}
|
||||
|
||||
/**
|
||||
* Generates a hash code for the message format object.
|
||||
* {@return the hash code for this {@code ChoiceFormat}}
|
||||
*
|
||||
* @implSpec This method calculates the hash code value using the values returned by
|
||||
* {@link #getFormats()} and {@link #getLimits()}.
|
||||
* @see Object#hashCode()
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
|
@ -585,7 +589,17 @@ public class ChoiceFormat extends NumberFormat {
|
|||
}
|
||||
|
||||
/**
|
||||
* Equality comparison between two
|
||||
* Compares the specified object with this {@code ChoiceFormat} for equality.
|
||||
* Returns true if the object is also a {@code ChoiceFormat} and the
|
||||
* two formats would format any value the same.
|
||||
*
|
||||
* @implSpec This method performs an equality check with a notion of class
|
||||
* identity based on {@code getClass()}, rather than {@code instanceof}.
|
||||
* Therefore, in the equals methods in subclasses, no instance of this class
|
||||
* should compare as equal to an instance of a subclass.
|
||||
* @param obj object to be compared for equality
|
||||
* @return {@code true} if the specified object is equal to this {@code ChoiceFormat}
|
||||
* @see Object#equals(Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue