8265426: Update java.security to use instanceof pattern variable

Reviewed-by: rriggs, weijun, dfuchs
This commit is contained in:
Patrick Concannon 2021-05-07 13:42:40 +00:00
parent 3fcdc50e44
commit 86b8dc9f5b
23 changed files with 85 additions and 165 deletions

View file

@ -1077,10 +1077,8 @@ public abstract class Provider extends Properties {
if (this == obj) {
return true;
}
if (!(obj instanceof ServiceKey other)) {
return false;
}
return this.type.equals(other.type)
return obj instanceof ServiceKey other
&& this.type.equals(other.type)
&& this.algorithm.equals(other.algorithm);
}
boolean matches(String type, String algorithm) {
@ -1500,11 +1498,8 @@ public abstract class Provider extends Properties {
if (this == obj) {
return true;
}
if (obj instanceof UString == false) {
return false;
}
UString other = (UString)obj;
return lowerString.equals(other.lowerString);
return obj instanceof UString other
&& lowerString.equals(other.lowerString);
}
public String toString() {
@ -2005,16 +2000,16 @@ public abstract class Provider extends Properties {
// unknown engine type, return true by default
return true;
}
if (cap.supportsParameter == false) {
if (!cap.supportsParameter) {
throw new InvalidParameterException("supportsParameter() not "
+ "used with " + type + " engines");
}
// allow null for keys without attributes for compatibility
if ((parameter != null) && (parameter instanceof Key == false)) {
if ((parameter != null) && (!(parameter instanceof Key))) {
throw new InvalidParameterException
("Parameter must be instanceof Key for engine " + type);
}
if (hasKeyAttributes() == false) {
if (!hasKeyAttributes()) {
return true;
}
if (parameter == null) {