Skip to content

Commit eecd963

Browse files
committed
Use varargs where possible for flexibility
1 parent 1c097c9 commit eecd963

File tree

6 files changed

+7
-8
lines changed

6 files changed

+7
-8
lines changed

configs/pmd-rules.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
<exclude name="PositionLiteralsFirstInComparisons" />
2222
<exclude name="ForLoopCanBeForeach" />
2323
<exclude name="CheckResultSet" />
24-
<exclude name="UseVarargs" />
2524
<exclude name="UseTryWithResources" />
2625
<exclude name="AvoidReassigningLoopVariables" />
2726
<exclude name="AbstractClassWithoutAbstractMethod" />

src/sqlancer/Main.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ public void incrementCreateDatabase() {
263263

264264
}
265265

266-
public static void printArray(Object[] arr) {
266+
public static void printArray(Object... arr) {
267267
for (Object o : arr) {
268268
System.out.println(o);
269269
}
@@ -273,7 +273,7 @@ public static void main(String[] args) {
273273
System.exit(executeMain(args));
274274
}
275275

276-
public static int executeMain(String[] args) throws AssertionError {
276+
public static int executeMain(String... args) throws AssertionError {
277277
List<DatabaseProvider<?, ?>> providers = getDBMSProviders();
278278
Map<String, DatabaseProvider<?, ?>> nameToProvider = new HashMap<>();
279279
Map<String, Object> nameToOptions = new HashMap<>();

src/sqlancer/mysql/ast/MySQLComputableFunction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ public int getNrArgs() {
182182
return nrArgs;
183183
}
184184

185-
public abstract MySQLConstant apply(MySQLConstant[] evaluatedArgs, MySQLExpression[] args);
185+
public abstract MySQLConstant apply(MySQLConstant[] evaluatedArgs, MySQLExpression... args);
186186

187187
public static MySQLFunction getRandomFunction() {
188188
return Randomly.fromOptions(values());

src/sqlancer/postgres/ast/PostgresFunction.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ public int getNrArgs() {
253253
return nrArgs;
254254
}
255255

256-
public abstract PostgresConstant apply(PostgresConstant[] evaluatedArgs, PostgresExpression[] args);
256+
public abstract PostgresConstant apply(PostgresConstant[] evaluatedArgs, PostgresExpression... args);
257257

258258
public static PostgresFunctionWithResult getRandomFunction() {
259259
return Randomly.fromOptions(values());
@@ -276,7 +276,7 @@ public String getName() {
276276

277277
public abstract PostgresDataType[] getInputTypesForReturnType(PostgresDataType returnType, int nrArguments);
278278

279-
public boolean checkArguments(PostgresExpression[] constants) {
279+
public boolean checkArguments(PostgresExpression... constants) {
280280
return true;
281281
}
282282

src/sqlancer/sqlite3/SQLite3ToStringVisitor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ public void visit(SQLite3TableReference tableReference) {
463463
}
464464
}
465465

466-
private void visit(SQLite3Expression[] expressions) {
466+
private void visit(SQLite3Expression... expressions) {
467467
visit(Arrays.asList(expressions));
468468
}
469469

src/sqlancer/sqlite3/ast/SQLite3WindowFunction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public int getNrArgs() {
107107
}
108108
}
109109

110-
public SQLite3WindowFunction(WindowFunction func, SQLite3Expression[] args) {
110+
public SQLite3WindowFunction(WindowFunction func, SQLite3Expression... args) {
111111
this.func = func;
112112
this.args = args.clone();
113113
}

0 commit comments

Comments
 (0)