From 3b449e6270183c26e6bdaff6a7561e544f9603d4 Mon Sep 17 00:00:00 2001 From: shedaniel Date: Mon, 12 Aug 2024 21:16:10 +0900 Subject: [PATCH] remove hashcode and equals --- .../java/net/fabricmc/loom/util/Version.java | 32 ++----------------- 1 file changed, 2 insertions(+), 30 deletions(-) diff --git a/src/main/java/net/fabricmc/loom/util/Version.java b/src/main/java/net/fabricmc/loom/util/Version.java index 6044b81b6..77650a26a 100644 --- a/src/main/java/net/fabricmc/loom/util/Version.java +++ b/src/main/java/net/fabricmc/loom/util/Version.java @@ -24,7 +24,7 @@ package net.fabricmc.loom.util; -import java.util.Objects; +import java.util.Locale; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -63,7 +63,7 @@ public static Version parse(String version, boolean withPatch) { int patch = !Strings.isNullOrEmpty(matcher.group(4)) ? Integer.parseInt(matcher.group(4)) : 0; String qualifier = matcher.group(5); - return new Version(major, minor, micro, patch, toLowerCase(qualifier)); + return new Version(major, minor, micro, patch, qualifier == null ? null : qualifier.toLowerCase(Locale.ROOT)); } public Version asBaseVersion() { @@ -84,32 +84,4 @@ public int compareTo(@NotNull Version other) { .compare(this.qualifier, other.qualifier); } } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } else if (obj == null || this.getClass() != obj.getClass()) { - return false; - } else { - Version other = (Version) obj; - return this.major == other.major && this.minor == other.minor && this.micro == other.micro && this.patch == other.patch - && Objects.equals(this.qualifier, other.qualifier); - } - } - - @Override - public int hashCode() { - int result = this.major; - result = 31 * result + this.minor; - result = 31 * result + this.micro; - result = 31 * result + this.patch; - result = 31 * result + Objects.hashCode(this.qualifier); - return result; - } - - @Nullable - private static String toLowerCase(@Nullable String string) { - return string == null ? null : string.toLowerCase(); - } }