Replace delombok-ed equals and hashCode methods (#3518)

* regenerate leftover delombok-ed equals and hashCode methods

* delegate to hashCode directly instead of single parameter calls
This commit is contained in:
Hannes Greule 2022-02-27 18:51:37 +01:00 committed by GitHub
parent 954c813cef
commit 75f31c5bf6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 71 additions and 90 deletions

View File

@ -83,34 +83,31 @@ public class BukkitWorld implements World<org.bukkit.World> {
return this.world.getName(); return this.world.getName();
} }
@Override
public boolean equals(final Object o) { public boolean equals(final Object o) {
if (o == this) { if (this == o) {
return true; return true;
} }
if (!(o instanceof final BukkitWorld other)) { if (o == null || getClass() != o.getClass()) {
return false; return false;
} }
if (!other.canEqual(this)) { final BukkitWorld that = (BukkitWorld) o;
return false; return world.equals(that.world);
}
if (!Objects.equals(this.world, other.world)) {
return false;
}
return true;
} }
@Override
public int hashCode() {
return world.hashCode();
}
/**
* @deprecated This method is not meant to be invoked or overridden, with no replacement.
*/
@Deprecated(forRemoval = true, since = "TODO")
protected boolean canEqual(final Object other) { protected boolean canEqual(final Object other) {
return other instanceof BukkitWorld; return other instanceof BukkitWorld;
} }
public int hashCode() {
final int PRIME = 59;
int result = 1;
final Object $world = this.world;
result = result * PRIME + ($world == null ? 43 : $world.hashCode());
return result;
}
public String toString() { public String toString() {
return "BukkitWorld(world=" + this.world + ")"; return "BukkitWorld(world=" + this.world + ")";
} }

View File

@ -105,31 +105,29 @@ public abstract class PlotWorld {
return this.world; return this.world;
} }
@Override
public boolean equals(final Object o) { public boolean equals(final Object o) {
if (o == this) { if (this == o) {
return true; return true;
} }
if (!(o instanceof final PlotWorld other)) { if (o == null || getClass() != o.getClass()) {
return false; return false;
} }
if (!other.canEqual(this)) { final PlotWorld plotWorld = (PlotWorld) o;
return false; return world.equals(plotWorld.world);
}
final Object this$world = this.getWorld();
final Object other$world = other.getWorld();
return Objects.equals(this$world, other$world);
} }
@Override
public int hashCode() {
return world.hashCode();
}
/**
* @deprecated This method is not meant to be invoked or overridden, with no replacement.
*/
@Deprecated(forRemoval = true, since = "TODO")
protected boolean canEqual(final Object other) { protected boolean canEqual(final Object other) {
return other instanceof PlotWorld; return other instanceof PlotWorld;
} }
public int hashCode() {
final int PRIME = 59;
int result = 1;
final Object $world = this.getWorld();
result = result * PRIME + ($world == null ? 43 : $world.hashCode());
return result;
}
} }

View File

@ -371,33 +371,31 @@ public class FlagContainer {
} }
} }
@Override
public boolean equals(final Object o) { public boolean equals(final Object o) {
if (o == this) { if (this == o) {
return true; return true;
} }
if (!(o instanceof final FlagContainer other)) { if (o == null || getClass() != o.getClass()) {
return false; return false;
} }
if (!other.canEqual(this)) { final FlagContainer that = (FlagContainer) o;
return false; return flagMap.equals(that.flagMap);
}
final Object this$flagMap = this.getFlagMap();
final Object other$flagMap = other.getFlagMap();
return Objects.equals(this$flagMap, other$flagMap);
} }
@Override
public int hashCode() {
return flagMap.hashCode();
}
/**
* @deprecated This method is not meant to be invoked or overridden, with no replacement.
*/
@Deprecated(forRemoval = true, since = "TODO")
protected boolean canEqual(final Object other) { protected boolean canEqual(final Object other) {
return other instanceof FlagContainer; return other instanceof FlagContainer;
} }
public int hashCode() {
final int PRIME = 59;
int result = 1;
final Object $flagMap = this.getFlagMap();
result = result * PRIME + ($flagMap == null ? 43 : $flagMap.hashCode());
return result;
}
/** /**
* Update event types used in {@link PlotFlagUpdateHandler}. * Update event types used in {@link PlotFlagUpdateHandler}.
*/ */

View File

@ -31,6 +31,7 @@ import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.Objects;
/** /**
* A plot flag is any property that can be assigned * A plot flag is any property that can be assigned
@ -200,34 +201,30 @@ public abstract class PlotFlag<T, F extends PlotFlag<T, F>> {
return Collections.emptyList(); return Collections.emptyList();
} }
@Override
public boolean equals(final Object o) { public boolean equals(final Object o) {
if (o == this) { if (this == o) {
return true; return true;
} }
if (!(o instanceof final PlotFlag<?, ?> other)) { if (o == null || getClass() != o.getClass()) {
return false; return false;
} }
if (!other.canEqual(this)) { final PlotFlag<?, ?> plotFlag = (PlotFlag<?, ?>) o;
return false; return value.equals(plotFlag.value);
}
final Object this$value = this.getValue();
final Object other$value = other.getValue();
if (this$value == null ? other$value != null : !this$value.equals(other$value)) {
return false;
}
return true;
} }
@Override
public int hashCode() {
return value.hashCode();
}
/**
* @deprecated This method is not meant to be invoked or overridden, with no replacement.
*/
@Deprecated(forRemoval = true, since = "TODO")
protected boolean canEqual(final Object other) { protected boolean canEqual(final Object other) {
return other instanceof PlotFlag; return other instanceof PlotFlag;
} }
public int hashCode() {
final int PRIME = 59;
int result = 1;
final Object $value = this.getValue();
result = result * PRIME + ($value == null ? 43 : $value.hashCode());
return result;
}
} }

View File

@ -51,38 +51,29 @@ public class UUIDMapping {
return this.uuid; return this.uuid;
} }
@Override
public boolean equals(final Object o) { public boolean equals(final Object o) {
if (o == this) { if (this == o) {
return true; return true;
} }
if (!(o instanceof final UUIDMapping other)) { if (o == null || getClass() != o.getClass()) {
return false; return false;
} }
if (!other.canEqual(this)) { final UUIDMapping that = (UUIDMapping) o;
return false; return uuid.equals(that.uuid) && username.equals(that.username);
}
final Object this$uuid = this.getUuid();
final Object other$uuid = other.getUuid();
if (!Objects.equals(this$uuid, other$uuid)) {
return false;
}
final Object this$username = this.getUsername();
final Object other$username = other.getUsername();
return Objects.equals(this$username, other$username);
} }
@Override
public int hashCode() {
return Objects.hash(uuid, username);
}
/**
* @deprecated This method is not meant to be invoked or overridden, with no replacement.
*/
@Deprecated(forRemoval = true, since = "TODO")
protected boolean canEqual(final Object other) { protected boolean canEqual(final Object other) {
return other instanceof UUIDMapping; return other instanceof UUIDMapping;
} }
public int hashCode() {
final int PRIME = 59;
int result = 1;
final Object $uuid = this.getUuid();
result = result * PRIME + $uuid.hashCode();
final Object $username = this.getUsername();
result = result * PRIME + $username.hashCode();
return result;
}
} }