Package io.papermc.asm.rules.method
Record Class MethodRewrites.SubTypeReturn
java.lang.Object
java.lang.Record
io.papermc.asm.rules.method.MethodRewrites.SubTypeReturn
- Record Components:
owners- owners of the methods to changemethodMatcher- method matcher to find methods witholdReturnType- the return type that will be found in bytecode that needs to be transformednewReturnType- the return type that is valid for existing method
- All Implemented Interfaces:
MethodRewriteRule,OwnableMethodRewriteRule,OwnableMethodRewriteRule.Filtered,OwnableRewriteRule,RewriteRule
- Enclosing class:
- MethodRewrites
public static record MethodRewrites.SubTypeReturn(Set<ClassDesc> owners, MethodMatcher methodMatcher, ClassDesc oldReturnType, ClassDesc newReturnType)
extends Record
implements OwnableMethodRewriteRule.Filtered
Changes a return type to a subtype of the old type. This isn't a compile break as subtypes inherit everything, but it is an ABI break.
We just change the return type in the descriptor and move on.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.papermc.asm.rules.method.MethodRewriteRule
MethodRewriteRule.GeneratorInfo<D extends GeneratedMethodHolder.CallData>, MethodRewriteRule.MethodGenerator, MethodRewriteRule.Rewrite<D extends GeneratedMethodHolder.CallData>, MethodRewriteRule.RewriteSingleNested 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
ConstructorsConstructorDescriptionSubTypeReturn(Set<ClassDesc> owners, MethodMatcher methodMatcher, ClassDesc oldReturnType, ClassDesc newReturnType) Creates an instance of aSubTypeReturnrecord 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 thenewReturnTyperecord component.Returns the value of theoldReturnTyperecord component.owners()Returns the value of theownersrecord component.rewrite(ClassProcessingContext context, boolean isInvokeDynamic, int opcode, ClassDesc owner, String name, MethodTypeDesc descriptor, boolean isInterface) 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
-
SubTypeReturn
public SubTypeReturn(Set<ClassDesc> owners, MethodMatcher methodMatcher, ClassDesc oldReturnType, ClassDesc newReturnType) Creates an instance of aSubTypeReturnrecord class.- Parameters:
owners- the value for theownersrecord componentmethodMatcher- the value for themethodMatcherrecord componentoldReturnType- the value for theoldReturnTyperecord componentnewReturnType- the value for thenewReturnTyperecord component
-
-
Method Details
-
rewrite
public @Nullable MethodRewriteRule.Rewrite<?> rewrite(ClassProcessingContext context, boolean isInvokeDynamic, int opcode, ClassDesc owner, String name, MethodTypeDesc descriptor, boolean isInterface) - Specified by:
rewritein interfaceMethodRewriteRule
-
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
-
oldReturnType
Returns the value of theoldReturnTyperecord component.- Returns:
- the value of the
oldReturnTyperecord component
-
newReturnType
Returns the value of thenewReturnTyperecord component.- Returns:
- the value of the
newReturnTyperecord component
-