提交 231a81de authored 作者: noelgrandin's avatar noelgrandin

these final fields can be made static because they reference read-only data

上级 c324777c
......@@ -47,7 +47,7 @@ public class Shell extends Tool implements Runnable {
private boolean listMode;
private int maxColumnSize = 100;
// Windows: '\u00b3';
private final char boxVertical = '|';
private static final char boxVertical = '|';
private final ArrayList<String> history = New.arrayList();
private boolean stopHide;
private String serverPropertiesDir = Constants.SERVER_PROPERTIES_DIR;
......
......@@ -23,11 +23,11 @@ public class BenchB implements Bench, Runnable {
// master data
private Database database;
private final int scale = 1;
private final int branches = 1;
private final int tellers = 10;
private final int accounts = 100000;
private final int clients = 10;
private static final int scale = 1;
private static final int branches = 1;
private static final int tellers = 10;
private static final int accounts = 100000;
private static final int clients = 10;
private int transactionPerClient;
// client data
......
......@@ -176,7 +176,7 @@ public class BenchC implements Bench {
private BenchCRandom random;
private String action;
private final int commitEvery = 1000;
private static final int commitEvery = 1000;
public void init(Database db, int size) throws SQLException {
......
......@@ -38,7 +38,7 @@ class Database {
private long startTime;
private Connection conn;
private Statement stat;
private final boolean trace = true;
private static final boolean trace = true;
private long lastTrace;
private final Random random = new Random(1);
private final ArrayList<Object[]> results = new ArrayList<Object[]>();
......
......@@ -24,7 +24,7 @@ import org.h2.util.JdbcUtils;
*/
public class TestPowerOff extends TestBase {
private final String dbName = "powerOff";
private static final String dbName = "powerOff";
private String dir, url;
private int maxPowerOffCount;
......
......@@ -37,8 +37,8 @@ public class TestBatchUpdates extends TestBase {
private static final String COFFEE_UPDATE_SET = "UPDATE TEST SET KEY_ID=?, C_NAME=? WHERE C_NAME=?";
private static final String COFFEE_SELECT_CONTINUED = "SELECT COUNT(*) FROM TEST WHERE C_NAME='Continue-1'";
private final int coffeeSize = 10;
private final int coffeeType = 11;
private static final int coffeeSize = 10;
private static final int coffeeType = 11;
private Connection conn;
private Statement stat;
private PreparedStatement prep;
......
......@@ -26,7 +26,7 @@ public class TestMetaData extends TestBase {
private Connection conn;
private DatabaseMetaData meta;
private Statement stat;
private final String catalog = "METADATA";
private static final String catalog = "METADATA";
/**
* Run just this test.
......
......@@ -26,7 +26,7 @@ public class TestKill extends TestBase {
private static final String DIR = TestBase.getTestDir("kill");
private Connection conn;
private final int accounts = 10;
private static final int accounts = 10;
private final Random random = new Random(1);
/**
......
......@@ -27,8 +27,8 @@ public class TestPowerOffFs2 extends TestBase {
private FilePathDebug fs;
private String url;
private final String user = "sa";
private final String password = "sa";
private static final String user = "sa";
private static final String password = "sa";
private final ArrayList<Connection> connections = New.arrayList();
private final ArrayList<String> tables = New.arrayList();
......
......@@ -21,7 +21,7 @@ public class TestMultiNews extends TestMultiThread {
private static final String PREFIX_URL =
"http://feeds.wizbangblog.com/WizbangFullFeed?m=";
private final int len = 10000;
private static final int len = 10000;
private Connection conn;
TestMultiNews(TestMulti base) throws SQLException {
......
......@@ -30,9 +30,9 @@ public class CheckTextFiles {
private static final String[] SUFFIX_CRLF = { "bat" };
private boolean failOnError;
private final boolean allowTab = false, allowCR = true, allowTrailingSpaces = false;
private final int spacesPerTab = 4;
private final boolean autoFix = true;
private static final boolean allowTab = false, allowCR = true, allowTrailingSpaces = false;
private static final int spacesPerTab = 4;
private static final boolean autoFix = true;
private boolean useCRLF;
private final String[] suffixIgnoreLicense = {
"bat", "nsi", "txt", "properties", "xml",
......
......@@ -33,7 +33,7 @@ import org.h2.util.StringUtils;
public class GenerateDoc {
private String inDir = "src/docsrc/html";
private final String inHelp = "src/docsrc/help/help.csv";
private static final String inHelp = "src/docsrc/help/help.csv";
private String outDir = "docs/html";
private Connection conn;
private final HashMap<String, Object> session = new HashMap<String, Object>();
......
......@@ -20,7 +20,7 @@ import org.h2.util.StringUtils;
*/
public class MergeDocs {
private final String baseDir = "docs/html";
private static final String baseDir = "docs/html";
/**
* This method is called when executing this application from the command
......
......@@ -34,8 +34,8 @@ public class WebSite {
private static final String TRANSLATE_START = "<!-- translate";
private static final String TRANSLATE_END = "translate -->";
private final String sourceDir = "docs";
private final String webDir = "../h2web";
private static final String sourceDir = "docs";
private static final String webDir = "../h2web";
private final HashMap<String, String> fragments = new HashMap<String, String>();
/**
......
......@@ -68,7 +68,7 @@ public class FtpServer extends Tool implements Service {
private ServerSocket serverSocket;
private int port = DEFAULT_PORT;
private int openConnectionCount;
private final int maxConnectionCount = 100;
private static final int maxConnectionCount = 100;
private final SimpleDateFormat dateFormatNew = new SimpleDateFormat("MMM dd HH:mm", Locale.ENGLISH);
private final SimpleDateFormat dateFormatOld = new SimpleDateFormat("MMM dd yyyy", Locale.ENGLISH);
......
......@@ -49,7 +49,7 @@ public class TableInspector {
private final List<String> primaryKeys = New.arrayList();
private Map<String, IndexInspector> indexes;
private Map<String, ColumnInspector> columns;
private final String eol = "\n";
private static final String eol = "\n";
TableInspector(String schema, String table, boolean forceUpperCase,
Class<? extends java.util.Date> dateTimeClass) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论