提交 5b81d2b9 authored 作者: Noel Grandin's avatar Noel Grandin

clean up or annotate unused parameters

上级 3e77d2fb
......@@ -112,7 +112,7 @@ public abstract class Command implements CommandInterface {
* @return the local result set
* @throws DbException if the command is not a query
*/
public ResultInterface query(int maxrows) {
public ResultInterface query(@SuppressWarnings("unused") int maxrows) {
throw DbException.get(ErrorCode.METHOD_ONLY_ALLOWED_FOR_QUERY);
}
......
......@@ -208,6 +208,7 @@ public abstract class Prepared {
* @return the result set
* @throws DbException if it is not a query
*/
@SuppressWarnings("unused")
public ResultInterface query(int maxrows) {
throw DbException.get(ErrorCode.METHOD_ONLY_ALLOWED_FOR_QUERY);
}
......
......@@ -118,7 +118,7 @@ public class CreateView extends SchemaCommand {
view = new TableView(getSchema(), id, viewName, querySQL, null,
columnTemplates, sysSession, false);
} else {
view.replace(querySQL, columnNames, sysSession, false, force);
view.replace(querySQL, sysSession, false, force);
view.setModified();
}
} finally {
......
......@@ -192,7 +192,7 @@ public abstract class Constraint extends SchemaObjectBase implements
* @return true if every visited expression returned true, or if there are
* no expressions
*/
public boolean isEverything(ExpressionVisitor visitor) {
public boolean isEverything(@SuppressWarnings("unused") ExpressionVisitor visitor) {
return true;
}
......
......@@ -134,7 +134,7 @@ public abstract class Expression {
* @param session the session
* @return the negated expression, or null
*/
public Expression getNotIfPossible(Session session) {
public Expression getNotIfPossible(@SuppressWarnings("unused") Session session) {
// by default it is not possible
return null;
}
......@@ -184,6 +184,7 @@ public abstract class Expression {
* @param session the session
* @param filter the table filter
*/
@SuppressWarnings("unused")
public void createIndexConditions(Session session, TableFilter filter) {
// default is do nothing
}
......@@ -292,6 +293,7 @@ public abstract class Expression {
* @param session the session
* @return array of expression columns if applicable, null otherwise
*/
@SuppressWarnings("unused")
public Expression[] getExpressionColumns(Session session) {
return null;
}
......
......@@ -180,11 +180,10 @@ public class SpatialTreeIndex extends BaseIndex implements SpatialIndex {
/**
* Compute spatial index cost
* @param masks Search mask
* @param rowCount Table row count
* @param columns Table columns
* @return Index cost hint
*/
public static long getCostRangeIndex(int[] masks, long rowCount, Column[] columns) {
public static long getCostRangeIndex(int[] masks, Column[] columns) {
// Never use spatial tree index without spatial filter
if (columns.length == 0) {
return Long.MAX_VALUE;
......@@ -203,7 +202,7 @@ public class SpatialTreeIndex extends BaseIndex implements SpatialIndex {
public double getCost(Session session, int[] masks,
TableFilter[] filters, int filter, SortOrder sortOrder,
HashSet<Column> allColumnsSet) {
return getCostRangeIndex(masks, table.getRowCountApproximation(), columns);
return getCostRangeIndex(masks, columns);
}
......
......@@ -12,7 +12,6 @@ import java.sql.SQLWarning;
import java.sql.Statement;
import java.util.ArrayList;
import org.h2.api.ErrorCode;
import org.h2.command.Command;
import org.h2.command.CommandInterface;
import org.h2.engine.SessionInterface;
import org.h2.engine.SysProperties;
......
......@@ -206,6 +206,7 @@ public class StreamStore {
*
* @param len the length of the stored block.
*/
@SuppressWarnings("unused")
protected void onStore(int len) {
// do nothing by default
}
......
......@@ -174,6 +174,7 @@ public class CacheLongKeyLIRS<V> {
* @param value the value
* @return the size
*/
@SuppressWarnings("unused")
protected int sizeOf(V value) {
return 1;
}
......
......@@ -253,8 +253,7 @@ public class MVSpatialIndex extends BaseIndex implements SpatialIndex, MVIndex {
public double getCost(Session session, int[] masks, TableFilter[] filters,
int filter, SortOrder sortOrder,
HashSet<Column> allColumnsSet) {
return SpatialTreeIndex.getCostRangeIndex(masks,
table.getRowCountApproximation(), columns);
return SpatialTreeIndex.getCostRangeIndex(masks, columns);
}
@Override
......
......@@ -7,7 +7,6 @@ package org.h2.mvstore.rtree;
import java.util.ArrayList;
import java.util.Iterator;
import org.h2.mvstore.CursorPos;
import org.h2.mvstore.DataUtils;
import org.h2.mvstore.MVMap;
......@@ -556,6 +555,7 @@ public class MVRTreeMap<V> extends MVMap<SpatialKey, V> {
* @param test the user-supplied test key
* @return true if there is a match
*/
@SuppressWarnings("unused")
protected boolean check(boolean leaf, SpatialKey key, SpatialKey test) {
return true;
}
......
......@@ -19,7 +19,6 @@ import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
import org.h2.api.ErrorCode;
import org.h2.engine.Constants;
import org.h2.message.DbException;
......@@ -311,6 +310,7 @@ public class PgServer implements Service {
* @param pretty this flag is ignored
* @return the SQL statement or the column name
*/
@SuppressWarnings("unused")
public static String getIndexColumn(Connection conn, int indexId,
Integer ordinalPosition, Boolean pretty) throws SQLException {
if (ordinalPosition == null || ordinalPosition.intValue() == 0) {
......@@ -438,6 +438,7 @@ public class PgServer implements Service {
* @param privilege the privilege to check
* @return true
*/
@SuppressWarnings("unused")
public static boolean hasDatabasePrivilege(int id, String privilege) {
return true;
}
......@@ -450,6 +451,7 @@ public class PgServer implements Service {
* @param privilege the privilege to check
* @return true
*/
@SuppressWarnings("unused")
public static boolean hasTablePrivilege(String table, String privilege) {
return true;
}
......@@ -462,6 +464,7 @@ public class PgServer implements Service {
* @param id the id
* @return 1
*/
@SuppressWarnings("unused")
public static int getCurrentTid(String table, String id) {
return 1;
}
......@@ -475,6 +478,7 @@ public class PgServer implements Service {
* @param relationOid the relation object id
* @return always null
*/
@SuppressWarnings("unused")
public static String getPgExpr(String exprText, int relationOid) {
return null;
}
......
......@@ -147,6 +147,7 @@ public class FileStore {
*
* @param salt the salt
*/
@SuppressWarnings("unused")
protected void initKey(byte[] salt) {
// do nothing
}
......
......@@ -254,6 +254,7 @@ public abstract class FilePath {
* @param inTempDir if the file should be stored in the temporary directory
* @return the name of the created file
*/
@SuppressWarnings("unused")
public FilePath createTempFile(String suffix, boolean deleteOnExit,
boolean inTempDir) throws IOException {
while (true) {
......
......@@ -155,6 +155,7 @@ public abstract class Table extends SchemaObjectBase {
* @param key the primary key
* @return the row
*/
@SuppressWarnings("unused")
public Row getRow(Session session, long key) {
return null;
}
......@@ -189,6 +190,7 @@ public abstract class Table extends SchemaObjectBase {
* @param operation the operation
* @param row the row
*/
@SuppressWarnings("unused")
public void commit(short operation, Row row) {
// nothing to do
}
......@@ -226,6 +228,7 @@ public abstract class Table extends SchemaObjectBase {
* @param allColumnsSet all columns
* @return the scan index
*/
@SuppressWarnings("unused")
public Index getScanIndex(Session session, int[] masks,
TableFilter[] filters, int filter, SortOrder sortOrder,
HashSet<Column> allColumnsSet) {
......@@ -456,6 +459,7 @@ public abstract class Table extends SchemaObjectBase {
* @param session the session
* @return true if it is
*/
@SuppressWarnings("unused")
public boolean isLockedExclusivelyBy(Session session) {
return false;
}
......@@ -1136,6 +1140,7 @@ public abstract class Table extends SchemaObjectBase {
* @return an object array with the sessions involved in the deadlock, or
* null
*/
@SuppressWarnings("unused")
public ArrayList<Session> checkDeadlock(Session session, Session clash,
Set<Session> visited) {
return null;
......
......@@ -71,12 +71,11 @@ public class TableView extends Table {
* dependent views.
*
* @param querySQL the SQL statement
* @param columnNames the column names
* @param session the session
* @param recursive whether this is a recursive view
* @param force if errors should be ignored
*/
public void replace(String querySQL, String[] columnNames, Session session,
public void replace(String querySQL, Session session,
boolean recursive, boolean force) {
String oldQuerySQL = this.querySQL;
Column[] oldColumnTemplates = this.columnTemplates;
......
......@@ -102,7 +102,7 @@ public class Profiler implements Runnable {
* @param agentArgs the agent arguments
* @param inst the instrumentation object
*/
public static void premain(String agentArgs, Instrumentation inst) {
public static void premain(@SuppressWarnings("unused") String agentArgs, Instrumentation inst) {
instrumentation = inst;
}
......
......@@ -122,7 +122,7 @@ public class ToChar {
* @return the formatted number
*/
public static String toChar(BigDecimal number, String format,
String nlsParam) {
@SuppressWarnings("unused") String nlsParam) {
// short-circuit logic for formats that don't follow common logic below
String formatUp = format != null ? StringUtils.toUpperEnglish(format) : null;
......@@ -594,7 +594,7 @@ public class ToChar {
* @param nlsParam the NLS parameter (if any)
* @return the formatted timestamp
*/
public static String toChar(Timestamp ts, String format, String nlsParam) {
public static String toChar(Timestamp ts, String format, @SuppressWarnings("unused") String nlsParam) {
if (format == null) {
format = "DD-MON-YY HH.MI.SS.FF PM";
......
......@@ -477,7 +477,7 @@ public abstract class Value {
* @param v the value to add
* @return the result
*/
public Value add(Value v) {
public Value add(@SuppressWarnings("unused") Value v) {
throw throwUnsupportedExceptionForType("+");
}
......@@ -500,7 +500,7 @@ public abstract class Value {
* @param v the value to subtract
* @return the result
*/
public Value subtract(Value v) {
public Value subtract(@SuppressWarnings("unused") Value v) {
throw throwUnsupportedExceptionForType("-");
}
......@@ -510,7 +510,7 @@ public abstract class Value {
* @param v the value to divide by
* @return the result
*/
public Value divide(Value v) {
public Value divide(@SuppressWarnings("unused") Value v) {
throw throwUnsupportedExceptionForType("/");
}
......@@ -520,7 +520,7 @@ public abstract class Value {
* @param v the value to multiply with
* @return the result
*/
public Value multiply(Value v) {
public Value multiply(@SuppressWarnings("unused") Value v) {
throw throwUnsupportedExceptionForType("*");
}
......@@ -530,7 +530,7 @@ public abstract class Value {
* @param v the value to take the modulus with
* @return the result
*/
public Value modulus(Value v) {
public Value modulus(@SuppressWarnings("unused") Value v) {
throw throwUnsupportedExceptionForType("%");
}
......@@ -1054,6 +1054,7 @@ public abstract class Value {
* @param targetScale the requested scale
* @return the value
*/
@SuppressWarnings("unused")
public Value convertScale(boolean onlyToSmallerScale, int targetScale) {
return this;
}
......@@ -1067,6 +1068,7 @@ public abstract class Value {
* @param force true if losing numeric precision is allowed
* @return the new value
*/
@SuppressWarnings("unused")
public Value convertPrecision(long precision, boolean force) {
return this;
}
......@@ -1122,6 +1124,7 @@ public abstract class Value {
* @param tableId the table where this object is used
* @return the new value or itself
*/
@SuppressWarnings("unused")
public Value copy(DataHandler handler, int tableId) {
return this;
}
......
......@@ -34,7 +34,6 @@ import java.util.ArrayList;
import java.util.LinkedList;
import java.util.SimpleTimeZone;
import java.util.concurrent.TimeUnit;
import org.h2.jdbc.JdbcConnection;
import org.h2.message.DbException;
import org.h2.store.fs.FilePath;
......@@ -130,6 +129,7 @@ public abstract class TestBase {
*
* @param seed the random seed value
*/
@SuppressWarnings("unused")
public void testCase(int seed) throws Exception {
// do nothing
}
......
......@@ -16,8 +16,8 @@ import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.Arrays;
import org.h2.test.utils.SelfDestructor;
import org.h2.util.Task;
import org.h2.util.StringUtils;
import org.h2.util.Task;
/**
* A task that is run as an external process. This class communicates over
......@@ -59,7 +59,6 @@ public class TaskProcess {
}
String[] procDef = new String[list.size()];
list.toArray(procDef);
traceOperation("start: " + StringUtils.arrayCombine(procDef, ' '));
process = Runtime.getRuntime().exec(procDef);
copyInThread(process.getErrorStream(), System.err);
reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
......@@ -70,7 +69,6 @@ public class TaskProcess {
"No reply from process, command: " +
StringUtils.arrayCombine(procDef, ' '));
} else if (line.startsWith("running")) {
traceOperation("got reply: " + line);
} else if (line.startsWith("init error")) {
throw new RuntimeException(line);
}
......@@ -130,12 +128,4 @@ public class TaskProcess {
process.destroy();
}
/**
* Trace the operation. Tracing is disabled by default.
*
* @param s the string to print
*/
private void traceOperation(String s) {
// ignore
}
}
......@@ -179,7 +179,7 @@ public class TestFunctions extends TestBase implements AggregateFunction {
* @param conn the connection
* @return a result set
*/
public static ResultSet simpleFunctionTable(Connection conn) {
public static ResultSet simpleFunctionTable(@SuppressWarnings("unused") Connection conn) {
SimpleResultSet result = new SimpleResultSet();
result.addColumn("A", Types.INTEGER, 0, 0);
result.addColumn("B", Types.CHAR, 0, 0);
......@@ -2259,7 +2259,7 @@ public class TestFunctions extends TestBase implements AggregateFunction {
* @param conn the connection
* @return the result set
*/
public static ResultSet nullResultSet(Connection conn) {
public static ResultSet nullResultSet(@SuppressWarnings("unused") Connection conn) {
return null;
}
......
......@@ -13,7 +13,6 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import org.h2.test.TestBase;
/**
......@@ -138,7 +137,7 @@ public class TestBatchUpdates extends TestBase {
* @param f the float
* @return the float converted to an int
*/
public static int updatePrices(String message, double f) {
public static int updatePrices(@SuppressWarnings("unused") String message, double f) {
return (int) f;
}
......
......@@ -2067,6 +2067,7 @@ public class TestMVStore extends TestBase {
*
* @param msg the message
*/
@SuppressWarnings("unused")
protected static void log(String msg) {
// System.out.println(msg);
}
......
......@@ -88,7 +88,7 @@ public class TestSort extends TestBase {
*
* @param type the type of data
*/
private void test(String type) throws Exception {
private void test(@SuppressWarnings("unused") String type) throws Exception {
compareCount.set(0);
// long t = System.nanoTime();
......
......@@ -18,7 +18,7 @@ public class H2Utils {
* @param factory the cursor factory to use
* @return the database connection
*/
public static H2Database openOrCreateDatabase(String name, int mode,
public static H2Database openOrCreateDatabase(String name, @SuppressWarnings("unused") int mode,
H2Database.CursorFactory factory) {
return H2Database.openOrCreateDatabase(name, factory);
}
......
......@@ -495,7 +495,7 @@ public class XMLParser {
* @param name the local name of the attribute
* @return the value or null
*/
public String getAttributeValue(String namespaceURI, String name) {
public String getAttributeValue(@SuppressWarnings("unused") String namespaceURI, String name) {
int len = getAttributeCount();
for (int i = 0; i < len; i++) {
if (getAttributeLocalName(i).equals(name)) {
......
......@@ -194,6 +194,7 @@ public class CacheLIRS<K, V> extends AbstractMap<K, V> {
* @param value the value
* @return the size
*/
@SuppressWarnings("unused")
protected int sizeOf(K key, V value) {
return 1;
}
......@@ -204,7 +205,7 @@ public class CacheLIRS<K, V> extends AbstractMap<K, V> {
*
* @param key the key
*/
protected void onRemove(K key) {
protected void onRemove(@SuppressWarnings("unused") K key) {
// do nothing
}
......
......@@ -5,6 +5,9 @@
*/
package org.h2.jaqu;
import static org.h2.jaqu.ValidationRemark.consider;
import static org.h2.jaqu.ValidationRemark.error;
import static org.h2.jaqu.ValidationRemark.warn;
import java.lang.reflect.Modifier;
import java.sql.DatabaseMetaData;
import java.sql.ResultSet;
......@@ -28,10 +31,6 @@ import org.h2.util.New;
import org.h2.util.StatementBuilder;
import org.h2.util.StringUtils;
import static org.h2.jaqu.ValidationRemark.consider;
import static org.h2.jaqu.ValidationRemark.error;
import static org.h2.jaqu.ValidationRemark.warn;
/**
* Class to inspect the contents of a particular table including its indexes.
* This class does the bulk of the work in terms of model generation and model
......@@ -423,6 +422,7 @@ public class TableInspector {
* Validates an inspected index from the database against the
* IndexDefinition within the TableDefinition.
*/
@SuppressWarnings("unused")
private <T> void validate(List<ValidationRemark> remarks,
TableDefinition<T> def, IndexInspector index, boolean throwError) {
List<IndexDefinition> defIndexes = def.getIndexes(IndexType.STANDARD);
......
......@@ -15,6 +15,7 @@ public class PrintStream {
*
* @param s the string
*/
@SuppressWarnings("unused")
public void println(String s) {
// c: int x = s->chars->length();
// c: printf("%.*S\n", x, s->chars->getPointer());
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论