This is NOT part of any supported API. If you write code that depends on this, you do so at your own risk. This code and its internal interfaces are subject to change or deletion without notice.
| Modifier and Type | Class and Description |
|---|---|
| pack-priv static enum | |
| private static enum | |
| pack-priv static interface | |
| pack-priv class | |
| pack-priv static enum | |
| pack-priv static enum | |
| private static enum |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv boolean | allowRecords
Switch: are records allowed in this source level? |
| pack-priv boolean | allowSealedTypes
Switch: are sealed types allowed in this source level? |
| pack-priv boolean | allowStringFolding
Switch: should we fold strings? |
| pack-priv boolean | allowThisIdent
Switch: is "this" allowed as an identifier? |
| pack-priv boolean | allowYieldStatement
Switch: is yield statement allowed in this source level? |
| private int | |
| protected Map | danglingComments
A map associating "other nearby documentation comments" with the preferred documentation comment for a declaration. |
| private static final JCDiagnostic. | |
| private final DocCommentTable | docComments
A table to store all documentation comments indexed by the tree nodes they refer to. |
| protected int | |
| private int | |
| private JCTree. | |
| protected static final int | EXPR
When terms are parsed, the mode determines which is expected: mode = EXPR : an expression mode = TYPE : a type mode = NOLAMBDA : lambdas are not allowed |
| protected TreeMaker | F
The factory to be used for abstract syntax tree construction. |
| private static final int | infixPrecedenceLevels
The number of precedence levels of infix operators. |
| pack-priv boolean | keepDocComments
Switch: should we keep docComments? |
| pack-priv boolean | keepLineMap
Switch: should we keep line table? |
| protected int | lastmode
The mode of the term that was parsed last. |
| protected Predicate | LAX_IDENTIFIER
Accepts all identifier-like tokens |
| private Log | log
The log to be used for error diagnostics. |
| protected int | mode
The current mode. |
| private Names | names
The name table. |
| protected static final int | |
| pack-priv ArrayList | odStackSupply
optimization: To save allocating a new operand/operator stack for every binary operation, we use supplys. |
| pack-priv ArrayList | |
| private final boolean | parseModuleInfo
Is the parser instantiated to parse a module-info file ? |
| private boolean | permitTypeAnnotationsPushBack
If the parser notices extra annotations, then it either immediately issues an error (if this variable is false) or places the extra annotations in variable typeAnnotationsPushedBack (if this variable is true). |
| private Preview | preview
The Preview language setting. |
| pack-priv JCTree. | receiverParam
The type of the method receiver, as specified by a first "this" parameter. |
| private static final int | |
| protected Lexer | S
The scanner used for lexical analysis. |
| private Source | source
The Source language setting. |
| protected Tokens. | |
| protected static final int | |
| private List | typeAnnotationsPushedBack
Type annotations that have already been read but have not yet been used. |
| private JCDiagnostic. |
| Access | Constructor and Description |
|---|---|
| protected | JavacParser(ParserFactory fac, Lexer S, boolean keepDocComments, boolean keepLineMap)
Construct a parser from a given scanner, tree factory and log. |
| protected | JavacParser(ParserFactory fac, Lexer S, boolean keepDocComments, boolean keepLineMap, boolean parseModuleInfo)
Construct a parser from a given scanner, tree factory and log. |
| protected | JavacParser(JavacParser parser, Lexer S)
Construct a parser from an existing parser, with minimal overhead. |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | |
| private boolean | |
| pack-priv JavacParser. | analyzeParens()
If we see an identifier followed by a '<' it could be an unbound method reference or a binary expression. |
| pack-priv JavacParser. | |
| pack-priv JCTree. | annotation(int
position of "@" token pos, JCTree.Whether to parse an ANNOTATION or TYPE_ANNOTATION kindAnnotation = "@" Qualident [ "(" AnnotationFieldValues ")" ] |
| pack-priv JCTree. | |
| pack-priv List | annotationFieldValues()
AnnotationFieldValues = "(" [ AnnotationFieldValue { "," AnnotationFieldValue } ] ")" |
| pack-priv List | |
| protected List | annotationsOpt(JCTree.
Whether to parse an ANNOTATION or TYPE_ANNOTATION kindAnnotationsOpt = { '@' Annotation } |
| pack-priv JCTree. | |
| pack-priv List | |
| pack-priv JCTree. | |
| pack-priv JCTree. | |
| pack-priv JCTree. | arrayCreatorRest(int newpos, JCTree.
ArrayCreatorRest = [Annotations] "[" ( "]" BracketsOpt ArrayInitializer | Expression "]" {[Annotations] "[" Expression "]"} BracketsOpt ) |
| pack-priv JCTree. | arrayInitializer(int newpos, JCTree.
ArrayInitializer = "{" [VariableInitializer {"," VariableInitializer}] [","] "}" |
| pack-priv List | |
| protected <T extends JCTree> T | |
| pack-priv JCTree. | |
| pack-priv JCTree. | |
| public JCTree. | |
| pack-priv List | |
| pack-priv List | blockStatements()
BlockStatements = { BlockStatement } BlockStatement = LocalVariableDeclarationStatement | ClassOrInterfaceOrEnumDeclaration | [Ident ":"] Statement LocalVariableDeclarationStatement = { FINAL | '@' Annotation } Type VariableDeclarators ";" |
| private JCTree. | bracketsOpt(JCTree.
BracketsOpt = { [Annotations] "[" "]" }*
|
| private JCTree. | |
| private JCTree. | |
| pack-priv JCTree. | |
| protected JCTree. | catchClause()
CatchClause = CATCH "(" FormalParameter ")" Block Todo the "FormalParameter" is not correct, it uses the special "catchTypes" rule below. |
| pack-priv List | |
| protected JCTree. | |
| protected void | |
| protected void | |
| pack-priv void | |
| protected void | |
| pack-priv JCTree. | classCreatorRest(int newpos, JCTree.
ClassCreatorRest = Arguments [ClassBody] |
| protected JCTree. | classDeclaration(JCTree.
The modifiers starting the class declaration mods,The documentation comment for the class, or null. dcClassDeclaration = CLASS Ident TypeParametersOpt [EXTENDS Type] [IMPLEMENTS TypeList] ClassBody |
| pack-priv List | classInterfaceOrRecordBody(Name className, boolean isInterface, boolean isRecord)
ClassBody = "{" {ClassBodyDeclaration} "}" InterfaceBody = "{" {InterfaceBodyDeclaration} "}" |
| protected List | classOrInterfaceOrRecordBodyDeclaration(JCTree.
ClassBodyDeclaration = ";" | [STATIC] Block | ModifiersOpt ( Type Ident ( VariableDeclaratorsRest ";" | MethodDeclaratorRest ) | VOID Ident VoidMethodDeclaratorRest | TypeParameters [Annotations] ( Type Ident MethodDeclaratorRest | VOID Ident VoidMethodDeclaratorRest ) | Ident ConstructorDeclaratorRest | TypeParameters Ident ConstructorDeclaratorRest | ClassOrInterfaceOrEnumDeclaration ) InterfaceBodyDeclaration = ";" | ModifiersOpt ( Type Ident ( ConstantDeclaratorsRest ";" | MethodDeclaratorRest ) | VOID Ident MethodDeclaratorRest | TypeParameters [Annotations] ( Type Ident MethodDeclaratorRest | VOID Ident VoidMethodDeclaratorRest ) | ClassOrInterfaceOrEnumDeclaration ) |
| protected JCTree. | classOrRecordOrInterfaceOrEnumDeclaration(JCTree.
Any modifiers starting the class or interface declaration mods,The documentation comment for the class, or null. dcClassOrInterfaceOrEnumDeclaration = ModifiersOpt (ClassDeclaration | InterfaceDeclaration | EnumDeclaration) |
| private List | |
| private List | constructorOrMethodOrFieldDeclaration(JCTree.
|
| pack-priv JCTree. | creator(int newpos, List<JCTree.
Creator = [Annotations] Qualident [TypeArguments] ( ArrayCreatorRest | ClassCreatorRest ) |
| private JCTree. | |
| pack-priv static int | earlier(int pos1, int pos2)
Return the lesser of two positions, making allowance for either one being unset. |
| pack-priv List | |
| protected JCTree. | enumDeclaration(JCTree.
The modifiers starting the enum declaration mods,The documentation comment for the enum, or null. dcEnumDeclaration = ENUM Ident [IMPLEMENTS TypeList] EnumBody |
| pack-priv JCTree | enumeratorDeclaration(Name enumName)
EnumeratorDeclaration = AnnotationsOpt [TypeArguments] IDENTIFIER [ Arguments ] [ "{" ClassBody "}" ] |
| private JavacParser. | |
| private boolean | foldIfNeeded(JCTree.
|
| protected JCTree. | foldStrings(JCTree.
If tree is a concatenation of string literals, replace it by a single literal representing the concatenated string. |
| pack-priv List | forInit()
ForInit = StatementExpression MoreStatementExpressions | { FINAL | '@' Annotation } Type VariableDeclarators |
| protected JCTree. | formalParameter(boolean lambdaParameter, boolean recordComponent)
FormalParameter = { FINAL | '@' Annotation } Type VariableDeclaratorId LastFormalParameter = { FINAL | '@' Annotation } Type '...' Ident | FormalParameter |
| pack-priv List | formalParameters()
FormalParameters = "(" [ FormalParameterList ] ")" FormalParameterList = [ FormalParameterListNovarargs , ] LastFormalParameter FormalParameterListNovarargs = [ FormalParameterListNovarargs , ] FormalParameter |
| pack-priv List | |
| pack-priv List | |
| public int | |
| public int | |
| public Name | |
| protected Name | |
| protected Name | |
| public Name | |
| private void | ignoreDanglingComments()
Ignores any recent documentation comments found by the scanner, such as those that cannot be associated with a nearby declaration. |
| pack-priv JCTree. | |
| pack-priv JCTree. | |
| protected JCTree. | |
| pack-priv List | |
| protected JCTree | |
| pack-priv JCTree. | innerCreator(int newpos, List<JCTree.
InnerCreator = [Annotations] Ident [TypeArguments] ClassCreatorRest |
| private JCTree. | insertAnnotationsToMostInner(JCTree.
Inserts the annotations (and possibly a new array level) to the left-most type in an array or nested type. |
| protected JCTree. | interfaceDeclaration(JCTree.
The modifiers starting the interface declaration mods,The documentation comment for the interface, or null. dcInterfaceDeclaration = INTERFACE Ident TypeParametersOpt [EXTENDS TypeList] InterfaceBody |
| protected boolean | |
| private boolean | |
| private boolean | Returns: true if and only if the current token is definitelly a token that starts a statement.Returns true if and only if the current token is definitelly a token that starts a statement. |
| pack-priv boolean | |
| protected boolean | |
| protected boolean | |
| protected boolean | |
| protected boolean | |
| protected boolean | |
| pack-priv boolean | isUnboundMemberRef()
If we see an identifier followed by a '<' it could be an unbound method reference or a binary expression. |
| pack-priv boolean | |
| pack-priv JCTree. | |
| pack-priv JCTree. | |
| pack-priv JCTree. | |
| pack-priv JCTree. | |
| pack-priv JCTree. | |
| pack-priv JCTree. | |
| private List | |
| pack-priv JCTree. | memberReferenceSuffix(JCTree.
MemberReferenceSuffix = "::" [TypeArguments] Ident | "::" [TypeArguments] "new" |
| pack-priv JCTree. | |
| pack-priv boolean | |
| protected JCTree | methodDeclaratorRest(int pos, JCTree.
MethodDeclaratorRest = FormalParameters BracketsOpt [THROWS TypeList] ( MethodBody | [DEFAULT AnnotationValue] ";") VoidMethodDeclaratorRest = FormalParameters [THROWS TypeList] ( MethodBody | ";") ConstructorDeclaratorRest = "(" FormalParameterListOpt ")" [THROWS TypeList] MethodBody |
| protected JCTree. | modifiersOpt()
ModifiersOpt = { Modifier } Modifier = PUBLIC | PROTECTED | PRIVATE | STATIC | ABSTRACT | FINAL | NATIVE | SYNCHRONIZED | TRANSIENT | VOLATILE | "@" | "@" Annotation |
| protected JCTree. | |
| pack-priv JCTree. | |
| pack-priv List | |
| pack-priv <T extends ListBuffer | moreStatementExpressions(int pos, JCTree.
MoreStatementExpressions = { COMMA StatementExpression } |
| protected DocCommentTable | |
| private JCTree. | |
| private Tokens. | |
| public void | |
| private boolean | Returns: true if and only if the following code should be parsed as a block.whether there was a serious problem in the
parameters list unclosedParameterList)After seeing a method header, and not seeing an opening left brace, attempt to estimate if acting as if the left brace was present and parsing the upcoming code will get better results than not parsing the code as a block. |
| pack-priv static JCTree. | |
| pack-priv JCTree. | |
| pack-priv JCTree. | |
| private JCTree. | |
| public JCTree. | parseCompilationUnit()
Implements com. CompilationUnit = [ { "@" Annotation } PACKAGE Qualident ";"] {ImportDeclaration} {TypeDeclaration} |
| public JCTree. | parseExpression()
Implements com. terms can be either expressions or types. |
| private JCTree. | |
| protected JCTree. | |
| public JCTree. | parsePattern(int pos, JCTree.
parses patterns. |
| public JCTree. | parseSimpleStatement()
Statement = Block | IF ParExpression Statement [ELSE Statement] | FOR "(" ForInitOpt ";" [Expression] ";" ForUpdateOpt ")" Statement | FOR "(" FormalParameter : Expression ")" Statement | WHILE ParExpression Statement | DO Statement WHILE ParExpression ";" | TRY Block ( Catches | [Catches] FinallyPart ) | TRY "(" ResourceSpecification ";"opt ")" Block [Catches] [FinallyPart] | SWITCH ParExpression "{" SwitchBlockStatementGroups "}" | SYNCHRONIZED ParExpression Block | RETURN [Expression] ";" | THROW Expression ";" | BREAK [Ident] ";" | CONTINUE [Ident] ";" | ASSERT Expression [ ":" Expression ] ";" | ";" |
| public JCTree. | |
| pack-priv JCTree. | |
| public JCTree. | parseType()
Implements com. parses (optional) type annotations followed by a type. |
| public JCTree. | |
| public JCTree. | |
| protected boolean | |
| protected boolean | |
| protected boolean | |
| protected boolean | |
| protected boolean | |
| protected boolean | |
| protected boolean | |
| protected boolean | |
| pack-priv List | |
| pack-priv static int | |
| public JCTree. | |
| pack-priv List | qualidentList(boolean allowAnnos)
QualidentList = [Annotations] Qualident {"," [Annotations] Qualident} |
| protected JCTree. | |
| pack-priv JCTree. | |
| pack-priv void | reportDanglingComments(JCTree
the tree node for the declaration tree, Tokens.the primary comment for the declaration dcReports all dangling comments associated with the primary comment for a declaration against the position of the tree node for a declaration. |
| pack-priv void | reportDanglingDocComment(JCTree tree, Tokens.
the comment cReports an individual dangling comment as a warning to the log. |
| pack-priv void | |
| protected void | reportSyntaxError(int pos, JCDiagnostic.
Report a syntax using the given the position parameter and arguments, unless one was already reported at the same position. |
| protected void | reportSyntaxError(JCDiagnostic.
Report a syntax error using the given DiagnosticPosition object and arguments, unless one was already reported at the same position. |
| private void | reportSyntaxError(JCDiagnostic.
|
| protected JCTree | |
| pack-priv List | |
| pack-priv Name | |
| pack-priv Source | |
| private void | saveDanglingDocComments(Tokens.
the primary documentation comment dcRecord nearby documentation comments against the primary documentation comment for a declaration. |
| protected void | |
| protected void | |
| protected void | |
| protected void | |
| protected void | |
| private boolean | shebang(Tokens.
Returns true for a comment that acts similarly to shebang in UNIX |
| protected void | skip(boolean stopAtImport, boolean stopAtMemberDecl, boolean stopAtIdentifier, boolean stopAtStatement)
Skip forward until a suitable stop token is found. |
| private int | |
| protected <T extends JCTree> T | Returns: treetree node tree, int the ending position to associate with endpos)treeStore ending position for a tree, the value of which is the greater of
|
| private JCTree. | |
| pack-priv String | |
| pack-priv JCTree. | superSuffix(List<JCTree.
SuperSuffix = Arguments | "." [TypeArguments] Ident [Arguments] |
| protected List | |
| pack-priv List | switchBlockStatementGroups()
SwitchBlockStatementGroups = { SwitchBlockStatementGroup } SwitchBlockStatementGroup = SwitchLabel BlockStatements SwitchLabel = CASE ConstantExpression ":" | DEFAULT ":" |
| private List | |
| protected JCTree. | |
| protected JCTree. | |
| private JCTree. | |
| protected JCTree. | |
| pack-priv JCTree. | term()
Expression = Expression1 [ExpressionRest] ExpressionRest = [AssignmentOperator Expression1] AssignmentOperator = "=" | "+=" | "-=" | "*=" | "/=" | "&=" | "|=" | "^=" | "%=" | "<<=" | ">>=" | ">>>=" Type = Type1 TypeNoParams = TypeNoParams1 StatementExpression = Expression ConstantExpression = Expression |
| pack-priv JCTree. | |
| pack-priv JCTree. | |
| pack-priv JCTree. | |
| pack-priv JCTree. | |
| protected JCTree. | term3()
Expression3 = PrefixOp Expression3 | "(" Expr | TypeNoParams ")" Expression3 | Primary {Selector} {PostfixOp} Primary = "(" Expression ")" | Literal | [TypeArguments] THIS [Arguments] | [TypeArguments] SUPER SuperSuffix | NEW [TypeArguments] Creator | "(" Arguments ")" "->" ( Expression | Block ) | Ident "->" ( Expression | Block ) | [Annotations] Ident { "." [Annotations] Ident } | Expression3 MemberReferenceSuffix [ [Annotations] "[" ( "]" BracketsOpt "." CLASS | Expression "]" ) | Arguments | "." ( CLASS | THIS | [TypeArguments] SUPER Arguments | NEW [TypeArguments] InnerCreator ) ] | BasicType BracketsOpt "." CLASS PrefixOp = "++" | "--" | "!" | "~" | "+" | "-" PostfixOp = "++" | "--" Type3 = Ident { "." Ident } [TypeArguments] {TypeSelector} BracketsOpt | BasicType TypeNoParams3 = Ident { "." Ident } BracketsOpt Selector = "." [TypeArguments] Ident [Arguments] | "." THIS | "." [TypeArguments] SUPER SuperSuffix | "." NEW [TypeArguments] InnerCreator | "[" Expression "]" TypeSelector = "." Ident [TypeArguments] SuperSuffix = Arguments | "." Ident [Arguments] |
| pack-priv JCTree. | |
| pack-priv JCTree. | |
| protected <T extends JCTree> T | to(T
tree node tree)Store current token's ending position for a tree, the value of which
will be the greater of |
| public Tokens. | |
| protected <T extends JCTree> T | toP(T
tree node tree)Store current token's ending position for a tree, the value of which
will be the greater of |
| private List | |
| pack-priv List | |
| pack-priv JCTree. | |
| pack-priv JCTree. | |
| pack-priv JCTree. | |
| pack-priv JCTree. | typeArgument()
TypeArgument = Type | [Annotations] "?" | [Annotations] "?" EXTENDS Type {"&" Type} | [Annotations] "?" SUPER Type |
| pack-priv List | |
| pack-priv List | |
| pack-priv List | |
| pack-priv JCTree | typeDeclaration(JCTree.
TypeDeclaration = ClassOrInterfaceOrEnumDeclaration | ";" |
| pack-priv List | |
| pack-priv Name | |
| pack-priv JCTree. | typeParameter()
TypeParameter = [Annotations] TypeVariable [TypeParameterBound] TypeParameterBound = EXTENDS Type {"&" Type} TypeVariable = Ident |
| protected List | |
| protected List | typeParametersOpt(boolean parseEmpty)
Parses a potentially empty type parameter list if needed with `allowEmpty`. |
| pack-priv static TypeTag | |
| public JCTree. | |
| public JCTree. | |
| pack-priv static JCTree. | |
| private void | |
| pack-priv JCTree. | variableDeclarator(JCTree.
VariableDeclarator = Ident VariableDeclaratorRest ConstantDeclarator = Ident ConstantDeclaratorRest |
| pack-priv JCTree. | variableDeclaratorId(JCTree.
VariableDeclaratorId = Ident BracketsOpt |
| pack-priv JCTree. | variableDeclaratorRest(int pos, JCTree.
Is an initializer always required? reqInit, Tokens.The documentation comment for the variable declarations, or null. dc,VariableDeclaratorRest = BracketsOpt ["=" VariableInitializer] ConstantDeclaratorRest = BracketsOpt "=" VariableInitializer |
| public <T extends ListBuffer | variableDeclarators(JCTree.
VariableDeclarators = VariableDeclarator { "," VariableDeclarator } |
| protected <T extends ListBuffer | variableDeclaratorsRest(int pos, JCTree.
Is an initializer always required? reqInit, Tokens.The documentation comment for the variable declarations, or null. dc,VariableDeclaratorsRest = VariableDeclaratorRest { "," VariableDeclarator } ConstantDeclaratorsRest = ConstantDeclaratorRest { "," ConstantDeclarator } |
| public JCTree. | |
| protected boolean |