Class TokenTypes
Implementation detail: This class has been introduced to break the circular dependency between packages.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Theabstract
keyword.static final int
An annotation of a package, type, field, parameter or variable.static final int
An annotation array member initialization.static final int
An annotation declaration.static final int
An annotation field declaration.static final int
An initialization of an annotation member with a value.static final int
A collection of annotations on a package or enum constant.static final int
An array declaration.static final int
An array initialization.static final int
The=
(assignment) operator.static final int
An@
symbol - signifying an annotation instance or the prefix to the interface literal signifying the definition of an annotation declaration.static final int
The&
(bitwise AND) operator.static final int
The&=
(bitwise AND assignment) operator.static final int
Beginning of block comment: '/*'.static final int
End of block comment: '*/'.static final int
The~
(bitwise complement) operator.static final int
The|
(bitwise OR) operator.static final int
The|=
(bitwise OR assignment) operator.static final int
The>>>
(unsigned shift right) operator.static final int
The>>>=
(unsigned right shift assignment) operator.static final int
The^
(bitwise exclusive OR) operator.static final int
The^=
(bitwise exclusive OR assignment) operator.static final int
A group of case clauses.static final int
A character literal.static final int
A class declaration.static final int
The:
(colon) operator.static final int
The,
(comma) operator.static final int
Text of single-line or block comment.static final int
A compact canonical constructor eliminates the list of formal parameters; they are declared implicitly.static final int
A constructor call.static final int
A constructor declaration.static final int
The--
(prefix decrement) operator.static final int
The/
(division) operator.static final int
The/=
(division assignment) operator.static final int
Literalwhile
in do-while loop.static final int
The.
(dot) operator.static final int
The::
(double colon) separator.static final int
An expression list.static final int
A triple dot for variable-length parameters.static final int
The empty statement.static final int
Theenum
keyword.static final int
An enum constant declaration.static final int
An enum declaration.static final int
The end of file token.static final int
The==
(equal) operator.static final int
An expression.static final int
An extends clause.static final int
Thefinal
keyword.static final int
A for loop condition.static final int
A for-each clause.static final int
A for loop initializer.static final int
A for loop iterator.static final int
The>=
(greater than or equal) operator.static final int
A>
symbol signifying the end of type arguments or type parameters.static final int
A<
symbol signifying the start of type arguments or type parameters.static final int
The>
(greater than) operator.static final int
An identifier.static final int
An implements clause.static final int
An import declaration.static final int
The++
(prefix increment) operator.static final int
The array index operator.static final int
An instance initializer.static final int
An interface declaration.static final int
A labeled statement.static final int
Special lambda symbol->
.static final int
The&&
(conditional AND) operator.static final int
A left curly brace ({
).static final int
The<=
(less than or equal) operator.static final int
Theassert
keyword.static final int
Theboolean
keyword.static final int
Thebreak
keyword.static final int
Thebyte
keyword.static final int
Thecase
keyword.static final int
Thecatch
keyword.static final int
Thechar
keyword.static final int
Theclass
keyword.static final int
Thecontinue
keyword.static final int
Thedefault
keyword.static final int
Thedo
keyword.static final int
Thedouble
keyword.static final int
Theelse
keyword.static final int
Thefalse
keyword.static final int
Thefinally
keyword.static final int
Thefloat
keyword.static final int
Thefor
keyword.static final int
Theif
keyword.static final int
Theinstanceof
operator.static final int
Theint
keyword.static final int
Theinterface
keyword.static final int
Thelong
keyword.static final int
Thenative
keyword.static final int
Thenew
keyword.static final int
Thenull
keyword.static final int
Theprivate
keyword.static final int
Theprotected
keyword.static final int
Thepublic
keyword.static final int
Therecord
keyword.static final int
Thereturn
keyword.static final int
Theshort
keyword.static final int
Thestatic
keyword.static final int
Thesuper
keyword.static final int
Theswitch
keyword.static final int
Thesynchronized
keyword.static final int
Thethis
keyword.static final int
Thethrow
keyword.static final int
Thethrows
keyword.static final int
Thetransient
keyword.static final int
Thetrue
keyword.static final int
Thetry
keyword.static final int
Thevoid
keyword.static final int
Thevolatile
keyword.static final int
Thewhile
keyword.static final int
Theyield
keyword.static final int
The!
(logical complement) operator.static final int
The||
(conditional OR) operator.static final int
A left parenthesis ((
).static final int
The<
(less than) operator.static final int
A method call.static final int
A method declaration.static final int
A reference to a method or constructor without arguments.static final int
The-
(subtraction) operator.static final int
The-=
(subtraction assignment) operator.static final int
The%
(remainder) operator.static final int
The%=
(remainder assignment) operator.static final int
Modifiers for type, method, and field declarations.static final int
The!=
(not equal) operator.static final int
A double precision floating point literal.static final int
A single precision floating point literal.static final int
An integer literal.static final int
A long integer literal.static final int
An object block.static final int
The package declaration.static final int
A parameter declaration.static final int
A list of parameters to a method or constructor.static final int
A pattern variable definition; when conditionally matched, this variable is assigned with the defined type.static final int
The+
(addition) operator.static final int
The+=
(addition assignment) operator.static final int
The--
(postfix decrement) operator.static final int
The++
(postfix increment) operator.static final int
The?
(conditional) operator.static final int
The]
symbol.static final int
A right curly brace (}
).static final int
A record component is a variable that comprises the state of a record.static final int
Record components are a (possibly empty) list containing the components of a record, which are the variables that make up its state.static final int
A declaration of a record specifies a name, a header, and a body.static final int
A resource in the Java 7 try-with-resources construct.static final int
The Java 7 try-with-resources construct.static final int
A list of resources in the Java 7 try-with-resources construct.static final int
A right parenthesis ()
).static final int
The statement terminator (;
).static final int
Beginning of single line comment: '//'.static final int
The<<
(shift left) operator.static final int
The<<=
(left shift assignment) operator.static final int
A list of statements.static final int
The>>
(signed shift right) operator.static final int
The>>=
(signed right shift assignment) operator.static final int
The*
(multiplication or wildcard) operator.static final int
The*=
(multiplication assignment) operator.static final int
A static import declaration.static final int
A static initialization block.static final int
Thestrictfp
keyword.static final int
A string literal.static final int
A super constructor call.static final int
Switch Expressions.static final int
Content of a Java 14 text block.static final int
Beginning of a Java 14 Text Block literal, delimited by three double quotes.static final int
End of a Java 14 text block literal, delimited by three double quotes.static final int
A type.static final int
A type arguments to a type reference or a method/ctor invocation.static final int
A list of type arguments to a type reference or a method/ctor invocation.static final int
The&
symbol when used to extend a generic upper or lower bounds constrain or a type cast expression with an additional interface.static final int
A lower bounds on a wildcard type argument.static final int
A type parameter to a class, interface or method definition.static final int
A list of type parameters to a class, interface or method definition.static final int
An upper bounds on a wildcard type argument or type parameter.static final int
A type-cast.static final int
The-
(unary minus) operator.static final int
The+
(unary plus) operator.static final int
A field or local variable declaration.static final int
The type that refers to all types. -
Method Summary
-
Field Details
-
EOF
public static final int EOFThe end of file token. This is the root node for the source file. It's children are an optional package definition, zero or more import statements, and one or more class or interface definitions. -
MODIFIERS
public static final int MODIFIERSModifiers for type, method, and field declarations. The modifiers element is always present even though it may have no children. -
OBJBLOCK
public static final int OBJBLOCKAn object block. These are children of class, interface, enum, annotation and enum constant declarations. Also, object blocks are children of the new keyword when defining anonymous inner types. -
SLIST
public static final int SLISTA list of statements. -
CTOR_DEF
public static final int CTOR_DEFA constructor declaration.For example:
public SpecialEntry(int value, String text) { this.value = value; this.text = text; }
parses as:
+--CTOR_DEF | +--MODIFIERS | +--LITERAL_PUBLIC (public) +--IDENT (SpecialEntry) +--LPAREN (() +--PARAMETERS | +--PARAMETER_DEF | +--MODIFIERS +--TYPE | +--LITERAL_INT (int) +--IDENT (value) +--COMMA (,) +--PARAMETER_DEF | +--MODIFIERS +--TYPE | +--IDENT (String) +--IDENT (text) +--RPAREN ()) +--SLIST ({) | +--EXPR | +--ASSIGN (=) | +--DOT (.) | +--LITERAL_THIS (this) +--IDENT (value) +--IDENT (value) +--SEMI (;) +--EXPR | +--ASSIGN (=) | +--DOT (.) | +--LITERAL_THIS (this) +--IDENT (text) +--IDENT (text) +--SEMI (;) +--RCURLY (})
- See Also:
-
METHOD_DEF
public static final int METHOD_DEFA method declaration. The children are modifiers, type parameters, return type, method name, parameter list, an optional throws list, and statement list. The statement list is omitted if the method declaration appears in an interface declaration. Method declarations may appear inside object blocks of class declarations, interface declarations, enum declarations, enum constant declarations or anonymous inner-class declarations.For example:
public static int square(int x) { return x*x; }
parses as:
+--METHOD_DEF | +--MODIFIERS | +--LITERAL_PUBLIC (public) +--LITERAL_STATIC (static) +--TYPE | +--LITERAL_INT (int) +--IDENT (square) +--PARAMETERS | +--PARAMETER_DEF | +--MODIFIERS +--TYPE | +--LITERAL_INT (int) +--IDENT (x) +--SLIST ({) | +--LITERAL_RETURN (return) | +--EXPR | +--STAR (*) | +--IDENT (x) +--IDENT (x) +--SEMI (;) +--RCURLY (})
-
VARIABLE_DEF
public static final int VARIABLE_DEFA field or local variable declaration. The children are modifiers, type, the identifier name, and an optional assignment statement.- See Also:
-
INSTANCE_INIT
public static final int INSTANCE_INITAn instance initializer. Zero or more instance initializers may appear in class and enum definitions. This token will be a child of the object block of the declaring type. -
STATIC_INIT
public static final int STATIC_INITA static initialization block. Zero or more static initializers may be children of the object block of a class or enum declaration (interfaces cannot have static initializers). The first and only child is a statement list. -
TYPE
public static final int TYPEA type. This is either a return type of a method or a type of a variable or field. The first child of this element is the actual type. This may be a primitive type, an identifier, a dot which is the root of a fully qualified type, or an array of any of these. The second child may be type arguments to the type. -
CLASS_DEF
public static final int CLASS_DEFA class declaration.For example:
public class MyClass implements Serializable { }
parses as:
+--CLASS_DEF | +--MODIFIERS | +--LITERAL_PUBLIC (public) +--LITERAL_CLASS (class) +--IDENT (MyClass) +--EXTENDS_CLAUSE +--IMPLEMENTS_CLAUSE | +--IDENT (Serializable) +--OBJBLOCK | +--LCURLY ({) +--RCURLY (})
-
INTERFACE_DEF
public static final int INTERFACE_DEFAn interface declaration.For example:
public interface MyInterface { }
parses as:
+--INTERFACE_DEF | +--MODIFIERS | +--LITERAL_PUBLIC (public) +--LITERAL_INTERFACE (interface) +--IDENT (MyInterface) +--EXTENDS_CLAUSE +--OBJBLOCK | +--LCURLY ({) +--RCURLY (})
-
PACKAGE_DEF
public static final int PACKAGE_DEFThe package declaration. This is optional, but if it is included, then there is only one package declaration per source file and it must be the first non-comment in the file. A package declaration may be annotated in which case the annotations comes before the rest of the declaration (and are the first children).For example:
package com.puppycrawl.tools.checkstyle.api;
parses as:
+--PACKAGE_DEF (package) | +--ANNOTATIONS +--DOT (.) | +--DOT (.) | +--DOT (.) | +--DOT (.) | +--IDENT (com) +--IDENT (puppycrawl) +--IDENT (tools) +--IDENT (checkstyle) +--IDENT (api) +--SEMI (;)
-
ARRAY_DECLARATOR
public static final int ARRAY_DECLARATORAn array declaration.If the array declaration represents a type, then the type of the array elements is the first child. Multidimensional arrays may be regarded as arrays of arrays. In other words, the first child of the array declaration is another array declaration.
For example:
int[] x;
parses as:
+--VARIABLE_DEF | +--MODIFIERS +--TYPE | +--ARRAY_DECLARATOR ([) | +--LITERAL_INT (int) +--IDENT (x) +--SEMI (;)
The array declaration may also represent an inline array definition. In this case, the first child will be either an expression specifying the length of the array or an array initialization block.
-
EXTENDS_CLAUSE
public static final int EXTENDS_CLAUSEAn extends clause. This appear as part of class and interface definitions. This element appears even if theextends
keyword is not explicitly used. The child is an optional identifier.For example:
extends java.util.LinkedList
parses as:
+--EXTENDS_CLAUSE | +--DOT (.) | +--DOT (.) | +--IDENT (java) +--IDENT (util) +--IDENT (LinkedList)
- See Also:
-
IMPLEMENTS_CLAUSE
public static final int IMPLEMENTS_CLAUSEAn implements clause. This always appears in a class or enum declaration, even if there are no implemented interfaces. The children are a comma separated list of zero or more identifiers.For example:
implements Serializable, Comparable
parses as:
+--IMPLEMENTS_CLAUSE | +--IDENT (Serializable) +--COMMA (,) +--IDENT (Comparable)
-
PARAMETERS
public static final int PARAMETERSA list of parameters to a method or constructor. The children are zero or more parameter declarations separated by commas.For example
int start, int end
parses as:
+--PARAMETERS | +--PARAMETER_DEF | +--MODIFIERS +--TYPE | +--LITERAL_INT (int) +--IDENT (start) +--COMMA (,) +--PARAMETER_DEF | +--MODIFIERS +--TYPE | +--LITERAL_INT (int) +--IDENT (end)
-
PARAMETER_DEF
public static final int PARAMETER_DEFA parameter declaration. The last parameter in a list of parameters may be variable length (indicated by the ELLIPSIS child node immediately after the TYPE child).- See Also:
-
LABELED_STAT
public static final int LABELED_STATA labeled statement.For example:
outside: ;
parses as:
+--LABELED_STAT (:) | +--IDENT (outside) +--EMPTY_STAT (;)
-
TYPECAST
public static final int TYPECASTA type-cast.For example:
(String)it.next()
parses as:
+--TYPECAST (() | +--TYPE | +--IDENT (String) +--RPAREN ()) +--METHOD_CALL (() | +--DOT (.) | +--IDENT (it) +--IDENT (next) +--ELIST +--RPAREN ())
-
INDEX_OP
public static final int INDEX_OPThe array index operator.For example:
ar[2] = 5;
parses as:
+--EXPR | +--ASSIGN (=) | +--INDEX_OP ([) | +--IDENT (ar) +--EXPR | +--NUM_INT (2) +--NUM_INT (5) +--SEMI (;)
- See Also:
-
POST_INC
public static final int POST_INCThe++
(postfix increment) operator. -
POST_DEC
public static final int POST_DECThe--
(postfix decrement) operator. -
METHOD_CALL
public static final int METHOD_CALLA method call. A method call may have type arguments however these are attached to the appropriate node in the qualified method name.For example:
Math.random()
parses as:
+--METHOD_CALL (() | +--DOT (.) | +--IDENT (Math) +--IDENT (random) +--ELIST +--RPAREN ())
- See Also:
-
METHOD_REF
public static final int METHOD_REFA reference to a method or constructor without arguments. Part of Java 8 syntax. The token should be used for subscribing for double colon literal.DOUBLE_COLON
token does not appear in the tree.For example:
String::compareToIgnoreCase
parses as:
+--METHOD_REF (::) | +--IDENT (String) +--IDENT (compareToIgnoreCase)
- See Also:
-
EXPR
public static final int EXPRAn expression. Operators with lower precedence appear at a higher level in the tree than operators with higher precedence. Parentheses are siblings to the operator they enclose.For example:
x = 4 + 3 * 5 + (30 + 26) / 4 + 5 % 4 + (1<<3);
parses as:
+--EXPR | +--ASSIGN (=) | +--IDENT (x) +--PLUS (+) | +--PLUS (+) | +--PLUS (+) | +--PLUS (+) | +--NUM_INT (4) +--STAR (*) | +--NUM_INT (3) +--NUM_INT (5) +--DIV (/) | +--LPAREN (() +--PLUS (+) | +--NUM_INT (30) +--NUM_INT (26) +--RPAREN ()) +--NUM_INT (4) +--MOD (%) | +--NUM_INT (5) +--NUM_INT (4) +--LPAREN (() +--SL (<<) | +--NUM_INT (1) +--NUM_INT (3) +--RPAREN ()) +--SEMI (;)
- See Also:
-
ARRAY_INIT
public static final int ARRAY_INITAn array initialization. This may occur as part of an array declaration or inline withnew
.For example:
int[] y = { 1, 2, };
parses as:
+--VARIABLE_DEF | +--MODIFIERS +--TYPE | +--ARRAY_DECLARATOR ([) | +--LITERAL_INT (int) +--IDENT (y) +--ASSIGN (=) | +--ARRAY_INIT ({) | +--EXPR | +--NUM_INT (1) +--COMMA (,) +--EXPR | +--NUM_INT (2) +--COMMA (,) +--RCURLY (}) +--SEMI (;)
Also consider:
int[] z = new int[] { 1, 2, };
which parses as:
+--VARIABLE_DEF | +--MODIFIERS +--TYPE | +--ARRAY_DECLARATOR ([) | +--LITERAL_INT (int) +--IDENT (z) +--ASSIGN (=) | +--EXPR | +--LITERAL_NEW (new) | +--LITERAL_INT (int) +--ARRAY_DECLARATOR ([) +--ARRAY_INIT ({) | +--EXPR | +--NUM_INT (1) +--COMMA (,) +--EXPR | +--NUM_INT (2) +--COMMA (,) +--RCURLY (})
-
IMPORT
public static final int IMPORTAn import declaration. Import declarations are option, but must appear after the package declaration and before the first type declaration.For example:
import java.io.IOException;
parses as:
+--IMPORT (import) | +--DOT (.) | +--DOT (.) | +--IDENT (java) +--IDENT (io) +--IDENT (IOException) +--SEMI (;)
-
UNARY_MINUS
public static final int UNARY_MINUSThe-
(unary minus) operator. -
UNARY_PLUS
public static final int UNARY_PLUSThe+
(unary plus) operator. -
CASE_GROUP
public static final int CASE_GROUPA group of case clauses. Case clauses with no associated statements are grouped together into a case group. The last child is a statement list containing the statements to execute upon a match.For example:
case 0: case 1: case 2: x = 3; break;
parses as:
+--CASE_GROUP | +--LITERAL_CASE (case) | +--EXPR | +--NUM_INT (0) +--LITERAL_CASE (case) | +--EXPR | +--NUM_INT (1) +--LITERAL_CASE (case) | +--EXPR | +--NUM_INT (2) +--SLIST | +--EXPR | +--ASSIGN (=) | +--IDENT (x) +--NUM_INT (3) +--SEMI (;) +--LITERAL_BREAK (break) | +--SEMI (;)
-
ELIST
public static final int ELISTAn expression list. The children are a comma separated list of expressions. -
FOR_INIT
public static final int FOR_INITA for loop initializer. This is a child ofLITERAL_FOR
. The children of this element may be a comma separated list of variable declarations, an expression list, or empty.- See Also:
-
FOR_CONDITION
public static final int FOR_CONDITIONA for loop condition. This is a child ofLITERAL_FOR
. The child of this element is an optional expression.- See Also:
-
FOR_ITERATOR
public static final int FOR_ITERATORA for loop iterator. This is a child ofLITERAL_FOR
. The child of this element is an optional expression list.- See Also:
-
EMPTY_STAT
public static final int EMPTY_STATThe empty statement. This goes in place of anSLIST
for afor
orwhile
loop body. -
FINAL
public static final int FINALThefinal
keyword.- See Also:
-
ABSTRACT
public static final int ABSTRACTTheabstract
keyword.- See Also:
-
STRICTFP
public static final int STRICTFPThestrictfp
keyword.- See Also:
-
SUPER_CTOR_CALL
public static final int SUPER_CTOR_CALLA super constructor call.- See Also:
-
CTOR_CALL
public static final int CTOR_CALLA constructor call.For example:
this(1);
parses as:
+--CTOR_CALL (this) | +--LPAREN (() +--ELIST | +--EXPR | +--NUM_INT (1) +--RPAREN ()) +--SEMI (;)
- See Also:
-
SEMI
public static final int SEMIThe statement terminator (;
). Depending on the context, this make occur as a sibling, a child, or not at all. -
RBRACK
public static final int RBRACKThe]
symbol.- See Also:
-
LITERAL_VOID
public static final int LITERAL_VOIDThevoid
keyword.- See Also:
-
LITERAL_BOOLEAN
public static final int LITERAL_BOOLEANTheboolean
keyword.- See Also:
-
LITERAL_BYTE
public static final int LITERAL_BYTEThebyte
keyword.- See Also:
-
LITERAL_CHAR
public static final int LITERAL_CHARThechar
keyword.- See Also:
-
LITERAL_SHORT
public static final int LITERAL_SHORTTheshort
keyword.- See Also:
-
LITERAL_INT
public static final int LITERAL_INTTheint
keyword.- See Also:
-
LITERAL_FLOAT
public static final int LITERAL_FLOATThefloat
keyword.- See Also:
-
LITERAL_LONG
public static final int LITERAL_LONGThelong
keyword.- See Also:
-
LITERAL_DOUBLE
public static final int LITERAL_DOUBLEThedouble
keyword.- See Also:
-
IDENT
public static final int IDENTAn identifier. These can be names of types, subpackages, fields, methods, parameters, and local variables.- See Also:
-
DOT
public static final int DOTThe.
(dot) operator.- See Also:
-
STAR
public static final int STARThe*
(multiplication or wildcard) operator. -
LITERAL_PRIVATE
public static final int LITERAL_PRIVATETheprivate
keyword.- See Also:
-
LITERAL_PUBLIC
public static final int LITERAL_PUBLICThepublic
keyword.- See Also:
-
LITERAL_PROTECTED
public static final int LITERAL_PROTECTEDTheprotected
keyword.- See Also:
-
LITERAL_STATIC
public static final int LITERAL_STATICThestatic
keyword.- See Also:
-
LITERAL_TRANSIENT
public static final int LITERAL_TRANSIENTThetransient
keyword.- See Also:
-
LITERAL_NATIVE
public static final int LITERAL_NATIVEThenative
keyword.- See Also:
-
LITERAL_SYNCHRONIZED
public static final int LITERAL_SYNCHRONIZEDThesynchronized
keyword. This may be used as a modifier of a method or in the definition of a synchronized block.For example:
synchronized(this) { x++; }
parses as:
+--LITERAL_SYNCHRONIZED (synchronized) | +--LPAREN (() +--EXPR | +--LITERAL_THIS (this) +--RPAREN ()) +--SLIST ({) | +--EXPR | +--POST_INC (++) | +--IDENT (x) +--SEMI (;) +--RCURLY (}) +--RCURLY (})
-
LITERAL_VOLATILE
public static final int LITERAL_VOLATILEThevolatile
keyword.- See Also:
-
LITERAL_CLASS
public static final int LITERAL_CLASSTheclass
keyword. This element appears both as part of a class declaration, and inline to reference a class object.For example:
int.class
parses as:
+--EXPR | +--DOT (.) | +--LITERAL_INT (int) +--LITERAL_CLASS (class)
- See Also:
-
LITERAL_INTERFACE
public static final int LITERAL_INTERFACETheinterface
keyword. This token appears in interface definition.- See Also:
-
LCURLY
public static final int LCURLYA left curly brace ({
).- See Also:
-
RCURLY
public static final int RCURLYA right curly brace (}
).- See Also:
-
COMMA
public static final int COMMAThe,
(comma) operator. -
LPAREN
public static final int LPARENA left parenthesis ((
). -
RPAREN
public static final int RPARENA right parenthesis ()
). -
LITERAL_THIS
public static final int LITERAL_THISThethis
keyword.- See Also:
-
LITERAL_SUPER
public static final int LITERAL_SUPERThesuper
keyword.- See Also:
-
ASSIGN
public static final int ASSIGNThe=
(assignment) operator. -
LITERAL_THROWS
public static final int LITERAL_THROWSThethrows
keyword. The children are a number of one or more identifiers separated by commas. -
COLON
public static final int COLONThe:
(colon) operator. This will appear as part of the conditional operator (? :
).- See Also:
-
DOUBLE_COLON
public static final int DOUBLE_COLONThe::
(double colon) separator. It is part of Java 8 syntax that is used for method reference. The token does not appear in tree,METHOD_REF
should be used instead.- See Also:
-
LITERAL_IF
public static final int LITERAL_IFTheif
keyword.For example:
if(optimistic) { message = "half full"; } else { message = "half empty"; }
parses as:
+--LITERAL_IF (if) | +--LPAREN (() +--EXPR | +--IDENT (optimistic) +--RPAREN ()) +--SLIST ({) | +--EXPR | +--ASSIGN (=) | +--IDENT (message) +--STRING_LITERAL ("half full") +--SEMI (;) +--RCURLY (}) +--LITERAL_ELSE (else) | +--SLIST ({) | +--EXPR | +--ASSIGN (=) | +--IDENT (message) +--STRING_LITERAL ("half empty") +--SEMI (;) +--RCURLY (})
- See Also:
-
LITERAL_FOR
public static final int LITERAL_FORThefor
keyword. The children are(
, an initializer, a condition, an iterator, a)
and either a statement list, a single expression, or an empty statement.For example:
for(int i = 0, n = myArray.length; i < n; i++) { }
parses as:
+--LITERAL_FOR (for) | +--LPAREN (() +--FOR_INIT | +--VARIABLE_DEF | +--MODIFIERS +--TYPE | +--LITERAL_INT (int) +--IDENT (i) +--ASSIGN (=) | +--EXPR | +--NUM_INT (0) +--COMMA (,) +--VARIABLE_DEF | +--MODIFIERS +--TYPE | +--LITERAL_INT (int) +--IDENT (n) +--ASSIGN (=) | +--EXPR | +--DOT (.) | +--IDENT (myArray) +--IDENT (length) +--SEMI (;) +--FOR_CONDITION | +--EXPR | +--LT (<) | +--IDENT (i) +--IDENT (n) +--SEMI (;) +--FOR_ITERATOR | +--ELIST | +--EXPR | +--POST_INC (++) | +--IDENT (i) +--RPAREN ()) +--SLIST ({) | +--RCURLY (})
-
LITERAL_WHILE
public static final int LITERAL_WHILEThewhile
keyword.For example:
while(line != null) { process(line); line = in.readLine(); }
parses as:
+--LITERAL_WHILE (while) | +--LPAREN (() +--EXPR | +--NOT_EQUAL (!=) | +--IDENT (line) +--LITERAL_NULL (null) +--RPAREN ()) +--SLIST ({) | +--EXPR | +--METHOD_CALL (() | +--IDENT (process) +--ELIST | +--EXPR | +--IDENT (line) +--RPAREN ()) +--SEMI (;) +--EXPR | +--ASSIGN (=) | +--IDENT (line) +--METHOD_CALL (() | +--DOT (.) | +--IDENT (in) +--IDENT (readLine) +--ELIST +--RPAREN ()) +--SEMI (;) +--RCURLY (})
- See Also:
-
LITERAL_DO
public static final int LITERAL_DOThedo
keyword. Note the the while token does not appear as part of the do-while construct.For example:
do { x = rand.nextInt(10); } while(x < 5);
parses as:
+--LITERAL_DO (do) | +--SLIST ({) | +--EXPR | +--ASSIGN (=) | +--IDENT (x) +--METHOD_CALL (() | +--DOT (.) | +--IDENT (rand) +--IDENT (nextInt) +--ELIST | +--EXPR | +--NUM_INT (10) +--RPAREN ()) +--SEMI (;) +--RCURLY (}) +--DO_WHILE (while) +--LPAREN (() +--EXPR | +--LT (<) | +--IDENT (x) +--NUM_INT (5) +--RPAREN ()) +--SEMI (;)
- See Also:
-
DO_WHILE
public static final int DO_WHILELiteralwhile
in do-while loop.- See Also:
-
LITERAL_BREAK
public static final int LITERAL_BREAKThebreak
keyword. The first child is an optional identifier and the last child is a semicolon.- See Also:
-
LITERAL_CONTINUE
public static final int LITERAL_CONTINUEThecontinue
keyword. The first child is an optional identifier and the last child is a semicolon.- See Also:
-
LITERAL_RETURN
public static final int LITERAL_RETURNThereturn
keyword. The first child is an optional expression for the return value. The last child is a semi colon.- See Also:
-
LITERAL_SWITCH
public static final int LITERAL_SWITCHTheswitch
keyword.For example:
switch(type) { case 0: background = Color.blue; break; case 1: background = Color.red; break; default: background = Color.green; break; }
parses as:
+--LITERAL_SWITCH (switch) | +--LPAREN (() +--EXPR | +--IDENT (type) +--RPAREN ()) +--LCURLY ({) +--CASE_GROUP | +--LITERAL_CASE (case) | +--EXPR | +--NUM_INT (0) +--SLIST | +--EXPR | +--ASSIGN (=) | +--IDENT (background) +--DOT (.) | +--IDENT (Color) +--IDENT (blue) +--SEMI (;) +--LITERAL_BREAK (break) | +--SEMI (;) +--CASE_GROUP | +--LITERAL_CASE (case) | +--EXPR | +--NUM_INT (1) +--SLIST | +--EXPR | +--ASSIGN (=) | +--IDENT (background) +--DOT (.) | +--IDENT (Color) +--IDENT (red) +--SEMI (;) +--LITERAL_BREAK (break) | +--SEMI (;) +--CASE_GROUP | +--LITERAL_DEFAULT (default) +--SLIST | +--EXPR | +--ASSIGN (=) | +--IDENT (background) +--DOT (.) | +--IDENT (Color) +--IDENT (green) +--SEMI (;) +--LITERAL_BREAK (break) | +--SEMI (;) +--RCURLY (})
-
LITERAL_THROW
public static final int LITERAL_THROWThethrow
keyword. The first child is an expression that evaluates to aThrowable
instance. -
LITERAL_ELSE
public static final int LITERAL_ELSETheelse
keyword. This appears as a child of anif
statement.- See Also:
-
LITERAL_CASE
public static final int LITERAL_CASEThecase
keyword. The first child is a constant expression that evaluates to an integer.- See Also:
-
LITERAL_DEFAULT
public static final int LITERAL_DEFAULTThedefault
keyword. This element has no children.- See Also:
-
LITERAL_TRY
public static final int LITERAL_TRYThetry
keyword. The children are a statement list, zero or more catch blocks and then an optional finally block.For example:
try { FileReader in = new FileReader("abc.txt"); } catch(IOException ioe) { } finally { }
parses as:
+--LITERAL_TRY (try) | +--SLIST ({) | +--VARIABLE_DEF | +--MODIFIERS +--TYPE | +--IDENT (FileReader) +--IDENT (in) +--ASSIGN (=) | +--EXPR | +--LITERAL_NEW (new) | +--IDENT (FileReader) +--LPAREN (() +--ELIST | +--EXPR | +--STRING_LITERAL ("abc.txt") +--RPAREN ()) +--SEMI (;) +--RCURLY (}) +--LITERAL_CATCH (catch) | +--LPAREN (() +--PARAMETER_DEF | +--MODIFIERS +--TYPE | +--IDENT (IOException) +--IDENT (ioe) +--RPAREN ()) +--SLIST ({) | +--RCURLY (}) +--LITERAL_FINALLY (finally) | +--SLIST ({) | +--RCURLY (}) +--RCURLY (})
-
RESOURCE_SPECIFICATION
public static final int RESOURCE_SPECIFICATIONThe Java 7 try-with-resources construct.For example:
try (Foo foo = new Foo(); Bar bar = new Bar()) { }
parses as:
+--LITERAL_TRY (try) | +--RESOURCE_SPECIFICATION | +--LPAREN (() +--RESOURCES | +--RESOURCE | +--MODIFIERS +--TYPE | +--IDENT (Foo) +--IDENT (foo) +--ASSIGN (=) +--EXPR | +--LITERAL_NEW (new) | +--IDENT (Foo) +--LPAREN (() +--ELIST +--RPAREN ()) +--SEMI (;) +--RESOURCE | +--MODIFIERS +--TYPE | +--IDENT (Bar) +--IDENT (bar) +--ASSIGN (=) +--EXPR | +--LITERAL_NEW (new) | +--IDENT (Bar) +--LPAREN (() +--ELIST +--RPAREN ()) +--RPAREN ()) +--SLIST ({) +--RCURLY (})
Also consider:
try (BufferedReader br = new BufferedReader(new FileReader(path))) { return br.readLine(); }
which parses as:
+--LITERAL_TRY (try) | +--RESOURCE_SPECIFICATION | +--LPAREN (() +--RESOURCES | +--RESOURCE | +--MODIFIERS +--TYPE | +--IDENT (BufferedReader) +--IDENT (br) +--ASSIGN (=) +--EXPR | +--LITERAL_NEW (new) | +--IDENT (FileReader) +--LPAREN (() +--ELIST | +--EXPR | +--LITERAL_NEW (new) | +--IDENT (BufferedReader) +--LPAREN (() +--ELIST | +--EXPR | +--IDENT (path) +--RPAREN ()) +--RPAREN ()) +--RPAREN ()) +--SLIST ({) | +--LITERAL_RETURN (return) | +--EXPR | +--METHOD_CALL (() | +--DOT (.) | +--IDENT (br) +--IDENT (readLine) +--ELIST +--RPAREN ()) +--SEMI (;) +--RCURLY (})
-
RESOURCES
public static final int RESOURCESA list of resources in the Java 7 try-with-resources construct. This is a child of RESOURCE_SPECIFICATION.- See Also:
-
RESOURCE
public static final int RESOURCEA resource in the Java 7 try-with-resources construct. This is a child of RESOURCES. -
LITERAL_CATCH
public static final int LITERAL_CATCHThecatch
keyword. -
LITERAL_FINALLY
public static final int LITERAL_FINALLYThefinally
keyword.- See Also:
-
PLUS_ASSIGN
public static final int PLUS_ASSIGNThe+=
(addition assignment) operator. -
MINUS_ASSIGN
public static final int MINUS_ASSIGNThe-=
(subtraction assignment) operator. -
STAR_ASSIGN
public static final int STAR_ASSIGNThe*=
(multiplication assignment) operator. -
DIV_ASSIGN
public static final int DIV_ASSIGNThe/=
(division assignment) operator. -
MOD_ASSIGN
public static final int MOD_ASSIGNThe%=
(remainder assignment) operator. -
SR_ASSIGN
public static final int SR_ASSIGNThe>>=
(signed right shift assignment) operator. -
BSR_ASSIGN
public static final int BSR_ASSIGNThe>>>=
(unsigned right shift assignment) operator. -
SL_ASSIGN
public static final int SL_ASSIGNThe<<=
(left shift assignment) operator. -
BAND_ASSIGN
public static final int BAND_ASSIGNThe&=
(bitwise AND assignment) operator. -
BXOR_ASSIGN
public static final int BXOR_ASSIGNThe^=
(bitwise exclusive OR assignment) operator. -
BOR_ASSIGN
public static final int BOR_ASSIGNThe|=
(bitwise OR assignment) operator. -
QUESTION
public static final int QUESTIONThe?
(conditional) operator. Technically, the colon is also part of this operator, but it appears as a separate token.For example:
(quantity == 1) ? "": "s"
parses as:
+--QUESTION (?) | +--LPAREN (() +--EQUAL (==) | +--IDENT (quantity) +--NUM_INT (1) +--RPAREN ()) +--STRING_LITERAL ("") +--COLON (:) +--STRING_LITERAL ("s")
-
LOR
public static final int LORThe||
(conditional OR) operator. -
LAND
public static final int LANDThe&&
(conditional AND) operator. -
BOR
public static final int BORThe|
(bitwise OR) operator. -
BXOR
public static final int BXORThe^
(bitwise exclusive OR) operator. -
BAND
public static final int BANDThe&
(bitwise AND) operator. -
NOT_EQUAL
public static final int NOT_EQUALThe!=
(not equal) operator.- See Also:
-
EQUAL
public static final int EQUALThe==
(equal) operator.- See Also:
-
LT
public static final int LTThe<
(less than) operator.- See Also:
-
GT
public static final int GTThe>
(greater than) operator.- See Also:
-
LE
public static final int LEThe<=
(less than or equal) operator.- See Also:
-
GE
public static final int GEThe>=
(greater than or equal) operator.- See Also:
-
LITERAL_INSTANCEOF
public static final int LITERAL_INSTANCEOFTheinstanceof
operator. The first child is an object reference or something that evaluates to an object reference. The second child is a reference type. -
SL
public static final int SLThe<<
(shift left) operator. -
SR
public static final int SRThe>>
(signed shift right) operator. -
BSR
public static final int BSRThe>>>
(unsigned shift right) operator. -
PLUS
public static final int PLUSThe+
(addition) operator. -
MINUS
public static final int MINUSThe-
(subtraction) operator. -
DIV
public static final int DIVThe/
(division) operator. -
MOD
public static final int MODThe%
(remainder) operator. -
INC
public static final int INCThe++
(prefix increment) operator. -
DEC
public static final int DECThe--
(prefix decrement) operator. -
BNOT
public static final int BNOTThe~
(bitwise complement) operator. -
LNOT
public static final int LNOTThe!
(logical complement) operator. -
LITERAL_TRUE
public static final int LITERAL_TRUEThetrue
keyword. -
LITERAL_FALSE
public static final int LITERAL_FALSEThefalse
keyword. -
LITERAL_NULL
public static final int LITERAL_NULLThenull
keyword. -
LITERAL_NEW
public static final int LITERAL_NEWThenew
keyword. This element is used to define new instances of objects, new arrays, and new anonymous inner classes.For example:
new ArrayList(50)
parses as:
+--LITERAL_NEW (new) | +--IDENT (ArrayList) +--LPAREN (() +--ELIST | +--EXPR | +--NUM_INT (50) +--RPAREN ())
For example:
new float[] { 3.0f, 4.0f };
parses as:
+--LITERAL_NEW (new) | +--LITERAL_FLOAT (float) +--ARRAY_DECLARATOR ([) +--ARRAY_INIT ({) | +--EXPR | +--NUM_FLOAT (3.0f) +--COMMA (,) +--EXPR | +--NUM_FLOAT (4.0f) +--RCURLY (})
For example:
new FilenameFilter() { public boolean accept(File dir, String name) { return name.endsWith(".java"); } }
parses as:
+--LITERAL_NEW (new) | +--IDENT (FilenameFilter) +--LPAREN (() +--ELIST +--RPAREN ()) +--OBJBLOCK | +--LCURLY ({) +--METHOD_DEF | +--MODIFIERS | +--LITERAL_PUBLIC (public) +--TYPE | +--LITERAL_BOOLEAN (boolean) +--IDENT (accept) +--PARAMETERS | +--PARAMETER_DEF | +--MODIFIERS +--TYPE | +--IDENT (File) +--IDENT (dir) +--COMMA (,) +--PARAMETER_DEF | +--MODIFIERS +--TYPE | +--IDENT (String) +--IDENT (name) +--SLIST ({) | +--LITERAL_RETURN (return) | +--EXPR | +--METHOD_CALL (() | +--DOT (.) | +--IDENT (name) +--IDENT (endsWith) +--ELIST | +--EXPR | +--STRING_LITERAL (".java") +--RPAREN ()) +--SEMI (;) +--RCURLY (}) +--RCURLY (})
-
NUM_INT
public static final int NUM_INTAn integer literal. These may be specified in decimal, hexadecimal, or octal form. -
CHAR_LITERAL
public static final int CHAR_LITERALA character literal. This is a (possibly escaped) character enclosed in single quotes. -
STRING_LITERAL
public static final int STRING_LITERALA string literal. This is a sequence of (possibly escaped) characters enclosed in double quotes. -
NUM_FLOAT
public static final int NUM_FLOATA single precision floating point literal. This is a floating point number with anF
orf
suffix. -
NUM_LONG
public static final int NUM_LONGA long integer literal. These are almost the same as integer literals, but they have anL
orl
(ell) suffix. -
NUM_DOUBLE
public static final int NUM_DOUBLEA double precision floating point literal. This is a floating point number with an optionalD
ord
suffix. -
LITERAL_ASSERT
public static final int LITERAL_ASSERTTheassert
keyword. This is only for Java 1.4 and later.For example:
assert(x==4);
parses as:
+--LITERAL_ASSERT (assert) | +--EXPR | +--LPAREN (() +--EQUAL (==) | +--IDENT (x) +--NUM_INT (4) +--RPAREN ()) +--SEMI (;)
- See Also:
-
STATIC_IMPORT
public static final int STATIC_IMPORTA static import declaration. Static import declarations are optional, but must appear after the package declaration and before the type declaration.For example:
import static java.io.IOException;
parses as:
+--STATIC_IMPORT (import) | +--LITERAL_STATIC +--DOT (.) | +--DOT (.) | +--IDENT (java) +--IDENT (io) +--IDENT (IOException) +--SEMI (;)
- See Also:
-
ENUM_DEF
public static final int ENUM_DEFAn enum declaration. Its notable children are enum constant declarations followed by any construct that may be expected in a class body.For example:
public enum MyEnum implements Serializable { FIRST_CONSTANT, SECOND_CONSTANT; public void someMethod() { } }
parses as:
+--ENUM_DEF | +--MODIFIERS | +--LITERAL_PUBLIC (public) +--ENUM (enum) +--IDENT (MyEnum) +--EXTENDS_CLAUSE +--IMPLEMENTS_CLAUSE | +--IDENT (Serializable) +--OBJBLOCK | +--LCURLY ({) +--ENUM_CONSTANT_DEF | +--IDENT (FIRST_CONSTANT) +--COMMA (,) +--ENUM_CONSTANT_DEF | +--IDENT (SECOND_CONSTANT) +--SEMI (;) +--METHOD_DEF | +--MODIFIERS | +--LITERAL_PUBLIC (public) +--TYPE | +--LITERAL_void (void) +--IDENT (someMethod) +--LPAREN (() +--PARAMETERS +--RPAREN ()) +--SLIST ({) | +--RCURLY (}) +--RCURLY (})
-
ENUM
public static final int ENUMTheenum
keyword. This element appears as part of an enum declaration.- See Also:
-
ENUM_CONSTANT_DEF
public static final int ENUM_CONSTANT_DEFAn enum constant declaration. Its notable children are annotations, arguments and object block akin to an anonymous inner class' body.For example:
SOME_CONSTANT(1) { public void someMethodOverriddenFromMainBody() { } }
parses as:
+--ENUM_CONSTANT_DEF | +--ANNOTATIONS +--IDENT (SOME_CONSTANT) +--LPAREN (() +--ELIST | +--EXPR | +--NUM_INT (1) +--RPAREN ()) +--OBJBLOCK | +--LCURLY ({) | +--METHOD_DEF | +--MODIFIERS | +--LITERAL_PUBLIC (public) +--TYPE | +--LITERAL_void (void) +--IDENT (someMethodOverriddenFromMainBody) +--LPAREN (() +--PARAMETERS +--RPAREN ()) +--SLIST ({) | +--RCURLY (}) +--RCURLY (})
-
FOR_EACH_CLAUSE
public static final int FOR_EACH_CLAUSEA for-each clause. This is a child ofLITERAL_FOR
. The children of this element may be a parameter definition, the colon literal and an expression.For example:
for (int value : values) { doSmth(); }
parses as:
--LITERAL_FOR (for) |--LPAREN (() |--FOR_EACH_CLAUSE | |--VARIABLE_DEF | | |--MODIFIERS | | |--TYPE | | | `--LITERAL_INT (int) | | `--IDENT (value) | |--COLON (:) | `--EXPR | `--IDENT (values |--RPAREN ()) `--SLIST ({) |--EXPR | `--METHOD_CALL (() | |--IDENT (doSmth) | |--ELIST | `--RPAREN ()) |--SEMI (;) `--RCURLY (})
- See Also:
-
ANNOTATION_DEF
public static final int ANNOTATION_DEFAn annotation declaration. The notable children are the name of the annotation type, annotation field declarations and (constant) fields.For example:
public @interface MyAnnotation { int someValue(); }
parses as:
+--ANNOTATION_DEF | +--MODIFIERS | +--LITERAL_PUBLIC (public) +--AT (@) +--LITERAL_INTERFACE (interface) +--IDENT (MyAnnotation) +--OBJBLOCK | +--LCURLY ({) +--ANNOTATION_FIELD_DEF | +--MODIFIERS +--TYPE | +--LITERAL_INT (int) +--IDENT (someValue) +--LPAREN (() +--RPAREN ()) +--SEMI (;) +--RCURLY (})
-
ANNOTATION_FIELD_DEF
public static final int ANNOTATION_FIELD_DEFAn annotation field declaration. The notable children are modifiers, field type, field name and an optional default value (a conditional compile-time constant expression). Default values may also by annotations.For example:
String someField() default "Hello world";
parses as:
+--ANNOTATION_FIELD_DEF | +--MODIFIERS +--TYPE | +--IDENT (String) +--IDENT (someField) +--LPAREN (() +--RPAREN ()) +--LITERAL_DEFAULT (default) +--STRING_LITERAL ("Hello world") +--SEMI (;)
- See Also:
-
ANNOTATIONS
public static final int ANNOTATIONSA collection of annotations on a package or enum constant. A collections of annotations will only occur on these nodes as all other nodes that may be qualified with an annotation can be qualified with any other modifier and hence these annotations would be contained in aMODIFIERS
node.For example:
@MyAnnotation package blah;
parses as:
+--PACKAGE_DEF (package) | +--ANNOTATIONS | +--ANNOTATION | +--AT (@) +--IDENT (MyAnnotation) +--IDENT (blah) +--SEMI (;)
- See Also:
-
ANNOTATION
public static final int ANNOTATIONAn annotation of a package, type, field, parameter or variable. An annotation may occur anywhere modifiers occur (it is a type of modifier) and may also occur prior to a package definition. The notable children are: The annotation name and either a single default annotation value or a sequence of name value pairs. Annotation values may also be annotations themselves.For example:
@MyAnnotation(someField1 = "Hello", someField2 = @SomeOtherAnnotation)
parses as:
+--ANNOTATION | +--AT (@) +--IDENT (MyAnnotation) +--LPAREN (() +--ANNOTATION_MEMBER_VALUE_PAIR | +--IDENT (someField1) +--ASSIGN (=) +--ANNOTATION | +--AT (@) +--IDENT (SomeOtherAnnotation) +--ANNOTATION_MEMBER_VALUE_PAIR | +--IDENT (someField2) +--ASSIGN (=) +--STRING_LITERAL ("Hello") +--RPAREN ())
-
ANNOTATION_MEMBER_VALUE_PAIR
public static final int ANNOTATION_MEMBER_VALUE_PAIRAn initialization of an annotation member with a value. Its children are the name of the member, the assignment literal and the (compile-time constant conditional expression) value.- See Also:
-
ANNOTATION_ARRAY_INIT
public static final int ANNOTATION_ARRAY_INITAn annotation array member initialization. Initializers can not be nested. An initializer may be present as a default to an annotation member, as the single default value to an annotation (e.g. @Annotation({1,2})) or as the value of an annotation member value pair.For example:
{ 1, 2 }
parses as:
+--ANNOTATION_ARRAY_INIT ({) | +--NUM_INT (1) +--COMMA (,) +--NUM_INT (2) +--RCURLY (})
-
TYPE_PARAMETERS
public static final int TYPE_PARAMETERSA list of type parameters to a class, interface or method definition. Children are LT, at least one TYPE_PARAMETER, zero or more of: a COMMAs followed by a single TYPE_PARAMETER and a final GT.For example:
public class Blah<A, B> { }
parses as:
+--CLASS_DEF ({) | +--MODIFIERS | +--LITERAL_PUBLIC (public) +--LITERAL_CLASS (class) +--IDENT (Blah) +--TYPE_PARAMETERS | +--GENERIC_START (<) +--TYPE_PARAMETER | +--IDENT (A) +--COMMA (,) +--TYPE_PARAMETER | +--IDENT (B) +--GENERIC_END (>) +--OBJBLOCK | +--LCURLY ({) +--NUM_INT (1) +--COMMA (,) +--NUM_INT (2) +--RCURLY (})
-
TYPE_PARAMETER
public static final int TYPE_PARAMETERA type parameter to a class, interface or method definition. Children are the type name and an optional TYPE_UPPER_BOUNDS.For example:
A extends Collection
parses as:
+--TYPE_PARAMETER | +--IDENT (A) +--TYPE_UPPER_BOUNDS | +--IDENT (Collection)
-
TYPE_ARGUMENTS
public static final int TYPE_ARGUMENTSA list of type arguments to a type reference or a method/ctor invocation. Children are GENERIC_START, at least one TYPE_ARGUMENT, zero or more of a COMMAs followed by a single TYPE_ARGUMENT, and a final GENERIC_END.For example:
public Collection<?> a;
parses as:
+--VARIABLE_DEF | +--MODIFIERS | +--LITERAL_PUBLIC (public) +--TYPE | +--IDENT (Collection) | +--TYPE_ARGUMENTS | +--GENERIC_START (<) +--TYPE_ARGUMENT | +--WILDCARD_TYPE (?) +--GENERIC_END (>) +--IDENT (a) +--SEMI (;)
-
TYPE_ARGUMENT
public static final int TYPE_ARGUMENTA type arguments to a type reference or a method/ctor invocation. Children are either: type name or wildcard type with possible type upper or lower bounds.For example:
? super List
parses as:
+--TYPE_ARGUMENT | +--WILDCARD_TYPE (?) +--TYPE_LOWER_BOUNDS | +--IDENT (List)
-
WILDCARD_TYPE
public static final int WILDCARD_TYPEThe type that refers to all types. This node has no children. -
TYPE_UPPER_BOUNDS
public static final int TYPE_UPPER_BOUNDSAn upper bounds on a wildcard type argument or type parameter. This node has one child - the type that is being used for the bounding. -
TYPE_LOWER_BOUNDS
public static final int TYPE_LOWER_BOUNDSA lower bounds on a wildcard type argument. This node has one child - the type that is being used for the bounding.- See Also:
-
AT
public static final int ATAn@
symbol - signifying an annotation instance or the prefix to the interface literal signifying the definition of an annotation declaration.- See Also:
-
ELLIPSIS
public static final int ELLIPSISA triple dot for variable-length parameters. This token only ever occurs in a parameter declaration immediately after the type of the parameter.- See Also:
-
TYPE_EXTENSION_AND
public static final int TYPE_EXTENSION_ANDThe&
symbol when used to extend a generic upper or lower bounds constrain or a type cast expression with an additional interface.Generic type bounds extension:
class Comparable<T extends Serializable & CharSequence>
CLASS_DEF |--MODIFIERS |--LITERAL_CLASS (class) |--IDENT (Comparable) +--TYPE_PARAMETERS |--GENERIC_START (<) |--TYPE_PARAMETER | |--IDENT (T) | +--TYPE_UPPER_BOUNDS (extends) | |--IDENT (Serializable) | |--TYPE_EXTENSION_AND (&) | +--IDENT (CharSequence) +--GENERIC_END (>)
Type cast extension:
return (CheckedFunction & Serializable) null;
LITERAL_RETURN (return) |--EXPR | +--TYPECAST (() | |--TYPE | | +--IDENT (CheckedFunction) | |--TYPE_EXTENSION_AND (&) | |--TYPE | | +--IDENT (Serializable) | |--RPAREN ()) | +--LITERAL_NULL (null) +--SEMI (;)
-
GENERIC_START
public static final int GENERIC_STARTA<
symbol signifying the start of type arguments or type parameters.- See Also:
-
GENERIC_END
public static final int GENERIC_ENDA>
symbol signifying the end of type arguments or type parameters.- See Also:
-
LAMBDA
public static final int LAMBDASpecial lambda symbol->
.- See Also:
-
SINGLE_LINE_COMMENT
public static final int SINGLE_LINE_COMMENTBeginning of single line comment: '//'.+--SINGLE_LINE_COMMENT | +--COMMENT_CONTENT
- See Also:
-
BLOCK_COMMENT_BEGIN
public static final int BLOCK_COMMENT_BEGINBeginning of block comment: '/*'.+--BLOCK_COMMENT_BEGIN | +--COMMENT_CONTENT +--BLOCK_COMMENT_END
- See Also:
-
BLOCK_COMMENT_END
public static final int BLOCK_COMMENT_ENDEnd of block comment: '*/'.+--BLOCK_COMMENT_BEGIN | +--COMMENT_CONTENT +--BLOCK_COMMENT_END
- See Also:
-
COMMENT_CONTENT
public static final int COMMENT_CONTENTText of single-line or block comment.+--SINGLE_LINE_COMMENT | +--COMMENT_CONTENT
+--BLOCK_COMMENT_BEGIN | +--COMMENT_CONTENT +--BLOCK_COMMENT_END
- See Also:
-
PATTERN_VARIABLE_DEF
public static final int PATTERN_VARIABLE_DEFA pattern variable definition; when conditionally matched, this variable is assigned with the defined type.For example:
if (obj instanceof String str) { }
parses as:
LITERAL_IF (if) |--LPAREN (() |--EXPR | `--LITERAL_INSTANCEOF (instanceof) | |--IDENT (obj) | `--PATTERN_VARIABLE_DEF | |--TYPE | | `--IDENT (String) | `--IDENT (str) |--RPAREN ()) `--SLIST ({) `--RCURLY (})
- Since:
- 8.35
- See Also:
-
LITERAL_RECORD
public static final int LITERAL_RECORDTherecord
keyword. This element appears as part of a record declaration.- Since:
- 8.35
- See Also:
-
RECORD_DEF
public static final int RECORD_DEFA declaration of a record specifies a name, a header, and a body. The header lists the components of the record, which are the variables that make up its state.For example:
public record myRecord () {}
parses as:
RECORD_DEF |--MODIFIERS | `--LITERAL_PUBLIC (public) |--LITERAL_RECORD (record) |--IDENT (myRecord) |--LPAREN (() |--RECORD_COMPONENTS |--RPAREN ()) `--OBJBLOCK |--LCURLY ({) `--RCURLY (})
- Since:
- 8.35
- See Also:
-
RECORD_COMPONENTS
public static final int RECORD_COMPONENTSRecord components are a (possibly empty) list containing the components of a record, which are the variables that make up its state.For example:
public record myRecord (Comp x, Comp y) { }
parses as:
RECORD_DEF |--MODIFIERS | `--LITERAL_PUBLIC (public) |--LITERAL_RECORD (record) |--IDENT (myRecord) |--LPAREN (() |--RECORD_COMPONENTS | |--RECORD_COMPONENT_DEF | | |--ANNOTATIONS | | |--TYPE | | | `--IDENT (Comp) | | `--IDENT (x) | |--COMMA (,) | `--RECORD_COMPONENT_DEF | |--ANNOTATIONS | |--TYPE | | `--IDENT (Comp) | `--IDENT (y) |--RPAREN ()) `--OBJBLOCK |--LCURLY ({) `--RCURLY (})
- Since:
- 8.36
- See Also:
-
RECORD_COMPONENT_DEF
public static final int RECORD_COMPONENT_DEFA record component is a variable that comprises the state of a record. Record components have annotations (possibly), a type definition, and an identifier. They can also be of variable arity ('...').For example:
public record myRecord (Comp x, Comp... comps) { }
parses as:
RECORD_DEF |--MODIFIERS | `--LITERAL_PUBLIC (public) |--LITERAL_RECORD (record) |--IDENT (myRecord) |--LPAREN (() |--RECORD_COMPONENTS | |--RECORD_COMPONENT_DEF | | |--ANNOTATIONS | | |--TYPE | | | `--IDENT (Comp) | | `--IDENT (x) | |--COMMA (,) | `--RECORD_COMPONENT_DEF | |--ANNOTATIONS | |--TYPE | | `--IDENT (Comp) | |--ELLIPSIS (...) | `--IDENT (comps) |--RPAREN ()) `--OBJBLOCK |--LCURLY ({) `--RCURLY (})
- Since:
- 8.36
- See Also:
-
COMPACT_CTOR_DEF
public static final int COMPACT_CTOR_DEFA compact canonical constructor eliminates the list of formal parameters; they are declared implicitly.For example:
public record myRecord () { public myRecord{} }
parses as:
RECORD_DEF |--MODIFIERS | `--LITERAL_PUBLIC (public) |--LITERAL_RECORD (record) |--IDENT (myRecord) |--LPAREN (() |--RECORD_COMPONENTS |--RPAREN ()) `--OBJBLOCK |--LCURLY ({) |--COMPACT_CTOR_DEF | |--MODIFIERS | | `--LITERAL_PUBLIC (public) | |--IDENT (myRecord) | `--SLIST ({) | `--RCURLY (}) `--RCURLY (})
- Since:
- 8.36
- See Also:
-
TEXT_BLOCK_LITERAL_BEGIN
public static final int TEXT_BLOCK_LITERAL_BEGINBeginning of a Java 14 Text Block literal, delimited by three double quotes.For example:
String hello = """ Hello, world! """;
parses as:
|--VARIABLE_DEF | |--MODIFIERS | |--TYPE | | `--IDENT (String) | |--IDENT (hello) | |--ASSIGN (=) | | `--EXPR | | `--TEXT_BLOCK_LITERAL_BEGIN (""") | | |--TEXT_BLOCK_CONTENT (\n Hello, world!\n ) | | `--TEXT_BLOCK_LITERAL_END (""") | `--SEMI (;)
- Since:
- 8.36
- See Also:
-
TEXT_BLOCK_CONTENT
public static final int TEXT_BLOCK_CONTENTContent of a Java 14 text block. This is a sequence of characters, possibly escaped with '\'. Actual line terminators are represented by '\n'.For example:
String hello = """ Hello, world! """;
parses as:
|--VARIABLE_DEF | |--MODIFIERS | |--TYPE | | `--IDENT (String) | |--IDENT (hello) | |--ASSIGN (=) | | `--EXPR | | `--TEXT_BLOCK_LITERAL_BEGIN (""") | | |--TEXT_BLOCK_CONTENT (\n Hello, world!\n ) | | `--TEXT_BLOCK_LITERAL_END (""") | `--SEMI (;)
- Since:
- 8.36
- See Also:
-
TEXT_BLOCK_LITERAL_END
public static final int TEXT_BLOCK_LITERAL_ENDEnd of a Java 14 text block literal, delimited by three double quotes.For example:
String hello = """ Hello, world! """;
parses as:
|--VARIABLE_DEF | |--MODIFIERS | |--TYPE | | `--IDENT (String) | |--IDENT (hello) | |--ASSIGN (=) | | `--EXPR | | `--TEXT_BLOCK_LITERAL_BEGIN (""") | | |--TEXT_BLOCK_CONTENT (\n Hello, world!\n ) | | `--TEXT_BLOCK_LITERAL_END (""") | `--SEMI (;)
- Since:
- 8.36
- See Also:
-
LITERAL_YIELD
public static final int LITERAL_YIELDTheyield
keyword. This element appears as part of a yield statement.For example:
int yield = 0; // not a keyword here return switch (mode) { case "a", "b": yield 1; default: yield - 1; };
parses as:
|--VARIABLE_DEF | |--MODIFIERS | |--TYPE | | `--LITERAL_INT (int) | |--IDENT (yield) | `--ASSIGN (=) | `--EXPR | `--NUM_INT (0) |--SEMI (;) |--LITERAL_RETURN (return) | |--EXPR | | `--LITERAL_SWITCH (switch) | | |--LPAREN (() | | |--EXPR | | | `--IDENT (mode) | | |--RPAREN ()) | | |--LCURLY ({) | | |--CASE_GROUP | | | |--LITERAL_CASE (case) | | | | |--EXPR | | | | | `--STRING_LITERAL ("a") | | | | |--COMMA (,) | | | | |--EXPR | | | | | `--STRING_LITERAL ("b") | | | | `--COLON (:) | | | `--SLIST | | | `--LITERAL_YIELD (yield) | | | |--EXPR | | | | `--NUM_INT (1) | | | `--SEMI (;) | | |--CASE_GROUP | | | |--LITERAL_DEFAULT (default) | | | | `--COLON (:) | | | `--SLIST | | | `--LITERAL_YIELD (yield) | | | |--EXPR | | | | `--UNARY_MINUS (-) | | | | `--NUM_INT (1) | | | `--SEMI (;) | | `--RCURLY (}) | `--SEMI (;)
- Since:
- 8.36
- See Also:
-
SWITCH_RULE
public static final int SWITCH_RULESwitch Expressions.For example:
return switch (day) { case SAT, SUN
->
"Weekend"; default->
"Working day"; };parses as:
LITERAL_RETURN (return) |--EXPR | `--LITERAL_SWITCH (switch) | |--LPAREN (() | |--EXPR | | `--IDENT (day) | |--RPAREN ()) | |--LCURLY ({) | |--SWITCH_RULE | | |--LITERAL_CASE (case) | | | |--EXPR | | | | `--IDENT (SAT) | | | |--COMMA (,) | | | `--EXPR | | | `--IDENT (SUN) | | |--LAMBDA
->
| | |--EXPR | | | `--STRING_LITERAL ("Weekend") | | `--SEMI (;) | |--SWITCH_RULE | | |--LITERAL_DEFAULT (default) | | |--LAMBDA->
| | |--EXPR | | | `--STRING_LITERAL ("Working day") | | `--SEMI (;) | `--RCURLY (}) `--SEMI (;)
-