-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deal with inheritance in mappings properly
- Loading branch information
1 parent
a2cfdce
commit db285e9
Showing
10 changed files
with
562 additions
and
46 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
...in/java/dev/lukebemish/taskgraphrunner/runtime/mappings/MappingDropMissingSrcVisitor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package dev.lukebemish.taskgraphrunner.runtime.mappings; | ||
|
||
import net.fabricmc.mappingio.FlatMappingVisitor; | ||
import net.fabricmc.mappingio.MappingVisitor; | ||
import net.fabricmc.mappingio.adapter.RegularAsFlatMappingVisitor; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import java.io.IOException; | ||
import java.util.Arrays; | ||
import java.util.Objects; | ||
|
||
public class MappingDropMissingSrcVisitor extends ForwardingFlatVisitor { | ||
public MappingDropMissingSrcVisitor(FlatMappingVisitor delegate) { | ||
super(delegate); | ||
} | ||
|
||
public static MappingVisitor create(MappingVisitor delegate) { | ||
return new MappingDropMissingSrcVisitor(new RegularAsFlatMappingVisitor(delegate)).asRegularVisitor(); | ||
} | ||
|
||
private boolean checkNames(@Nullable String[] dstNames) { | ||
return dstNames != null && dstNames.length > 0 && Arrays.stream(dstNames).allMatch(Objects::nonNull); | ||
} | ||
|
||
@Override | ||
public boolean visitClass(String srcName, @Nullable String[] dstNames) throws IOException { | ||
return checkNames(dstNames) && super.visitClass(srcName, dstNames); | ||
} | ||
|
||
@Override | ||
public boolean visitMethod(String srcClsName, String srcName, @Nullable String srcDesc, @Nullable String[] dstClsNames, @Nullable String[] dstNames, @Nullable String[] dstDescs) throws IOException { | ||
return checkNames(dstNames) && super.visitMethod(srcClsName, srcName, srcDesc, dstClsNames, dstNames, dstDescs); | ||
} | ||
|
||
@Override | ||
public boolean visitField(String srcClsName, String srcName, @Nullable String srcDesc, @Nullable String[] dstClsNames, @Nullable String[] dstNames, @Nullable String[] dstDescs) throws IOException { | ||
return checkNames(dstNames) && super.visitField(srcClsName, srcName, srcDesc, dstClsNames, dstNames, dstDescs); | ||
} | ||
|
||
@Override | ||
public boolean visitMethodArg(String srcClsName, String srcMethodName, @Nullable String srcMethodDesc, int argPosition, int lvIndex, @Nullable String srcName, @Nullable String[] dstClsNames, @Nullable String[] dstMethodNames, @Nullable String[] dstMethodDescs, String[] dstNames) throws IOException { | ||
return checkNames(dstNames) && super.visitMethodArg(srcClsName, srcMethodName, srcMethodDesc, argPosition, lvIndex, srcName, dstClsNames, dstMethodNames, dstMethodDescs, dstNames); | ||
} | ||
|
||
@Override | ||
public boolean visitMethodVar(String srcClsName, String srcMethodName, @Nullable String srcMethodDesc, int lvtRowIndex, int lvIndex, int startOpIdx, int endOpIdx, @Nullable String srcName, @Nullable String[] dstClsNames, @Nullable String[] dstMethodNames, @Nullable String[] dstMethodDescs, String[] dstNames) throws IOException { | ||
return checkNames(dstNames) && super.visitMethodVar(srcClsName, srcMethodName, srcMethodDesc, lvtRowIndex, lvIndex, startOpIdx, endOpIdx, srcName, dstClsNames, dstMethodNames, dstMethodDescs, dstNames); | ||
} | ||
} |
317 changes: 317 additions & 0 deletions
317
src/main/java/dev/lukebemish/taskgraphrunner/runtime/mappings/MappingInheritance.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.