8263358: Update java.lang to use instanceof pattern variable

Reviewed-by: iris, chegar, mchung, dfuchs
This commit is contained in:
Patrick Concannon 2021-03-24 09:57:22 +00:00
parent ae9af57bf6
commit 329697b02e
18 changed files with 63 additions and 112 deletions

View file

@ -714,8 +714,7 @@ public final class Method extends Executable {
getConstantPool(getDeclaringClass()),
getDeclaringClass());
if (result instanceof ExceptionProxy) {
if (result instanceof TypeNotPresentExceptionProxy) {
TypeNotPresentExceptionProxy proxy = (TypeNotPresentExceptionProxy)result;
if (result instanceof TypeNotPresentExceptionProxy proxy) {
throw new TypeNotPresentException(proxy.typeName(), proxy.getCause());
}
throw new AnnotationFormatError("Invalid default: " + this);

View file

@ -77,12 +77,9 @@ public final class Parameter implements AnnotatedElement {
*/
@Override
public boolean equals(Object obj) {
if(obj instanceof Parameter) {
Parameter other = (Parameter)obj;
return (other.executable.equals(executable) &&
other.index == index);
}
return false;
return (obj instanceof Parameter other)
&& other.executable.equals(executable)
&& other.index == index;
}
/**