Interface MethodRewrite<D extends GeneratedMethodHolder.CallData>
- Type Parameters:
D- the type of call data
- All Known Implementing Classes:
ConstructorRewrite,SimpleRewrite
public interface MethodRewrite<D extends GeneratedMethodHolder.CallData>
Represents a change/rewrite to bytecode.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final recordstatic interface -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidapply(MethodVisitor delegate, MethodNode context) Called to apply the rewrite when a matching invoke non-dynamic instruction is found.voidapplyToBootstrapArguments(Object[] arguments) Called to apply the rewrite to a matching invokedynamic instruction is found.Creates aMethodRewrite.MethodGeneratorfor this rewrite.withGeneratorInfo(GeneratedMethodHolder holder, D original) Creates a newMethodRewritewith the given generator info.default MethodRewrite<D> withHandleExtras(Consumer<Object[]> extras) Creates a newMethodRewritewith the given "extras" handler.
-
Field Details
-
BOOTSTRAP_HANDLE_IDX
static final int BOOTSTRAP_HANDLE_IDX- See Also:
-
DYNAMIC_TYPE_IDX
static final int DYNAMIC_TYPE_IDX- See Also:
-
GENERATED_PREFIX
- See Also:
-
-
Method Details
-
apply
Called to apply the rewrite when a matching invoke non-dynamic instruction is found.- Parameters:
delegate- the visitor to apply the change tocontext- the surrounding context of the method's data including instructions
-
applyToBootstrapArguments
Called to apply the rewrite to a matching invokedynamic instruction is found.- Parameters:
arguments- the bootstrap argumentsMethodVisitor.visitInvokeDynamicInsn(String, String, Handle, Object...)
-
withGeneratorInfo
Creates a newMethodRewritewith the given generator info.- Parameters:
holder- the generator holderoriginal- the original call data- Returns:
- the new rewrite
-
withHandleExtras
Creates a newMethodRewritewith the given "extras" handler. This is when extra changes are required for invokedynamic instructions.- Parameters:
extras- the extras handler- Returns:
- the new rewrite (or the same if not supported on the rewrite type)
-
createMethodGenerator
@Nullable MethodRewrite.MethodGenerator createMethodGenerator()Creates aMethodRewrite.MethodGeneratorfor this rewrite.- Returns:
- a method generator, or null if this rewrite doesn't have one
- See Also:
-