Package org.objectweb.asm.commons
Class Remapper
- java.lang.Object
-
- org.objectweb.asm.commons.Remapper
-
- Direct Known Subclasses:
SimpleRemapper
public abstract class Remapper extends java.lang.Object
A class responsible for remapping types and names.
-
-
Constructor Summary
Constructors Constructor Description Remapper()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected org.objectweb.asm.signature.SignatureVisitor
createRemappingSignatureAdapter(org.objectweb.asm.signature.SignatureVisitor signatureVisitor)
Deprecated.protected org.objectweb.asm.signature.SignatureVisitor
createSignatureRemapper(org.objectweb.asm.signature.SignatureVisitor signatureVisitor)
Constructs a new remapper for signatures.java.lang.String
map(java.lang.String internalName)
Maps the internal name of a class to its new name.java.lang.String
mapAnnotationAttributeName(java.lang.String descriptor, java.lang.String name)
Maps an annotation attribute name.java.lang.String
mapDesc(java.lang.String descriptor)
Returns the given descriptor, remapped withmap(String)
.java.lang.String
mapFieldName(java.lang.String owner, java.lang.String name, java.lang.String descriptor)
Maps a field name to its new name.java.lang.String
mapInnerClassName(java.lang.String name, java.lang.String ownerName, java.lang.String innerName)
Maps an inner class name to its new name.java.lang.String
mapInvokeDynamicMethodName(java.lang.String name, java.lang.String descriptor)
Maps an invokedynamic or a constant dynamic method name to its new name.java.lang.String
mapMethodDesc(java.lang.String methodDescriptor)
Returns the given method descriptor, with its argument and return type descriptors remapped withmapDesc(String)
.java.lang.String
mapMethodName(java.lang.String owner, java.lang.String name, java.lang.String descriptor)
Maps a method name to its new name.java.lang.String
mapModuleName(java.lang.String name)
Maps a module name to its new name.java.lang.String
mapPackageName(java.lang.String name)
Maps a package name to its new name.java.lang.String
mapRecordComponentName(java.lang.String owner, java.lang.String name, java.lang.String descriptor)
Maps a record component name to its new name.java.lang.String
mapSignature(java.lang.String signature, boolean typeSignature)
Returns the given signature, remapped with theSignatureVisitor
returned bycreateSignatureRemapper(SignatureVisitor)
.java.lang.String
mapType(java.lang.String internalName)
Returns the given internal name, remapped withmap(String)
.java.lang.String[]
mapTypes(java.lang.String[] internalNames)
Returns the given internal names, remapped withmap(String)
.java.lang.Object
mapValue(java.lang.Object value)
Returns the given value, remapped with this remapper.
-
-
-
Method Detail
-
mapDesc
public java.lang.String mapDesc(java.lang.String descriptor)
Returns the given descriptor, remapped withmap(String)
.- Parameters:
descriptor
- a type descriptor.- Returns:
- the given descriptor, with its [array element type] internal name remapped with
map(String)
(if the descriptor corresponds to an array or object type, otherwise the descriptor is returned as is).
-
mapType
public java.lang.String mapType(java.lang.String internalName)
Returns the given internal name, remapped withmap(String)
.- Parameters:
internalName
- the internal name (or array type descriptor) of some (array) class.- Returns:
- the given internal name, remapped with
map(String)
.
-
mapTypes
public java.lang.String[] mapTypes(java.lang.String[] internalNames)
Returns the given internal names, remapped withmap(String)
.- Parameters:
internalNames
- the internal names (or array type descriptors) of some (array) classes.- Returns:
- the given internal name, remapped with
map(String)
.
-
mapMethodDesc
public java.lang.String mapMethodDesc(java.lang.String methodDescriptor)
Returns the given method descriptor, with its argument and return type descriptors remapped withmapDesc(String)
.- Parameters:
methodDescriptor
- a method descriptor.- Returns:
- the given method descriptor, with its argument and return type descriptors remapped
with
mapDesc(String)
.
-
mapValue
public java.lang.Object mapValue(java.lang.Object value)
Returns the given value, remapped with this remapper. Possible values areBoolean
,Byte
,Short
,Character
,Integer
,Long
,Double
,Float
,String
,Type
,Handle
,ConstantDynamic
or arrays of primitive types .- Parameters:
value
- an object. OnlyType
,Handle
andConstantDynamic
values are remapped.- Returns:
- the given value, remapped with this remapper.
-
mapSignature
public java.lang.String mapSignature(java.lang.String signature, boolean typeSignature)
Returns the given signature, remapped with theSignatureVisitor
returned bycreateSignatureRemapper(SignatureVisitor)
.- Parameters:
signature
- a JavaTypeSignature, ClassSignature or MethodSignature.typeSignature
- whether the given signature is a JavaTypeSignature.- Returns:
- signature the given signature, remapped with the
SignatureVisitor
returned bycreateSignatureRemapper(SignatureVisitor)
.
-
createRemappingSignatureAdapter
@Deprecated protected org.objectweb.asm.signature.SignatureVisitor createRemappingSignatureAdapter(org.objectweb.asm.signature.SignatureVisitor signatureVisitor)
Deprecated.Constructs a new remapper for signatures. The default implementation of this method returns a newSignatureRemapper
.- Parameters:
signatureVisitor
- the SignatureVisitor the remapper must delegate to.- Returns:
- the newly created remapper.
-
createSignatureRemapper
protected org.objectweb.asm.signature.SignatureVisitor createSignatureRemapper(org.objectweb.asm.signature.SignatureVisitor signatureVisitor)
Constructs a new remapper for signatures. The default implementation of this method returns a newSignatureRemapper
.- Parameters:
signatureVisitor
- the SignatureVisitor the remapper must delegate to.- Returns:
- the newly created remapper.
-
mapAnnotationAttributeName
public java.lang.String mapAnnotationAttributeName(java.lang.String descriptor, java.lang.String name)
Maps an annotation attribute name. The default implementation of this method returns the given name, unchanged. Subclasses can override.- Parameters:
descriptor
- the descriptor of the annotation class.name
- the name of the annotation attribute.- Returns:
- the new name of the annotation attribute.
-
mapInnerClassName
public java.lang.String mapInnerClassName(java.lang.String name, java.lang.String ownerName, java.lang.String innerName)
Maps an inner class name to its new name. The default implementation of this method provides a strategy that will work for inner classes produced by Java, but not necessarily other languages. Subclasses can override.- Parameters:
name
- the fully-qualified internal name of the inner class.ownerName
- the internal name of the owner class of the inner class.innerName
- the internal name of the inner class.- Returns:
- the new inner name of the inner class.
-
mapMethodName
public java.lang.String mapMethodName(java.lang.String owner, java.lang.String name, java.lang.String descriptor)
Maps a method name to its new name. The default implementation of this method returns the given name, unchanged. Subclasses can override.- Parameters:
owner
- the internal name of the owner class of the method.name
- the name of the method.descriptor
- the descriptor of the method.- Returns:
- the new name of the method.
-
mapInvokeDynamicMethodName
public java.lang.String mapInvokeDynamicMethodName(java.lang.String name, java.lang.String descriptor)
Maps an invokedynamic or a constant dynamic method name to its new name. The default implementation of this method returns the given name, unchanged. Subclasses can override.- Parameters:
name
- the name of the method.descriptor
- the descriptor of the method.- Returns:
- the new name of the method.
-
mapRecordComponentName
public java.lang.String mapRecordComponentName(java.lang.String owner, java.lang.String name, java.lang.String descriptor)
Maps a record component name to its new name. The default implementation of this method returns the given name, unchanged. Subclasses can override.- Parameters:
owner
- the internal name of the owner class of the field.name
- the name of the field.descriptor
- the descriptor of the field.- Returns:
- the new name of the field.
-
mapFieldName
public java.lang.String mapFieldName(java.lang.String owner, java.lang.String name, java.lang.String descriptor)
Maps a field name to its new name. The default implementation of this method returns the given name, unchanged. Subclasses can override.- Parameters:
owner
- the internal name of the owner class of the field.name
- the name of the field.descriptor
- the descriptor of the field.- Returns:
- the new name of the field.
-
mapPackageName
public java.lang.String mapPackageName(java.lang.String name)
Maps a package name to its new name. The default implementation of this method returns the given name, unchanged. Subclasses can override.- Parameters:
name
- the fully qualified name of the package (using dots).- Returns:
- the new name of the package.
-
mapModuleName
public java.lang.String mapModuleName(java.lang.String name)
Maps a module name to its new name. The default implementation of this method returns the given name, unchanged. Subclasses can override.- Parameters:
name
- the fully qualified name (using dots) of a module.- Returns:
- the new name of the module.
-
map
public java.lang.String map(java.lang.String internalName)
Maps the internal name of a class to its new name. The default implementation of this method returns the given name, unchanged. Subclasses can override.- Parameters:
internalName
- the internal name of a class.- Returns:
- the new internal name.
-
-