Class SubsetChecker
java.lang.Object
net.fabricmc.mappingio.adapter.SubsetChecker
- All Implemented Interfaces:
FlatMappingVisitor
A visitor which checks whether the visited mappings are a subset of a superset tree.
Experimental feature, may be removed or changed without further notice.
-
Constructor Summary
ConstructorsConstructorDescriptionSubsetChecker(MappingTreeView supTree, @Nullable MappingFormat supFormat, @Nullable MappingFormat subFormat, Consumer<String> errorHandler) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidassertEquals(Object expected, Object actual, String message) protected voidassertFalse(boolean condition, String message) protected voidassertNotNull(Object obj, String message) protected voidassertTrue(boolean condition, String message) booleanvisitClass(String srcName, @Nullable String[] dstNames) voidvisitClassComment(String srcName, @Nullable String[] dstNames, String comment) booleanvisitField(String srcClsName, String srcName, @Nullable String srcDesc, @Nullable String[] dstClsNames, @Nullable String[] dstNames, @Nullable String[] dstDescs) voidvisitFieldComment(String srcClsName, String srcName, @Nullable String srcDesc, @Nullable String[] dstClsNames, @Nullable String[] dstNames, @Nullable String[] dstDescs, String comment) booleanvisitMethod(String srcClsName, String srcName, @Nullable String srcDesc, @Nullable String[] dstClsNames, @Nullable String[] dstNames, @Nullable String[] dstDescs) booleanvisitMethodArg(String srcClsName, String srcMethodName, @Nullable String srcMethodDesc, int argPosition, int lvIndex, @Nullable String srcName, @Nullable String[] dstClsNames, @Nullable String[] dstMethodNames, @Nullable String[] dstMethodDescs, @Nullable String[] dstNames) voidvisitMethodArgComment(String srcClsName, String srcMethodName, @Nullable String srcMethodDesc, int argPosition, int lvIndex, @Nullable String srcArgName, @Nullable String[] dstClsNames, @Nullable String[] dstMethodNames, @Nullable String[] dstMethodDescs, @Nullable String[] dstNames, String comment) voidvisitMethodComment(String srcClsName, String srcName, @Nullable String srcDesc, @Nullable String[] dstClsNames, @Nullable String[] dstNames, @Nullable String[] dstDescs, String comment) booleanvisitMethodVar(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, @Nullable String[] dstNames) voidvisitMethodVarComment(String srcClsName, String srcMethodName, @Nullable String srcMethodDesc, int lvtRowIndex, int lvIndex, int startOpIdx, int endOpIdx, @Nullable String srcVarName, @Nullable String[] dstClsNames, @Nullable String[] dstMethodNames, @Nullable String[] dstMethodDescs, @Nullable String[] dstNames, String comment) voidvisitNamespaces(String srcNamespace, List<String> dstNamespaces) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface FlatMappingVisitor
asRegularVisitor, getFlags, reset, visitClass, visitClassComment, visitClassComment, visitContent, visitEnd, visitField, visitField, visitField, visitFieldComment, visitFieldComment, visitHeader, visitMetadata, visitMethod, visitMethod, visitMethod, visitMethodArg, visitMethodArg, visitMethodArg, visitMethodArgComment, visitMethodArgComment, visitMethodComment, visitMethodComment, visitMethodVar, visitMethodVar, visitMethodVar, visitMethodVarComment, visitMethodVarComment
-
Constructor Details
-
SubsetChecker
public SubsetChecker(MappingTreeView supTree, @Nullable @Nullable MappingFormat supFormat, @Nullable @Nullable MappingFormat subFormat, Consumer<String> errorHandler) - Parameters:
supTree- The superset tree.supFormat- The superset format, ornullif supTree has all the original data.subFormat- The subset format, ornullif lossless (e.g. if the visit calls are coming from a tree).errorHandler- The error handler, which will be called with the error message if a non-subset element is found. Currently expected to throw an exception, otherwise the checker will continue to run in an invalid state.
-
-
Method Details
-
visitNamespaces
- Specified by:
visitNamespacesin interfaceFlatMappingVisitor- Throws:
IOException
-
visitClass
- Specified by:
visitClassin interfaceFlatMappingVisitor- Throws:
IOException
-
visitClassComment
public void visitClassComment(String srcName, @Nullable @Nullable String[] dstNames, String comment) throws IOException - Specified by:
visitClassCommentin interfaceFlatMappingVisitor- Throws:
IOException
-
visitField
public boolean visitField(String srcClsName, String srcName, @Nullable @Nullable String srcDesc, @Nullable @Nullable String[] dstClsNames, @Nullable @Nullable String[] dstNames, @Nullable @Nullable String[] dstDescs) throws IOException - Specified by:
visitFieldin interfaceFlatMappingVisitor- Throws:
IOException
-
visitFieldComment
public void visitFieldComment(String srcClsName, String srcName, @Nullable @Nullable String srcDesc, @Nullable @Nullable String[] dstClsNames, @Nullable @Nullable String[] dstNames, @Nullable @Nullable String[] dstDescs, String comment) throws IOException - Specified by:
visitFieldCommentin interfaceFlatMappingVisitor- Throws:
IOException
-
visitMethod
public boolean visitMethod(String srcClsName, String srcName, @Nullable @Nullable String srcDesc, @Nullable @Nullable String[] dstClsNames, @Nullable @Nullable String[] dstNames, @Nullable @Nullable String[] dstDescs) throws IOException - Specified by:
visitMethodin interfaceFlatMappingVisitor- Throws:
IOException
-
visitMethodComment
public void visitMethodComment(String srcClsName, String srcName, @Nullable @Nullable String srcDesc, @Nullable @Nullable String[] dstClsNames, @Nullable @Nullable String[] dstNames, @Nullable @Nullable String[] dstDescs, String comment) throws IOException - Specified by:
visitMethodCommentin interfaceFlatMappingVisitor- Throws:
IOException
-
visitMethodArg
public boolean visitMethodArg(String srcClsName, String srcMethodName, @Nullable @Nullable String srcMethodDesc, int argPosition, int lvIndex, @Nullable @Nullable String srcName, @Nullable @Nullable String[] dstClsNames, @Nullable @Nullable String[] dstMethodNames, @Nullable @Nullable String[] dstMethodDescs, @Nullable @Nullable String[] dstNames) throws IOException - Specified by:
visitMethodArgin interfaceFlatMappingVisitor- Throws:
IOException
-
visitMethodArgComment
public void visitMethodArgComment(String srcClsName, String srcMethodName, @Nullable @Nullable String srcMethodDesc, int argPosition, int lvIndex, @Nullable @Nullable String srcArgName, @Nullable @Nullable String[] dstClsNames, @Nullable @Nullable String[] dstMethodNames, @Nullable @Nullable String[] dstMethodDescs, @Nullable @Nullable String[] dstNames, String comment) throws IOException - Specified by:
visitMethodArgCommentin interfaceFlatMappingVisitor- Throws:
IOException
-
visitMethodVar
public boolean visitMethodVar(String srcClsName, String srcMethodName, @Nullable @Nullable String srcMethodDesc, int lvtRowIndex, int lvIndex, int startOpIdx, int endOpIdx, @Nullable @Nullable String srcName, @Nullable @Nullable String[] dstClsNames, @Nullable @Nullable String[] dstMethodNames, @Nullable @Nullable String[] dstMethodDescs, @Nullable @Nullable String[] dstNames) throws IOException - Specified by:
visitMethodVarin interfaceFlatMappingVisitor- Throws:
IOException
-
visitMethodVarComment
public void visitMethodVarComment(String srcClsName, String srcMethodName, @Nullable @Nullable String srcMethodDesc, int lvtRowIndex, int lvIndex, int startOpIdx, int endOpIdx, @Nullable @Nullable String srcVarName, @Nullable @Nullable String[] dstClsNames, @Nullable @Nullable String[] dstMethodNames, @Nullable @Nullable String[] dstMethodDescs, @Nullable @Nullable String[] dstNames, String comment) throws IOException - Specified by:
visitMethodVarCommentin interfaceFlatMappingVisitor- Throws:
IOException
-
assertTrue
-
assertFalse
-
assertEquals
-
assertNotNull
-