-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Labels
status: waiting-for-triageAn issue we've not yet triagedAn issue we've not yet triaged
Description
In the QueryTransformers.CountSelectionTokenStream class, several .equals() calls are made with a variable on the left and a constant on the right (e.g., token.equals(CONSTANT)).
Example:
class QueryTokens {
// ...
static final QueryToken TOKEN_COMMA = token(", ");
static final QueryToken TOKEN_AS = expression("AS");
// ...
}
QueryTransformers.java
Before:
if (token.equals(TOKEN_AS)) {
// ...
}
After:
if (token.equals(TOKEN_AS)) {
// ...
}
While there is no evidence that token can currently be null, it is a widely accepted Java best practice to place
the constant or literal on the left side of an equals() comparison (e.g., CONSTANT.equals(token)).
This defensively prevents any potential NullPointerException if the code were to be refactored in the future in a
way that might allow a null variable.
Metadata
Metadata
Assignees
Labels
status: waiting-for-triageAn issue we've not yet triagedAn issue we've not yet triaged