-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed as not planned
Closed as not planned
Copy link
Labels
status: declinedA suggestion or change that we don't feel we should currently applyA suggestion or change that we don't feel we should currently apply
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: declinedA suggestion or change that we don't feel we should currently applyA suggestion or change that we don't feel we should currently apply