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

make some fields final

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