Class RebaseImplementationTarget
- java.lang.Object
-
- net.bytebuddy.implementation.Implementation.Target.AbstractBase
-
- net.bytebuddy.dynamic.scaffold.inline.RebaseImplementationTarget
-
- All Implemented Interfaces:
Implementation.Target
@Enhance public class RebaseImplementationTarget extends Implementation.Target.AbstractBase
An implementation target for redefining a given type while preserving the original methods within the instrumented type.Implementation.Target
in order to preserve Java's super call semantics a user would expect when invoking asuper
-prefixed method. This means that original methods are either moved to renamedprivate
methods which are never dispatched virtually or they are invoked directly via theINVOKESPECIAL
invocation to explicitly forbid a virtual dispatch.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RebaseImplementationTarget.Factory
A factory for creating aRebaseImplementationTarget
.protected static class
RebaseImplementationTarget.RebasedMethodInvocation
AImplementation.SpecialMethodInvocation
which invokes a rebased method as given by aMethodRebaseResolver
.-
Nested classes/interfaces inherited from class net.bytebuddy.implementation.Implementation.Target.AbstractBase
Implementation.Target.AbstractBase.DefaultMethodInvocation
-
Nested classes/interfaces inherited from interface net.bytebuddy.implementation.Implementation.Target
Implementation.Target.AbstractBase
-
-
Field Summary
-
Fields inherited from class net.bytebuddy.implementation.Implementation.Target.AbstractBase
defaultMethodInvocation, instrumentedType, methodGraph
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
RebaseImplementationTarget(TypeDescription instrumentedType, MethodGraph.Linked methodGraph, Implementation.Target.AbstractBase.DefaultMethodInvocation defaultMethodInvocation, Map<MethodDescription.SignatureToken,MethodRebaseResolver.Resolution> rebaseableMethods)
Creates a rebase implementation target.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description TypeDescription
getOriginType()
Identifies the origin type of an implementation.Implementation.SpecialMethodInvocation
invokeSuper(MethodDescription.SignatureToken token)
Creates a special method invocation for invoking the super method of the given method.protected static Implementation.Target
of(TypeDescription instrumentedType, MethodGraph.Linked methodGraph, ClassFileVersion classFileVersion, MethodRebaseResolver methodRebaseResolver)
Creates a new rebase implementation target.-
Methods inherited from class net.bytebuddy.implementation.Implementation.Target.AbstractBase
getInstrumentedType, invokeDefault, invokeDefault, invokeDominant
-
-
-
-
Constructor Detail
-
RebaseImplementationTarget
protected RebaseImplementationTarget(TypeDescription instrumentedType, MethodGraph.Linked methodGraph, Implementation.Target.AbstractBase.DefaultMethodInvocation defaultMethodInvocation, Map<MethodDescription.SignatureToken,MethodRebaseResolver.Resolution> rebaseableMethods)
Creates a rebase implementation target.- Parameters:
instrumentedType
- The instrumented type.methodGraph
- A method graph of the instrumented type.defaultMethodInvocation
- The default method invocation mode to apply.rebaseableMethods
- A mapping of the instrumented type's declared methods by each method's token.
-
-
Method Detail
-
of
protected static Implementation.Target of(TypeDescription instrumentedType, MethodGraph.Linked methodGraph, ClassFileVersion classFileVersion, MethodRebaseResolver methodRebaseResolver)
Creates a new rebase implementation target.- Parameters:
instrumentedType
- The instrumented type.methodGraph
- A method graph of the instrumented type.classFileVersion
- The type's class file version.methodRebaseResolver
- A method rebase resolver to be used when calling a rebased method.- Returns:
- An implementation target for the given input.
-
invokeSuper
public Implementation.SpecialMethodInvocation invokeSuper(MethodDescription.SignatureToken token)
Creates a special method invocation for invoking the super method of the given method.- Parameters:
token
- A token of the method that is to be invoked as a super method.- Returns:
- The corresponding special method invocation which might be illegal if the requested invocation is not legal.
-
getOriginType
public TypeDescription getOriginType()
Identifies the origin type of an implementation. The origin type describes the type that is subject to any form of enhancement. If a subclass of a given type is generated, the base type of this subclass describes the origin type. If a given type is redefined or rebased, the origin type is described by the instrumented type itself.- Returns:
- The origin type of this implementation.
-
-