8170432: Class java.util.UUID & @Override

Reviewed-by: dfuchs, lancea
This commit is contained in:
Fleshgrinder 2020-11-27 19:29:50 +00:00 committed by Lance Andersen
parent 5be4de8583
commit b4cba15a0e

View File

@ -456,6 +456,7 @@ public final class UUID implements java.io.Serializable, Comparable<UUID> {
* *
* @return A string representation of this {@code UUID} * @return A string representation of this {@code UUID}
*/ */
@Override
public String toString() { public String toString() {
return jla.fastUUID(leastSigBits, mostSigBits); return jla.fastUUID(leastSigBits, mostSigBits);
} }
@ -465,6 +466,7 @@ public final class UUID implements java.io.Serializable, Comparable<UUID> {
* *
* @return A hash code value for this {@code UUID} * @return A hash code value for this {@code UUID}
*/ */
@Override
public int hashCode() { public int hashCode() {
long hilo = mostSigBits ^ leastSigBits; long hilo = mostSigBits ^ leastSigBits;
return ((int)(hilo >> 32)) ^ (int) hilo; return ((int)(hilo >> 32)) ^ (int) hilo;
@ -482,6 +484,7 @@ public final class UUID implements java.io.Serializable, Comparable<UUID> {
* @return {@code true} if the objects are the same; {@code false} * @return {@code true} if the objects are the same; {@code false}
* otherwise * otherwise
*/ */
@Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if ((null == obj) || (obj.getClass() != UUID.class)) if ((null == obj) || (obj.getClass() != UUID.class))
return false; return false;
@ -506,6 +509,7 @@ public final class UUID implements java.io.Serializable, Comparable<UUID> {
* greater than {@code val} * greater than {@code val}
* *
*/ */
@Override
public int compareTo(UUID val) { public int compareTo(UUID val) {
// The ordering is intentionally set up so that the UUIDs // The ordering is intentionally set up so that the UUIDs
// can simply be numerically compared as two numbers // can simply be numerically compared as two numbers