Package libcore.reflect
Class GenericSignatureParser
- java.lang.Object
-
- libcore.reflect.GenericSignatureParser
-
public final class GenericSignatureParser extends Object
Implements a parser for the generics signature attribute. Uses a top-down, recursive descent parsing approach for the following grammar:ClassSignature ::= OptFormalTypeParams SuperclassSignature {SuperinterfaceSignature}. SuperclassSignature ::= ClassTypeSignature. SuperinterfaceSignature ::= ClassTypeSignature. OptFormalTypeParams ::= ["<" FormalTypeParameter {FormalTypeParameter} ">"]. FormalTypeParameter ::= Ident ClassBound {InterfaceBound}. ClassBound ::= ":" [FieldTypeSignature]. InterfaceBound ::= ":" FieldTypeSignature. FieldTypeSignature ::= ClassTypeSignature | ArrayTypeSignature | TypeVariableSignature. ArrayTypeSignature ::= "[" TypSignature. ClassTypeSignature ::= "L" {Ident "/"} Ident OptTypeArguments {"." Ident OptTypeArguments} ";". OptTypeArguments ::= "<" TypeArgument {TypeArgument} ">". TypeArgument ::= ([WildcardIndicator] FieldTypeSignature) | "*". WildcardIndicator ::= "+" | "-". TypeVariableSignature ::= "T" Ident ";". TypSignature ::= FieldTypeSignature | BaseType. BaseType ::= "B" | "C" | "D" | "F" | "I" | "J" | "S" | "Z". MethodTypeSignature ::= OptFormalTypeParams "(" {TypeSignature} ")" ReturnType {ThrowsSignature}. ThrowsSignature ::= ("^" ClassTypeSignature) | ("^" TypeVariableSignature). ReturnType ::= TypSignature | VoidDescriptor. VoidDescriptor ::= "V".
-
-
Field Summary
Fields Modifier and Type Field Description ListOfTypesexceptionTypesTypefieldTypeTypeVariable[]formalTypeParametersListOfTypesinterfaceTypesClassLoaderloaderListOfTypesparameterTypesTypereturnTypeTypesuperclassType
-
Constructor Summary
Constructors Constructor Description GenericSignatureParser(ClassLoader loader)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidparseForClass(GenericDeclaration genericDecl, String signature)Parses the generic signature of a class and creates the data structure representing the signature.voidparseForConstructor(GenericDeclaration genericDecl, String signature, Class<?>[] rawExceptionTypes)Parses the generic signature of a constructor and creates the data structure representing the signature.voidparseForField(GenericDeclaration genericDecl, String signature)Parses the generic signature of a field and creates the data structure representing the signature.voidparseForMethod(GenericDeclaration genericDecl, String signature, Class<?>[] rawExceptionTypes)Parses the generic signature of a method and creates the data structure representing the signature.
-
-
-
Field Detail
-
exceptionTypes
public ListOfTypes exceptionTypes
-
parameterTypes
public ListOfTypes parameterTypes
-
formalTypeParameters
public TypeVariable[] formalTypeParameters
-
returnType
public Type returnType
-
fieldType
public Type fieldType
-
interfaceTypes
public ListOfTypes interfaceTypes
-
superclassType
public Type superclassType
-
loader
public ClassLoader loader
-
-
Constructor Detail
-
GenericSignatureParser
public GenericSignatureParser(ClassLoader loader)
-
-
Method Detail
-
parseForClass
public void parseForClass(GenericDeclaration genericDecl, String signature)
Parses the generic signature of a class and creates the data structure representing the signature.- Parameters:
genericDecl- the GenericDeclaration calling this methodsignature- the generic signature of the class
-
parseForMethod
public void parseForMethod(GenericDeclaration genericDecl, String signature, Class<?>[] rawExceptionTypes)
Parses the generic signature of a method and creates the data structure representing the signature.- Parameters:
genericDecl- the GenericDeclaration calling this methodsignature- the generic signature of the class
-
parseForConstructor
public void parseForConstructor(GenericDeclaration genericDecl, String signature, Class<?>[] rawExceptionTypes)
Parses the generic signature of a constructor and creates the data structure representing the signature.- Parameters:
genericDecl- the GenericDeclaration calling this methodsignature- the generic signature of the class
-
parseForField
public void parseForField(GenericDeclaration genericDecl, String signature)
Parses the generic signature of a field and creates the data structure representing the signature.- Parameters:
genericDecl- the GenericDeclaration calling this methodsignature- the generic signature of the class
-
-