8267110: Update java.util to use instanceof pattern variable

Reviewed-by: lancea, naoto
This commit is contained in:
Patrick Concannon 2021-05-25 08:24:49 +00:00
parent 0a03fc84b3
commit a52c4ede2f
29 changed files with 142 additions and 266 deletions

View file

@ -514,12 +514,8 @@ public class Attributes implements Map<Object,Object>, Cloneable {
if (this == o) {
return true;
}
if (o instanceof Name) {
Name other = (Name)o;
return other.name.equalsIgnoreCase(name);
} else {
return false;
}
return o instanceof Name other
&& other.name.equalsIgnoreCase(name);
}
/**

View file

@ -551,10 +551,9 @@ class JarVerifier {
* Match CodeSource to a CodeSigner[] in the signer cache.
*/
private CodeSigner[] findMatchingSigners(CodeSource cs) {
if (cs instanceof VerifierCodeSource) {
VerifierCodeSource vcs = (VerifierCodeSource) cs;
if (cs instanceof VerifierCodeSource vcs) {
if (vcs.isSameDomain(csdomain)) {
return ((VerifierCodeSource) cs).getPrivateSigners();
return vcs.getPrivateSigners();
}
}
@ -617,8 +616,7 @@ class JarVerifier {
if (obj == this) {
return true;
}
if (obj instanceof VerifierCodeSource) {
VerifierCodeSource that = (VerifierCodeSource) obj;
if (obj instanceof VerifierCodeSource that) {
/*
* Only compare against other per-signer singletons constructed

View file

@ -379,13 +379,9 @@ public class Manifest implements Cloneable {
* the same main Attributes and entries
*/
public boolean equals(Object o) {
if (o instanceof Manifest) {
Manifest m = (Manifest)o;
return attr.equals(m.getMainAttributes()) &&
entries.equals(m.getEntries());
} else {
return false;
}
return o instanceof Manifest m
&& attr.equals(m.getMainAttributes())
&& entries.equals(m.getEntries());
}
/**