AST class reference

Statement classes

This table lists all subclasses of Stmt.

Statement syntax QL class Superclasses Remarks
; EmptyStmt    
``Expr`` ; ExprStmt    
{ ``Stmt`` ... } Block    
``if`` ( ``Expr`` ) ``Stmt`` ``else`` ``Stmt````if`` ( ``Expr`` ) ``Stmt`` IfStmt ConditionalStmt  
``while`` ( ``Expr`` ) ``Stmt`` WhileStmt ConditionalStmt, LoopStmt  
``do`` ``Stmt`` ``while`` ( ``Expr`` ) DoStmt ConditionalStmt, LoopStmt  
``for`` ( ``Expr`` ; ``Expr`` ; ``Expr`` ) ``Stmt`` ForStmt ConditionalStmt, LoopStmt  
``for`` ( ``VarAccess`` : ``Expr`` ) ``Stmt`` EnhancedForStmt LoopStmt  
``switch`` ( ``Expr`` ) { ``SwitchCase`` ... } SwitchStmt    
``try`` { ``Stmt`` ... } ``finally`` { ``Stmt`` ... } TryStmt    
``return`` ``Expr`` ;``return`` ; ReturnStmt    
``throw`` ``Expr`` ; ThrowStmt    
``break`` ;``break`` label ; BreakStmt JumpStmt  
``continue`` ;``continue`` label ; ContinueStmt JumpStmt  
label : ``Stmt`` LabeledStmt    
``synchronized`` ( ``Expr`` ) ``Stmt`` SynchronizedStmt    
``assert`` ``Expr`` : ``Expr`` ;``assert`` ``Expr`` ; AssertStmt    
``TypeAccess`` name ; LocalVariableDeclStmt    
``class`` name { ``Member`` ... } ; LocalClassDeclStmt    
``this`` ( ``Expr`` , ... ) ; ThisConstructorInvocationStmt    
``super`` ( ``Expr`` , ... ) ; SuperConstructorInvocationStmt    
``catch`` ( ``TypeAccess`` name ) { ``Stmt`` ... } CatchClause   can only occur as child of a TryStmt
``case`` ``Literal`` : ``Stmt`` ... ConstCase   can only occur as child of a SwitchStmt
``default`` : ``Stmt`` ... DefaultCase   can only occur as child of a SwitchStmt

Expression classes

There is a large number of expression classes, so we present them by category. All classes in this section are subclasses of Expr.

Literals

All classes in this subsection are subclasses of Literal.

Expression syntax example QL class
true BooleanLiteral
23 IntegerLiteral
23l LongLiteral
4.2f FloatingPointLiteral
4.2 DoubleLiteral
'a' CharacterLiteral
"Hello" StringLiteral
null NullLiteral

Unary expressions

All classes in this subsection are subclasses of UnaryExpr.

Expression syntax example QL class Superclasses Remarks
x++ PostIncExpr UnaryAssignExpr  
x-- PostDecExpr UnaryAssignExpr  
++x PreIncExpr UnaryAssignExpr  
--x PreDecExpr UnaryAssignExpr  
~x BitNotExpr BitwiseExpr see below for other subclasses of BitwiseExpr
-x MinusExpr    
+x PlusExpr    
!x LogNotExpr LogicExpr see below for other subclasses of LogicExpr

Binary expressions

All classes in this subsection are subclasses of BinaryExpr.

Expression syntax example QL class Superclasses
x * y MulExpr  
x / y DivExpr  
x % y RemExpr  
x + y AddExpr  
x - y SubExpr  
x << y LShiftExpr  
x >> y RShiftExpr  
x >>> y URShiftExpr  
x && y AndLogicalExpr LogicExpr
x || y OrLogicalExpr LogicExpr
x < y LTExpr ComparisonExpr
x > y GTExpr ComparisonExpr
x <= y LEExpr ComparisonExpr
x >= y GEExpr ComparisonExpr
x == y EQExpr EqualityTest
x != y NEExpr EqualityTest
x & y AndBitwiseExpr BitwiseExpr
x | y OrBitwiseExpr BitwiseExpr
x ^ y XorBitwiseExpr BitwiseExpr

Assignment expressions

All classes in this table are subclasses of Assignment.

Expression syntax example QL class Superclasses
x = y AssignExpr  
x += y AssignAddExpr AssignOp
x -= y AssignSubExpr AssignOp
x *= y AssignMulExpr AssignOp
x /= y AssignDivExpr AssignOp
x %= y AssignRemExpr AssignOp
x &= y AssignAndExpr AssignOp
x |= y AssignOrExpr AssignOp
x ^= y AssignXorExpr AssignOp
x <<= y AssignLShiftExpr AssignOp
x >>= y AssignRShiftExpr AssignOp
x >>>= y AssignURShiftExpr AssignOp

Accesses

Expression syntax examples QL class
``this``Outer.``this`` ThisAccess
``super``Outer.``super`` SuperAccess
xe.f VarAccess
a[i] ArrayAccess
f(...)e.m(...) MethodAccess
Stringjava.lang.String TypeAccess
? ``extends`` Number? ``super`` Double WildcardTypeAccess

A VarAccess that refers to a field is a FieldAccess.

Miscellaneous

Expression syntax examples QL class Remarks
(int) f CastExpr  
(23 + 42) ParExpr  
o ``instanceof`` String InstanceOfExpr  
``Expr`` ? ``Expr`` : ``Expr`` ConditionalExpr  
String.``class`` TypeLiteral  
``new`` A() ClassInstanceExpr  
``new`` String[3][2]``new`` int[] { 23, 42 } ArrayCreationExpr  
{ 23, 42 } ArrayInit can only appear as an initializer or as a child of an ArrayCreationExpr
@Annot(key=val) Annotation