Class SignatureParser
java.lang.Object
org.codehaus.janino.util.signature.SignatureParser
Helper class for parsing signatures and descriptors. See
Java 5 class file format,
section 4.4.4, "Signatures".
The various structures that the parser returns (e.g. SignatureParser.ClassTypeSignature) all have Object.toString() methods that convert them into nice, human-readable strings. This conversion can be customized
using SignatureParser(Options) and passing a custom SignatureParser.Options object.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classRepresentation of the "ArrayTypeSignature" clause.static classRepresentation of the "ClassSignature" clause.static classRepresentation of the "ClassTypeSignature" clause, e.g.static interfaceRepresentation of the "FieldTypeSignature" clause.static interfacestatic classRepresentation of the "FormalTypeParameter" clause, e.g.static classRepresentation of the "MethodTypeSignature" clause.static interfacestatic classRepresentation of the "PrimitiveTypeSignature" clause, i.e.static classSignalizes am malformed signature.static classRepresentation of the "SimpleClassTypeSignature" clause, e.g.static interfaceRepresentation of the "ThrowsSignature" clause.static classRepresentation of the "TypeArgument" clause.static interfaceRepresentation of the "TypeSignature" clause.static classRepresentation of the "TypeVariableSignature" clause, e.g. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final SignatureParser.PrimitiveTypeSignatureThe primitive 'boolean' type.static final SignatureParser.PrimitiveTypeSignatureThe primitive 'byte' type.static final SignatureParser.PrimitiveTypeSignatureThe primitive 'char' type.static final SignatureParser.OptionsA trivial implementation ofSignatureParser.Options.static final SignatureParser.PrimitiveTypeSignatureThe primitive 'double' type.static final SignatureParser.PrimitiveTypeSignatureThe primitive 'float' type.static final SignatureParser.PrimitiveTypeSignatureThe primitive 'int' type.static final SignatureParser.PrimitiveTypeSignatureThe primitive 'long' type.The class type signature of theObjectclass.private SignatureParser.Optionsprivate static final SignatureParser.PrimitiveTypeSignature[]static final SignatureParser.PrimitiveTypeSignatureThe primitive 'short' type.static final SignatureParser.TypeSignatureRepresentation of the 'void' type. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate SignatureParser.TypeSignaturedecodeClassName(String internalName) Decodes a "class-name-or-field-descriptor" as defined in JLS8 4.4.1 ("name_index").Decodes a 'class signature' as defined in JVMS7 4.3.4 / JVMS8 4.7.9.1.Decodes a 'field descriptor' as defined in JLS7 4.3.2.Decodes a 'field type signature' as defined in JVMS7 4.3.4 / JVMS8 4.7.9.1.Decodes a 'method descriptor' as defined in JVMS[78] 4.3.3.Decodes a 'method type signature' as defined in JVMS7 4.3.4 / JVMS8 4.7.9.1.Decodes a 'return type' as defined in JVMS7 4.3.4 / JVMS8 4.7.9.1.Decodes a 'type signature' as defined in JVMS7 4.3.4 / JVMS8 4.7.9.1.private SignatureParser.ClassSignatureprivate SignatureParser.TypeSignatureprivate static Stringprivate static Stringprivate SignatureParser.TypeSignatureprivate SignatureParser.ThrowsSignatureprivate SignatureParser.TypeArgumentprivate SignatureParser.TypeSignatureprivate static SignatureParser.TypeVariableSignature
-
Field Details
-
DEFAULT_OPTIONS
A trivial implementation ofSignatureParser.Options. -
options
-
object
The class type signature of theObjectclass. -
BYTE
The primitive 'byte' type. -
CHAR
The primitive 'char' type. -
DOUBLE
The primitive 'double' type. -
FLOAT
The primitive 'float' type. -
INT
The primitive 'int' type. -
LONG
The primitive 'long' type. -
SHORT
The primitive 'short' type. -
BOOLEAN
The primitive 'boolean' type. -
VOID
Representation of the 'void' type. -
PRIMITIVE_TYPES
-
-
Constructor Details
-
SignatureParser
public SignatureParser() -
SignatureParser
-
-
Method Details
-
decodeClassSignature
public SignatureParser.ClassSignature decodeClassSignature(String s) throws SignatureParser.SignatureException Decodes a 'class signature' as defined in JVMS7 4.3.4 / JVMS8 4.7.9.1. -
decodeMethodTypeSignature
public SignatureParser.MethodTypeSignature decodeMethodTypeSignature(String s) throws SignatureParser.SignatureException Decodes a 'method type signature' as defined in JVMS7 4.3.4 / JVMS8 4.7.9.1. -
decodeTypeSignature
public SignatureParser.TypeSignature decodeTypeSignature(String s) throws SignatureParser.SignatureException Decodes a 'type signature' as defined in JVMS7 4.3.4 / JVMS8 4.7.9.1. -
decodeFieldTypeSignature
public SignatureParser.FieldTypeSignature decodeFieldTypeSignature(String s) throws SignatureParser.SignatureException Decodes a 'field type signature' as defined in JVMS7 4.3.4 / JVMS8 4.7.9.1. -
decodeMethodDescriptor
public SignatureParser.MethodTypeSignature decodeMethodDescriptor(String s) throws SignatureParser.SignatureException Decodes a 'method descriptor' as defined in JVMS[78] 4.3.3.- Returns:
- E.g.
"(Object[]) => java.util.stream.Stream"or"join()"(void method) - Throws:
SignatureParser.SignatureException
-
decodeClassName
-
decodeFieldDescriptor
public SignatureParser.TypeSignature decodeFieldDescriptor(String s) throws SignatureParser.SignatureException Decodes a 'field descriptor' as defined in JLS7 4.3.2. -
decodeClassNameOrFieldDescriptor
public SignatureParser.TypeSignature decodeClassNameOrFieldDescriptor(String s) throws SignatureParser.SignatureException Decodes a "class-name-or-field-descriptor" as defined in JLS8 4.4.1 ("name_index"). -
decodeReturnType
public SignatureParser.TypeSignature decodeReturnType(String s) throws SignatureParser.SignatureException Decodes a 'return type' as defined in JVMS7 4.3.4 / JVMS8 4.7.9.1. -
parseFieldDescriptor
private SignatureParser.TypeSignature parseFieldDescriptor(StringCharStream scs) throws EOFException, UnexpectedCharacterException, SignatureParser.SignatureException -
parseMethodDescriptor
private SignatureParser.MethodTypeSignature parseMethodDescriptor(StringCharStream scs) throws EOFException, UnexpectedCharacterException, SignatureParser.SignatureException -
parseClassSignature
private SignatureParser.ClassSignature parseClassSignature(StringCharStream scs) throws EOFException, SignatureParser.SignatureException, UnexpectedCharacterException -
parseMethodTypeSignature
private SignatureParser.MethodTypeSignature parseMethodTypeSignature(StringCharStream scs) throws EOFException, UnexpectedCharacterException, SignatureParser.SignatureException -
parseReturnType
private SignatureParser.TypeSignature parseReturnType(StringCharStream scs) throws EOFException, UnexpectedCharacterException, SignatureParser.SignatureException -
parseThrowsSignature
private SignatureParser.ThrowsSignature parseThrowsSignature(StringCharStream scs) throws EOFException, UnexpectedCharacterException, SignatureParser.SignatureException -
parseClassTypeSignature
private SignatureParser.ClassTypeSignature parseClassTypeSignature(StringCharStream scs) throws EOFException, UnexpectedCharacterException, SignatureParser.SignatureException -
parseIdentifier
private static String parseIdentifier(StringCharStream scs) throws EOFException, SignatureParser.SignatureException -
parseIdentifierRest
private static String parseIdentifierRest(StringCharStream scs) throws EOFException, SignatureParser.SignatureException -
parseTypeVariableSignature
private static SignatureParser.TypeVariableSignature parseTypeVariableSignature(StringCharStream scs) throws EOFException, UnexpectedCharacterException, SignatureParser.SignatureException -
parseFormalTypeParameter
private SignatureParser.FormalTypeParameter parseFormalTypeParameter(StringCharStream scs) throws EOFException, SignatureParser.SignatureException, UnexpectedCharacterException -
parseTypeSignature
private SignatureParser.TypeSignature parseTypeSignature(StringCharStream scs) throws EOFException, UnexpectedCharacterException, SignatureParser.SignatureException -
parseFieldTypeSignature
private SignatureParser.FieldTypeSignature parseFieldTypeSignature(StringCharStream scs) throws EOFException, UnexpectedCharacterException, SignatureParser.SignatureException -
parseArrayTypeSignature
private SignatureParser.FieldTypeSignature parseArrayTypeSignature(StringCharStream scs) throws EOFException, UnexpectedCharacterException, SignatureParser.SignatureException -
parseTypeArgument
private SignatureParser.TypeArgument parseTypeArgument(StringCharStream scs) throws EOFException, UnexpectedCharacterException, SignatureParser.SignatureException
-