Package javassist.bytecode
Class SignatureAttribute
java.lang.Object
javassist.bytecode.AttributeInfo
javassist.bytecode.SignatureAttribute
Signature_attribute
.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Array types.static class
Primitive types.static class
Class signature.static class
Class types.private static class
static class
Method type signature.static class
Nested class types.static class
Class types, array types, and type variables.static class
Primitive types and object types.static class
Type argument.static class
Formal type parameters.static class
Type variables. -
Field Summary
FieldsFields inherited from class javassist.bytecode.AttributeInfo
constPool, info, name
-
Constructor Summary
ConstructorsConstructorDescriptionSignatureAttribute
(ConstPool cp, int n, DataInputStream in) SignatureAttribute
(ConstPool cp, String signature) Constructs aSignature
attribute. -
Method Summary
Modifier and TypeMethodDescriptionMakes a copy.private static BadBytecode
Returns the generic signature indicated bysignature_index
.private static boolean
isNamePart
(int c) private static boolean
makeNewClassName
(String desc, Map<String, String> map, String name, String newname, StringBuilder newdesc, int head, int j, ArrayList<StringBuilder> nameBufs, ArrayList<StringBuilder> genericParamBufs) private static SignatureAttribute.ObjectType
private static int
parseClassName
(ArrayList<StringBuilder> nameBufs, ArrayList<StringBuilder> genericParamBufs, String desc, int j) private static SignatureAttribute.ClassType
private static SignatureAttribute.ClassType
parseClassType2
(String sig, SignatureAttribute.Cursor c, SignatureAttribute.ClassType parent) private static SignatureAttribute.MethodSignature
parseMethodSig
(String sig) private static SignatureAttribute.ObjectType
parseObjectType
(String sig, SignatureAttribute.Cursor c, boolean dontThrow) private static SignatureAttribute.ClassSignature
private static SignatureAttribute.Type
parseType
(String sig, SignatureAttribute.Cursor c) private static SignatureAttribute.TypeArgument[]
private static SignatureAttribute.TypeParameter[]
parseTypeParams
(String sig, SignatureAttribute.Cursor cur) (package private) void
renameClass
(String oldname, String newname) (package private) static String
renameClass
(String desc, String oldname, String newname) (package private) static String
renameClass
(String desc, Map<String, String> map) (package private) void
renameClass
(Map<String, String> classnames) private static boolean
replaceTypeArguments
(String desc, Map<String, String> map, StringBuilder newdesc, int head, int j, ArrayList<StringBuilder> nameBufs, ArrayList<StringBuilder> genericParamBufs) void
setSignature
(String sig) Setssignature_index
to the index of the given generic signature, which is added to a constant pool.toClassSignature
(String sig) Parses the given signature string as a class signature.toFieldSignature
(String sig) Parses the given signature string as a field type signature.toMethodSignature
(String sig) Parses the given signature string as a method type signature.static SignatureAttribute.Type
toTypeSignature
(String sig) Parses the given signature string as a type signature.Methods inherited from class javassist.bytecode.AttributeInfo
copyAll, get, getConstPool, getLength, getName, getRefClasses, getRefClasses, length, lookup, read, remove, renameClass, renameClass, set, write, writeAll
-
Field Details
-
tag
The name of this attribute"Signature"
.- See Also:
-
-
Constructor Details
-
SignatureAttribute
SignatureAttribute(ConstPool cp, int n, DataInputStream in) throws IOException - Throws:
IOException
-
SignatureAttribute
Constructs aSignature
attribute.- Parameters:
cp
- a constant pool table.signature
- the signature represented by this attribute.
-
-
Method Details
-
getSignature
Returns the generic signature indicated bysignature_index
.- See Also:
-
setSignature
Setssignature_index
to the index of the given generic signature, which is added to a constant pool.- Parameters:
sig
- new signature.- Since:
- 3.11
-
copy
Makes a copy. Class names are replaced according to the givenMap
object.- Overrides:
copy
in classAttributeInfo
- Parameters:
newCp
- the constant pool table used by the new copy.classnames
- pairs of replaced and substituted class names.
-
renameClass
- Overrides:
renameClass
in classAttributeInfo
-
renameClass
- Overrides:
renameClass
in classAttributeInfo
-
renameClass
-
renameClass
-
parseClassName
private static int parseClassName(ArrayList<StringBuilder> nameBufs, ArrayList<StringBuilder> genericParamBufs, String desc, int j) -
makeNewClassName
private static boolean makeNewClassName(String desc, Map<String, String> map, String name, String newname, StringBuilder newdesc, int head, int j, ArrayList<StringBuilder> nameBufs, ArrayList<StringBuilder> genericParamBufs) -
replaceTypeArguments
private static boolean replaceTypeArguments(String desc, Map<String, String> map, StringBuilder newdesc, int head, int j, ArrayList<StringBuilder> nameBufs, ArrayList<StringBuilder> genericParamBufs) -
isNamePart
private static boolean isNamePart(int c) -
toClassSignature
Parses the given signature string as a class signature.- Parameters:
sig
- the signature obtained from theSignatureAttribute
of aClassFile
.- Returns:
- a tree-like data structure representing a class signature. It provides convenient accessor methods.
- Throws:
BadBytecode
- thrown when a syntactical error is found.- Since:
- 3.5
- See Also:
-
toMethodSignature
Parses the given signature string as a method type signature.- Parameters:
sig
- the signature obtained from theSignatureAttribute
of aMethodInfo
.- Returns:
- @return a tree-like data structure representing a method signature. It provides convenient accessor methods.
- Throws:
BadBytecode
- thrown when a syntactical error is found.- Since:
- 3.5
- See Also:
-
toFieldSignature
Parses the given signature string as a field type signature.- Parameters:
sig
- the signature string obtained from theSignatureAttribute
of aFieldInfo
.- Returns:
- the field type signature.
- Throws:
BadBytecode
- thrown when a syntactical error is found.- Since:
- 3.5
- See Also:
-
toTypeSignature
Parses the given signature string as a type signature. The type signature is either the field type signature or a base type descriptor includingvoid
type.- Throws:
BadBytecode
- thrown when a syntactical error is found.- Since:
- 3.18
-
parseSig
private static SignatureAttribute.ClassSignature parseSig(String sig) throws BadBytecode, IndexOutOfBoundsException - Throws:
BadBytecode
IndexOutOfBoundsException
-
parseMethodSig
- Throws:
BadBytecode
-
parseTypeParams
private static SignatureAttribute.TypeParameter[] parseTypeParams(String sig, SignatureAttribute.Cursor cur) throws BadBytecode - Throws:
BadBytecode
-
parseObjectType
private static SignatureAttribute.ObjectType parseObjectType(String sig, SignatureAttribute.Cursor c, boolean dontThrow) throws BadBytecode - Throws:
BadBytecode
-
parseClassType
private static SignatureAttribute.ClassType parseClassType(String sig, SignatureAttribute.Cursor c) throws BadBytecode - Throws:
BadBytecode
-
parseClassType2
private static SignatureAttribute.ClassType parseClassType2(String sig, SignatureAttribute.Cursor c, SignatureAttribute.ClassType parent) throws BadBytecode - Throws:
BadBytecode
-
parseTypeArgs
private static SignatureAttribute.TypeArgument[] parseTypeArgs(String sig, SignatureAttribute.Cursor c) throws BadBytecode - Throws:
BadBytecode
-
parseArray
private static SignatureAttribute.ObjectType parseArray(String sig, SignatureAttribute.Cursor c) throws BadBytecode - Throws:
BadBytecode
-
parseType
private static SignatureAttribute.Type parseType(String sig, SignatureAttribute.Cursor c) throws BadBytecode - Throws:
BadBytecode
-
error
-