Class InjectionPointSelector
- java.lang.Object
-
- org.stianloader.micromixin.transform.api.InjectionPointSelector
-
- Direct Known Subclasses:
ConstantInjectionPointSelector,FieldInjectionPointSelector,HeadInjectionPointSelector,InvokeInjectionPointSelector,LoadInjectionPointSelector,NewInjectionPointSelector,ReturnInjectionPointSelector,StoreInjectionPointSelector,TailInjectionPointSelector
public abstract class InjectionPointSelector extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description java.util.Set<java.lang.String>allNamesjava.lang.StringfullyQualifiedName
-
Constructor Summary
Constructors Constructor Description InjectionPointSelector(java.lang.String fqn, java.lang.String... aliases)InjectionPointSelector(java.lang.String fqn, java.util.Collection<java.lang.String> allNames)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description abstract org.objectweb.asm.tree.AbstractInsnNodegetFirstInsn(org.objectweb.asm.tree.MethodNode method, SlicedInjectionPointSelector from, SlicedInjectionPointSelector to, SimpleRemapper remapper, java.lang.StringBuilder sharedBuilder)Obtains the firstAbstractInsnNodethat corresponds to the first applicable entrypoint within the provided method as defined by thisInjectionPointSelector.abstract java.util.Collection<? extends org.objectweb.asm.tree.AbstractInsnNode>getMatchedInstructions(org.objectweb.asm.tree.MethodNode method, SlicedInjectionPointSelector from, SlicedInjectionPointSelector to, SimpleRemapper remapper, java.lang.StringBuilder sharedBuilder)Obtains theAbstractInsnNodesthat correspond to every applicable entrypoint within the provided method as defined by thisInjectionPointSelector.booleansupportsRedirect()Deprecated.Redirect in theory (not implemented in micromixin-transformer as of now) also supports redirecting PUTFIELD/GETFIELD, PUTSTATIC/GETStATIC, xALOAD and the ARRAYLENGTH instructions.
-
-
-
Method Detail
-
getFirstInsn
@Nullable public abstract org.objectweb.asm.tree.AbstractInsnNode getFirstInsn(@NotNull org.objectweb.asm.tree.MethodNode method, @Nullable SlicedInjectionPointSelector from, @Nullable SlicedInjectionPointSelector to, @NotNull SimpleRemapper remapper, @NotNull java.lang.StringBuilder sharedBuilder)Obtains the firstAbstractInsnNodethat corresponds to the first applicable entrypoint within the provided method as defined by thisInjectionPointSelector. TheAbstractInsnNodemay not be virtual, that is it may not have anopcodevalue of -1.Implementations of this method are trusted to not go out of bounds when it comes to the slices. Failure to do so could have nasty consequences for user behaviour as micromixin-transformer or any other caller is not guaranteed to verify the location of the matched instruction (but inversely it is not guaranteed that such as check won't be introduced in the future).
- Parameters:
method- The method to find the entrypoints in.from- TheInjectionPointSelectorthat represents the start of the slice where the injection point should be selected from. May be null to represent HEAD (start of method).to- TheInjectionPointSelectorthat represents the end of the slice where the injection point should be selected from. May be null to represent TAIL (end of method).remapper- The remapper instance to make use of. This is used to remap any references of the mixin class to the target class when applying injection point constraints.sharedBuilder- SharedStringBuilderinstance to reduceStringBuilderallocations.- Returns:
- The first matched instruction, or null if no instructions match.
-
getMatchedInstructions
@NotNull public abstract java.util.Collection<? extends org.objectweb.asm.tree.AbstractInsnNode> getMatchedInstructions(@NotNull org.objectweb.asm.tree.MethodNode method, @Nullable SlicedInjectionPointSelector from, @Nullable SlicedInjectionPointSelector to, @NotNull SimpleRemapper remapper, @NotNull java.lang.StringBuilder sharedBuilder)Obtains theAbstractInsnNodesthat correspond to every applicable entrypoint within the provided method as defined by thisInjectionPointSelector.Implementations of this method are trusted to not go out of bounds when it comes to the slices. Failure to do so could have nasty consequences for user behaviour as micromixin-transformer or any other caller is not guaranteed to verify the location of the matched instructions (but inversely it is not guaranteed that such as check won't be introduced in the future).
- Parameters:
method- The method to find the entrypoints in.from- TheInjectionPointSelectorthat represents the start of the slice where the injection point should be selected from. May be null to represent HEAD (start of method).to- TheInjectionPointSelectorthat represents the end of the slice where the injection point should be selected from. May be null to represent TAIL (end of method).remapper- The remapper instance to make use of. This is used to remap any references of the mixin class to the target class when applying injection point constraints.sharedBuilder- SharedStringBuilderinstance to reduceStringBuilderallocations.- Returns:
- The selected instruction nodes that correspond to this entry point.
-
supportsRedirect
@Deprecated @ScheduledForRemoval @OverrideOnly public boolean supportsRedirect()
Deprecated.Redirect in theory (not implemented in micromixin-transformer as of now) also supports redirecting PUTFIELD/GETFIELD, PUTSTATIC/GETStATIC, xALOAD and the ARRAYLENGTH instructions. Added with the introduction of slices which make the semantics of the matched instruction type less predictable at first glance, this method has little sense going forward.WARNING WARNING WARNING The method was deprecated for removal in the 0.6.X lifecycle and will get removed at an unspecified point in time (this might fall within the 0.7.X lifecycle!). This method is no longer considered to be part of the public API.Checks whether the injection point can be used in conjunction with the Redirect-annotation. Generally should only be true if this injection point selector can select method instruction nodes.
- Returns:
- True if usable in redirects, false otherwise.
-
-