FabricModJson: Make hashCode final again

Fixes ModAccessWidenerEntryTest.
This commit is contained in:
Juuz
2023-02-18 14:05:19 +02:00
parent ae4fe17cca
commit 319b7a5fed
2 changed files with 5 additions and 7 deletions

View File

@@ -67,7 +67,7 @@ public abstract sealed class FabricModJson permits FabricModJsonV0, FabricModJso
}
@Override
public int hashCode() {
public final int hashCode() {
return Objects.hash(getId(), getVersion());
}

View File

@@ -42,6 +42,7 @@ import org.jetbrains.annotations.Nullable;
import net.fabricmc.loom.util.gradle.SourceSetHelper;
public final class ModMetadataFabricModJson extends FabricModJson {
private static final int FABRIC_SCHEMA_VERSION = -1;
private final ModMetadataFile modMetadata;
private final FabricModJsonSource source;
@@ -99,7 +100,9 @@ public final class ModMetadataFabricModJson extends FabricModJson {
@Override
public int getVersion() {
throw new UnsupportedOperationException();
// Technically not correct since we're not a real fabric.mod.json,
// but this is needed for computing the hash code.
return FABRIC_SCHEMA_VERSION;
}
@Override
@@ -122,9 +125,4 @@ public final class ModMetadataFabricModJson extends FabricModJson {
.stream()
.collect(Collectors.toMap(Function.identity(), path -> ModEnvironment.UNIVERSAL));
}
@Override
public int hashCode() {
return modMetadata.hashCode();
}
}