Class TokenTypes


  • public final class TokenTypes
    extends java.lang.Object
    Contains the constants for all the tokens contained in the Abstract Syntax Tree.

    Implementation detail: This class has been introduced to break the circular dependency between packages.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int ABSTRACT
      The abstract keyword.
      static int ANNOTATION
      An annotation of a package, type, field, parameter or variable.
      static int ANNOTATION_ARRAY_INIT
      An annotation array member initialization.
      static int ANNOTATION_DEF
      An annotation declaration.
      static int ANNOTATION_FIELD_DEF
      An annotation field declaration.
      static int ANNOTATION_MEMBER_VALUE_PAIR
      An initialization of an annotation member with a value.
      static int ANNOTATIONS
      A collection of annotations on a package or enum constant.
      static int ARRAY_DECLARATOR
      An array declaration.
      static int ARRAY_INIT
      An array initialization.
      static int ASSIGN
      The = (assignment) operator.
      static int AT
      An @ symbol - signifying an annotation instance or the prefix to the interface literal signifying the definition of an annotation declaration.
      static int BAND
      The & (bitwise AND) operator.
      static int BAND_ASSIGN
      The &= (bitwise AND assignment) operator.
      static int BLOCK_COMMENT_BEGIN
      Beginning of block comment: '/*'.
      static int BLOCK_COMMENT_END
      End of block comment: '*/'.
      static int BNOT
      The ~ (bitwise complement) operator.
      static int BOR
      The | (bitwise OR) operator.
      static int BOR_ASSIGN
      The |= (bitwise OR assignment) operator.
      static int BSR
      The >>> (unsigned shift right) operator.
      static int BSR_ASSIGN
      The >>>= (unsigned right shift assignment) operator.
      static int BXOR
      The ^ (bitwise exclusive OR) operator.
      static int BXOR_ASSIGN
      The ^= (bitwise exclusive OR assignment) operator.
      static int CASE_GROUP
      A group of case clauses.
      static int CHAR_LITERAL
      A character literal.
      static int CLASS_DEF
      A class declaration.
      static int COLON
      The : (colon) operator.
      static int COMMA
      The , (comma) operator.
      static int COMMENT_CONTENT
      Text of single-line or block comment.
      static int COMPACT_CTOR_DEF
      A compact canonical constructor eliminates the list of formal parameters; they are declared implicitly.
      static int CTOR_CALL
      A constructor call.
      static int CTOR_DEF
      A constructor declaration.
      static int DEC
      The -- (prefix decrement) operator.
      static int DIV
      The / (division) operator.
      static int DIV_ASSIGN
      The /= (division assignment) operator.
      static int DO_WHILE
      Literal while in do-while loop.
      static int DOT
      The . (dot) operator.
      static int DOUBLE_COLON
      The :: (double colon) separator.
      static int ELIST
      An expression list.
      static int ELLIPSIS
      A triple dot for variable-length parameters.
      static int EMPTY_STAT
      The empty statement.
      static int ENUM
      The enum keyword.
      static int ENUM_CONSTANT_DEF
      An enum constant declaration.
      static int ENUM_DEF
      An enum declaration.
      static int EOF
      The end of file token.
      static int EQUAL
      The == (equal) operator.
      static int EXPR
      An expression.
      static int EXTENDS_CLAUSE
      An extends clause.
      static int FINAL
      The final keyword.
      static int FOR_CONDITION
      A for loop condition.
      static int FOR_EACH_CLAUSE
      A for-each clause.
      static int FOR_INIT
      A for loop initializer.
      static int FOR_ITERATOR
      A for loop iterator.
      static int GE
      The >= (greater than or equal) operator.
      static int GENERIC_END
      A > symbol signifying the end of type arguments or type parameters.
      static int GENERIC_START
      A < symbol signifying the start of type arguments or type parameters.
      static int GT
      The > (greater than) operator.
      static int IDENT
      An identifier.
      static int IMPLEMENTS_CLAUSE
      An implements clause.
      static int IMPORT
      An import declaration.
      static int INC
      The ++ (prefix increment) operator.
      static int INDEX_OP
      The array index operator.
      static int INSTANCE_INIT
      An instance initializer.
      static int INTERFACE_DEF
      An interface declaration.
      static int LABELED_STAT
      A labeled statement.
      static int LAMBDA
      Special lambda symbol ->.
      static int LAND
      The && (conditional AND) operator.
      static int LCURLY
      A left curly brace ({).
      static int LE
      The <= (less than or equal) operator.
      static int LITERAL_ASSERT
      The assert keyword.
      static int LITERAL_BOOLEAN
      The boolean keyword.
      static int LITERAL_BREAK
      The break keyword.
      static int LITERAL_BYTE
      The byte keyword.
      static int LITERAL_CASE
      The case keyword.
      static int LITERAL_CATCH
      The catch keyword.
      static int LITERAL_CHAR
      The char keyword.
      static int LITERAL_CLASS
      The class keyword.
      static int LITERAL_CONTINUE
      The continue keyword.
      static int LITERAL_DEFAULT
      The default keyword.
      static int LITERAL_DO
      The do keyword.
      static int LITERAL_DOUBLE
      The double keyword.
      static int LITERAL_ELSE
      The else keyword.
      static int LITERAL_FALSE
      The false keyword.
      static int LITERAL_FINALLY
      The finally keyword.
      static int LITERAL_FLOAT
      The float keyword.
      static int LITERAL_FOR
      The for keyword.
      static int LITERAL_IF
      The if keyword.
      static int LITERAL_INSTANCEOF
      The instanceof operator.
      static int LITERAL_INT
      The int keyword.
      static int LITERAL_INTERFACE
      The interface keyword.
      static int LITERAL_LONG
      The long keyword.
      static int LITERAL_NATIVE
      The native keyword.
      static int LITERAL_NEW
      The new keyword.
      static int LITERAL_NULL
      The null keyword.
      static int LITERAL_PRIVATE
      The private keyword.
      static int LITERAL_PROTECTED
      The protected keyword.
      static int LITERAL_PUBLIC
      The public keyword.
      static int LITERAL_RECORD
      The record keyword.
      static int LITERAL_RETURN
      The return keyword.
      static int LITERAL_SHORT
      The short keyword.
      static int LITERAL_STATIC
      The static keyword.
      static int LITERAL_SUPER
      The super keyword.
      static int LITERAL_SWITCH
      The switch keyword.
      static int LITERAL_SYNCHRONIZED
      The synchronized keyword.
      static int LITERAL_THIS
      The this keyword.
      static int LITERAL_THROW
      The throw keyword.
      static int LITERAL_THROWS
      The throws keyword.
      static int LITERAL_TRANSIENT
      The transient keyword.
      static int LITERAL_TRUE
      The true keyword.
      static int LITERAL_TRY
      The try keyword.
      static int LITERAL_VOID
      The void keyword.
      static int LITERAL_VOLATILE
      The volatile keyword.
      static int LITERAL_WHILE
      The while keyword.
      static int LITERAL_YIELD
      The yield keyword.
      static int LNOT
      The ! (logical complement) operator.
      static int LOR
      The || (conditional OR) operator.
      static int LPAREN
      A left parenthesis (().
      static int LT
      The < (less than) operator.
      static int METHOD_CALL
      A method call.
      static int METHOD_DEF
      A method declaration.
      static int METHOD_REF
      A reference to a method or constructor without arguments.
      static int MINUS
      The - (subtraction) operator.
      static int MINUS_ASSIGN
      The -= (subtraction assignment) operator.
      static int MOD
      The % (remainder) operator.
      static int MOD_ASSIGN
      The %= (remainder assignment) operator.
      static int MODIFIERS
      Modifiers for type, method, and field declarations.
      static int NOT_EQUAL
      The != (not equal) operator.
      static int NUM_DOUBLE
      A double precision floating point literal.
      static int NUM_FLOAT
      A single precision floating point literal.
      static int NUM_INT
      An integer literal.
      static int NUM_LONG
      A long integer literal.
      static int OBJBLOCK
      An object block.
      static int PACKAGE_DEF
      The package declaration.
      static int PARAMETER_DEF
      A parameter declaration.
      static int PARAMETERS
      A list of parameters to a method or constructor.
      static int PATTERN_VARIABLE_DEF
      A pattern variable definition; when conditionally matched, this variable is assigned with the defined type.
      static int PLUS
      The + (addition) operator.
      static int PLUS_ASSIGN
      The += (addition assignment) operator.
      static int POST_DEC
      The -- (postfix decrement) operator.
      static int POST_INC
      The ++ (postfix increment) operator.
      static int QUESTION
      The ? (conditional) operator.
      static int RBRACK
      The ] symbol.
      static int RCURLY
      A right curly brace (}).
      static int RECORD_COMPONENT_DEF
      A record component is a variable that comprises the state of a record.
      static int RECORD_COMPONENTS
      Record components are a (possibly empty) list containing the components of a record, which are the variables that make up its state.
      static int RECORD_DEF
      A declaration of a record specifies a name, a header, and a body.
      static int RESOURCE
      A resource in the Java 7 try-with-resources construct.
      static int RESOURCE_SPECIFICATION
      The Java 7 try-with-resources construct.
      static int RESOURCES
      A list of resources in the Java 7 try-with-resources construct.
      static int RPAREN
      A right parenthesis ()).
      static int SEMI
      The statement terminator (;).
      static int SINGLE_LINE_COMMENT
      Beginning of single line comment: '//'.
      static int SL
      The << (shift left) operator.
      static int SL_ASSIGN
      The <<= (left shift assignment) operator.
      static int SLIST
      A list of statements.
      static int SR
      The >> (signed shift right) operator.
      static int SR_ASSIGN
      The >>= (signed right shift assignment) operator.
      static int STAR
      The * (multiplication or wildcard) operator.
      static int STAR_ASSIGN
      The *= (multiplication assignment) operator.
      static int STATIC_IMPORT
      A static import declaration.
      static int STATIC_INIT
      A static initialization block.
      static int STRICTFP
      The strictfp keyword.
      static int STRING_LITERAL
      A string literal.
      static int SUPER_CTOR_CALL
      A super constructor call.
      static int SWITCH_RULE
      Switch Expressions.
      static int TEXT_BLOCK_CONTENT
      Content of a Java 14 text block.
      static int TEXT_BLOCK_LITERAL_BEGIN
      Beginning of a Java 14 Text Block literal, delimited by three double quotes.
      static int TEXT_BLOCK_LITERAL_END
      End of a Java 14 text block literal, delimited by three double quotes.
      static int TYPE
      A type.
      static int TYPE_ARGUMENT
      A type arguments to a type reference or a method/ctor invocation.
      static int TYPE_ARGUMENTS
      A list of type arguments to a type reference or a method/ctor invocation.
      static int TYPE_EXTENSION_AND
      The & symbol when used to extend a generic upper or lower bounds constrain or a type cast expression with an additional interface.
      static int TYPE_LOWER_BOUNDS
      A lower bounds on a wildcard type argument.
      static int TYPE_PARAMETER
      A type parameter to a class, interface or method definition.
      static int TYPE_PARAMETERS
      A list of type parameters to a class, interface or method definition.
      static int TYPE_UPPER_BOUNDS
      An upper bounds on a wildcard type argument or type parameter.
      static int TYPECAST
      A type-cast.
      static int UNARY_MINUS
      The - (unary minus) operator.
      static int UNARY_PLUS
      The + (unary plus) operator.
      static int VARIABLE_DEF
      A field or local variable declaration.
      static int WILDCARD_TYPE
      The type that refers to all types.
    • Method Summary

      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • EOF

        public static final int EOF
        The 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.
        See Also:
        PACKAGE_DEF, IMPORT, CLASS_DEF, INTERFACE_DEF, Constant Field Values
      • CTOR_DEF

        public static final int CTOR_DEF
        A 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:
        OBJBLOCK, CLASS_DEF, Constant Field Values
      • METHOD_DEF

        public static final int METHOD_DEF
        A 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 (})
         
        See Also:
        MODIFIERS, TYPE_PARAMETERS, TYPE, IDENT, PARAMETERS, LITERAL_THROWS, SLIST, OBJBLOCK, Constant Field Values
      • VARIABLE_DEF

        public static final int VARIABLE_DEF
        A field or local variable declaration. The children are modifiers, type, the identifier name, and an optional assignment statement.
        See Also:
        MODIFIERS, TYPE, IDENT, ASSIGN, Constant Field Values
      • STATIC_INIT

        public static final int STATIC_INIT
        A 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.
        See Also:
        Java Language Specification, §8.7, SLIST, OBJBLOCK, Constant Field Values
      • PACKAGE_DEF

        public static final int PACKAGE_DEF
        The 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 (;)
         
        See Also:
        Java Language Specification §7.4, DOT, IDENT, SEMI, ANNOTATIONS, FullIdent, Constant Field Values
      • ARRAY_DECLARATOR

        public static final int ARRAY_DECLARATOR
        An 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.

        See Also:
        Java Language Specification §10, TYPE, ARRAY_INIT, Constant Field Values
      • EXTENDS_CLAUSE

        public static final int EXTENDS_CLAUSE
        An extends clause. This appear as part of class and interface definitions. This element appears even if the extends 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:
        IDENT, DOT, CLASS_DEF, INTERFACE_DEF, FullIdent, Constant Field Values
      • IMPLEMENTS_CLAUSE

        public static final int IMPLEMENTS_CLAUSE
        An 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)
         
        See Also:
        IDENT, DOT, COMMA, CLASS_DEF, ENUM_DEF, Constant Field Values
      • PARAMETERS

        public static final int PARAMETERS
        A 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)
         
        See Also:
        PARAMETER_DEF, COMMA, METHOD_DEF, CTOR_DEF, Constant Field Values
      • PARAMETER_DEF

        public static final int PARAMETER_DEF
        A 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:
        MODIFIERS, TYPE, IDENT, PARAMETERS, ELLIPSIS, Constant Field Values
      • INDEX_OP

        public static final int INDEX_OP
        The 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:
        EXPR, Constant Field Values
      • METHOD_CALL

        public static final int METHOD_CALL
        A 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:
        IDENT, TYPE_ARGUMENTS, DOT, ELIST, RPAREN, FullIdent, Constant Field Values
      • METHOD_REF

        public static final int METHOD_REF
        A 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:
        IDENT, DOUBLE_COLON, Constant Field Values
      • EXPR

        public static final int EXPR
        An 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:
        ELIST, ASSIGN, LPAREN, RPAREN, Constant Field Values
      • ARRAY_INIT

        public static final int ARRAY_INIT
        An array initialization. This may occur as part of an array declaration or inline with new.

        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 (})
         
        See Also:
        ARRAY_DECLARATOR, TYPE, LITERAL_NEW, COMMA, Constant Field Values
      • IMPORT

        public static final int IMPORT
        An 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 (;)
         
        See Also:
        Java Language Specification §7.5, DOT, IDENT, STAR, SEMI, FullIdent, Constant Field Values
      • CASE_GROUP

        public static final int CASE_GROUP
        A 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 (;)
         
        See Also:
        LITERAL_CASE, LITERAL_DEFAULT, LITERAL_SWITCH, LITERAL_YIELD, Constant Field Values
      • FOR_INIT

        public static final int FOR_INIT
        A for loop initializer. This is a child of LITERAL_FOR. The children of this element may be a comma separated list of variable declarations, an expression list, or empty.
        See Also:
        VARIABLE_DEF, ELIST, LITERAL_FOR, Constant Field Values
      • FOR_CONDITION

        public static final int FOR_CONDITION
        A for loop condition. This is a child of LITERAL_FOR. The child of this element is an optional expression.
        See Also:
        EXPR, LITERAL_FOR, Constant Field Values
      • FOR_ITERATOR

        public static final int FOR_ITERATOR
        A for loop iterator. This is a child of LITERAL_FOR. The child of this element is an optional expression list.
        See Also:
        ELIST, LITERAL_FOR, Constant Field Values
      • CTOR_CALL

        public static final int CTOR_CALL
        A constructor call.

        For example:

         this(1);
         

        parses as:

         +--CTOR_CALL (this)
             |
             +--LPAREN (()
             +--ELIST
                 |
                 +--EXPR
                     |
                     +--NUM_INT (1)
             +--RPAREN ())
             +--SEMI (;)
         
        See Also:
        ELIST, RPAREN, SEMI, SUPER_CTOR_CALL, Constant Field Values
      • IDENT

        public static final int IDENT
        An identifier. These can be names of types, subpackages, fields, methods, parameters, and local variables.
        See Also:
        Constant Field Values
      • LITERAL_SYNCHRONIZED

        public static final int LITERAL_SYNCHRONIZED
        The synchronized 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 (})
         
        See Also:
        MODIFIERS, LPAREN, EXPR, RPAREN, SLIST, RCURLY, Constant Field Values
      • LITERAL_CLASS

        public static final int LITERAL_CLASS
        The class 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:
        DOT, IDENT, CLASS_DEF, FullIdent, Constant Field Values
      • LITERAL_INTERFACE

        public static final int LITERAL_INTERFACE
        The interface keyword. This token appears in interface definition.
        See Also:
        INTERFACE_DEF, Constant Field Values
      • DOUBLE_COLON

        public static final int DOUBLE_COLON
        The :: (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:
        METHOD_REF, Constant Field Values
      • LITERAL_IF

        public static final int LITERAL_IF
        The if 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:
        LPAREN, EXPR, RPAREN, SLIST, EMPTY_STAT, LITERAL_ELSE, Constant Field Values
      • LITERAL_FOR

        public static final int LITERAL_FOR
        The for 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 (})
         
        See Also:
        LPAREN, FOR_INIT, SEMI, FOR_CONDITION, FOR_ITERATOR, RPAREN, SLIST, EMPTY_STAT, EXPR, Constant Field Values
      • LITERAL_WHILE

        public static final int LITERAL_WHILE
        The while 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:
        Constant Field Values
      • LITERAL_DO

        public static final int LITERAL_DO
        The do 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:
        SLIST, EXPR, EMPTY_STAT, LPAREN, RPAREN, SEMI, Constant Field Values
      • LITERAL_BREAK

        public static final int LITERAL_BREAK
        The break keyword. The first child is an optional identifier and the last child is a semicolon.
        See Also:
        IDENT, SEMI, SLIST, Constant Field Values
      • LITERAL_CONTINUE

        public static final int LITERAL_CONTINUE
        The continue keyword. The first child is an optional identifier and the last child is a semicolon.
        See Also:
        IDENT, SEMI, SLIST, Constant Field Values
      • LITERAL_RETURN

        public static final int LITERAL_RETURN
        The return keyword. The first child is an optional expression for the return value. The last child is a semi colon.
        See Also:
        EXPR, SEMI, SLIST, Constant Field Values
      • LITERAL_SWITCH

        public static final int LITERAL_SWITCH
        The switch 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 (})
         
        See Also:
        Java Language Specification, §14.10, LPAREN, EXPR, RPAREN, LCURLY, CASE_GROUP, RCURLY, SLIST, SWITCH_RULE, Constant Field Values
      • LITERAL_CASE

        public static final int LITERAL_CASE
        The case keyword. The first child is a constant expression that evaluates to an integer.
        See Also:
        CASE_GROUP, EXPR, Constant Field Values
      • LITERAL_TRY

        public static final int LITERAL_TRY
        The try 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 (})
         
        See Also:
        Java Language Specification, §14.19, SLIST, LITERAL_CATCH, LITERAL_FINALLY, Constant Field Values
      • RESOURCE_SPECIFICATION

        public static final int RESOURCE_SPECIFICATION
        The 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 (})
         
        See Also:
        LPAREN, RESOURCES, RESOURCE, SEMI, RPAREN, LITERAL_TRY, Constant Field Values
      • QUESTION

        public static final int QUESTION
        The ? (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")
         
        See Also:
        Java Language Specification, §15.25, EXPR, COLON, Constant Field Values
      • LITERAL_NEW

        public static final int LITERAL_NEW
        The new 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 (})
         
        See Also:
        IDENT, DOT, LPAREN, ELIST, RPAREN, OBJBLOCK, ARRAY_INIT, FullIdent, Constant Field Values
      • LITERAL_ASSERT

        public static final int LITERAL_ASSERT
        The assert 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:
        Constant Field Values
      • STATIC_IMPORT

        public static final int STATIC_IMPORT
        A 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:
        JSR201, LITERAL_STATIC, DOT, IDENT, STAR, SEMI, FullIdent, Constant Field Values
      • ENUM_DEF

        public static final int ENUM_DEF
        An 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 (})
         
        See Also:
        JSR201, MODIFIERS, ENUM, IDENT, EXTENDS_CLAUSE, IMPLEMENTS_CLAUSE, OBJBLOCK, LITERAL_NEW, ENUM_CONSTANT_DEF, Constant Field Values
      • ENUM

        public static final int ENUM
        The enum keyword. This element appears as part of an enum declaration.
        See Also:
        Constant Field Values
      • ENUM_CONSTANT_DEF

        public static final int ENUM_CONSTANT_DEF
        An 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 (})
         
        See Also:
        JSR201, ANNOTATIONS, MODIFIERS, IDENT, ELIST, OBJBLOCK, Constant Field Values
      • FOR_EACH_CLAUSE

        public static final int FOR_EACH_CLAUSE
        A for-each clause. This is a child of LITERAL_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:
        VARIABLE_DEF, ELIST, LITERAL_FOR, Constant Field Values
      • ANNOTATION_DEF

        public static final int ANNOTATION_DEF
        An 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 (})
         
        See Also:
        JSR201, MODIFIERS, LITERAL_INTERFACE, IDENT, OBJBLOCK, ANNOTATION_FIELD_DEF, Constant Field Values
      • ANNOTATION_FIELD_DEF

        public static final int ANNOTATION_FIELD_DEF
        An 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:
        JSR201, MODIFIERS, TYPE, LITERAL_DEFAULT, Constant Field Values
      • ANNOTATIONS

        public static final int ANNOTATIONS
        A 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 a MODIFIERS node.

        For example:

             @MyAnnotation package blah;
         

        parses as:

         +--PACKAGE_DEF (package)
             |
             +--ANNOTATIONS
                 |
                 +--ANNOTATION
                     |
                     +--AT (@)
                     +--IDENT (MyAnnotation)
             +--IDENT (blah)
             +--SEMI (;)
         
        See Also:
        JSR201, ANNOTATION, AT, IDENT, Constant Field Values
      • ANNOTATION

        public static final int ANNOTATION
        An 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 ())
         
        See Also:
        JSR201, MODIFIERS, IDENT, ANNOTATION_MEMBER_VALUE_PAIR, Constant Field Values
      • ANNOTATION_MEMBER_VALUE_PAIR

        public static final int ANNOTATION_MEMBER_VALUE_PAIR
        An 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:
        JSR201, ANNOTATION, IDENT, Constant Field Values
      • ANNOTATION_ARRAY_INIT

        public static final int ANNOTATION_ARRAY_INIT
        An 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 (})
         
        See Also:
        JSR201, ANNOTATION, IDENT, ANNOTATION_MEMBER_VALUE_PAIR, Constant Field Values
      • TYPE_PARAMETERS

        public static final int TYPE_PARAMETERS
        A 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 (})
         
        See Also:
        JSR14, GENERIC_START, GENERIC_END, TYPE_PARAMETER, COMMA, Constant Field Values
      • TYPE_PARAMETER

        public static final int TYPE_PARAMETER
        A 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)
         
        See Also:
        JSR14, IDENT, WILDCARD_TYPE, TYPE_UPPER_BOUNDS, Constant Field Values
      • TYPE_ARGUMENTS

        public static final int TYPE_ARGUMENTS
        A 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 (;)
         
        See Also:
        GENERIC_START, GENERIC_END, TYPE_ARGUMENT, COMMA, Constant Field Values
      • TYPE_ARGUMENT

        public static final int TYPE_ARGUMENT
        A 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)
         
        See Also:
        JSR14, WILDCARD_TYPE, TYPE_UPPER_BOUNDS, TYPE_LOWER_BOUNDS, Constant Field Values
      • AT

        public static final int AT
        An @ symbol - signifying an annotation instance or the prefix to the interface literal signifying the definition of an annotation declaration.
        See Also:
        JSR201, Constant Field Values
      • ELLIPSIS

        public static final int ELLIPSIS
        A triple dot for variable-length parameters. This token only ever occurs in a parameter declaration immediately after the type of the parameter.
        See Also:
        JSR201, Constant Field Values
      • TYPE_EXTENSION_AND

        public static final int TYPE_EXTENSION_AND
        The & 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 (;)
         
        See Also:
        EXTENDS_CLAUSE, TYPECAST, Java Language Specification, §4.4, Java Language Specification, §15.16, Constant Field Values
      • GENERIC_START

        public static final int GENERIC_START
        A < symbol signifying the start of type arguments or type parameters.
        See Also:
        Constant Field Values
      • GENERIC_END

        public static final int GENERIC_END
        A > symbol signifying the end of type arguments or type parameters.
        See Also:
        Constant Field Values
      • SINGLE_LINE_COMMENT

        public static final int SINGLE_LINE_COMMENT
        Beginning of single line comment: '//'.
         +--SINGLE_LINE_COMMENT
                 |
                 +--COMMENT_CONTENT
         
        See Also:
        Constant Field Values
      • BLOCK_COMMENT_BEGIN

        public static final int BLOCK_COMMENT_BEGIN
        Beginning of block comment: '/*'.
         +--BLOCK_COMMENT_BEGIN
                 |
                 +--COMMENT_CONTENT
                 +--BLOCK_COMMENT_END
         
        See Also:
        Constant Field Values
      • BLOCK_COMMENT_END

        public static final int BLOCK_COMMENT_END
        End of block comment: '*/'.
         +--BLOCK_COMMENT_BEGIN
                 |
                 +--COMMENT_CONTENT
                 +--BLOCK_COMMENT_END
         
        See Also:
        Constant Field Values
      • COMMENT_CONTENT

        public static final int COMMENT_CONTENT
        Text of single-line or block comment.
         +--SINGLE_LINE_COMMENT
                 |
                 +--COMMENT_CONTENT
         
         +--BLOCK_COMMENT_BEGIN
                 |
                 +--COMMENT_CONTENT
                 +--BLOCK_COMMENT_END
         
        See Also:
        Constant Field Values
      • PATTERN_VARIABLE_DEF

        public static final int PATTERN_VARIABLE_DEF
        A 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_INSTANCEOF, Constant Field Values
      • LITERAL_RECORD

        public static final int LITERAL_RECORD
        The record keyword. This element appears as part of a record declaration.
        Since:
        8.35
        See Also:
        Constant Field Values
      • RECORD_DEF

        public static final int RECORD_DEF
        A 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:
        Constant Field Values
      • RECORD_COMPONENTS

        public static final int RECORD_COMPONENTS
        Record 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:
        Constant Field Values
      • RECORD_COMPONENT_DEF

        public static final int RECORD_COMPONENT_DEF
        A 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:
        Constant Field Values
      • COMPACT_CTOR_DEF

        public static final int COMPACT_CTOR_DEF
        A 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:
        Constant Field Values
      • TEXT_BLOCK_LITERAL_BEGIN

        public static final int TEXT_BLOCK_LITERAL_BEGIN
        Beginning 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:
        Constant Field Values
      • TEXT_BLOCK_CONTENT

        public static final int TEXT_BLOCK_CONTENT
        Content 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:
        Constant Field Values
      • TEXT_BLOCK_LITERAL_END

        public static final int TEXT_BLOCK_LITERAL_END
        End 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:
        Constant Field Values
      • LITERAL_YIELD

        public static final int LITERAL_YIELD
        The yield 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:
        LITERAL_SWITCH, CASE_GROUP, SLIST, SWITCH_RULE, Java Language Specification, §14.21, Constant Field Values
      • SWITCH_RULE

        public static final int SWITCH_RULE
        Switch 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 (;)
         
        Since:
        8.36
        See Also:
        LITERAL_CASE, LITERAL_DEFAULT, LITERAL_SWITCH, LITERAL_YIELD, Java Language Specification, §14.21, Constant Field Values