Class MicromixinRemapper
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionMicromixinRemapper(@NotNull org.stianloader.remapper.MappingLookup lookup, @NotNull org.stianloader.remapper.MappingSink sink, @NotNull MemberLister lister) -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanforbidRemappingInterfaceMembers(@NotNull String name, @NotNull Collection<@NotNull String> targets) Queries whether interface members may be renamed as a result of aremapClass(ClassNode)pass.protected voidlogUnimplementedFeature(@NotNull String featureDescription) The error handler that is invoked whenever an unimplemented or unknown feature is encountered.protected @Nullable AtSelectorlookupSelector(@NotNull String atValue) voidremapAt(@NotNull String owner, @NotNull String member, int ordinal, @NotNull Collection<String> targets, org.objectweb.asm.tree.AnnotationNode annot) voidremapAtArray(@NotNull String owner, @NotNull String method, @NotNull Collection<String> targets, Object nodes) voidremapClass(@NotNull org.objectweb.asm.tree.ClassNode node) Remap aClassNodeand all the memberMethodNodesandFieldNodeswithin the class.voidremapMethodSelectorList(List<?> selectors, @NotNull String originName, org.objectweb.asm.tree.MethodNode originMethod, @NotNull Collection<String> targets, @Nullable Predicate<@NotNull String> inferredDescriptorPredicate) voidremapSlice(@NotNull String owner, @NotNull String member, int ordinal, @NotNull Collection<String> targets, org.objectweb.asm.tree.AnnotationNode annot)
-
Field Details
-
CALLBACK_INFO_CLASS
- See Also:
-
CALLBACK_INFO_RETURNABLE_CLASS
- See Also:
-
-
Constructor Details
-
MicromixinRemapper
public MicromixinRemapper(@NotNull @NotNull org.stianloader.remapper.MappingLookup lookup, @NotNull @NotNull org.stianloader.remapper.MappingSink sink, @NotNull @NotNull MemberLister lister)
-
-
Method Details
-
forbidRemappingInterfaceMembers
protected boolean forbidRemappingInterfaceMembers(@NotNull @NotNull String name, @NotNull @NotNull Collection<@NotNull String> targets) Queries whether interface members may be renamed as a result of aremapClass(ClassNode)pass. This method mainly exist as a way to prevent collateral damage when inappropriately implementing interfaces when using annotations such as@Shadowor@Overwritealongside theOverride.The default implementation always returns
trueas an overly cautious way of weeding out potentially inappropriate usages of mixins.- Parameters:
name- The internal name of the interface whose member may be modifiedtargets- A collection of internal names of the targeted classes by the mixin (in case one wishes to perform hierarchy validation)- Returns:
- True if renaming it's members is forbidden, false if allowed.
-
logUnimplementedFeature
@OverrideOnly protected void logUnimplementedFeature(@NotNull @NotNull String featureDescription) throws MissingFeatureException The error handler that is invoked whenever an unimplemented or unknown feature is encountered.Being able to track down these cases may help narrow down why the remapper failed remapping something or remapped something in an unexpected way.
By default it'll cause an
MissingFeatureExceptionto be thrown, but it is possible to overwrite this behaviour with a logging call. In that case, the remapper will try to continue on a best-effort basis.- Parameters:
featureDescription- The description of the feature that is not implemented and what caused the issue to occur.- Throws:
MissingFeatureException- Thrown if the error handler is configured to stop execution of the remapper in a fail-fast manner.
-
lookupSelector
@Nullable @MustBeInvokedByOverriders @Contract(pure=true) protected @Nullable AtSelector lookupSelector(@NotNull @NotNull String atValue) -
remapAt
@Internal public void remapAt(@NotNull @NotNull String owner, @NotNull @NotNull String member, int ordinal, @NotNull @NotNull Collection<String> targets, org.objectweb.asm.tree.AnnotationNode annot) throws IllegalMixinException, MissingFeatureException -
remapAtArray
@Internal public void remapAtArray(@NotNull @NotNull String owner, @NotNull @NotNull String method, @NotNull @NotNull Collection<String> targets, Object nodes) throws IllegalMixinException, MissingFeatureException -
remapClass
public void remapClass(@NotNull @NotNull org.objectweb.asm.tree.ClassNode node) throws IllegalMixinException, MissingFeatureException Remap aClassNodeand all the memberMethodNodesandFieldNodeswithin the class. Note that in order for the micromixin remapping process to work correctly and account for inter-class relationships (mixin inheritance), this method needs to be executed before the actual remapping process throughRemapper.remapNode(ClassNode, StringBuilder). More concisely, this method expect thatRemapper.remapNode(ClassNode, StringBuilder)will be run afterremapClass(ClassNode).Modifications to this remapper's underlying
MappingSinkinstance (set through the constructor) are expected to be applied to theRemapperinstance. It is highly recommended that theMappingSinkis aware of class hierarchy remapping. Additionally, it may be useful to be able to verify that theMappingSinkinstance does not accidentally or not remap non-mixin classes. If a mapping request emitted by this method (or any of the method is is delegating to) ends up remapping an unrelated class, then the mixin should be considered illegal.It is permissible for the provided mixin class to not be an
@Mixin-annotated class, in which case the class is skipped.- Parameters:
node- TheClassNodeto remap- Throws:
IllegalMixinException- Thrown if the mixin contains illegal code (e.g. invalid targets in the@Mixinor@Shadowcollisions while implementing an interface).MissingFeatureException- Thrown due tologUnimplementedFeature(String), this exception is reserved for purposes where the remapper encounters mixin features it is not aware of at the current point in time.
-
remapMethodSelectorList
@Internal public void remapMethodSelectorList(List<?> selectors, @NotNull @NotNull String originName, org.objectweb.asm.tree.MethodNode originMethod, @NotNull @NotNull Collection<String> targets, @Nullable @Nullable Predicate<@NotNull String> inferredDescriptorPredicate) throws IllegalMixinException, MissingFeatureException -
remapSlice
@Internal public void remapSlice(@NotNull @NotNull String owner, @NotNull @NotNull String member, int ordinal, @NotNull @NotNull Collection<String> targets, org.objectweb.asm.tree.AnnotationNode annot) throws IllegalMixinException, MissingFeatureException
-