Package io.papermc.asm.rules.method
Record Class MoveInstanceMethod
java.lang.Object
java.lang.Record
io.papermc.asm.rules.method.MoveInstanceMethod
- All Implemented Interfaces:
GeneratedMethodHolder,GeneratedStaticRewrite,MethodRewriteRule,OwnableMethodRewriteRule,OwnableMethodRewriteRule.Filtered,StaticRewrite,OwnableRewriteRule,RewriteRule
public record MoveInstanceMethod(Set<ClassDesc> owners, MethodMatcher methodMatcher, ClassDesc newOwner, String newMethodName)
extends Record
implements GeneratedStaticRewrite, OwnableMethodRewriteRule.Filtered
Generally used to move a method from an interface to its implementation class. This is
useful when the API has a changed method, but you still want the exact behavior of the
original method. Just keep the original in the implementation and redirect to the implementation.
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface io.papermc.asm.rules.generate.GeneratedMethodHolder
GeneratedMethodHolder.CallData, GeneratedMethodHolder.ConstructorCallData, GeneratedMethodHolder.MethodCallDataNested classes/interfaces inherited from interface io.papermc.asm.rules.method.OwnableMethodRewriteRule
OwnableMethodRewriteRule.FilteredNested classes/interfaces inherited from interface io.papermc.asm.rules.RewriteRule
RewriteRule.Chain, RewriteRule.ChainBuilder, RewriteRule.Delegate, RewriteRule.GeneratorAdapterFactory -
Field Summary
Fields inherited from interface io.papermc.asm.rules.method.MethodRewriteRule
LAMBDA_METAFACTORY_OWNERFields inherited from interface io.papermc.asm.rules.RewriteRule
EMPTYFields inherited from interface io.papermc.asm.rules.method.StaticRewrite
CONSTRUCTOR_METHOD_NAME -
Constructor Summary
ConstructorsConstructorDescriptionMoveInstanceMethod(Set<ClassDesc> owners, MethodMatcher methodMatcher, ClassDesc newOwner, String newMethodName) Creates an instance of aMoveInstanceMethodrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.voidgenerateConstructor(RewriteRule.GeneratorAdapterFactory factory, GeneratedMethodHolder.MethodCallData modified, GeneratedMethodHolder.ConstructorCallData original) voidgenerateMethod(RewriteRule.GeneratorAdapterFactory factory, GeneratedMethodHolder.MethodCallData modified, GeneratedMethodHolder.MethodCallData original) Generates a method with the provided information.final inthashCode()Returns a hash code value for this object.Returns the value of themethodMatcherrecord component.Returns the value of thenewMethodNamerecord component.newOwner()Returns the value of thenewOwnerrecord component.owners()Returns the value of theownersrecord component.rewrite(ClassProcessingContext context, boolean isInvokeDynamic, int opcode, ClassDesc owner, String name, MethodTypeDesc descriptor, boolean isInterface) Creates aMethodRewritewhich will be applied to the processed bytecode.final StringtoString()Returns a string representation of this record class.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface io.papermc.asm.rules.generate.GeneratedMethodHolder
createAdapterMethods inherited from interface io.papermc.asm.rules.method.generated.GeneratedStaticRewrite
createConstructorRewrite, createRewrite, staticRedirectOwnerMethods inherited from interface io.papermc.asm.rules.method.MethodRewriteRule
createVisitorMethods inherited from interface io.papermc.asm.rules.method.OwnableMethodRewriteRule.Filtered
shouldProcessMethods inherited from interface io.papermc.asm.rules.OwnableRewriteRule
matchesOwnerMethods inherited from interface io.papermc.asm.rules.method.StaticRewrite
transformToRedirectDescriptor
-
Constructor Details
-
MoveInstanceMethod
public MoveInstanceMethod(Set<ClassDesc> owners, MethodMatcher methodMatcher, ClassDesc newOwner, String newMethodName) Creates an instance of aMoveInstanceMethodrecord class.- Parameters:
owners- the value for theownersrecord componentmethodMatcher- the value for themethodMatcherrecord componentnewOwner- the value for thenewOwnerrecord componentnewMethodName- the value for thenewMethodNamerecord component
-
-
Method Details
-
rewrite
public @Nullable MethodRewrite<?> rewrite(ClassProcessingContext context, boolean isInvokeDynamic, int opcode, ClassDesc owner, String name, MethodTypeDesc descriptor, boolean isInterface) Description copied from interface:MethodRewriteRuleCreates aMethodRewritewhich will be applied to the processed bytecode.- Specified by:
rewritein interfaceMethodRewriteRule- Specified by:
rewritein interfaceStaticRewrite- 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
-
generateMethod
public void generateMethod(RewriteRule.GeneratorAdapterFactory factory, GeneratedMethodHolder.MethodCallData modified, GeneratedMethodHolder.MethodCallData original) Description copied from interface:GeneratedMethodHolderGenerates a method with the provided information.- Specified by:
generateMethodin interfaceGeneratedMethodHolder- Parameters:
factory- the factory for method generationmodified- the method call information that replaced the matching method in bytecodeoriginal- the original method that was matched in the bytecode
-
generateConstructor
public void generateConstructor(RewriteRule.GeneratorAdapterFactory factory, GeneratedMethodHolder.MethodCallData modified, GeneratedMethodHolder.ConstructorCallData original) - Specified by:
generateConstructorin interfaceGeneratedMethodHolder
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
owners
Returns the value of theownersrecord component.- Specified by:
ownersin interfaceOwnableRewriteRule- Returns:
- the value of the
ownersrecord component
-
methodMatcher
Returns the value of themethodMatcherrecord component.- Specified by:
methodMatcherin interfaceOwnableMethodRewriteRule.Filtered- Returns:
- the value of the
methodMatcherrecord component
-
newOwner
Returns the value of thenewOwnerrecord component.- Returns:
- the value of the
newOwnerrecord component
-
newMethodName
Returns the value of thenewMethodNamerecord component.- Returns:
- the value of the
newMethodNamerecord component
-