mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8263358: Update java.lang to use instanceof pattern variable
Reviewed-by: iris, chegar, mchung, dfuchs
This commit is contained in:
parent
ae9af57bf6
commit
329697b02e
18 changed files with 63 additions and 112 deletions
|
@ -310,10 +310,8 @@ public class ModuleDescriptor
|
|||
*/
|
||||
@Override
|
||||
public boolean equals(Object ob) {
|
||||
if (!(ob instanceof Requires))
|
||||
return false;
|
||||
Requires that = (Requires)ob;
|
||||
return name.equals(that.name) && mods.equals(that.mods)
|
||||
return (ob instanceof Requires that)
|
||||
&& name.equals(that.name) && mods.equals(that.mods)
|
||||
&& Objects.equals(compiledVersion, that.compiledVersion)
|
||||
&& Objects.equals(rawCompiledVersion, that.rawCompiledVersion);
|
||||
}
|
||||
|
@ -531,10 +529,8 @@ public class ModuleDescriptor
|
|||
*/
|
||||
@Override
|
||||
public boolean equals(Object ob) {
|
||||
if (!(ob instanceof Exports))
|
||||
return false;
|
||||
Exports other = (Exports)ob;
|
||||
return Objects.equals(this.mods, other.mods)
|
||||
return (ob instanceof Exports other)
|
||||
&& Objects.equals(this.mods, other.mods)
|
||||
&& Objects.equals(this.source, other.source)
|
||||
&& Objects.equals(this.targets, other.targets);
|
||||
}
|
||||
|
@ -736,12 +732,10 @@ public class ModuleDescriptor
|
|||
*/
|
||||
@Override
|
||||
public boolean equals(Object ob) {
|
||||
if (!(ob instanceof Opens))
|
||||
return false;
|
||||
Opens other = (Opens)ob;
|
||||
return Objects.equals(this.mods, other.mods)
|
||||
&& Objects.equals(this.source, other.source)
|
||||
&& Objects.equals(this.targets, other.targets);
|
||||
return (ob instanceof Opens other)
|
||||
&& Objects.equals(this.mods, other.mods)
|
||||
&& Objects.equals(this.source, other.source)
|
||||
&& Objects.equals(this.targets, other.targets);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -872,11 +866,9 @@ public class ModuleDescriptor
|
|||
*/
|
||||
@Override
|
||||
public boolean equals(Object ob) {
|
||||
if (!(ob instanceof Provides))
|
||||
return false;
|
||||
Provides other = (Provides)ob;
|
||||
return Objects.equals(this.service, other.service) &&
|
||||
Objects.equals(this.providers, other.providers);
|
||||
return (ob instanceof Provides other)
|
||||
&& Objects.equals(this.service, other.service)
|
||||
&& Objects.equals(this.providers, other.providers);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2241,10 +2233,8 @@ public class ModuleDescriptor
|
|||
public boolean equals(Object ob) {
|
||||
if (ob == this)
|
||||
return true;
|
||||
if (!(ob instanceof ModuleDescriptor))
|
||||
return false;
|
||||
ModuleDescriptor that = (ModuleDescriptor)ob;
|
||||
return (name.equals(that.name)
|
||||
return (ob instanceof ModuleDescriptor that)
|
||||
&& (name.equals(that.name)
|
||||
&& modifiers.equals(that.modifiers)
|
||||
&& requires.equals(that.requires)
|
||||
&& Objects.equals(packages, that.packages)
|
||||
|
|
|
@ -138,12 +138,9 @@ public final class ResolvedModule {
|
|||
*/
|
||||
@Override
|
||||
public boolean equals(Object ob) {
|
||||
if (!(ob instanceof ResolvedModule))
|
||||
return false;
|
||||
|
||||
ResolvedModule that = (ResolvedModule) ob;
|
||||
return Objects.equals(this.cf, that.cf)
|
||||
&& Objects.equals(this.mref, that.mref);
|
||||
return (ob instanceof ResolvedModule that)
|
||||
&& Objects.equals(this.cf, that.cf)
|
||||
&& Objects.equals(this.mref, that.mref);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue