Package io.papermc.asm.rules.method
Interface MethodRewriteRule
- All Superinterfaces:
RewriteRule
- All Known Subinterfaces:
GeneratedStaticRewrite,OwnableMethodRewriteRule,OwnableMethodRewriteRule.Filtered,StaticRewrite,TargetedTypeGeneratedStaticRewrite,TargetedTypeGeneratedStaticRewrite.Parameter,TargetedTypeGeneratedStaticRewrite.Return
- All Known Implementing Classes:
DirectParameterRewrite,DirectReturnRewrite,DirectStaticRewrite,FuzzyParameterRewrite,MoveInstanceMethod,SubTypeReturnRewrite,SuperTypeParamRewrite
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.papermc.asm.rules.RewriteRule
RewriteRule.Chain, RewriteRule.ChainBuilder, RewriteRule.Delegate, RewriteRule.GeneratorAdapterFactory -
Field Summary
FieldsFields inherited from interface io.papermc.asm.rules.RewriteRule
EMPTY -
Method Summary
Modifier and TypeMethodDescriptiondefault ClassVisitorcreateVisitor(int api, ClassVisitor parent, ClassProcessingContext context) rewrite(ClassProcessingContext context, boolean isInvokeDynamic, int opcode, ClassDesc owner, String name, MethodTypeDesc descriptor, boolean isInterface) Creates aMethodRewritewhich will be applied to the processed bytecode.booleanshouldProcess(ClassProcessingContext context, int opcode, String owner, String name, String descriptor, boolean isInterface, boolean isInvokeDynamic) Checks if this rule should even attempt to create aMethodRewritefor the current context.
-
Field Details
-
LAMBDA_METAFACTORY_OWNER
- See Also:
-
-
Method Details
-
shouldProcess
boolean shouldProcess(ClassProcessingContext context, int opcode, String owner, String name, String descriptor, boolean isInterface, boolean isInvokeDynamic) Checks if this rule should even attempt to create aMethodRewritefor the current context. Returning true here does not mean aMethodRewritewill be created, but it's an early exit for rules that know they won't be able to rewrite the method.- Parameters:
context- the current contextopcode- the method opcodeowner- the method owner (with slashes)name- the method namedescriptor- the method descriptorisInterface- if the owning class is an interfaceisInvokeDynamic- if the method call is from an invokedynamic instruction- Returns:
- true to continue processing the instruction
-
rewrite
@Nullable MethodRewrite<?> rewrite(ClassProcessingContext context, boolean isInvokeDynamic, int opcode, ClassDesc owner, String name, MethodTypeDesc descriptor, boolean isInterface) Creates aMethodRewritewhich will be applied to the processed bytecode.- Parameters:
context- the current contextisInvokeDynamic- if this is in an invokedynamic instructionopcode- the opcode of the invoke instruction or the invokedynamic handle tagowner- the owner of the invoke method or the owner of the invokedynamic handlename- the name of the invoke method or the name of the invokedynamic handledescriptor- the descriptor of the invoke method or the descriptor of the invokedynamic handleisInterface- if the method is an interface method- Returns:
- the rewrite or null if no rewrite should be applied
-
createVisitor
- Specified by:
createVisitorin interfaceRewriteRule
-