Skip to content

Commit

Permalink
fix checks not using outputVersion
Browse files Browse the repository at this point in the history
  • Loading branch information
wagyourtail committed Jul 20, 2024
1 parent 2e8769c commit 0cf5c46
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ interface DowngradeFlags : TransformParameters {
* default is null
*/
@get:InputFiles
@get:PathSensitive(PathSensitivity.ABSOLUTE)
@get:PathSensitive(PathSensitivity.NONE)
@get:Optional
val apiJar: ListProperty<File>

Expand Down
12 changes: 8 additions & 4 deletions src/main/java/xyz/wagyourtail/jvmdg/ClassDowngrader.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,12 @@ public synchronized Map<Integer, VersionProvider> collectProviders() {
}

public Set<MemberNameAndDesc> getMembers(int version, Type type, Set<String> warnings) throws IOException {
for (int vers = version; vers > target; vers--) {
for (int vers = version; vers > target; ) {
VersionProvider downgrader = downgraders.get(vers);
if (downgrader == null) {
throw new RuntimeException("Unsupported class version: " + vers + " supported: " + downgraders.keySet());
}
vers = downgrader.outputVersion;
downgrader.ensureInit(this);
Type stubbed = downgrader.stubClass(type, warnings);
if (!stubbed.equals(type)) {
Expand Down Expand Up @@ -158,11 +159,12 @@ public Set<MemberNameAndDesc> getMembers(int version, Type type, Set<String> war
}

public List<Pair<Type, Boolean>> getSupertypes(int version, Type type, Set<String> warnings) throws IOException {
for (int vers = version; vers > target; vers--) {
for (int vers = version; vers > target;) {
VersionProvider downgrader = downgraders.get(vers);
if (downgrader == null) {
throw new RuntimeException("Unsupported class version: " + vers + " supported: " + downgraders.keySet());
}
vers = downgrader.outputVersion;
downgrader.ensureInit(this);
Type stubbed = downgrader.stubClass(type, warnings);
if (!stubbed.equals(type)) {
Expand Down Expand Up @@ -191,11 +193,12 @@ public List<Pair<Type, Boolean>> getSupertypes(int version, Type type, Set<Strin
}

public Boolean isInterface(int version, Type type, Set<String> warnings) throws IOException {
for (int vers = version; vers > target; vers--) {
for (int vers = version; vers > target; ) {
VersionProvider downgrader = downgraders.get(vers);
if (downgrader == null) {
throw new RuntimeException("Unsupported class version: " + vers + " supported: " + downgraders.keySet());
}
vers = downgrader.outputVersion;
downgrader.ensureInit(this);
Type stubbed = downgrader.stubClass(type, warnings);
if (!stubbed.equals(type)) {
Expand All @@ -214,11 +217,12 @@ public Boolean isInterface(int version, Type type, Set<String> warnings) throws
}

public Type stubClass(int version, Type type, Set<String> warnings) {
for (int vers = version; vers > target; vers--) {
for (int vers = version; vers > target;) {
VersionProvider downgrader = downgraders.get(vers);
if (downgrader == null) {
throw new RuntimeException("Unsupported class version: " + vers + " supported: " + downgraders.keySet());
}
vers = downgrader.outputVersion;
downgrader.ensureInit(this);
Type stubbed = downgrader.stubClass(type, warnings);
if (!stubbed.equals(type)) {
Expand Down

0 comments on commit 0cf5c46

Please sign in to comment.