Revert "fix: Version.jar should be resolved to id of self if null instead of the id of ancestor.". Closes #934.

This reverts commit 5de150b06e85603d6e34ee3db29ad6e285394d66.
This commit is contained in:
Yuhui Huang 2021-07-28 16:15:11 +08:00
parent 0d69e944f6
commit 5f8f01e0ab
2 changed files with 5 additions and 4 deletions

1
.gitignore vendored
View File

@ -45,3 +45,4 @@ NVIDIA
# test # test
/hmcl.json /hmcl.json
/.hmcl.json

View File

@ -163,7 +163,7 @@ public class Version implements Comparable<Version>, Validation {
} }
public String getJar() { public String getJar() {
return jar == null ? id : jar; return jar;
} }
public String getInheritsFrom() { public String getInheritsFrom() {
@ -275,14 +275,14 @@ public class Version implements Comparable<Version>, Validation {
if (inheritsFrom == null) { if (inheritsFrom == null) {
if (isRoot()) if (isRoot())
thisVersion = new Version(id).setPatches(patches); thisVersion = new Version(id).setPatches(patches).setJar(id);
else else
thisVersion = this; thisVersion = this.jar == null ? this.setJar(id) : this;
} else { } else {
// To maximize the compatibility. // To maximize the compatibility.
if (!resolvedSoFar.add(id)) { if (!resolvedSoFar.add(id)) {
Logging.LOG.log(Level.WARNING, "Found circular dependency versions: " + resolvedSoFar); Logging.LOG.log(Level.WARNING, "Found circular dependency versions: " + resolvedSoFar);
thisVersion = this; thisVersion = this.jar == null ? this.setJar(id) : this;
} else { } else {
// It is supposed to auto install an version in getVersion. // It is supposed to auto install an version in getVersion.
thisVersion = merge(provider.getVersion(inheritsFrom).resolve(provider, resolvedSoFar), false); thisVersion = merge(provider.getVersion(inheritsFrom).resolve(provider, resolvedSoFar), false);