Package org.openjdk.asmtools.jasm
Class ParserAnnotation
- java.lang.Object
-
- org.openjdk.asmtools.jasm.ParseBase
-
- org.openjdk.asmtools.jasm.ParserAnnotation
-
public class ParserAnnotation extends ParseBase
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 Classes Modifier and Type Class Description (package private) static class
ParserAnnotation.AnnotationElemValue
AnnotationElemValue Used to store Annotation values(package private) static class
ParserAnnotation.ArrayElemValue
ArrayElemValue Annotation Element value referring to an Array(package private) static class
ParserAnnotation.ClassElemValue
ClassElemValue Annotation Element value referring to a class(package private) static class
ParserAnnotation.ConstElemValue
ConstElemValue Annotation Element value referring to a Constant(package private) static class
ParserAnnotation.EnumElemValue
EnumElemValue Element Value for Enumsprivate static class
ParserAnnotation.TTVis
TTVis Target Type visitor, used for constructing the target-info within a type annotation.
-
Constructor Summary
Constructors Modifier Constructor Description protected
ParserAnnotation(Scanner scanner, Parser parser, Environment env)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
_scanAnnotation(AnnotationData annotData)
_scanAnnotation parses an individual annotation-data.private void
_scanTargetPath(TypeAnnotationData annotData)
_scanTargetPath parses 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]; }private TypeAnnotationTypes.TypePathEntry
_scanTypePathEntry()
_scanTypeLocation parses a path entry of the type_path.private void
_scanTypeTarget(TypeAnnotationData annotData)
_scanAnnotation parses an individual annotation-data.private AnnotationData
parseAnnotation()
scanAnnotation parses an individual annotation.protected DefaultAnnotationAttr
parseDefaultAnnotation()
parseDefaultAnnotation parses a default Annotation attributeprotected void
parseParamAnnots(int _totalParams, MethodData curMethod)
parseParamAnnots Parses Parameter Annotations attributes.private AnnotationData
parseTypeAnnotation()
parseTypeAnnotation parses an individual annotation.private ParserAnnotation.ArrayElemValue
scanAnnotationArray(java.lang.String name)
scanAnnotationArray Scans an Array of annotations.private Data
scanAnnotationClass(java.lang.String name)
scanAnnotationEnum Scans an annotation enum val.private Data
scanAnnotationData(java.lang.String name)
scanAnnotationData parses the internals of an annotation.private ParserAnnotation.EnumElemValue
scanAnnotationEnum(java.lang.String name)
scanAnnotationEnum Scans an annotation enum val.private Data
scanAnnotationIdent(java.lang.String ident, java.lang.String name)
scanAnnotationIdent parses the identifier of an annotation.(package private) java.util.ArrayList<AnnotationData>
scanAnnotations()
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
debugScan, debugStr, enableDebug, init
-
-
-
-
Field Detail
-
ttVisitor
private static ParserAnnotation.TTVis ttVisitor
local handles on the scanner, main parser, and the error reporting env
-
-
Constructor Detail
-
ParserAnnotation
protected ParserAnnotation(Scanner scanner, Parser parser, Environment env)
-
-
Method Detail
-
scanParamName
protected void scanParamName(int totalParams, int paramNum, MethodData curMethod) throws java.io.IOException
- Throws:
java.io.IOException
-
scanAnnotations
java.util.ArrayList<AnnotationData> scanAnnotations() throws java.io.IOException
The main entry for parsing an annotation list.- Returns:
- An ArrayList of parsed annotations
- Throws:
java.io.IOException
-
parseDefaultAnnotation
protected DefaultAnnotationAttr parseDefaultAnnotation() throws Scanner.SyntaxError, java.io.IOException
parseDefaultAnnotation parses a default Annotation attribute- Returns:
- the parsed Annotation Attribute
- Throws:
Scanner.SyntaxError
java.io.IOException
-
parseParamAnnots
protected void parseParamAnnots(int _totalParams, MethodData curMethod) throws Scanner.SyntaxError, java.io.IOException
parseParamAnnots Parses Parameter Annotations attributes.- Parameters:
_totalParams
-curMethod
-- Throws:
Scanner.SyntaxError
java.io.IOException
-
parseTypeAnnotation
private AnnotationData parseTypeAnnotation() throws Scanner.SyntaxError, java.io.IOException
parseTypeAnnotation parses an individual annotation.- Returns:
- a parsed annotation.
- Throws:
java.io.IOException
Scanner.SyntaxError
-
parseAnnotation
private AnnotationData parseAnnotation() throws Scanner.SyntaxError, java.io.IOException
scanAnnotation parses an individual annotation.- Returns:
- a parsed annotation.
- Throws:
java.io.IOException
Scanner.SyntaxError
-
_scanAnnotation
private void _scanAnnotation(AnnotationData annotData) throws Scanner.SyntaxError, java.io.IOException
_scanAnnotation parses an individual annotation-data.- Throws:
java.io.IOException
Scanner.SyntaxError
-
_scanTypeTarget
private void _scanTypeTarget(TypeAnnotationData annotData) throws Scanner.SyntaxError, java.io.IOException
_scanAnnotation parses an individual annotation-data.- Throws:
java.io.IOException
Scanner.SyntaxError
-
_scanTargetPath
private void _scanTargetPath(TypeAnnotationData annotData) throws Scanner.SyntaxError, java.io.IOException
_scanTargetPath parses 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:
Scanner.SyntaxError
java.io.IOException
-
_scanTypePathEntry
private TypeAnnotationTypes.TypePathEntry _scanTypePathEntry() throws Scanner.SyntaxError, java.io.IOException
_scanTypeLocation parses a path entry of the type_path. { u1 type_path_kind; u1 type_argument_index; }- Returns:
- a parsed type path.
- Throws:
Scanner.SyntaxError
java.io.IOException
-
scanAnnotationArray
private ParserAnnotation.ArrayElemValue scanAnnotationArray(java.lang.String name) throws java.io.IOException
scanAnnotationArray Scans an Array of annotations.- Parameters:
name
- Name of the annotation- Returns:
- Array Element
- Throws:
java.io.IOException
- if scanning errors exist
-
scanAnnotationClass
private Data scanAnnotationClass(java.lang.String name) throws java.io.IOException
scanAnnotationEnum Scans an annotation enum val.- Parameters:
name
- Annotation Name- Returns:
- Constant element value for the Class Annotation.
- Throws:
java.io.IOException
-
scanAnnotationEnum
private ParserAnnotation.EnumElemValue scanAnnotationEnum(java.lang.String name) throws java.io.IOException
scanAnnotationEnum Scans an annotation enum val.- Parameters:
name
- Annotation Name- Returns:
- Enumeration Element Value
- Throws:
java.io.IOException
- for scanning errors.
-
scanAnnotationData
private Data scanAnnotationData(java.lang.String name) throws java.io.IOException
scanAnnotationData parses the internals of an annotation.- Parameters:
name
- Annotation Name- Returns:
- a Data data structure containing the annotation data.
- Throws:
java.io.IOException
- for scanning errors.
-
scanAnnotationIdent
private Data scanAnnotationIdent(java.lang.String ident, java.lang.String name) throws java.io.IOException
scanAnnotationIdent parses the identifier of an annotation.- Parameters:
ident
- Basic Type identifiername
- Annotation Name- Returns:
- Basic Type Annotation data
- Throws:
java.io.IOException
- if scanning errors occur
-
-