Class ParserAnnotation
ParserAnnotation is a parser class owned by Parser.java. It is primarily responsible for parsing Annotations (for classes, methods or fields).
ParserAnnotation can parse the different types of Annotation Attributes: Runtime(In)Visible Annotations (JDK 6+) Default Annotations (JDK 6+) Runtime(In)VisibleParameter Annotations (JDK 7+) Runtime(In)VisibleType Annotations (JSR308, JDK8+)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static class
AnnotationElemValue - used to store Annotation values(package private) static class
Annotation Element value referring to an Array(package private) static class
Annotation Element value referring to a class(package private) static class
Annotation Element value referring to a Constant(package private) static class
Element Value for Enumsprivate static class
Target Type visitor, used for constructing the target-info within a type annotation. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final ParserAnnotation.TargetTypeVisitor
local handles on the scanner, main parser, and the error reporting envFields inherited from class org.openjdk.asmtools.jasm.ParseBase
debugFlag, environment, parser, scanner
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
_scanAnnotation
(AnnotationData annotData) Parses an individual annotation-data.private void
_scanTargetPath
(TypeAnnotationData annotData) _scanTargetPath_scanTypeLocationprivate void
_scanTypeTarget
(TypeAnnotationData annotData) Parses an individual annotation-data.private DataWriter
getElementValueByCPIndex
(int cpIndex) private AnnotationData
Parses an individual annotation.protected DefaultAnnotationAttr
parseDefaultAnnotationprotected void
parseParamAnnots
(int totalParams, MethodData curMethod) Parses Parameter Annotations attributes.private AnnotationData
parseTypeAnnotation - parses an individual annotation.private ParserAnnotation.ArrayElemValue
scanAnnotationArray
(String name) scanAnnotationArrayprivate DataWriter
scanAnnotationClass
(String name) Scans an annotation enumeration.private DataWriter
scanAnnotationData
(String name) scanAnnotationDataprivate ParserAnnotation.EnumElemValue
scanAnnotationEnum
(String name) Scans an annotation enum val.private DataWriter
scanAnnotationIdent
(String ident, String name) scanAnnotationIdent(package private) ArrayList<AnnotationData>
The main entry for parsing an annotation list.protected void
scanParamName
(int totalParams, int paramNum, MethodData curMethod) Methods inherited from class org.openjdk.asmtools.jasm.ParseBase
init, init, init, setDebugFlag, traceMethodInfoLn, traceMethodInfoLn
-
Field Details
-
targetTypeVisitor
local handles on the scanner, main parser, and the error reporting env
-
-
Constructor Details
-
ParserAnnotation
-
-
Method Details
-
scanParamName
protected void scanParamName(int totalParams, int paramNum, MethodData curMethod) throws SyntaxError - Throws:
SyntaxError
-
scanAnnotations
The main entry for parsing an annotation list.- Returns:
- An ArrayList of parsed annotations
- Throws:
SyntaxError
-
parseDefaultAnnotation
parseDefaultAnnotationparses a default Annotation attribute
- Returns:
- the parsed Annotation Attribute
- Throws:
SyntaxError
SyntaxError
- if a scanner error occurs
-
parseParamAnnots
Parses Parameter Annotations attributes.- Parameters:
totalParams
-curMethod
-- Throws:
SyntaxError
- if a scanner error occurs
-
parseTypeAnnotation
parseTypeAnnotation - parses an individual annotation.- Returns:
- a parsed annotation.
- Throws:
SyntaxError
- if a scanner error occurs
-
parseAnnotation
Parses an individual annotation.- Returns:
- a parsed annotation.
- Throws:
SyntaxError
- if a scanner error occurs
-
_scanAnnotation
Parses an individual annotation-data.- Throws:
SyntaxError
- if a scanner error occurs
-
_scanTypeTarget
Parses an individual annotation-data.- Throws:
SyntaxError
- if a scanner error occurs
-
_scanTargetPath
_scanTargetPathparses and fills the type_path structure (4.7.20.2)
type_path { u1 path_length; { u1 type_path_kind; u1 type_argument_index; } path[path_length]; }
- Throws:
SyntaxError
- if a scanner error occurs
-
_scanTypePathEntry
_scanTypeLocationparses a path entry of the type_path.
{ u1 type_path_kind; u1 type_argument_index; }
- Returns:
- a parsed type path.
- Throws:
SyntaxError
- if a scanner error occurs
-
scanAnnotationArray
scanAnnotationArrayScans an Array of annotations.
- Parameters:
name
- Name of the annotation- Returns:
- Array Element
- Throws:
SyntaxError
- if a scanner error occurs
-
scanAnnotationClass
Scans an annotation enumeration.- Parameters:
name
- Annotation Name- Returns:
- Constant element value for the Class Annotation.
- Throws:
SyntaxError
- if a scanner error occurs
-
scanAnnotationEnum
Scans an annotation enum val.- Parameters:
name
- Annotation Name- Returns:
- Enumeration Element Value
- Throws:
SyntaxError
- if a scanner error occurs
-
scanAnnotationData
scanAnnotationDataparses the internals of an annotation.
- Parameters:
name
- Annotation Name- Returns:
- a Data data structure containing the annotation data.
- Throws:
IOException
- for scanning errors.
-
getElementValueByCPIndex
-
scanAnnotationIdent
scanAnnotationIdentparses the identifier of an annotation.
- Parameters:
ident
- Basic Type identifiername
- Annotation Name- Returns:
- Basic Type Annotation data
- Throws:
SyntaxError
- if a scanning error occurs
-