提交 2a081d0d authored 作者: Noel Grandin's avatar Noel Grandin

make some fields final

found by UCDetector
上级 3d763b4a
...@@ -21,7 +21,7 @@ public class DbColumn { ...@@ -21,7 +21,7 @@ public class DbColumn {
private final String dataType; private final String dataType;
private int position; private final int position;
private DbColumn(DbContents contents, ResultSet rs, boolean procedureColumn) private DbColumn(DbContents contents, ResultSet rs, boolean procedureColumn)
throws SQLException { throws SQLException {
......
...@@ -5,12 +5,11 @@ ...@@ -5,12 +5,11 @@
*/ */
package org.h2.bnf.context; package org.h2.bnf.context;
import org.h2.util.New;
import java.sql.DatabaseMetaData; import java.sql.DatabaseMetaData;
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.util.New;
/** /**
* Contains meta data information about a procedure. * Contains meta data information about a procedure.
...@@ -21,7 +20,7 @@ public class DbProcedure { ...@@ -21,7 +20,7 @@ public class DbProcedure {
private final DbSchema schema; private final DbSchema schema;
private final String name; private final String name;
private final String quotedName; private final String quotedName;
private boolean returnsResult; private final boolean returnsResult;
private DbColumn[] parameters; private DbColumn[] parameters;
public DbProcedure(DbSchema schema, ResultSet rs) throws SQLException { public DbProcedure(DbSchema schema, ResultSet rs) throws SQLException {
......
...@@ -50,7 +50,7 @@ public class AlterTableAddConstraint extends SchemaCommand { ...@@ -50,7 +50,7 @@ public class AlterTableAddConstraint extends SchemaCommand {
private boolean primaryKeyHash; private boolean primaryKeyHash;
private boolean ifTableExists; private boolean ifTableExists;
private final boolean ifNotExists; private final boolean ifNotExists;
private ArrayList<Index> createdIndexes = New.arrayList(); private final ArrayList<Index> createdIndexes = New.arrayList();
public AlterTableAddConstraint(Session session, Schema schema, public AlterTableAddConstraint(Session session, Schema schema,
boolean ifNotExists) { boolean ifNotExists) {
......
...@@ -114,7 +114,7 @@ public class MergeUsing extends Prepared { ...@@ -114,7 +114,7 @@ public class MergeUsing extends Prepared {
private int countUpdatedRows = 0; private int countUpdatedRows = 0;
private Column[] sourceKeys; private Column[] sourceKeys;
private Select targetMatchQuery; private Select targetMatchQuery;
private HashMap<Value, Integer> targetRowidsRemembered = new HashMap<>(); private final HashMap<Value, Integer> targetRowidsRemembered = new HashMap<>();
private int sourceQueryRowNumber = 0; private int sourceQueryRowNumber = 0;
public MergeUsing(Merge merge) { public MergeUsing(Merge merge) {
......
...@@ -78,7 +78,7 @@ public class DbSettings extends SettingsBase { ...@@ -78,7 +78,7 @@ public class DbSettings extends SettingsBase {
* performance reasons. Please note the Oracle JDBC driver will try to * performance reasons. Please note the Oracle JDBC driver will try to
* resolve this database URL if it is loaded before the H2 driver. * resolve this database URL if it is loaded before the H2 driver.
*/ */
public boolean defaultConnection = get("DEFAULT_CONNECTION", false); public final boolean defaultConnection = get("DEFAULT_CONNECTION", false);
/** /**
* Database setting <code>DEFAULT_ESCAPE</code> (default: \).<br /> * Database setting <code>DEFAULT_ESCAPE</code> (default: \).<br />
...@@ -162,7 +162,7 @@ public class DbSettings extends SettingsBase { ...@@ -162,7 +162,7 @@ public class DbSettings extends SettingsBase {
* no limit. Please note the actual query timeout may be set to a lower * no limit. Please note the actual query timeout may be set to a lower
* value. * value.
*/ */
public int maxQueryTimeout = get("MAX_QUERY_TIMEOUT", 0); public final int maxQueryTimeout = get("MAX_QUERY_TIMEOUT", 0);
/** /**
* Database setting <code>NESTED_JOINS</code> (default: true).<br /> * Database setting <code>NESTED_JOINS</code> (default: true).<br />
......
...@@ -92,7 +92,7 @@ public class SessionRemote extends SessionWithState implements DataHandler { ...@@ -92,7 +92,7 @@ public class SessionRemote extends SessionWithState implements DataHandler {
private JavaObjectSerializer javaObjectSerializer; private JavaObjectSerializer javaObjectSerializer;
private volatile boolean javaObjectSerializerInitialized; private volatile boolean javaObjectSerializerInitialized;
private CompareMode compareMode = CompareMode.getInstance(null, 0); private final CompareMode compareMode = CompareMode.getInstance(null, 0);
public SessionRemote(ConnectionInfo ci) { public SessionRemote(ConnectionInfo ci) {
this.connectionInfo = ci; this.connectionInfo = ci;
......
...@@ -17,7 +17,7 @@ import org.h2.value.Value; ...@@ -17,7 +17,7 @@ import org.h2.value.Value;
*/ */
public class FunctionCursor implements Cursor { public class FunctionCursor implements Cursor {
private Session session; private final Session session;
private final ResultInterface result; private final ResultInterface result;
private Value[] values; private Value[] values;
private Row row; private Row row;
......
...@@ -17,7 +17,7 @@ import org.h2.value.ValueLong; ...@@ -17,7 +17,7 @@ import org.h2.value.ValueLong;
*/ */
class RangeCursor implements Cursor { class RangeCursor implements Cursor {
private Session session; private final Session session;
private boolean beforeFirst; private boolean beforeFirst;
private long current; private long current;
private Row currentRow; private Row currentRow;
......
...@@ -56,7 +56,7 @@ public class MVMap<K, V> extends AbstractMap<K, V> ...@@ -56,7 +56,7 @@ public class MVMap<K, V> extends AbstractMap<K, V>
private final DataType keyType; private final DataType keyType;
private final DataType valueType; private final DataType valueType;
private ConcurrentArrayList<Page> oldRoots = private final ConcurrentArrayList<Page> oldRoots =
new ConcurrentArrayList<>(); new ConcurrentArrayList<>();
......
...@@ -277,7 +277,7 @@ public final class MVStore { ...@@ -277,7 +277,7 @@ public final class MVStore {
private int autoCompactFillRate; private int autoCompactFillRate;
private long autoCompactLastFileOpCount; private long autoCompactLastFileOpCount;
private Object compactSync = new Object(); private final Object compactSync = new Object();
private IllegalStateException panicException; private IllegalStateException panicException;
......
...@@ -1192,7 +1192,7 @@ public class CacheLongKeyLIRS<V> { ...@@ -1192,7 +1192,7 @@ public class CacheLongKeyLIRS<V> {
* The number of entries in the non-resident queue, as a factor of the * The number of entries in the non-resident queue, as a factor of the
* number of all other entries in the map. * number of all other entries in the map.
*/ */
public int nonResidentQueueSize = 3; public final int nonResidentQueueSize = 3;
} }
......
...@@ -49,7 +49,7 @@ public class MVPrimaryIndex extends BaseIndex { ...@@ -49,7 +49,7 @@ public class MVPrimaryIndex extends BaseIndex {
private final MVTable mvTable; private final MVTable mvTable;
private final String mapName; private final String mapName;
private TransactionMap<Value, Value> dataMap; private final TransactionMap<Value, Value> dataMap;
private final AtomicLong lastKey = new AtomicLong(0); private final AtomicLong lastKey = new AtomicLong(0);
private int mainIndexColumn = -1; private int mainIndexColumn = -1;
......
...@@ -52,8 +52,8 @@ public class MVSpatialIndex extends BaseIndex implements SpatialIndex, MVIndex { ...@@ -52,8 +52,8 @@ public class MVSpatialIndex extends BaseIndex implements SpatialIndex, MVIndex {
final MVTable mvTable; final MVTable mvTable;
private final String mapName; private final String mapName;
private TransactionMap<SpatialKey, Value> dataMap; private final TransactionMap<SpatialKey, Value> dataMap;
private MVRTreeMap<VersionedValue> spatialMap; private final MVRTreeMap<VersionedValue> spatialMap;
/** /**
* Constructor. * Constructor.
......
...@@ -59,7 +59,7 @@ public class TransactionStore { ...@@ -59,7 +59,7 @@ public class TransactionStore {
/** /**
* The map of maps. * The map of maps.
*/ */
private HashMap<Integer, MVMap<Object, VersionedValue>> maps = private final HashMap<Integer, MVMap<Object, VersionedValue>> maps =
New.hashMap(); New.hashMap();
private final DataType dataType; private final DataType dataType;
...@@ -896,7 +896,7 @@ public class TransactionStore { ...@@ -896,7 +896,7 @@ public class TransactionStore {
*/ */
final MVMap<K, VersionedValue> map; final MVMap<K, VersionedValue> map;
private Transaction transaction; private final Transaction transaction;
TransactionMap(Transaction transaction, MVMap<K, VersionedValue> map, TransactionMap(Transaction transaction, MVMap<K, VersionedValue> map,
int mapId) { int mapId) {
......
...@@ -17,7 +17,7 @@ import org.h2.value.Value; ...@@ -17,7 +17,7 @@ import org.h2.value.Value;
*/ */
public abstract class LazyResult implements ResultInterface { public abstract class LazyResult implements ResultInterface {
private Expression[] expressions; private final Expression[] expressions;
private int rowId = -1; private int rowId = -1;
private Value[] currentRow; private Value[] currentRow;
private Value[] nextRow; private Value[] nextRow;
......
...@@ -62,7 +62,7 @@ public class PgServerThread implements Runnable { ...@@ -62,7 +62,7 @@ public class PgServerThread implements Runnable {
private String userName; private String userName;
private String databaseName; private String databaseName;
private int processId; private int processId;
private int secret; private final int secret;
private JdbcStatement activeRequest; private JdbcStatement activeRequest;
private String clientEncoding = SysProperties.PG_DEFAULT_CLIENT_ENCODING; private String clientEncoding = SysProperties.PG_DEFAULT_CLIENT_ENCODING;
private String dateStyle = "ISO"; private String dateStyle = "ISO";
......
...@@ -37,7 +37,7 @@ public class LobStorageMap implements LobStorageInterface { ...@@ -37,7 +37,7 @@ public class LobStorageMap implements LobStorageInterface {
private boolean init; private boolean init;
private Object nextLobIdSync = new Object(); private final Object nextLobIdSync = new Object();
private long nextLobId; private long nextLobId;
/** /**
......
...@@ -87,7 +87,7 @@ public final class JoinBatch { ...@@ -87,7 +87,7 @@ public final class JoinBatch {
/** /**
* The filters. * The filters.
*/ */
JoinFilter[] filters; final JoinFilter[] filters;
/** /**
* Whether this is a batched subquery. * Whether this is a batched subquery.
......
...@@ -15,11 +15,11 @@ import org.h2.result.SortOrder; ...@@ -15,11 +15,11 @@ import org.h2.result.SortOrder;
*/ */
public class SubQueryInfo { public class SubQueryInfo {
private int[] masks; private final int[] masks;
private TableFilter[] filters; private final TableFilter[] filters;
private int filter; private final int filter;
private SortOrder sortOrder; private final SortOrder sortOrder;
private SubQueryInfo upper; private final SubQueryInfo upper;
/** /**
* @param upper upper level sub-query if any * @param upper upper level sub-query if any
......
...@@ -12,7 +12,6 @@ import java.util.ArrayList; ...@@ -12,7 +12,6 @@ import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import org.h2.message.DbException; import org.h2.message.DbException;
import org.h2.store.fs.FileUtils; import org.h2.store.fs.FileUtils;
import org.h2.util.IOUtils; import org.h2.util.IOUtils;
......
...@@ -23,7 +23,7 @@ import java.util.WeakHashMap; ...@@ -23,7 +23,7 @@ import java.util.WeakHashMap;
*/ */
public class AbbaLockingDetector implements Runnable { public class AbbaLockingDetector implements Runnable {
private int tickIntervalMs = 2; private final int tickIntervalMs = 2;
private volatile boolean stop; private volatile boolean stop;
private final ThreadMXBean threadMXBean = private final ThreadMXBean threadMXBean =
......
...@@ -17,8 +17,8 @@ public class ColumnNamer { ...@@ -17,8 +17,8 @@ public class ColumnNamer {
private static final String DEFAULT_COLUMN_NAME = "DEFAULT"; private static final String DEFAULT_COLUMN_NAME = "DEFAULT";
private ColumnNamerConfiguration configuration; private final ColumnNamerConfiguration configuration;
private Session session; private final Session session;
private final Set<String> existingColumnNames = new HashSet<>(); private final Set<String> existingColumnNames = new HashSet<>();
public ColumnNamer(Session session) { public ColumnNamer(Session session) {
......
...@@ -8,11 +8,9 @@ package org.h2.util; ...@@ -8,11 +8,9 @@ package org.h2.util;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException; import java.sql.SQLFeatureNotSupportedException;
import java.util.Properties; import java.util.Properties;
import javax.sql.ConnectionPoolDataSource; import javax.sql.ConnectionPoolDataSource;
import javax.sql.DataSource; import javax.sql.DataSource;
import javax.sql.XADataSource; import javax.sql.XADataSource;
import org.h2.engine.Constants; import org.h2.engine.Constants;
import org.h2.jdbcx.JdbcDataSource; import org.h2.jdbcx.JdbcDataSource;
import org.osgi.framework.BundleContext; import org.osgi.framework.BundleContext;
...@@ -38,7 +36,7 @@ import org.osgi.service.jdbc.DataSourceFactory; ...@@ -38,7 +36,7 @@ import org.osgi.service.jdbc.DataSourceFactory;
* @author Per Otterstrom * @author Per Otterstrom
*/ */
public class OsgiDataSourceFactory implements DataSourceFactory { public class OsgiDataSourceFactory implements DataSourceFactory {
private org.h2.Driver driver; private final org.h2.Driver driver;
public OsgiDataSourceFactory(org.h2.Driver driver) { public OsgiDataSourceFactory(org.h2.Driver driver) {
this.driver = driver; this.driver = driver;
......
...@@ -13,7 +13,7 @@ import java.util.concurrent.atomic.AtomicInteger; ...@@ -13,7 +13,7 @@ import java.util.concurrent.atomic.AtomicInteger;
*/ */
public abstract class Task implements Runnable { public abstract class Task implements Runnable {
private static AtomicInteger counter = new AtomicInteger(); private final static AtomicInteger counter = new AtomicInteger();
/** /**
* A flag indicating the get() method has been called. * A flag indicating the get() method has been called.
......
...@@ -54,7 +54,7 @@ public class ValueLobDb extends Value implements Value.ValueClob, ...@@ -54,7 +54,7 @@ public class ValueLobDb extends Value implements Value.ValueClob,
private final String fileName; private final String fileName;
private final FileStore tempFile; private final FileStore tempFile;
private int tableId; private final int tableId;
private int hash; private int hash;
//Arbonaut: 13.07.2016 //Arbonaut: 13.07.2016
...@@ -84,6 +84,7 @@ public class ValueLobDb extends Value implements Value.ValueClob, ...@@ -84,6 +84,7 @@ public class ValueLobDb extends Value implements Value.ValueClob,
this.handler = null; this.handler = null;
this.fileName = null; this.fileName = null;
this.tempFile = null; this.tempFile = null;
this.tableId = 0;
} }
/** /**
...@@ -115,6 +116,7 @@ public class ValueLobDb extends Value implements Value.ValueClob, ...@@ -115,6 +116,7 @@ public class ValueLobDb extends Value implements Value.ValueClob,
} }
} }
this.precision = tmpPrecision; this.precision = tmpPrecision;
this.tableId = 0;
} }
/** /**
...@@ -151,6 +153,7 @@ public class ValueLobDb extends Value implements Value.ValueClob, ...@@ -151,6 +153,7 @@ public class ValueLobDb extends Value implements Value.ValueClob,
out.close(); out.close();
} }
this.precision = tmpPrecision; this.precision = tmpPrecision;
this.tableId = 0;
} }
private static String createTempLobFileName(DataHandler handler) private static String createTempLobFileName(DataHandler handler)
......
...@@ -178,13 +178,13 @@ public class BuildBase { ...@@ -178,13 +178,13 @@ public class BuildBase {
/** /**
* The full path to the executable of the current JRE. * The full path to the executable of the current JRE.
*/ */
protected String javaExecutable = System.getProperty("java.home") + protected final String javaExecutable = System.getProperty("java.home") +
File.separator + "bin" + File.separator + "java"; File.separator + "bin" + File.separator + "java";
/** /**
* The full path to the tools jar of the current JDK. * The full path to the tools jar of the current JDK.
*/ */
protected String javaToolsJar = System.getProperty("java.home") + File.separator + ".." + protected final String javaToolsJar = System.getProperty("java.home") + File.separator + ".." +
File.separator + "lib" + File.separator + "tools.jar"; File.separator + "lib" + File.separator + "tools.jar";
/** /**
......
...@@ -933,7 +933,7 @@ public class ArchiveTool { ...@@ -933,7 +933,7 @@ public class ArchiveTool {
static class Chunk implements Comparable<Chunk> { static class Chunk implements Comparable<Chunk> {
ArrayList<Long> idList; ArrayList<Long> idList;
final byte[] value; final byte[] value;
private int[] sortKey; private final int[] sortKey;
Chunk(ArrayList<Long> idList, int[] sortKey, byte[] value) { Chunk(ArrayList<Long> idList, int[] sortKey, byte[] value) {
this.idList = idList; this.idList = idList;
......
...@@ -71,7 +71,7 @@ public class ThreadDumpCleaner { ...@@ -71,7 +71,7 @@ public class ThreadDumpCleaner {
}; };
private ArrayList<Pattern> patterns = new ArrayList<>(); private final ArrayList<Pattern> patterns = new ArrayList<>();
{ {
for (String s : PATTERN) { for (String s : PATTERN) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论