Package javassist.bytecode
Class SignatureAttribute
java.lang.Object
javassist.bytecode.AttributeInfo
javassist.bytecode.SignatureAttribute
Signature_attribute.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classArray types.static classPrimitive types.static classClass signature.static classClass types.private static classstatic classMethod type signature.static classNested class types.static classClass types, array types, and type variables.static classPrimitive types and object types.static classType argument.static classFormal type parameters.static classType 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 aSignatureattribute. -
Method Summary
Modifier and TypeMethodDescriptionMakes a copy.private static BadBytecodeReturns the generic signature indicated bysignature_index.private static booleanisNamePart(int c) private static booleanmakeNewClassName(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.ObjectTypeprivate static intparseClassName(ArrayList<StringBuilder> nameBufs, ArrayList<StringBuilder> genericParamBufs, String desc, int j) private static SignatureAttribute.ClassTypeprivate static SignatureAttribute.ClassTypeparseClassType2(String sig, SignatureAttribute.Cursor c, SignatureAttribute.ClassType parent) private static SignatureAttribute.MethodSignatureparseMethodSig(String sig) private static SignatureAttribute.ObjectTypeparseObjectType(String sig, SignatureAttribute.Cursor c, boolean dontThrow) private static SignatureAttribute.ClassSignatureprivate static SignatureAttribute.TypeparseType(String sig, SignatureAttribute.Cursor c) private static SignatureAttribute.TypeArgument[]private static SignatureAttribute.TypeParameter[]parseTypeParams(String sig, SignatureAttribute.Cursor cur) (package private) voidrenameClass(String oldname, String newname) (package private) static StringrenameClass(String desc, String oldname, String newname) (package private) static StringrenameClass(String desc, Map<String, String> map) (package private) voidrenameClass(Map<String, String> classnames) private static booleanreplaceTypeArguments(String desc, Map<String, String> map, StringBuilder newdesc, int head, int j, ArrayList<StringBuilder> nameBufs, ArrayList<StringBuilder> genericParamBufs) voidsetSignature(String sig) Setssignature_indexto 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.TypetoTypeSignature(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 aSignatureattribute.- Parameters:
cp- a constant pool table.signature- the signature represented by this attribute.
-
-
Method Details
-
getSignature
Returns the generic signature indicated bysignature_index. -
setSignature
Setssignature_indexto 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 givenMapobject.- Overrides:
copyin classAttributeInfo- Parameters:
newCp- the constant pool table used by the new copy.classnames- pairs of replaced and substituted class names.
-
renameClass
- Overrides:
renameClassin classAttributeInfo
-
renameClass
- Overrides:
renameClassin 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 theSignatureAttributeof 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 theSignatureAttributeof aMethodInfo.- Returns:
- 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 theSignatureAttributeof 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 includingvoidtype.- Throws:
BadBytecode- thrown when a syntactical error is found.- Since:
- 3.18
-
parseSig
private static SignatureAttribute.ClassSignature parseSig(String sig) throws BadBytecode, IndexOutOfBoundsException - Throws:
BadBytecodeIndexOutOfBoundsException
-
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
-