Class OuterClassNamePropagator
java.lang.Object
net.fabricmc.mappingio.adapter.ForwardingMappingVisitor
net.fabricmc.mappingio.adapter.OuterClassNamePropagator
- All Implemented Interfaces:
MappingVisitor
Searches for inner classes whose effective destination name contains outer classes referenced via their source name,
waits for mappings for these enclosing classes, and applies the latters' destination names
to the formers' fully qualified name.
For example, it takes a class class_1$class_2 that doesn't have a mapping,
tries to find class_1, which let's say has the mapping SomeClass,
and changes the former's destination name to SomeClass$class_2.
- Implementation Note:
- This visitor requires two pre-passes: one to collect all classes and their mappings, the other to actually apply the outer names. The third pass onwards will then emit the final mappings.
-
Field Summary
Fields inherited from class ForwardingMappingVisitor
next -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a newOuterClassNamePropagatorwhich processes all destination namespaces, including already remapped class destination names therein.OuterClassNamePropagator(MappingVisitor next, @Nullable Collection<String> namespaces, boolean processRemappedDstNames) Constructs a newOuterClassNamePropagatorwhich processes the selected destination namespaces. -
Method Summary
Modifier and TypeMethodDescriptiongetFlags()booleanvisitClass(String srcName) Visit a class.booleanDetermine whether the mapping content (classes and anything below, metadata if not part of the header) should be visited.voidvisitDstDesc(MappedElementKind targetKind, int namespace, String desc) voidvisitDstName(MappedElementKind targetKind, int namespace, String name) Destination name for the current element.booleanvisitElementContent(MappedElementKind targetKind) Determine whether the element content (comment, sub-elements) should be visited.booleanvisitEnd()Finish the visitation pass.booleanDetermine whether the header (namespaces, metadata if part of the header) should be visited.voidvisitMetadata(String key, @Nullable String value) voidvisitNamespaces(String srcNamespace, List<String> dstNamespaces) Methods inherited from class ForwardingMappingVisitor
reset, visitComment, visitField, visitMethod, visitMethodArg, visitMethodVar
-
Constructor Details
-
OuterClassNamePropagator
Constructs a newOuterClassNamePropagatorwhich processes all destination namespaces, including already remapped class destination names therein. -
OuterClassNamePropagator
public OuterClassNamePropagator(MappingVisitor next, @Nullable @Nullable Collection<String> namespaces, boolean processRemappedDstNames) Constructs a newOuterClassNamePropagatorwhich processes the selected destination namespaces.- Parameters:
namespaces- The destination namespaces where outer class names shall be propagated. Passnullto process all destination namespaces.processRemappedDstNames- Whether already remapped destination names should also get their unmapped outer classes replaced.
-
-
Method Details
-
getFlags
- Specified by:
getFlagsin interfaceMappingVisitor- Overrides:
getFlagsin classForwardingMappingVisitor
-
visitHeader
Description copied from interface:MappingVisitorDetermine whether the header (namespaces, metadata if part of the header) should be visited.- Specified by:
visitHeaderin interfaceMappingVisitor- Overrides:
visitHeaderin classForwardingMappingVisitor- Returns:
trueif the header is to be visited,falseotherwise.- Throws:
IOException
-
visitNamespaces
- Specified by:
visitNamespacesin interfaceMappingVisitor- Overrides:
visitNamespacesin classForwardingMappingVisitor- Throws:
IOException
-
visitMetadata
- Specified by:
visitMetadatain interfaceMappingVisitor- Overrides:
visitMetadatain classForwardingMappingVisitor- Throws:
IOException
-
visitContent
Description copied from interface:MappingVisitorDetermine whether the mapping content (classes and anything below, metadata if not part of the header) should be visited.- Specified by:
visitContentin interfaceMappingVisitor- Overrides:
visitContentin classForwardingMappingVisitor- Returns:
trueif content is to be visited,falseotherwise.- Throws:
IOException
-
visitClass
Description copied from interface:MappingVisitorVisit a class.- Specified by:
visitClassin interfaceMappingVisitor- Overrides:
visitClassin classForwardingMappingVisitor- Parameters:
srcName- The fully qualified source name of the class, in internal form (slashes instead of dots, dollar signs for delimiting inner classes).- Returns:
- Whether the class's content should be visited too.
- Throws:
IOException
-
visitDstName
public void visitDstName(MappedElementKind targetKind, int namespace, String name) throws IOException Description copied from interface:MappingVisitorDestination name for the current element.- Specified by:
visitDstNamein interfaceMappingVisitor- Overrides:
visitDstNamein classForwardingMappingVisitor- Parameters:
namespace- Namespace index (index into the dstNamespaces list inMappingVisitor.visitNamespaces(String, List)).name- Destination name.- Throws:
IOException
-
visitDstDesc
public void visitDstDesc(MappedElementKind targetKind, int namespace, String desc) throws IOException - Specified by:
visitDstDescin interfaceMappingVisitor- Overrides:
visitDstDescin classForwardingMappingVisitor- Throws:
IOException
-
visitElementContent
Description copied from interface:MappingVisitorDetermine whether the element content (comment, sub-elements) should be visited.Called after visiting the target itself (e.g. visitClass for targetKind=class), its dst names and descs, but before any child elements or the comment.
This is also a notification about all available dst names having been passed on.
- Specified by:
visitElementContentin interfaceMappingVisitor- Overrides:
visitElementContentin classForwardingMappingVisitor- Returns:
trueif the contents are to be visited,falseotherwise- Throws:
IOException
-
visitEnd
Description copied from interface:MappingVisitorFinish the visitation pass.Implementors may throw an exception if a second pass is requested without the
NEEDS_MULTIPLE_PASSESflag having been passed beforehand, but only if that behavior is documented.- Specified by:
visitEndin interfaceMappingVisitor- Overrides:
visitEndin classForwardingMappingVisitor- Returns:
trueif the visitation pass is final,falseif it should be started over.- Throws:
IOException
-