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();
}
@Override
public boolean equals(final Object o) {
if (o == this) {
if (this == o) {
return true;
}
if (!(o instanceof final BukkitWorld other)) {
if (o == null || getClass() != o.getClass()) {
return false;
}
if (!other.canEqual(this)) {
return false;
}
if (!Objects.equals(this.world, other.world)) {
return false;
}
return true;
final BukkitWorld that = (BukkitWorld) o;
return world.equals(that.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) {
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() {
return "BukkitWorld(world=" + this.world + ")";
}

View File

@ -105,31 +105,29 @@ public abstract class PlotWorld {
return this.world;
}
@Override
public boolean equals(final Object o) {
if (o == this) {
if (this == o) {
return true;
}
if (!(o instanceof final PlotWorld other)) {
if (o == null || getClass() != o.getClass()) {
return false;
}
if (!other.canEqual(this)) {
return false;
}
final Object this$world = this.getWorld();
final Object other$world = other.getWorld();
return Objects.equals(this$world, other$world);
final PlotWorld plotWorld = (PlotWorld) o;
return world.equals(plotWorld.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) {
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) {
if (o == this) {
if (this == o) {
return true;
}
if (!(o instanceof final FlagContainer other)) {
if (o == null || getClass() != o.getClass()) {
return false;
}
if (!other.canEqual(this)) {
return false;
}
final Object this$flagMap = this.getFlagMap();
final Object other$flagMap = other.getFlagMap();
return Objects.equals(this$flagMap, other$flagMap);
final FlagContainer that = (FlagContainer) o;
return flagMap.equals(that.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) {
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}.
*/

View File

@ -31,6 +31,7 @@ import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.Collection;
import java.util.Collections;
import java.util.Objects;
/**
* 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();
}
@Override
public boolean equals(final Object o) {
if (o == this) {
if (this == o) {
return true;
}
if (!(o instanceof final PlotFlag<?, ?> other)) {
if (o == null || getClass() != o.getClass()) {
return false;
}
if (!other.canEqual(this)) {
return false;
}
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;
final PlotFlag<?, ?> plotFlag = (PlotFlag<?, ?>) o;
return value.equals(plotFlag.value);
}
@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) {
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;
}
@Override
public boolean equals(final Object o) {
if (o == this) {
if (this == o) {
return true;
}
if (!(o instanceof final UUIDMapping other)) {
if (o == null || getClass() != o.getClass()) {
return false;
}
if (!other.canEqual(this)) {
return false;
}
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);
final UUIDMapping that = (UUIDMapping) o;
return uuid.equals(that.uuid) && username.equals(that.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) {
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;
}
}