Package org.objectweb.asm.commons
Class ClassRemapper
java.lang.Object
org.objectweb.asm.ClassVisitor
org.objectweb.asm.commons.ClassRemapper
public class ClassRemapper
extends org.objectweb.asm.ClassVisitor
A
ClassVisitor that remaps types with a Remapper.
This visitor has several limitations. A non-exhaustive list is the following:
- it cannot remap type names in dynamically computed strings (remapping of type names in static values is supported).
- it cannot remap values derived from type names at compile time, such as
- type name hashcodes used by some Java compilers to implement the string switch statement.
- some compound strings used by some Java compilers to implement lambda deserialization.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StringThe internal name of the visited class.protected final RemapperThe remapper used to remap the types in the visited class.Fields inherited from class org.objectweb.asm.ClassVisitor
api, cv -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedClassRemapper(int api, org.objectweb.asm.ClassVisitor classVisitor, Remapper remapper) Constructs a newClassRemapper.ClassRemapper(org.objectweb.asm.ClassVisitor classVisitor, Remapper remapper) Constructs a newClassRemapper. -
Method Summary
Modifier and TypeMethodDescriptionprotected org.objectweb.asm.AnnotationVisitorcreateAnnotationRemapper(String descriptor, org.objectweb.asm.AnnotationVisitor annotationVisitor) Constructs a new remapper for annotations.protected org.objectweb.asm.AnnotationVisitorcreateAnnotationRemapper(org.objectweb.asm.AnnotationVisitor annotationVisitor) Deprecated.protected org.objectweb.asm.FieldVisitorcreateFieldRemapper(org.objectweb.asm.FieldVisitor fieldVisitor) Constructs a new remapper for fields.protected org.objectweb.asm.MethodVisitorcreateMethodRemapper(org.objectweb.asm.MethodVisitor methodVisitor) Constructs a new remapper for methods.protected org.objectweb.asm.ModuleVisitorcreateModuleRemapper(org.objectweb.asm.ModuleVisitor moduleVisitor) Constructs a new remapper for modules.protected org.objectweb.asm.RecordComponentVisitorcreateRecordComponentRemapper(org.objectweb.asm.RecordComponentVisitor recordComponentVisitor) Constructs a new remapper for record components.voidvisit(int version, int access, String name, String signature, String superName, String[] interfaces) org.objectweb.asm.AnnotationVisitorvisitAnnotation(String descriptor, boolean visible) voidvisitAttribute(org.objectweb.asm.Attribute attribute) org.objectweb.asm.FieldVisitorvisitField(int access, String name, String descriptor, String signature, Object value) voidvisitInnerClass(String name, String outerName, String innerName, int access) org.objectweb.asm.MethodVisitorvisitMethod(int access, String name, String descriptor, String signature, String[] exceptions) org.objectweb.asm.ModuleVisitorvisitModule(String name, int flags, String version) voidvisitNestHost(String nestHost) voidvisitNestMember(String nestMember) voidvisitOuterClass(String owner, String name, String descriptor) voidvisitPermittedSubclass(String permittedSubclass) org.objectweb.asm.RecordComponentVisitorvisitRecordComponent(String name, String descriptor, String signature) org.objectweb.asm.AnnotationVisitorvisitTypeAnnotation(int typeRef, org.objectweb.asm.TypePath typePath, String descriptor, boolean visible) Methods inherited from class org.objectweb.asm.ClassVisitor
getDelegate, visitEnd, visitSource
-
Field Details
-
remapper
The remapper used to remap the types in the visited class. -
className
The internal name of the visited class.
-
-
Constructor Details
-
ClassRemapper
Constructs a newClassRemapper. Subclasses must not use this constructor. Instead, they must use theClassRemapper(int,ClassVisitor,Remapper)version.- Parameters:
classVisitor- the class visitor this remapper must delegate to.remapper- the remapper to use to remap the types in the visited class.
-
ClassRemapper
Constructs a newClassRemapper.- Parameters:
api- the ASM API version supported by this remapper. Must be one of theASMx values inOpcodes.classVisitor- the class visitor this remapper must delegate to.remapper- the remapper to use to remap the types in the visited class.
-
-
Method Details
-
visit
public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) - Overrides:
visitin classorg.objectweb.asm.ClassVisitor
-
visitModule
- Overrides:
visitModulein classorg.objectweb.asm.ClassVisitor
-
visitAnnotation
- Overrides:
visitAnnotationin classorg.objectweb.asm.ClassVisitor
-
visitTypeAnnotation
public org.objectweb.asm.AnnotationVisitor visitTypeAnnotation(int typeRef, org.objectweb.asm.TypePath typePath, String descriptor, boolean visible) - Overrides:
visitTypeAnnotationin classorg.objectweb.asm.ClassVisitor
-
visitAttribute
public void visitAttribute(org.objectweb.asm.Attribute attribute) - Overrides:
visitAttributein classorg.objectweb.asm.ClassVisitor
-
visitRecordComponent
public org.objectweb.asm.RecordComponentVisitor visitRecordComponent(String name, String descriptor, String signature) - Overrides:
visitRecordComponentin classorg.objectweb.asm.ClassVisitor
-
visitField
public org.objectweb.asm.FieldVisitor visitField(int access, String name, String descriptor, String signature, Object value) - Overrides:
visitFieldin classorg.objectweb.asm.ClassVisitor
-
visitMethod
public org.objectweb.asm.MethodVisitor visitMethod(int access, String name, String descriptor, String signature, String[] exceptions) - Overrides:
visitMethodin classorg.objectweb.asm.ClassVisitor
-
visitInnerClass
- Overrides:
visitInnerClassin classorg.objectweb.asm.ClassVisitor
-
visitOuterClass
- Overrides:
visitOuterClassin classorg.objectweb.asm.ClassVisitor
-
visitNestHost
- Overrides:
visitNestHostin classorg.objectweb.asm.ClassVisitor
-
visitNestMember
- Overrides:
visitNestMemberin classorg.objectweb.asm.ClassVisitor
-
visitPermittedSubclass
- Overrides:
visitPermittedSubclassin classorg.objectweb.asm.ClassVisitor
-
createFieldRemapper
protected org.objectweb.asm.FieldVisitor createFieldRemapper(org.objectweb.asm.FieldVisitor fieldVisitor) Constructs a new remapper for fields. The default implementation of this method returns a newFieldRemapper.- Parameters:
fieldVisitor- the FieldVisitor the remapper must delegate to.- Returns:
- the newly created remapper.
-
createMethodRemapper
protected org.objectweb.asm.MethodVisitor createMethodRemapper(org.objectweb.asm.MethodVisitor methodVisitor) Constructs a new remapper for methods. The default implementation of this method returns a newMethodRemapper.- Parameters:
methodVisitor- the MethodVisitor the remapper must delegate to.- Returns:
- the newly created remapper.
-
createAnnotationRemapper
@Deprecated protected org.objectweb.asm.AnnotationVisitor createAnnotationRemapper(org.objectweb.asm.AnnotationVisitor annotationVisitor) Deprecated.usecreateAnnotationRemapper(String, AnnotationVisitor)instead.Constructs a new remapper for annotations. The default implementation of this method returns a newAnnotationRemapper.- Parameters:
annotationVisitor- the AnnotationVisitor the remapper must delegate to.- Returns:
- the newly created remapper.
-
createAnnotationRemapper
protected org.objectweb.asm.AnnotationVisitor createAnnotationRemapper(String descriptor, org.objectweb.asm.AnnotationVisitor annotationVisitor) Constructs a new remapper for annotations. The default implementation of this method returns a newAnnotationRemapper.- Parameters:
descriptor- the descriptor of the visited annotation.annotationVisitor- the AnnotationVisitor the remapper must delegate to.- Returns:
- the newly created remapper.
-
createModuleRemapper
protected org.objectweb.asm.ModuleVisitor createModuleRemapper(org.objectweb.asm.ModuleVisitor moduleVisitor) Constructs a new remapper for modules. The default implementation of this method returns a newModuleRemapper.- Parameters:
moduleVisitor- the ModuleVisitor the remapper must delegate to.- Returns:
- the newly created remapper.
-
createRecordComponentRemapper
protected org.objectweb.asm.RecordComponentVisitor createRecordComponentRemapper(org.objectweb.asm.RecordComponentVisitor recordComponentVisitor) Constructs a new remapper for record components. The default implementation of this method returns a newRecordComponentRemapper.- Parameters:
recordComponentVisitor- the RecordComponentVisitor the remapper must delegate to.- Returns:
- the newly created remapper.
-
createAnnotationRemapper(String, AnnotationVisitor)instead.