提交 23f072e3 authored 作者: Noel Grandin's avatar Noel Grandin

remove dead code

found by UCDetector
上级 7e5ab118
...@@ -124,7 +124,7 @@ public class Session extends SessionWithState { ...@@ -124,7 +124,7 @@ public class Session extends SessionWithState {
private long modificationMetaID = -1; private long modificationMetaID = -1;
private SubQueryInfo subQueryInfo; private SubQueryInfo subQueryInfo;
private int parsingView; private int parsingView;
private Deque<String> viewNameStack = new ArrayDeque<>(); private final Deque<String> viewNameStack = new ArrayDeque<>();
private int preparingQueryExpression; private int preparingQueryExpression;
private volatile SmallLRUCache<Object, ViewIndex> viewIndexCache; private volatile SmallLRUCache<Object, ViewIndex> viewIndexCache;
private HashMap<Object, ViewIndex> subQueryIndexCache; private HashMap<Object, ViewIndex> subQueryIndexCache;
......
...@@ -56,13 +56,6 @@ public class SysProperties { ...@@ -56,13 +56,6 @@ public class SysProperties {
public static final String FILE_SEPARATOR = public static final String FILE_SEPARATOR =
Utils.getProperty("file.separator", "/"); Utils.getProperty("file.separator", "/");
/**
* System property <code>java.specification.version</code>.<br />
* It is set by the system. Examples: 0.9 (on Android), 1.7, 1.8, 9, 10.
*/
public static final String JAVA_SPECIFICATION_VERSION =
Utils.getProperty("java.specification.version", "1.7");
/** /**
* System property <code>line.separator</code> (default: \n).<br /> * System property <code>line.separator</code> (default: \n).<br />
* It is usually set by the system, and used by the script and trace tools. * It is usually set by the system, and used by the script and trace tools.
......
...@@ -29,7 +29,6 @@ import java.util.Calendar; ...@@ -29,7 +29,6 @@ import java.util.Calendar;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
import org.h2.api.ErrorCode; import org.h2.api.ErrorCode;
import org.h2.api.TimestampWithTimeZone; import org.h2.api.TimestampWithTimeZone;
import org.h2.command.CommandInterface; import org.h2.command.CommandInterface;
...@@ -91,7 +90,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet, JdbcResultS ...@@ -91,7 +90,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet, JdbcResultS
private HashMap<String, Integer> columnLabelMap; private HashMap<String, Integer> columnLabelMap;
private HashMap<Integer, Value[]> patchedRows; private HashMap<Integer, Value[]> patchedRows;
private JdbcPreparedStatement preparedStatement; private JdbcPreparedStatement preparedStatement;
private CommandInterface command; private final CommandInterface command;
JdbcResultSet(JdbcConnection conn, JdbcStatement stat, CommandInterface command, JdbcResultSet(JdbcConnection conn, JdbcStatement stat, CommandInterface command,
ResultInterface result, int id, boolean closeStatement, ResultInterface result, int id, boolean closeStatement,
...@@ -101,7 +100,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet, JdbcResultS ...@@ -101,7 +100,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet, JdbcResultS
this.stat = stat; this.stat = stat;
this.command = command; this.command = command;
this.result = result; this.result = result;
columnCount = result.getVisibleColumnCount(); this.columnCount = result.getVisibleColumnCount();
this.closeStatement = closeStatement; this.closeStatement = closeStatement;
this.scrollable = scrollable; this.scrollable = scrollable;
this.updatable = updatable; this.updatable = updatable;
......
...@@ -237,7 +237,7 @@ public final class MVStore { ...@@ -237,7 +237,7 @@ public final class MVStore {
* are counted. * are counted.
*/ */
private int unsavedMemory; private int unsavedMemory;
private int autoCommitMemory; private final int autoCommitMemory;
private boolean saveNeeded; private boolean saveNeeded;
/** /**
...@@ -274,7 +274,7 @@ public final class MVStore { ...@@ -274,7 +274,7 @@ public final class MVStore {
*/ */
private int autoCommitDelay; private int autoCommitDelay;
private int autoCompactFillRate; private final int autoCompactFillRate;
private long autoCompactLastFileOpCount; private long autoCompactLastFileOpCount;
private final Object compactSync = new Object(); private final Object compactSync = new Object();
...@@ -376,6 +376,9 @@ public final class MVStore { ...@@ -376,6 +376,9 @@ public final class MVStore {
// the parameter is different from the old value // the parameter is different from the old value
int delay = DataUtils.getConfigParam(config, "autoCommitDelay", 1000); int delay = DataUtils.getConfigParam(config, "autoCommitDelay", 1000);
setAutoCommitDelay(delay); setAutoCommitDelay(delay);
} else {
autoCommitMemory = 0;
autoCompactFillRate = 0;
} }
} }
......
...@@ -118,7 +118,7 @@ public class MVTable extends TableBase { ...@@ -118,7 +118,7 @@ public class MVTable extends TableBase {
private final Trace traceLock; private final Trace traceLock;
private int changesSinceAnalyze; private int changesSinceAnalyze;
private int nextAnalyze; private int nextAnalyze;
private boolean containsLargeObject; private final boolean containsLargeObject;
private Column rowIdColumn; private Column rowIdColumn;
private final MVTableEngine.Store store; private final MVTableEngine.Store store;
...@@ -130,11 +130,14 @@ public class MVTable extends TableBase { ...@@ -130,11 +130,14 @@ public class MVTable extends TableBase {
this.store = store; this.store = store;
this.transactionStore = store.getTransactionStore(); this.transactionStore = store.getTransactionStore();
this.isHidden = data.isHidden; this.isHidden = data.isHidden;
boolean b = false;
for (Column col : getColumns()) { for (Column col : getColumns()) {
if (DataType.isLargeObject(col.getType())) { if (DataType.isLargeObject(col.getType())) {
containsLargeObject = true; b = true;
break;
} }
} }
containsLargeObject = b;
traceLock = database.getTrace(Trace.LOCK); traceLock = database.getTrace(Trace.LOCK);
} }
......
...@@ -468,7 +468,7 @@ public class TransactionStore { ...@@ -468,7 +468,7 @@ public class TransactionStore {
* End this transaction * End this transaction
* *
* @param t the transaction * @param t the transaction
* @param previous status of this transaction * @param oldStatus status of this transaction
*/ */
synchronized void endTransaction(Transaction t, int oldStatus) { synchronized void endTransaction(Transaction t, int oldStatus) {
if (oldStatus == Transaction.STATUS_PREPARED) { if (oldStatus == Transaction.STATUS_PREPARED) {
......
...@@ -31,16 +31,16 @@ public class ResultTempTable implements ResultExternal { ...@@ -31,16 +31,16 @@ public class ResultTempTable implements ResultExternal {
private final boolean distinct; private final boolean distinct;
private final SortOrder sort; private final SortOrder sort;
private Index index; private Index index;
private Session session; private final Session session;
private Table table; private Table table;
private Cursor resultCursor; private Cursor resultCursor;
private int rowCount; private int rowCount;
private int columnCount; private final int columnCount;
private final ResultTempTable parent; private final ResultTempTable parent;
private boolean closed; private boolean closed;
private int childCount; private int childCount;
private boolean containsLob; private final boolean containsLob;
ResultTempTable(Session session, Expression[] expressions, boolean distinct, SortOrder sort) { ResultTempTable(Session session, Expression[] expressions, boolean distinct, SortOrder sort) {
this.session = session; this.session = session;
...@@ -49,15 +49,17 @@ public class ResultTempTable implements ResultExternal { ...@@ -49,15 +49,17 @@ public class ResultTempTable implements ResultExternal {
this.columnCount = expressions.length; this.columnCount = expressions.length;
Schema schema = session.getDatabase().getSchema(Constants.SCHEMA_MAIN); Schema schema = session.getDatabase().getSchema(Constants.SCHEMA_MAIN);
CreateTableData data = new CreateTableData(); CreateTableData data = new CreateTableData();
boolean b = false;
for (int i = 0; i < expressions.length; i++) { for (int i = 0; i < expressions.length; i++) {
int type = expressions[i].getType(); int type = expressions[i].getType();
Column col = new Column(COLUMN_NAME + i, Column col = new Column(COLUMN_NAME + i,
type); type);
if (type == Value.CLOB || type == Value.BLOB) { if (type == Value.CLOB || type == Value.BLOB) {
containsLob = true; b = true;
} }
data.columns.add(col); data.columns.add(col);
} }
containsLob = b;
data.id = session.getDatabase().allocateObjectId(); data.id = session.getDatabase().allocateObjectId();
data.tableName = "TEMP_RESULT_SET_" + data.id; data.tableName = "TEMP_RESULT_SET_" + data.id;
data.temporary = true; data.temporary = true;
......
...@@ -10,7 +10,6 @@ import java.sql.PreparedStatement; ...@@ -10,7 +10,6 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import org.h2.api.ErrorCode; import org.h2.api.ErrorCode;
import org.h2.jdbc.JdbcConnection; import org.h2.jdbc.JdbcConnection;
import org.h2.message.DbException; import org.h2.message.DbException;
......
...@@ -64,7 +64,7 @@ public class RegularTable extends TableBase { ...@@ -64,7 +64,7 @@ public class RegularTable extends TableBase {
private final Trace traceLock; private final Trace traceLock;
private final ArrayList<Index> indexes = New.arrayList(); private final ArrayList<Index> indexes = New.arrayList();
private long lastModificationId; private long lastModificationId;
private boolean containsLargeObject; private final boolean containsLargeObject;
private final PageDataIndex mainIndex; private final PageDataIndex mainIndex;
private int changesSinceAnalyze; private int changesSinceAnalyze;
private int nextAnalyze; private int nextAnalyze;
...@@ -74,11 +74,14 @@ public class RegularTable extends TableBase { ...@@ -74,11 +74,14 @@ public class RegularTable extends TableBase {
super(data); super(data);
nextAnalyze = database.getSettings().analyzeAuto; nextAnalyze = database.getSettings().analyzeAuto;
this.isHidden = data.isHidden; this.isHidden = data.isHidden;
boolean b = false;
for (Column col : getColumns()) { for (Column col : getColumns()) {
if (DataType.isLargeObject(col.getType())) { if (DataType.isLargeObject(col.getType())) {
containsLargeObject = true; b = true;
break;
} }
} }
containsLargeObject = b;
if (data.persistData && database.isPersistent()) { if (data.persistData && database.isPersistent()) {
mainIndex = new PageDataIndex(this, data.id, mainIndex = new PageDataIndex(this, data.id,
IndexColumn.wrap(getColumns()), IndexColumn.wrap(getColumns()),
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
*/ */
package org.h2.table; package org.h2.table;
import java.util.ArrayList; import java.util.Collections;
import java.util.List; import java.util.List;
import org.h2.command.ddl.CreateTableData; import org.h2.command.ddl.CreateTableData;
import org.h2.engine.Database; import org.h2.engine.Database;
...@@ -27,7 +27,7 @@ public abstract class TableBase extends Table { ...@@ -27,7 +27,7 @@ public abstract class TableBase extends Table {
*/ */
private final String tableEngine; private final String tableEngine;
/** Provided table parameters */ /** Provided table parameters */
private List<String> tableEngineParams = new ArrayList<>(); private final List<String> tableEngineParams;
private final boolean globalTemporary; private final boolean globalTemporary;
...@@ -38,6 +38,8 @@ public abstract class TableBase extends Table { ...@@ -38,6 +38,8 @@ public abstract class TableBase extends Table {
this.globalTemporary = data.globalTemporary; this.globalTemporary = data.globalTemporary;
if (data.tableEngineParams != null) { if (data.tableEngineParams != null) {
this.tableEngineParams = data.tableEngineParams; this.tableEngineParams = data.tableEngineParams;
} else {
this.tableEngineParams = Collections.EMPTY_LIST;
} }
setTemporary(data.temporary); setTemporary(data.temporary);
Column[] cols = data.columns.toArray(new Column[0]); Column[] cols = data.columns.toArray(new Column[0]);
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
package org.h2.util; package org.h2.util;
import static java.lang.String.format; import static java.lang.String.format;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
...@@ -113,11 +112,6 @@ class ToDateTokenizer { ...@@ -113,11 +112,6 @@ class ToDateTokenizer {
*/ */
static final InlineParslet PARSLET_INLINE = new InlineParslet(); static final InlineParslet PARSLET_INLINE = new InlineParslet();
/**
* The number of milliseconds in a day.
*/
static final int MILLIS_IN_HOUR = 60 * 60 * 1000;
/** /**
* Interface of the classes that can parse a specialized small bit of the * Interface of the classes that can parse a specialized small bit of the
* TO_DATE format-string. * TO_DATE format-string.
......
...@@ -5,18 +5,22 @@ ...@@ -5,18 +5,22 @@
*/ */
package org.h2.test.db; package org.h2.test.db;
import org.h2.api.ErrorCode; import java.sql.Connection;
import org.h2.test.TestBase; import java.sql.PreparedStatement;
import org.h2.tools.SimpleResultSet; import java.sql.ResultSet;
import org.h2.util.StringUtils; import java.sql.SQLException;
import org.h2.util.Task; import java.sql.Statement;
import java.sql.Types;
import java.sql.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Random; import java.util.Random;
import java.util.TreeSet; import java.util.TreeSet;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.h2.api.ErrorCode;
import org.h2.test.TestBase;
import org.h2.tools.SimpleResultSet;
import org.h2.util.StringUtils;
import org.h2.util.Task;
/** /**
* Test various optimizations (query cache, optimization for MIN(..), and * Test various optimizations (query cache, optimization for MIN(..), and
...@@ -818,7 +822,7 @@ public class TestOptimizations extends TestBase { ...@@ -818,7 +822,7 @@ public class TestOptimizations extends TestBase {
} }
} }
private long measureQuerySpeed(Statement stat, String sql, boolean optimized) throws SQLException { private static long measureQuerySpeed(Statement stat, String sql, boolean optimized) throws SQLException {
stat.execute("set OPTIMIZE_REUSE_RESULTS " + (optimized ? "1" : "0")); stat.execute("set OPTIMIZE_REUSE_RESULTS " + (optimized ? "1" : "0"));
stat.execute(sql); stat.execute(sql);
long time = System.nanoTime(); long time = System.nanoTime();
......
...@@ -8,12 +8,10 @@ package org.h2.test.store; ...@@ -8,12 +8,10 @@ package org.h2.test.store;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.TreeMap; import java.util.TreeMap;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.h2.mvstore.MVStore; import org.h2.mvstore.MVStore;
import org.h2.test.TestBase; import org.h2.test.TestBase;
import org.h2.util.New; import org.h2.util.New;
......
...@@ -19,8 +19,8 @@ import org.h2.jaqu.Table.JQColumn; ...@@ -19,8 +19,8 @@ import org.h2.jaqu.Table.JQColumn;
import org.h2.jaqu.Table.JQIndex; import org.h2.jaqu.Table.JQIndex;
import org.h2.jaqu.Table.JQSchema; import org.h2.jaqu.Table.JQSchema;
import org.h2.jaqu.Table.JQTable; import org.h2.jaqu.Table.JQTable;
import org.h2.jaqu.util.StatementLogger;
import org.h2.jaqu.util.ClassUtils; import org.h2.jaqu.util.ClassUtils;
import org.h2.jaqu.util.StatementLogger;
import org.h2.util.New; import org.h2.util.New;
import org.h2.util.StatementBuilder; import org.h2.util.StatementBuilder;
import org.h2.util.StringUtils; import org.h2.util.StringUtils;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论