8263190: Update java.io, java.math, and java.text to use instanceof pattern variable

Reviewed-by: lancea, bpb, darcy, naoto, iris, dfuchs, smarks, redestad
This commit is contained in:
Patrick Concannon 2021-03-09 11:09:06 +00:00
parent 4f0a12ec87
commit 0f2402d0a2
15 changed files with 32 additions and 59 deletions

View file

@ -2400,8 +2400,7 @@ public class ObjectStreamClass implements Serializable {
return true;
}
if (obj instanceof FieldReflectorKey) {
FieldReflectorKey other = (FieldReflectorKey) obj;
if (obj instanceof FieldReflectorKey other) {
Class<?> referent;
return (nullClass ? other.nullClass
: ((referent = get()) != null) &&
@ -2597,8 +2596,7 @@ public class ObjectStreamClass implements Serializable {
@Override
public final boolean equals(Object obj) {
if (!(obj instanceof Key)) return false;
Key other = (Key) obj;
if (!(obj instanceof Key other)) return false;
int n = length();
if (n != other.length()) return false;
for (int i = 0; i < n; i++) if (fieldType(i) != other.fieldType(i)) return false;