CodeQL library for Java
Search

Module Expr

Provides classes for working with Java expressions.

Import path

import semmle.code.java.Expr

Imports

java

Provides all default Java QL imports.

Classes

AddExpr

A binary expression using the + operator.

AndBitwiseExpr

A binary expression using the & operator.

AndLogicalExpr

A binary expression using the && operator.

Argument

An argument to a call.

ArrayAccess

An array access.

ArrayCreationExpr

An array creation expression.

ArrayInit

An array initializer consisting of an opening and closing curly bracket and optionally containing expressions (which themselves can be array initializers) representing the elements of the array. For example: { 'a', 'b' }.

ArrayTypeAccess

An array type access is a type access of the form String[].

AssignAddExpr

A compound assignment expression using the += operator.

AssignAndExpr

A compound assignment expression using the &= operator.

AssignDivExpr

A compound assignment expression using the /= operator.

AssignExpr

A simple assignment expression using the = operator.

AssignLShiftExpr

A compound assignment expression using the <<= operator.

AssignMulExpr

A compound assignment expression using the *= operator.

AssignOp

A common super-class to represent compound assignments, which include an implicit operator.

AssignOrExpr

A compound assignment expression using the |= operator.

AssignRShiftExpr

A compound assignment expression using the >>= operator.

AssignRemExpr

A compound assignment expression using the %= operator.

AssignSubExpr

A compound assignment expression using the -= operator.

AssignURShiftExpr

A compound assignment expression using the >>>= operator.

AssignXorExpr

A compound assignment expression using the ^= operator.

Assignment

A common super-class that represents all varieties of assignments.

BinaryExpr

A common super-class to represent binary operator expressions.

BitNotExpr

A bit negation expression. For example, ~x.

BitwiseExpr

A bitwise expression.

BooleanLiteral

A boolean literal. Either true or false.

Call

Any call to a callable.

CastExpr

A cast expression.

CastingExpr

Any kind of expression that casts values from one type to another.

CharacterLiteral

A character literal. For example, '\n'.

ChooseExpr

A conditional expression or a switch expression.

ClassExpr

A Kotlin ::class expression.

ClassInstanceExpr

A class instance creation expression.

ComparisonExpr

A comparison expression.

CompileTimeConstantExpr

A compile-time constant expression.

ConditionalExpr

A conditional expression of the form a ? b : c, where a is the condition, b is the expression that is evaluated if the condition evaluates to true, and c is the expression that is evaluated if the condition evaluates to false.

ConstructorCall

A constructor call, which occurs either as a constructor invocation inside a constructor, or as part of a class instance expression.

DivExpr

A binary expression using the / operator.

DoubleLiteral

A double literal. For example, 4.2.

EQExpr

A binary expression using Java’s == or Kotlin’s === operator.

EqualityTest

An equality test is a binary expression using Java’s == or != operators, or Kotlin’s ==, !=, === or !== operators.

ErrorExpr

An error expression.

Expr

A common super-class that represents all kinds of expressions.

ExprParent

An expression parent is an element that may have an expression as its child.

ExtensionReceiverAccess

An access to an extension receiver parameter. This is a parameter access that takes the form of this in Kotlin.

FieldAccess

An expression that accesses a field.

FieldRead

An expression that reads a field.

FieldWrite

An expression that assigns a value to a field.

FloatingPointLiteral

A float literal. For example, 4.2f.

FunctionalExpr

A functional expression is either a lambda expression or a member reference expression.

GEExpr

A binary expression using the >= operator.

GTExpr

A binary expression using the > operator.

GreaterThanComparison

A comparison expression using the operator > or >=.

ImplicitCastExpr

An implicit cast expression.

ImplicitCoercionToUnitExpr

An implicit coercion-to-unit expression.

ImplicitNotNullExpr

An implicit cast-to-non-null expression.

InstanceAccess

A use of one of the keywords this or super, which may be qualified.

InstanceOfExpr

An instanceof expression.

IntegerLiteral

An integer literal. For example, 23.

IntersectionTypeAccess

An intersection type access expression is a type access of the form T0 & T1 & ... & Tn, where T0 is a class or interface type and T1, ..., Tn are interface types.

KtInitializerAssignExpr

A Kotlin class member initializer assignment.

LEExpr

A binary expression using the <= operator.

LShiftExpr

A binary expression using the << operator.

LTExpr

A binary expression using the < operator.

LValue

An l-value is a write access to a variable, which occurs as the destination of an assignment.

LambdaExpr

