Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic code cleanup. #4441

Merged
merged 1 commit into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ public static Matcher<ExpressionTree> nonNullLiteral() {
case DOUBLE_LITERAL:
case BOOLEAN_LITERAL:
case CHAR_LITERAL:
// fall through
// fall through
case STRING_LITERAL:
return true;
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2074,25 +2074,25 @@ public Type visitBinary(BinaryTree tree, Void unused) {
Type leftType = checkNotNull(getType(tree.getLeftOperand()));
Type rightType = checkNotNull(getType(tree.getRightOperand()));
switch (tree.getKind()) {
// The addition and subtraction operators for numeric types + and - (§15.18.2)
// The addition and subtraction operators for numeric types + and - (§15.18.2)
case PLUS:
// If either operand is of string type, string concatenation is performed.
Type stringType = state.getSymtab().stringType;
if (isSameType(stringType, leftType, state) || isSameType(stringType, rightType, state)) {
return stringType;
}
// Fall through.
// Fall through.
case MINUS:
// The multiplicative operators *, /, and % (§15.17)
// The multiplicative operators *, /, and % (§15.17)
case MULTIPLY:
case DIVIDE:
case REMAINDER:
// The numerical comparison operators <, <=, >, and >= (§15.20.1)
// The numerical comparison operators <, <=, >, and >= (§15.20.1)
case LESS_THAN:
case LESS_THAN_EQUAL:
case GREATER_THAN:
case GREATER_THAN_EQUAL:
// The integer bitwise operators &, ^, and |
// The integer bitwise operators &, ^, and |
case AND:
case XOR:
case OR:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -438,21 +438,21 @@ void testAssert() {
void testSwitch(int anInt, String aString) {
final int detectInt = 0;
switch (anInt) {
// BUG: Diagnostic contains: int
// BUG: Diagnostic contains: int
case detectInt:
break;
}

final byte detectByte = 0;
switch (anInt) {
// BUG: Diagnostic contains: int
// BUG: Diagnostic contains: int
case detectByte:
break;
}

final String detectString = "";
switch (aString) {
// BUG: Diagnostic contains: java.lang.String
// BUG: Diagnostic contains: java.lang.String
case detectString:
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ public void visitIdent(JCTree.JCIdent tree) {
}
switch (sym.getKind()) {
case TYPE_PARAMETER:
// declaring a class as non-static just to access a type parameter is silly -
// why not just re-declare the type parameter instead of capturing it?
// TODO(cushon): consider making the suggestion anyways, maybe with a fix?
// fall through
// declaring a class as non-static just to access a type parameter is silly -
// why not just re-declare the type parameter instead of capturing it?
// TODO(cushon): consider making the suggestion anyways, maybe with a fix?
// fall through
case FIELD:
if (!isOwnedBy(sym, owner, state.getTypes())) {
canPossiblyBeStatic = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public Description matchMemberSelect(MemberSelectTree tree, VisitorState state)
|| sym.getSimpleName().contentEquals("super")) {
return NO_MATCH;
}
// fall through
// fall through
case ENUM_CONSTANT:
case METHOD:
if (!isStatic(sym)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ private Optional<Description> handleVariable(
|| state.getPath().getParentPath().getLeaf() instanceof LambdaExpressionTree) {
return Optional.empty();
}
// Fall through.
// Fall through.
case LOCAL_VARIABLE:
if (!variableMatches(tree, state)) {
return Optional.empty();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ private static boolean isTypeUse(String className) {
case "org.checkerframework.checker.nullness.qual.Nullable":
case "org.jspecify.annotations.NonNull":
case "org.jspecify.annotations.Nullable":
// We break these strings to avoid having them rewritten by Copybara.
// We break these strings to avoid having them rewritten by Copybara.
case "org.jspecify.null" + "ness.NonNull":
case "org.jspecify.null" + "ness.Nullable":
return true;
Expand Down
Loading