protected class TypeWriter.Default.ForInlining.WithFullProcessing.RedefinitionClassVisitor extends MetadataAwareClassVisitor
Modifier and Type | Class and Description |
---|---|
protected class |
TypeWriter.Default.ForInlining.WithFullProcessing.RedefinitionClassVisitor.AttributeObtainingFieldVisitor
A field visitor that obtains all attributes and annotations of a field that is found in the
class file but that discards all code.
|
protected class |
TypeWriter.Default.ForInlining.WithFullProcessing.RedefinitionClassVisitor.AttributeObtainingMethodVisitor
A method visitor that obtains all attributes and annotations of a method that is found in the
class file but that discards all code.
|
protected class |
TypeWriter.Default.ForInlining.WithFullProcessing.RedefinitionClassVisitor.AttributeObtainingRecordComponentVisitor
A record component visitor that obtains all attributes and annotations of a record component that is found
in the class file but discards all code.
|
protected class |
TypeWriter.Default.ForInlining.WithFullProcessing.RedefinitionClassVisitor.CodePreservingMethodVisitor
A method visitor that preserves the code of a method in the class file by copying it into a rebased
method while copying all attributes and annotations to the actual method.
|
api, cv
Modifier | Constructor and Description |
---|---|
protected |
RedefinitionClassVisitor(ClassVisitor classVisitor,
TypeInitializer typeInitializer,
TypeWriter.Default.ForInlining.ContextRegistry contextRegistry,
int writerFlags,
int readerFlags)
Creates a class visitor which is capable of redefining an existent class on the fly.
|
Modifier and Type | Method and Description |
---|---|
protected void |
onAfterAttributes()
Invoked if the attribute visitation is about to complete.
|
protected void |
onNestHost()
Invoked if the nest host was not visited.
|
protected void |
onOuterType()
Invoked if the outer class was not visited.
|
protected AnnotationVisitor |
onVisitAnnotation(String descriptor,
boolean visible)
An order-sensitive invocation of
ClassVisitor.visitAnnotation(String, boolean) . |
protected void |
onVisitEnd()
An order-sensitive invocation of
ClassVisitor.visitEnd() . |
protected FieldVisitor |
onVisitField(int modifiers,
String internalName,
String descriptor,
String genericSignature,
Object value)
An order-sensitive invocation of
ClassVisitor.visitField(int, String, String, String, Object) . |
protected void |
onVisitInnerClass(String internalName,
String outerName,
String innerName,
int modifiers)
An order-sensitive invocation of
ClassVisitor.visitInnerClass(String, String, String, int) . |
protected MethodVisitor |
onVisitMethod(int modifiers,
String internalName,
String descriptor,
String genericSignature,
String[] exceptionName)
An order-sensitive invocation of
ClassVisitor.visitMethod(int, String, String, String, String[]) . |
protected void |
onVisitNestHost(String nestHost)
An order-sensitive invocation of
ClassVisitor.visitNestHost(String) . |
protected void |
onVisitNestMember(String nestMember)
An order-sensitive invocation of
ClassVisitor.visitNestMember(String) . |
protected void |
onVisitOuterClass(String owner,
String name,
String descriptor)
An order-sensitive invocation of
ClassVisitor.visitOuterClass(String, String, String) . |
protected void |
onVisitPermittedSubclass(String permittedSubclass)
An order-sensitive invocation of
ClassVisitor#visitPermittedSubclass . |
protected RecordComponentVisitor |
onVisitRecordComponent(String name,
String descriptor,
String genericSignature)
An order-sensitive invocation of
ClassVisitor.visitRecordComponent(String, String, String) . |
protected AnnotationVisitor |
onVisitTypeAnnotation(int typeReference,
TypePath typePath,
String descriptor,
boolean visible)
An order-sensitive invocation of
ClassVisitor.visitTypeAnnotation(int, TypePath, String, boolean) . |
protected MethodVisitor |
redefine(MethodDescription methodDescription,
boolean abstractOrigin,
int modifiers,
String genericSignature)
Redefines a given method if this is required by looking up a potential implementation from the
TypeWriter.MethodPool . |
protected FieldVisitor |
redefine(TypeWriter.FieldPool.Record record,
Object value,
int modifiers,
String genericSignature)
Redefines a field using the given explicit field pool record and default value.
|
protected RecordComponentVisitor |
redefine(TypeWriter.RecordComponentPool.Record record,
String genericSignature)
Redefines a record component using the given explicit record component pool record.
|
void |
visit(int classFileVersionNumber,
int modifiers,
String internalName,
String genericSignature,
String superClassInternalName,
String[] interfaceTypeInternalName) |
onVisitAttribute, visitAnnotation, visitAttribute, visitEnd, visitField, visitInnerClass, visitMethod, visitNestHost, visitNestMember, visitOuterClass, visitPermittedSubclass, visitRecordComponent, visitTypeAnnotation
getDelegate, visitModule, visitSource
protected RedefinitionClassVisitor(ClassVisitor classVisitor, TypeInitializer typeInitializer, TypeWriter.Default.ForInlining.ContextRegistry contextRegistry, int writerFlags, int readerFlags)
classVisitor
- The underlying class visitor to which writes are delegated.typeInitializer
- The type initializer to apply.contextRegistry
- A context registry to register the lazily created implementation context to.writerFlags
- The writer flags being used.readerFlags
- The reader flags being used.public void visit(int classFileVersionNumber, int modifiers, String internalName, String genericSignature, String superClassInternalName, String[] interfaceTypeInternalName)
visit
in class ClassVisitor
protected void onVisitNestHost(String nestHost)
MetadataAwareClassVisitor
ClassVisitor.visitNestHost(String)
.onVisitNestHost
in class MetadataAwareClassVisitor
nestHost
- The internal name of the nest host.protected void onNestHost()
MetadataAwareClassVisitor
onNestHost
in class MetadataAwareClassVisitor
protected void onVisitPermittedSubclass(String permittedSubclass)
MetadataAwareClassVisitor
ClassVisitor#visitPermittedSubclass
.onVisitPermittedSubclass
in class MetadataAwareClassVisitor
permittedSubclass
- The internal name of the permitted subclass.protected void onVisitOuterClass(String owner, @MaybeNull String name, @MaybeNull String descriptor)
MetadataAwareClassVisitor
ClassVisitor.visitOuterClass(String, String, String)
.onVisitOuterClass
in class MetadataAwareClassVisitor
owner
- The outer class's internal name.name
- The outer method's name or null
if it does not exist.descriptor
- The outer method's descriptor or null
if it does not exist.protected void onOuterType()
MetadataAwareClassVisitor
onOuterType
in class MetadataAwareClassVisitor
protected void onAfterAttributes()
MetadataAwareClassVisitor
onAfterAttributes
in class MetadataAwareClassVisitor
@MaybeNull protected AnnotationVisitor onVisitTypeAnnotation(int typeReference, TypePath typePath, String descriptor, boolean visible)
MetadataAwareClassVisitor
ClassVisitor.visitTypeAnnotation(int, TypePath, String, boolean)
.onVisitTypeAnnotation
in class MetadataAwareClassVisitor
typeReference
- The type reference of the type annotation.typePath
- The type path of the type annotation.descriptor
- The descriptor of the annotation type.visible
- true
if the annotation is visible at runtime.null
if the annotation should be ignored.@MaybeNull protected AnnotationVisitor onVisitAnnotation(String descriptor, boolean visible)
MetadataAwareClassVisitor
ClassVisitor.visitAnnotation(String, boolean)
.onVisitAnnotation
in class MetadataAwareClassVisitor
descriptor
- The annotation type's descriptor.visible
- true
if the annotation is visible at runtime.null
if the annotation should be ignored.@MaybeNull protected RecordComponentVisitor onVisitRecordComponent(String name, String descriptor, @MaybeNull String genericSignature)
MetadataAwareClassVisitor
ClassVisitor.visitRecordComponent(String, String, String)
.onVisitRecordComponent
in class MetadataAwareClassVisitor
name
- The record component's name.descriptor
- The record component's descriptor.genericSignature
- The record component's generic signature or null
if the record component's type is non-generic.null
if the component should not be visited.@MaybeNull protected RecordComponentVisitor redefine(TypeWriter.RecordComponentPool.Record record, @MaybeNull String genericSignature)
record
- The record component pool record to apply during visitation of the existing record.genericSignature
- The record component's original generic signature which can be null
.@MaybeNull protected FieldVisitor onVisitField(int modifiers, String internalName, String descriptor, @MaybeNull String genericSignature, @MaybeNull Object value)
MetadataAwareClassVisitor
ClassVisitor.visitField(int, String, String, String, Object)
.onVisitField
in class MetadataAwareClassVisitor
modifiers
- The field's modifiers.internalName
- The field's internal name.descriptor
- The field type's descriptor.genericSignature
- The field's generic signature or null
if the field is not generic.value
- The field's default value or null
if no such value exists.null
to ignore it.@MaybeNull protected FieldVisitor redefine(TypeWriter.FieldPool.Record record, @MaybeNull Object value, int modifiers, @MaybeNull String genericSignature)
record
- The field pool value to apply during visitation of the existing field.value
- The default value to write onto the field which might be null
.modifiers
- The original modifiers of the transformed field.genericSignature
- The field's original generic signature which can be null
.@MaybeNull protected MethodVisitor onVisitMethod(int modifiers, String internalName, String descriptor, @MaybeNull String genericSignature, @MaybeNull String[] exceptionName)
MetadataAwareClassVisitor
ClassVisitor.visitMethod(int, String, String, String, String[])
.onVisitMethod
in class MetadataAwareClassVisitor
modifiers
- The method's modifiers.internalName
- The method's internal name.descriptor
- The field type's descriptor.genericSignature
- The method's generic signature or null
if the method is not generic.exceptionName
- The method's declared exceptions or null
if no exceptions are declared.null
to ignore it.@MaybeNull protected MethodVisitor redefine(MethodDescription methodDescription, boolean abstractOrigin, int modifiers, @MaybeNull String genericSignature)
TypeWriter.MethodPool
.methodDescription
- The method being considered for redefinition.abstractOrigin
- true
if the original method is abstract, i.e. there is no implementation to preserve.modifiers
- The original modifiers of the transformed method.genericSignature
- The method's original generic signature which can be null
.protected void onVisitInnerClass(String internalName, @MaybeNull String outerName, @MaybeNull String innerName, int modifiers)
MetadataAwareClassVisitor
ClassVisitor.visitInnerClass(String, String, String, int)
.onVisitInnerClass
in class MetadataAwareClassVisitor
internalName
- The internal name of the inner class.outerName
- The internal name of the outer class or null
for a member class.innerName
- The inner class's simple name or null
for an anonymous class.modifiers
- The inner class's source code modifiers.protected void onVisitNestMember(String nestMember)
MetadataAwareClassVisitor
ClassVisitor.visitNestMember(String)
.onVisitNestMember
in class MetadataAwareClassVisitor
nestMember
- The internal name of the nest member.protected void onVisitEnd()
MetadataAwareClassVisitor
ClassVisitor.visitEnd()
.onVisitEnd
in class MetadataAwareClassVisitor
Copyright © 2014–2023. All rights reserved.