Lambda expressions are represented by their implicit class instance creation expressions, which instantiate an anonymous class that overrides the unique method designated by their functional interface type. The parameters of the lambda expression correspond to the parameters of the overriding method, and the lambda body corresponds to the body of the overriding method (enclosed by a return statement and a block in the case of lambda expressions whose body is an expression).

LessThanComparison

A comparison expression using the operator < or <=.

Literal

A common super-class to represent constant literals.

LocalVariableDeclExpr

A local variable declaration expression.

LogNotExpr

A logical negation expression. For example, !b.

LogicExpr

A logical expression.

LongLiteral

A long literal. For example, 23L.

MemberRefExpr

Member references are represented by their implicit class instance expressions, which instantiate an anonymous class that overrides the unique method designated by their functional interface type. The correspondence of the parameters of the overriding method in the anonymous class with the parameters of the callable that is referenced differs depending on the particular kind of member reference expression.

MethodAccess

A method access is an invocation of a method with a list of arguments.

MinusExpr

A unary minus expression. For example, -i.

MulExpr

A binary expression using the * operator.

NEExpr

A binary expression using Java’s != or Kotlin’s !== operator.

NotInstanceOfExpr

An instanceof expression.

NotNullExpr

A Kotlin not-null expression. For example, expr!!.

NullLiteral

The null literal, written null.

OrBitwiseExpr

A binary expression using the | operator.

OrLogicalExpr

A binary expression using the || operator.

PackageAccess

A package access.

PlusExpr

A unary plus expression. For example, +i.

PostDecExpr

A post-decrement expression. For example, i--.

PostIncExpr

A post-increment expression. For example, i++.

PreDecExpr

A pre-decrement expression. For example, --i.

PreIncExpr

A pre-increment expression. For example, ++i.

PropertyRefExpr

Property references are represented by their implicit class instance expressions, which instantiate an anonymous class that overrides the get and set methods designated by their functional interface type.

RShiftExpr

A binary expression using the >> operator.

RValue

An r-value is a read access to a variable.

ReferenceEqualityTest

An equality test is a binary expression using Java’s == or != operators or Kotlin’s === or !== operators.

RemExpr

A binary expression using the % operator.

SafeCastExpr

A safe cast expression.

StaticMethodAccess

A static method call.

StmtExpr

An statement expression.

StringLiteral

A string literal or text block (Java 15 feature). For example, "hello world" or java """ Text with "quotes" """

StringTemplateExpr

A Kotlin string template expression. For example, "foo${bar}baz".

SubExpr

A binary expression using the - operator.

SuperAccess

A use of the keyword super, which may be qualified.

SuperMethodAccess

A call to a method in the superclass.

SwitchExpr

A switch expression.

ThisAccess

A use of the keyword this, which may be qualified.

TypeAccess

A type access is a (possibly qualified) reference to a type.

TypeLiteral

A type literal. For example, String.class.

URShiftExpr

A binary expression using the >>> operator.

UnaryAssignExpr

A unary assignment expression is a unary expression using the prefix or postfix ++ or -- operator.

UnaryExpr

A common super-class that represents unary operator expressions.

UnionTypeAccess

A union type access is a type access of the form T1 | T2.

UnsafeCoerceExpr

An unsafe coerce expression.

ValueDiscardingExpr

An expression for which the value of the expression as a whole is discarded. Only cases of discarded values at the language level (as described by the JLS) are considered; data flow, for example to determine if an assigned variable value is ever read, is not considered. Such expressions can for example appear as part of an ExprStmt or as initializer of a for loop.

ValueEQExpr

A binary expression using the Kotlin == operator, semantically equivalent to Objects.equals.

ValueNEExpr

A binary expression using the Kotlin != operator, semantically equivalent to Objects.equals.

ValueOrReferenceEqualsExpr

A binary expression using either Java or Kotlin’s == operator.

ValueOrReferenceNotEqualsExpr

A binary expression using either Java or Kotlin’s != operator.

VarAccess

A variable access is a (possibly qualified) reference to a field, parameter or local variable.

VariableAssign

An assignment to a variable or an initialization of the variable.

VariableUpdate

An update of a variable or an initialization of the variable.

VirtualMethodAccess

A polymorphic call to an instance method.

WhenBranch

A Kotlin when branch.

WhenExpr

A Kotlin when expression.

WildcardTypeAccess

A wildcard type access, which may have either a lower or an upper bound.

XorBitwiseExpr

A binary expression using the ^ operator.