Package net.bytebuddy.asm
Class TypeReferenceAdjustment.TypeReferenceClassVisitor
- java.lang.Object
-
- org.objectweb.asm.ClassVisitor
-
- net.bytebuddy.asm.TypeReferenceAdjustment.TypeReferenceClassVisitor
-
- Enclosing class:
- TypeReferenceAdjustment
protected static class TypeReferenceAdjustment.TypeReferenceClassVisitor extends org.objectweb.asm.ClassVisitor
A class visitor that collects all type references and all inner class references.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
TypeReferenceAdjustment.TypeReferenceClassVisitor.TypeReferenceAnnotationVisitor
An annotation visitor that collects all type references.protected class
TypeReferenceAdjustment.TypeReferenceClassVisitor.TypeReferenceFieldVisitor
A field visitor that collects all type references.protected class
TypeReferenceAdjustment.TypeReferenceClassVisitor.TypeReferenceMethodVisitor
A method visitor that collects all type references.
-
Field Summary
Fields Modifier and Type Field Description private ElementMatcher<? super TypeDescription>
filter
A filter for excluding types from type reference analysis.private static org.objectweb.asm.AnnotationVisitor
IGNORE_ANNOTATION
Indicates that an annotation is not of interest.private static org.objectweb.asm.FieldVisitor
IGNORE_FIELD
Indicates that a field is not of interest.private static org.objectweb.asm.MethodVisitor
IGNORE_METHOD
Indicates that a method is not of interest.private java.util.Set<java.lang.String>
observedTypes
A set of inner class names that have been observed within the processed class file.private boolean
strict
true
if the visitor should throw an exception if a type reference cannot be located.private TypePool
typePool
The type pool to use for locating types.private java.util.Set<java.lang.String>
visitedInnerTypes
A set of inner class names that were added as inner class attribute values.
-
Constructor Summary
Constructors Modifier Constructor Description protected
TypeReferenceClassVisitor(org.objectweb.asm.ClassVisitor classVisitor, boolean strict, ElementMatcher<? super TypeDescription> filter, TypePool typePool)
Creates a type reference class visitor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
resolve(java.lang.Object value)
Resolves all type references that are referenced by any ASM constant value.protected void
resolve(org.objectweb.asm.ConstantDynamic constant)
Resolves all type references that are referenced by aConstantDynamic
value.protected void
resolve(org.objectweb.asm.Handle handle)
Resolves all type references that are referenced by aHandle
value.protected void
resolve(org.objectweb.asm.Type type)
Resolves all type references that are referenced by aType
value.protected void
resolveInternalName(java.lang.String internalName)
Resolves an internal name to its element type.void
visit(int version, int modifiers, java.lang.String internalName, java.lang.String genericSignature, java.lang.String superClassInternalName, java.lang.String[] interfaceInternalName)
org.objectweb.asm.AnnotationVisitor
visitAnnotation(java.lang.String descriptor, boolean visible)
void
visitEnd()
org.objectweb.asm.FieldVisitor
visitField(int modifiers, java.lang.String name, java.lang.String descriptor, java.lang.String signature, java.lang.Object defaultValue)
void
visitInnerClass(java.lang.String internalName, java.lang.String outerName, java.lang.String innerName, int modifiers)
org.objectweb.asm.MethodVisitor
visitMethod(int modifiers, java.lang.String internalName, java.lang.String descriptor, java.lang.String signature, java.lang.String[] exceptionInternalName)
void
visitNestHost(java.lang.String nestHost)
void
visitNestMember(java.lang.String nestMember)
void
visitOuterClass(java.lang.String ownerTypeInternalName, java.lang.String methodName, java.lang.String methodDescriptor)
org.objectweb.asm.RecordComponentVisitor
visitRecordComponent(java.lang.String name, java.lang.String descriptor, java.lang.String signature)
org.objectweb.asm.AnnotationVisitor
visitTypeAnnotation(int typeReference, org.objectweb.asm.TypePath typePath, java.lang.String descriptor, boolean visible)
-
-
-
Field Detail
-
IGNORE_ANNOTATION
private static final org.objectweb.asm.AnnotationVisitor IGNORE_ANNOTATION
Indicates that an annotation is not of interest.
-
IGNORE_FIELD
private static final org.objectweb.asm.FieldVisitor IGNORE_FIELD
Indicates that a field is not of interest.
-
IGNORE_METHOD
private static final org.objectweb.asm.MethodVisitor IGNORE_METHOD
Indicates that a method is not of interest.
-
strict
private final boolean strict
true
if the visitor should throw an exception if a type reference cannot be located.
-
filter
private final ElementMatcher<? super TypeDescription> filter
A filter for excluding types from type reference analysis.
-
typePool
private final TypePool typePool
The type pool to use for locating types.
-
observedTypes
private final java.util.Set<java.lang.String> observedTypes
A set of inner class names that have been observed within the processed class file.
-
visitedInnerTypes
private final java.util.Set<java.lang.String> visitedInnerTypes
A set of inner class names that were added as inner class attribute values.
-
-
Constructor Detail
-
TypeReferenceClassVisitor
protected TypeReferenceClassVisitor(org.objectweb.asm.ClassVisitor classVisitor, boolean strict, ElementMatcher<? super TypeDescription> filter, TypePool typePool)
Creates a type reference class visitor.- Parameters:
classVisitor
-true
if the visitor should throw an exception if a type reference cannot be located.strict
-true
if the visitor should throw an exception if a type reference cannot be located.filter
- A filter for excluding types from type reference analysis.typePool
- The type pool to use for locating types.
-
-
Method Detail
-
visit
public void visit(int version, int modifiers, java.lang.String internalName, java.lang.String genericSignature, java.lang.String superClassInternalName, java.lang.String[] interfaceInternalName)
- Overrides:
visit
in classorg.objectweb.asm.ClassVisitor
-
visitNestHost
public void visitNestHost(java.lang.String nestHost)
- Overrides:
visitNestHost
in classorg.objectweb.asm.ClassVisitor
-
visitOuterClass
public void visitOuterClass(java.lang.String ownerTypeInternalName, java.lang.String methodName, java.lang.String methodDescriptor)
- Overrides:
visitOuterClass
in classorg.objectweb.asm.ClassVisitor
-
visitNestMember
public void visitNestMember(java.lang.String nestMember)
- Overrides:
visitNestMember
in classorg.objectweb.asm.ClassVisitor
-
visitInnerClass
public void visitInnerClass(java.lang.String internalName, java.lang.String outerName, java.lang.String innerName, int modifiers)
- Overrides:
visitInnerClass
in classorg.objectweb.asm.ClassVisitor
-
visitRecordComponent
public org.objectweb.asm.RecordComponentVisitor visitRecordComponent(java.lang.String name, java.lang.String descriptor, java.lang.String signature)
- Overrides:
visitRecordComponent
in classorg.objectweb.asm.ClassVisitor
-
visitAnnotation
public org.objectweb.asm.AnnotationVisitor visitAnnotation(java.lang.String descriptor, boolean visible)
- Overrides:
visitAnnotation
in classorg.objectweb.asm.ClassVisitor
-
visitTypeAnnotation
public org.objectweb.asm.AnnotationVisitor visitTypeAnnotation(int typeReference, org.objectweb.asm.TypePath typePath, java.lang.String descriptor, boolean visible)
- Overrides:
visitTypeAnnotation
in classorg.objectweb.asm.ClassVisitor
-
visitField
public org.objectweb.asm.FieldVisitor visitField(int modifiers, java.lang.String name, java.lang.String descriptor, java.lang.String signature, java.lang.Object defaultValue)
- Overrides:
visitField
in classorg.objectweb.asm.ClassVisitor
-
visitMethod
public org.objectweb.asm.MethodVisitor visitMethod(int modifiers, java.lang.String internalName, java.lang.String descriptor, java.lang.String signature, java.lang.String[] exceptionInternalName)
- Overrides:
visitMethod
in classorg.objectweb.asm.ClassVisitor
-
visitEnd
public void visitEnd()
- Overrides:
visitEnd
in classorg.objectweb.asm.ClassVisitor
-
resolve
protected void resolve(org.objectweb.asm.Type type)
Resolves all type references that are referenced by aType
value.- Parameters:
type
- The type to resolve.
-
resolve
protected void resolve(org.objectweb.asm.Handle handle)
Resolves all type references that are referenced by aHandle
value.- Parameters:
handle
- The handle to resolve.
-
resolve
protected void resolve(org.objectweb.asm.ConstantDynamic constant)
Resolves all type references that are referenced by aConstantDynamic
value.- Parameters:
constant
- The dynamic constant to resolve.
-
resolveInternalName
protected void resolveInternalName(java.lang.String internalName)
Resolves an internal name to its element type.- Parameters:
internalName
- The internal name to resolve.
-
resolve
protected void resolve(java.lang.Object value)
Resolves all type references that are referenced by any ASM constant value.- Parameters:
value
- The unknown constant value to resolve.
-
-