mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8258422: Cleanup unnecessary null comparison before instanceof check in java.base
Reviewed-by: chegar, aefimov
This commit is contained in:
parent
ff54b77b76
commit
022bc9f0cb
22 changed files with 69 additions and 81 deletions
|
@ -308,8 +308,7 @@ public final class Constructor<T> extends Executable {
|
|||
* same formal parameter types.
|
||||
*/
|
||||
public boolean equals(Object obj) {
|
||||
if (obj != null && obj instanceof Constructor) {
|
||||
Constructor<?> other = (Constructor<?>)obj;
|
||||
if (obj instanceof Constructor<?> other) {
|
||||
if (getDeclaringClass() == other.getDeclaringClass()) {
|
||||
return equalParamTypes(parameterTypes, other.parameterTypes);
|
||||
}
|
||||
|
|
|
@ -279,8 +279,7 @@ class Field extends AccessibleObject implements Member {
|
|||
* and type.
|
||||
*/
|
||||
public boolean equals(Object obj) {
|
||||
if (obj != null && obj instanceof Field) {
|
||||
Field other = (Field)obj;
|
||||
if (obj instanceof Field other) {
|
||||
return (getDeclaringClass() == other.getDeclaringClass())
|
||||
&& (getName() == other.getName())
|
||||
&& (getType() == other.getType());
|
||||
|
|
|
@ -358,8 +358,7 @@ public final class Method extends Executable {
|
|||
* and formal parameter types and return type.
|
||||
*/
|
||||
public boolean equals(Object obj) {
|
||||
if (obj != null && obj instanceof Method) {
|
||||
Method other = (Method)obj;
|
||||
if (obj instanceof Method other) {
|
||||
if ((getDeclaringClass() == other.getDeclaringClass())
|
||||
&& (getName() == other.getName())) {
|
||||
if (!returnType.equals(other.getReturnType()))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue