Class IntegerLiteral
An integer literal. For example, 23
.
An integer literal can never be negative except when:
- It is written in binary, octal or hexadecimal notation
- It is written in decimal notation, has the value
2147483648
and is preceded by a minus; in this case the value of the IntegerLiteral is -2147483648 and the preceding minus will not be modeled asMinusExpr
.
In all other cases the preceding minus, if any, will be modeled as a separate
MinusExpr
.
The last exception is necessary because 2147483648
on its own would not be
a valid integer literal (and could also not be parsed as CodeQL int
).
Import path
import java
Direct supertypes
Indirect supertypes
Predicates
getAPrimaryQlClass | Gets the name of a primary CodeQL class to which this element belongs. |
getIntValue | Gets the int representation of this literal. |
Inherited predicates
getAChildExpr | Gets a child of this expression. | from Expr |
getAnEnclosingStmt | Gets a statement that directly or transitively contains this expression, if any. This is equivalent to | from Expr |
getBasicBlock | Gets the basic block in which this expression occurs, if any. | from Expr |
getCompilationUnit | Gets the compilation unit in which this expression occurs. | from Expr |
getControlFlowNode | Gets the | from Expr |
getEnclosingCallable | Gets the callable in which this expression occurs, if any. | from Expr |
getEnclosingStmt | Gets the statement containing this expression, if any. | from Expr |
getFile | Gets the file associated with this element. | from Top |
getHalsteadID | This statement’s Halstead ID (used to compute Halstead metrics). | from Expr |
getIndex | Gets the index of this expression as a child of its parent. | from Expr |
getKind | Gets the kind of this expression. | from Expr |
getKotlinType | Gets the Kotlin type of this expression. | from Expr |
getLiteral | Gets a string representation of this literal as it appeared in the source code. | from Literal |
getLocation | Gets the source location for this element. | from Top |
getNumberOfCommentLines | Gets the number of comment lines that this element ranges over. | from Top |
getNumberOfLinesOfCode | Gets the number of lines of code that this element ranges over. | from Top |
getParent | Gets the parent of this expression. | from Expr |
getPrimaryQlClasses | Gets a comma-separated list of the names of the primary CodeQL classes to which this element belongs. | from Top |
getTotalNumberOfLines | Gets the total number of lines that this element ranges over, including lines of code, comment and whitespace-only lines. | from Top |
getType | Gets the type of this expression. | from Expr |
getUnderlyingExpr | Gets the underlying expression looking through casts and not-nulls, if any. Otherwise just gets this expression. | from Expr |
getValue | Gets a string representation of the value this literal represents. | from Literal |
hasLocationInfo | Holds if this element is at the specified location. The location spans column | from Top |
isCompileTimeConstant | Holds if this literal is a compile-time constant expression (as per JLS v8, section 15.28). | from Literal |
isInStaticContext | Holds if this expression occurs in a static context. | from Expr |
isNthChildOf | Holds if this expression is the child of the specified parent at the specified (zero-based) position. | from Expr |
isParenthesized | Holds if this expression is parenthesized. | from Expr |
toString | Gets a printable representation of this expression. | from Literal |