8311528: Remove IDE specific SuppressWarnings

Reviewed-by: lancea, bpb, jlu
This commit is contained in:
Naoto Sato 2023-07-10 17:07:26 +00:00
parent b285ed72ae
commit 63f32fbe97

View File

@ -2701,25 +2701,25 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
* @return {@code true} if this object is equal to {@code obj};
* {@code false} otherwise.
*/
@SuppressWarnings("EqualsWhichDoesntCheckParameterClass")
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
try {
Calendar that = (Calendar)obj;
return compareTo(getMillisOf(that)) == 0 &&
lenient == that.lenient &&
firstDayOfWeek == that.firstDayOfWeek &&
minimalDaysInFirstWeek == that.minimalDaysInFirstWeek &&
(zone instanceof ZoneInfo ?
zone.equals(that.zone) :
zone.equals(that.getTimeZone()));
} catch (Exception e) {
// Note: GregorianCalendar.computeTime throws
// IllegalArgumentException if the ERA value is invalid
// even it's in lenient mode.
if (obj instanceof Calendar that) {
try {
return compareTo(getMillisOf(that)) == 0 &&
lenient == that.lenient &&
firstDayOfWeek == that.firstDayOfWeek &&
minimalDaysInFirstWeek == that.minimalDaysInFirstWeek &&
(zone instanceof ZoneInfo ?
zone.equals(that.zone) :
zone.equals(that.getTimeZone()));
} catch (Exception e) {
// Note: GregorianCalendar.computeTime throws
// IllegalArgumentException if the ERA value is invalid
// even it's in lenient mode.
}
}
return false;
}