Record Class SuperTypeParamRewrite
java.lang.Object
java.lang.Record
io.papermc.asm.rules.method.params.SuperTypeParamRewrite
- Record Components:
owners- owners of the methods to changemethodMatcher- method matcher to find methods with (target is the type to be found in bytecode that needs to be transformed)newParamType- the parameter type that is valid for existing method
- All Implemented Interfaces:
MethodRewriteRule,OwnableMethodRewriteRule,OwnableMethodRewriteRule.Filtered,OwnableRewriteRule,RewriteRule
public record SuperTypeParamRewrite(Set<ClassDesc> owners, TargetedMethodMatcher methodMatcher, ClassDesc newParamType)
extends Record
implements OwnableMethodRewriteRule.Filtered
Changes a parameter type to a super type. This isn't a compile break, but it is an ABI break. We just change the
offending parameter in the descriptor and move on.
-
Nested Class Summary
Nested ClassesNested 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
EMPTY -
Constructor Summary
ConstructorsConstructorDescriptionSuperTypeParamRewrite(Set<ClassDesc> owners, TargetedMethodMatcher methodMatcher, ClassDesc newParamType) Creates an instance of aSuperTypeParamRewriterecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of themethodMatcherrecord component.Returns the value of thenewParamTyperecord 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.method.MethodRewriteRule
createVisitorMethods inherited from interface io.papermc.asm.rules.method.OwnableMethodRewriteRule.Filtered
shouldProcessMethods inherited from interface io.papermc.asm.rules.OwnableRewriteRule
matchesOwner
-
Constructor Details
-
SuperTypeParamRewrite
public SuperTypeParamRewrite(Set<ClassDesc> owners, TargetedMethodMatcher methodMatcher, ClassDesc newParamType) Creates an instance of aSuperTypeParamRewriterecord class.- Parameters:
owners- the value for theownersrecord componentmethodMatcher- the value for themethodMatcherrecord componentnewParamType- the value for thenewParamTyperecord component
-
-
Method Details
-
oldParamType
-
rewrite
public 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- 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
-
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
-
newParamType
Returns the value of thenewParamTyperecord component.- Returns:
- the value of the
newParamTyperecord component
-