Skip to content

Commit 4426dab

Browse files
committed
Enable a checkstyle rule for redundant modifiers and enforce it
1 parent f649407 commit 4426dab

64 files changed

Lines changed: 119 additions & 116 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

checkstyle.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@
148148
<!-- Modifier Checks -->
149149
<!-- See https://checkstyle.org/config_modifiers.html -->
150150
<module name="ModifierOrder"/>
151-
<!-- FIXME: <module name="RedundantModifier"/> -->
151+
<module name="RedundantModifier"/>
152152

153153
<!-- Checks for blocks. You know, those {}'s -->
154154
<!-- See https://checkstyle.org/config_blocks.html -->

src/sqlancer/AbstractAction.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@
33
import java.sql.SQLException;
44

55
public interface AbstractAction<G> {
6-
public Query getQuery(G globalState) throws SQLException;
6+
7+
Query getQuery(G globalState) throws SQLException;
8+
79
}

src/sqlancer/DatabaseProvider.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ default void printDatabaseSpecificState(FileWriter writer, StateToReproduce stat
3333

3434
O getCommand();
3535

36-
public static boolean isEqualDouble(String first, String second) {
36+
static boolean isEqualDouble(String first, String second) {
3737
try {
3838
double val = Double.parseDouble(first);
3939
double secVal = Double.parseDouble(second);
@@ -43,15 +43,15 @@ public static boolean isEqualDouble(String first, String second) {
4343
}
4444
}
4545

46-
public static boolean equals(double a, double b) {
46+
static boolean equals(double a, double b) {
4747
if (a == b) {
4848
return true;
4949
}
5050
// If the difference is less than epsilon, treat as equal.
5151
return Math.abs(a - b) < 0.0001 * Math.max(Math.abs(a), Math.abs(b));
5252
}
5353

54-
public static List<String> getResultSetFirstColumnAsString(String queryString, Set<String> errors, Connection con,
54+
static List<String> getResultSetFirstColumnAsString(String queryString, Set<String> errors, Connection con,
5555
GlobalState<?> state) throws SQLException {
5656
if (state.getOptions().logEachSelect()) {
5757
// TODO: refactor me

src/sqlancer/Main.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public static final class StateLogger {
6363

6464
private static final class AlsoWriteToConsoleFileWriter extends FileWriter {
6565

66-
public AlsoWriteToConsoleFileWriter(File file) throws IOException {
66+
AlsoWriteToConsoleFileWriter(File file) throws IOException {
6767
super(file);
6868
}
6969

src/sqlancer/MainOptions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public int getNrStatementRetryCount() {
7676
return nrStatementRetryCount;
7777
}
7878

79-
public static enum DBMS {
79+
public enum DBMS {
8080
MariaDB, SQLite3, MySQL, PostgreSQL, TDEngine, CockroachDB, TiDB
8181
}
8282

src/sqlancer/StatementExecutor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ public class StatementExecutor<G extends GlobalState<?>, A extends AbstractActio
88

99
@FunctionalInterface
1010
public interface AfterQueryAction {
11-
public void notify(Query q) throws SQLException;
11+
void notify(Query q) throws SQLException;
1212
}
1313

1414
@FunctionalInterface
1515
public interface ActionMapper<T, A> {
16-
public int map(T globalState, A action);
16+
int map(T globalState, A action);
1717
}
1818

1919
private final G globalState;

src/sqlancer/clickhouse/ClickhouseProvider.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@
2525

2626
public class ClickhouseProvider implements DatabaseProvider<ClickhouseGlobalState, ClickhouseOptions> {
2727

28-
public static enum Action implements AbstractAction<ClickhouseGlobalState> {
28+
public enum Action implements AbstractAction<ClickhouseGlobalState> {
2929

3030
INSERT(ClickhouseInsertGenerator::getQuery);
3131

3232
private final QueryProvider<ClickhouseGlobalState> queryProvider;
3333

34-
private Action(QueryProvider<ClickhouseGlobalState> queryProvider) {
34+
Action(QueryProvider<ClickhouseGlobalState> queryProvider) {
3535
this.queryProvider = queryProvider;
3636
}
3737

src/sqlancer/clickhouse/ClickhouseSchema.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@
1818

1919
public class ClickhouseSchema extends AbstractSchema<ClickhouseTable> {
2020

21-
public static enum ClickhouseDataType {
21+
public enum ClickhouseDataType {
2222

2323
INT("INT"), STRING("String");
2424

2525
private String textRepr;
2626

27-
private ClickhouseDataType(String textRepr) {
27+
ClickhouseDataType(String textRepr) {
2828
this.textRepr = textRepr;
2929
}
3030

src/sqlancer/clickhouse/gen/ClickhouseExpressionGenerator.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public enum ClickhouseUnaryPostfixOperator implements Operator {
7979

8080
private String textRepr;
8181

82-
private ClickhouseUnaryPostfixOperator(String textRepr) {
82+
ClickhouseUnaryPostfixOperator(String textRepr) {
8383
this.textRepr = textRepr;
8484
}
8585

@@ -100,7 +100,7 @@ public enum ClickhouseUnaryPrefixOperator implements Operator {
100100

101101
private String textRepr;
102102

103-
private ClickhouseUnaryPrefixOperator(String textRepr) {
103+
ClickhouseUnaryPrefixOperator(String textRepr) {
104104
this.textRepr = textRepr;
105105
}
106106

@@ -137,7 +137,7 @@ public enum ClickhouseBinaryComparisonOperator implements Operator {
137137

138138
private String textRepr;
139139

140-
private ClickhouseBinaryComparisonOperator(String textRepr) {
140+
ClickhouseBinaryComparisonOperator(String textRepr) {
141141
this.textRepr = textRepr;
142142
}
143143

src/sqlancer/cockroachdb/CockroachDBOptions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public class CockroachDBOptions {
2525
@Parameter(names = "--oracle", converter = DBMSConverter.class)
2626
public CockroachDBOracle oracle = CockroachDBOracle.NOREC;
2727

28-
public static enum CockroachDBOracle {
28+
public enum CockroachDBOracle {
2929
NOREC {
3030
@Override
3131
public TestOracle create(CockroachDBGlobalState globalState) throws SQLException {

0 commit comments

Comments
 (0)