提交 3881b560 authored 作者: Thomas Mueller's avatar Thomas Mueller

Enable warning for 'Local variable declaration hides another field or variable'.

上级 f076058c
......@@ -46,8 +46,6 @@ public class TestRecover {
private static final String URL = System.getProperty("test.url", "jdbc:h2:" + TEST_DIRECTORY + "/test;PAGE_STORE=TRUE");
private static final String DRIVER = System.getProperty("test.driver", "org.h2.Driver");
private Random random;
// private static final String DIR =
// System.getProperty("test.dir", "/temp/derby");
// private static final String URL =
......@@ -176,7 +174,7 @@ public class TestRecover {
}
private void testLoop() throws Exception {
random = new SecureRandom();
Random random = new SecureRandom();
while (true) {
runOneTest(random.nextInt());
}
......
......@@ -48,7 +48,7 @@ public class TestSynth extends TestBase {
static final int POSTGRESQL = 4;
private static final String DIR = "synth";
private DbState db = new DbState(this);
private DbState dbState = new DbState(this);
private ArrayList<DbInterface> databases;
private ArrayList<Command> commands;
private RandomGen random = new RandomGen();
......@@ -97,7 +97,7 @@ public class TestSynth extends TestBase {
}
private void add(Command command) throws Exception {
command.run(db);
command.run(dbState);
commands.add(command);
}
......@@ -248,7 +248,7 @@ public class TestSynth extends TestBase {
* @return the table
*/
Table randomTable() {
return db.randomTable();
return dbState.randomTable();
}
/**
......
......@@ -82,17 +82,17 @@ public class TestMultiNews extends TestMultiThread {
}
void first() throws SQLException {
Connection conn = base.getConnection();
Statement stat = conn.createStatement();
Connection c = base.getConnection();
Statement stat = c.createStatement();
stat.execute("CREATE TABLE TEST (ID IDENTITY, NAME VARCHAR)");
stat.execute("CREATE TABLE NEWS (FID NUMERIC(19) PRIMARY KEY, COMMENTS LONGVARCHAR, "
+ "LINK VARCHAR(255), STATE INTEGER, VALUE VARCHAR(255))");
stat.execute("CREATE INDEX IF NOT EXISTS NEWS_GUID_VALUE_INDEX ON NEWS(VALUE)");
stat.execute("CREATE INDEX IF NOT EXISTS NEWS_LINK_INDEX ON NEWS(LINK)");
stat.execute("CREATE INDEX IF NOT EXISTS NEWS_STATE_INDEX ON NEWS(STATE)");
PreparedStatement prep = conn.prepareStatement("INSERT INTO NEWS (FID, COMMENTS, LINK, STATE, VALUE) VALUES "
PreparedStatement prep = c.prepareStatement("INSERT INTO NEWS (FID, COMMENTS, LINK, STATE, VALUE) VALUES "
+ "(?, ?, ?, ?, ?) ");
PreparedStatement prep2 = conn.prepareStatement("INSERT INTO TEST (NAME) VALUES (?)");
PreparedStatement prep2 = c.prepareStatement("INSERT INTO TEST (NAME) VALUES (?)");
for (int i = 0; i < len; i++) {
int x = random.nextInt(10) * 128;
StringBuilder buff = new StringBuilder();
......
......@@ -31,14 +31,14 @@ public class TestMultiNewsSimple extends TestMultiThread {
}
void first() throws SQLException {
Connection conn = base.getConnection();
conn.createStatement().execute("create table news(id identity, state int default 0, text varchar default '')");
PreparedStatement prep = conn.prepareStatement("insert into news() values()");
Connection c = base.getConnection();
c.createStatement().execute("create table news(id identity, state int default 0, text varchar default '')");
PreparedStatement prep = c.prepareStatement("insert into news() values()");
for (int i = 0; i < newsCount; i++) {
prep.executeUpdate();
}
conn.createStatement().execute("update news set text = 'Text' || id");
conn.close();
c.createStatement().execute("update news set text = 'Text' || id");
c.close();
}
void begin() {
......
......@@ -118,18 +118,14 @@ public class TestMultiOrder extends TestMultiThread {
}
void first() throws SQLException {
Connection conn = base.getConnection();
conn.createStatement().execute("drop table customer if exists");
conn.createStatement().execute("drop table orders if exists");
conn.createStatement().execute("drop table orderLine if exists");
conn.createStatement().execute("create table customer(id int primary key, name varchar, account decimal)");
conn.createStatement().execute(
"create table orders(id int identity primary key, customer_id int, total decimal)");
conn
.createStatement()
.execute(
"create table orderLine(order_id int, line_id int, text varchar, amount decimal, primary key(order_id, line_id))");
conn.close();
Connection c = base.getConnection();
c.createStatement().execute("drop table customer if exists");
c.createStatement().execute("drop table orders if exists");
c.createStatement().execute("drop table orderLine if exists");
c.createStatement().execute("create table customer(id int primary key, name varchar, account decimal)");
c.createStatement().execute("create table orders(id int identity primary key, customer_id int, total decimal)");
c.createStatement().execute("create table orderLine(order_id int, line_id int, text varchar, amount decimal, primary key(order_id, line_id))");
c.close();
}
void finalTest() throws SQLException {
......
......@@ -68,17 +68,17 @@ class Arg {
return obj;
}
private String quote(Class< ? > clazz, Object value) {
private String quote(Class< ? > valueClass, Object value) {
if (value == null) {
return null;
} else if (clazz == String.class) {
} else if (valueClass == String.class) {
return StringUtils.quoteJavaString(value.toString());
} else if (clazz == BigDecimal.class) {
} else if (valueClass == BigDecimal.class) {
return "new BigDecimal(\"" + value.toString() + "\")";
} else if (clazz.isArray()) {
if (clazz == String[].class) {
} else if (valueClass.isArray()) {
if (valueClass == String[].class) {
return StringUtils.quoteJavaStringArray((String[]) value);
} else if (clazz == int[].class) {
} else if (valueClass == int[].class) {
return StringUtils.quoteJavaIntArray((int[]) value);
}
}
......
......@@ -71,12 +71,12 @@ public class Player {
* Execute a trace file.
*
* @param fileName the file name
* @param log print debug information
* @param checkResult if the result of each method should be compared
* against the result in the file
* @param trace print debug information
*/
public static void execute(String fileName, boolean log, boolean checkResult) throws IOException {
new Player().runFile(fileName, log);
public static void execute(String fileName, boolean trace) throws IOException {
Player player = new Player();
player.trace = trace;
player.runFile(fileName);
}
private void run(String... args) throws IOException {
......@@ -96,11 +96,10 @@ public class Player {
+ " [-trace] <fileName>");
return;
}
runFile(fileName, trace);
runFile(fileName);
}
private void runFile(String fileName, boolean trace) throws IOException {
this.trace = trace;
private void runFile(String fileName) throws IOException {
LineNumberReader reader = new LineNumberReader(new BufferedReader(
new FileReader(fileName)));
while (true) {
......
......@@ -51,8 +51,8 @@ public class FileObjectDatabase implements FileObject {
pos += len;
}
public void seek(long pos) {
this.pos = (int) pos;
public void seek(long newPos) {
this.pos = (int) newPos;
}
public void setFileLength(long newLength) {
......
......@@ -165,11 +165,11 @@ public class OutputCatcher {
/**
* Write a character.
*
* @param error if the character comes from the error stream
* @param errorStream if the character comes from the error stream
* @param b the character
*/
void write(boolean error, int b) throws IOException {
setError(error);
void write(boolean errorStream, int b) throws IOException {
setError(errorStream);
switch (b) {
case '\n':
super.write(BR);
......
......@@ -149,7 +149,7 @@ public class BuildBase {
/**
* The output stream (System.out).
*/
protected PrintStream out = System.out;
protected PrintStream sysOut = System.out;
/**
* If output should be disabled.
......@@ -185,7 +185,7 @@ public class BuildBase {
try {
m = getClass().getMethod(a);
} catch (Exception e) {
out.println("Unknown target: " + a);
sysOut.println("Unknown target: " + a);
projectHelp();
break;
}
......@@ -226,8 +226,8 @@ public class BuildBase {
* Emit a beep.
*/
protected void beep() {
out.print("\007");
out.flush();
sysOut.print("\007");
sysOut.flush();
}
/**
......@@ -241,14 +241,14 @@ public class BuildBase {
return a.getName().compareTo(b.getName());
}
});
out.println("Targets:");
sysOut.println("Targets:");
for (Method m : methods) {
int mod = m.getModifiers();
if (!Modifier.isStatic(mod) && Modifier.isPublic(mod) && m.getParameterTypes().length == 0) {
out.println(m.getName());
sysOut.println(m.getName());
}
}
out.println();
sysOut.println();
}
private boolean isWindows() {
......@@ -290,8 +290,8 @@ public class BuildBase {
}
println("");
Process p = Runtime.getRuntime().exec(cmd.array());
copyInThread(p.getInputStream(), quiet ? null : out);
copyInThread(p.getErrorStream(), quiet ? null : out);
copyInThread(p.getInputStream(), quiet ? null : sysOut);
copyInThread(p.getErrorStream(), quiet ? null : sysOut);
p.waitFor();
return p.exitValue();
} catch (Exception e) {
......@@ -851,7 +851,7 @@ public class BuildBase {
*/
protected void println(String s) {
if (!quiet) {
out.println(s);
sysOut.println(s);
}
}
......@@ -862,7 +862,7 @@ public class BuildBase {
*/
protected void print(String s) {
if (!quiet) {
out.print(s);
sysOut.print(s);
}
}
......
......@@ -40,11 +40,11 @@ public class RailroadImages {
/**
* Create the images.
*
* @param outDir the target directory
* @param out the target directory
*/
void run(String outDir) {
this.outDir = outDir;
new File(outDir).mkdirs();
void run(String out) {
this.outDir = out;
new File(out).mkdirs();
BufferedImage img;
Graphics2D g;
img = new BufferedImage(SIZE, SIZE, BufferedImage.TYPE_INT_ARGB);
......
......@@ -51,8 +51,8 @@ public class SpellChecker {
new SpellChecker().run("tools/org/h2/build/doc/dictionary.txt", dir);
}
private void run(String dictionary, String dir) throws IOException {
process(new File(dir + "/" + dictionary));
private void run(String dictionaryFileName, String dir) throws IOException {
process(new File(dir + "/" + dictionaryFileName));
process(new File(dir));
if (printDictionary) {
System.out.println("USED WORDS");
......
......@@ -62,13 +62,8 @@ public class XMLParser {
*/
public static final int DTD = 11;
// public static final int CDATA = 12;
// public static final int NAMESPACE = 13;
// public static final int NOTATION_DECLARATION = 14;
// public static final int ENTITY_DECLARATION = 15;
private String xml;
private int index;
private int pos;
private int eventType;
private String currentText;
private String currentToken;
......@@ -98,14 +93,14 @@ public class XMLParser {
this.html = html;
}
private void addAttributeName(String prefix, String localName) {
private void addAttributeName(String pre, String name) {
if (attributeValues.length <= currentAttribute) {
String[] temp = new String[attributeValues.length * 2];
System.arraycopy(attributeValues, 0, temp, 0, attributeValues.length);
attributeValues = temp;
}
attributeValues[currentAttribute++] = prefix;
attributeValues[currentAttribute++] = localName;
attributeValues[currentAttribute++] = pre;
attributeValues[currentAttribute++] = name;
}
private void addAttributeValue(String v) {
......@@ -113,18 +108,18 @@ public class XMLParser {
}
private int readChar() {
if (index >= xml.length()) {
if (pos >= xml.length()) {
return -1;
}
return xml.charAt(index++);
return xml.charAt(pos++);
}
private void back() {
index--;
pos--;
}
private void error(String expected) {
throw new RuntimeException("Expected: " + expected + " got: " + xml.substring(index, Math.min(index + 1000, xml.length())));
throw new RuntimeException("Expected: " + expected + " got: " + xml.substring(pos, Math.min(pos + 1000, xml.length())));
}
private void read(String chars) {
......@@ -136,26 +131,26 @@ public class XMLParser {
}
private void skipSpaces() {
while (index < xml.length() && xml.charAt(index) <= ' ') {
index++;
while (pos < xml.length() && xml.charAt(pos) <= ' ') {
pos++;
}
}
private void read() {
currentText = null;
currentAttribute = 0;
int tokenStart = index, currentStart = index;
int tokenStart = pos, currentStart = pos;
int ch = readChar();
if (ch < 0) {
eventType = END_DOCUMENT;
} else if (ch == '<') {
currentStart = index;
currentStart = pos;
ch = readChar();
if (ch < 0) {
eventType = ERROR;
} else if (ch == '?') {
eventType = PROCESSING_INSTRUCTION;
currentStart = index;
currentStart = pos;
while (true) {
ch = readChar();
if (ch < 0) {
......@@ -170,7 +165,7 @@ public class XMLParser {
read();
tokenStart = back;
} else {
currentText = xml.substring(currentStart, index - 1);
currentText = xml.substring(currentStart, pos - 1);
}
} else if (ch == '!') {
ch = readChar();
......@@ -179,7 +174,7 @@ public class XMLParser {
if (readChar() != '-') {
error("-");
}
currentStart = index;
currentStart = pos;
while (true) {
ch = readChar();
if (ch < 0) {
......@@ -190,7 +185,7 @@ public class XMLParser {
break;
}
}
currentText = xml.substring(currentStart, index - 1);
currentText = xml.substring(currentStart, pos - 1);
} else if (ch == 'D') {
read("OCTYPE");
eventType = DTD;
......@@ -205,7 +200,7 @@ public class XMLParser {
}
} else if (ch == '[') {
read("CDATA[");
currentStart = index;
currentStart = pos;
eventType = CHARACTERS;
while (true) {
ch = readChar();
......@@ -225,14 +220,14 @@ public class XMLParser {
}
} while (ch == ']');
if (ch == '>') {
currentText = xml.substring(currentStart, index - 3);
currentText = xml.substring(currentStart, pos - 3);
break;
}
}
}
}
} else if (ch == '/') {
currentStart = index;
currentStart = pos;
prefix = null;
eventType = END_ELEMENT;
while (true) {
......@@ -240,13 +235,13 @@ public class XMLParser {
if (ch < 0) {
error(">");
} else if (ch == ':') {
prefix = xml.substring(currentStart, index - 1);
currentStart = index + 1;
prefix = xml.substring(currentStart, pos - 1);
currentStart = pos + 1;
} else if (ch == '>') {
localName = xml.substring(currentStart, index - 1);
localName = xml.substring(currentStart, pos - 1);
break;
} else if (ch <= ' ') {
localName = xml.substring(currentStart, index - 1);
localName = xml.substring(currentStart, pos - 1);
skipSpaces();
read(">");
break;
......@@ -261,23 +256,23 @@ public class XMLParser {
if (ch < 0) {
error(">");
} else if (ch == ':') {
prefix = xml.substring(currentStart, index - 1);
currentStart = index + 1;
prefix = xml.substring(currentStart, pos - 1);
currentStart = pos + 1;
} else if (ch <= ' ') {
localName = xml.substring(currentStart, index - 1);
localName = xml.substring(currentStart, pos - 1);
readAttributeValues();
ch = readChar();
}
if (ch == '/') {
if (localName == null) {
localName = xml.substring(currentStart, index - 1);
localName = xml.substring(currentStart, pos - 1);
}
read(">");
endElement = true;
break;
} else if (ch == '>') {
if (localName == null) {
localName = xml.substring(currentStart, index - 1);
localName = xml.substring(currentStart, pos - 1);
}
break;
}
......@@ -295,14 +290,14 @@ public class XMLParser {
break;
}
}
currentText = xml.substring(currentStart, index);
currentText = xml.substring(currentStart, pos);
}
currentToken = xml.substring(tokenStart, index);
currentToken = xml.substring(tokenStart, pos);
}
private void readAttributeValues() {
while (true) {
int start = index;
int start = pos;
int ch = readChar();
if (ch < 0) {
error(">");
......@@ -316,7 +311,7 @@ public class XMLParser {
int localNameStart = start;
boolean noValue = false;
while (true) {
end = index;
end = pos;
ch = readChar();
if (ch < 0) {
error("=");
......@@ -335,7 +330,7 @@ public class XMLParser {
} else if (ch == '=') {
break;
} else if (ch == ':') {
localNameStart = index;
localNameStart = pos;
} else if (ch == '/' || ch == '>') {
if (html) {
back();
......@@ -358,9 +353,9 @@ public class XMLParser {
if (ch != '\"') {
error("\"");
}
start = index;
start = pos;
while (true) {
end = index;
end = pos;
ch = readChar();
if (ch < 0) {
error("\"");
......@@ -379,7 +374,7 @@ public class XMLParser {
* @return true if there are more tags
*/
public boolean hasNext() {
return index < xml.length();
return pos < xml.length();
}
/**
......@@ -477,9 +472,9 @@ public class XMLParser {
* @return the full name
*/
public String getAttributeName(int index) {
String prefix = getAttributePrefix(index);
String localName = getAttributeLocalName(index);
return prefix == null || prefix.length() == 0 ? localName : prefix + ":" + localName;
String pre = getAttributePrefix(index);
String name = getAttributeLocalName(index);
return pre == null || pre.length() == 0 ? name : pre + ":" + name;
}
/**
......@@ -496,13 +491,13 @@ public class XMLParser {
* Get the value of this attribute.
*
* @param namespaceURI the namespace URI (currently ignored)
* @param localName the attribute name
* @param name the local name of the attribute
* @return the value or null
*/
public String getAttributeValue(String namespaceURI, String localName) {
public String getAttributeValue(String namespaceURI, String name) {
int len = getAttributeCount();
for (int i = 0; i < len; i++) {
if (getAttributeLocalName(i).equals(localName)) {
if (getAttributeLocalName(i).equals(name)) {
return getAttributeValue(i);
}
}
......@@ -554,16 +549,16 @@ public class XMLParser {
* @return the remaining XML
*/
public String getRemaining() {
return xml.substring(index);
return xml.substring(pos);
}
/**
* Get the index of the current position.
* Get the current character position in the XML document.
*
* @return the position
*/
public int getPos() {
return index;
return pos;
}
}
......@@ -627,4 +627,5 @@ checklists serves gbif biodiversity wakes taxon ratio ended ipt auckland
galapagos pacific pastebin mystic posting mysticpaste reject prof tick freeing
sweden abbreviated xmx trede googlecode gustav standing hashes
decompressed expansion ziv abbreviated augments omitted gain
subtracted maxed logical lempel increases
subtracted maxed logical lempel increases sibling impersonate proper remembers
moon
......@@ -166,14 +166,13 @@ public class Indexer {
}
});
for (int i = 0; i < pages.size(); i++) {
Page page = pages.get(i);
page.id = i;
pages.get(i).id = i;
}
}
private void listPages() {
for (Page page : pages) {
output.println("pages[" + page.id + "]=new Page('" + convertUTF(page.title) + "', '" + page.fileName
for (Page p : pages) {
output.println("pages[" + p.id + "]=new Page('" + convertUTF(p.title) + "', '" + p.fileName
+ "');");
}
}
......@@ -226,7 +225,7 @@ public class Indexer {
totalRelations += weights.size();
for (int j = 0; j < weights.size(); j++) {
Weight weight = weights.get(j);
Page page = weight.page;
Page p = weight.page;
if (j > 0) {
buff.append(",");
}
......@@ -242,7 +241,7 @@ public class Indexer {
weightString = ws;
buff.append(ws);
}
buff.append(page.id);
buff.append(p.id);
}
}
output.println("ref['" + convertUTF(first) + "']='" + buff.toString() + "';");
......
......@@ -45,9 +45,8 @@ class CacheTQ implements Cache {
private CacheObject[] values;
CacheTQ(CacheWriter writer, int maxKb) {
int maxSize = maxKb * 1024 / 4;
this.writer = writer;
this.maxSize = maxSize;
this.maxSize = maxKb * 1024 / 4;
this.len = MathUtils.nextPowerOf2(maxSize / 64);
this.mask = len - 1;
MathUtils.checkPowerOf2(len);
......@@ -56,9 +55,9 @@ class CacheTQ implements Cache {
}
public void clear() {
headMain.next = headMain.previous = headMain;
headIn.next = headIn.previous = headIn;
headOut.next = headOut.previous = headOut;
headMain.cacheNext = headMain.cachePrevious = headMain;
headIn.cacheNext = headIn.cachePrevious = headIn;
headOut.cacheNext = headOut.cachePrevious = headOut;
// first set to null - avoiding out of memory
values = null;
values = new CacheObject[len];
......@@ -77,26 +76,26 @@ class CacheTQ implements Cache {
if (rec == head) {
Message.throwInternalError("try to move head");
}
if (rec.next != null || rec.previous != null) {
if (rec.cacheNext != null || rec.cachePrevious != null) {
Message.throwInternalError("already linked");
}
}
rec.next = head;
rec.previous = head.previous;
rec.previous.next = rec;
head.previous = rec;
rec.cacheNext = head;
rec.cachePrevious = head.cachePrevious;
rec.cachePrevious.cacheNext = rec;
head.cachePrevious = rec;
}
private void removeFromList(CacheObject rec) {
if (SysProperties.CHECK && (rec instanceof CacheHead && rec.cacheQueue != OUT)) {
Message.throwInternalError();
}
rec.previous.next = rec.next;
rec.next.previous = rec.previous;
rec.cachePrevious.cacheNext = rec.cacheNext;
rec.cacheNext.cachePrevious = rec.cachePrevious;
// TODO cache: mystery: why is this required? needs more memory if we
// don't do this
rec.next = null;
rec.previous = null;
rec.cacheNext = null;
rec.cachePrevious = null;
}
public CacheObject get(int pos) {
......@@ -122,7 +121,7 @@ class CacheTQ implements Cache {
private CacheObject findCacheObject(int pos) {
CacheObject rec = values[pos & mask];
while (rec != null && rec.getPos() != pos) {
rec = rec.chained;
rec = rec.cacheChained;
}
return rec;
}
......@@ -134,23 +133,23 @@ class CacheTQ implements Cache {
return null;
}
if (rec.getPos() == pos) {
values[index] = rec.chained;
values[index] = rec.cacheChained;
} else {
CacheObject last;
do {
last = rec;
rec = rec.chained;
rec = rec.cacheChained;
if (rec == null) {
return null;
}
} while (rec.getPos() != pos);
last.chained = rec.chained;
last.cacheChained = rec.cacheChained;
}
if (!(rec instanceof CacheHead)) {
recordCount--;
}
if (SysProperties.CHECK) {
rec.chained = null;
rec.cacheChained = null;
}
return rec;
}
......@@ -178,7 +177,7 @@ class CacheTQ implements Cache {
int i = 0;
ObjectArray<CacheObject> changed = ObjectArray.newInstance();
int si = sizeIn, sm = sizeMain, rc = recordCount;
CacheObject inNext = headIn.next, mainNext = headMain.next;
CacheObject inNext = headIn.cacheNext, mainNext = headMain.cacheNext;
while (((si * 4 > maxIn * 3) || (sm * 4 > maxMain * 3))
&& rc > Constants.CACHE_MIN_RECORDS) {
i++;
......@@ -194,7 +193,7 @@ class CacheTQ implements Cache {
}
if (si > maxIn) {
CacheObject r = inNext;
inNext = r.next;
inNext = r.cacheNext;
if (!r.canRemove()) {
if (r != headIn) {
removeFromList(r);
......@@ -211,7 +210,7 @@ class CacheTQ implements Cache {
}
} else if (sm > 0) {
CacheObject r = mainNext;
mainNext = r.next;
mainNext = r.cacheNext;
if (!r.canRemove() && !(r instanceof CacheHead)) {
removeFromList(r);
addToFront(headMain, r);
......@@ -265,7 +264,7 @@ class CacheTQ implements Cache {
addToFront(headOut, r);
sizeOut++;
while (sizeOut >= maxOut) {
r = headOut.next;
r = headOut.cacheNext;
sizeOut--;
removeCacheObject(r.getPos());
removeFromList(r);
......@@ -279,12 +278,12 @@ class CacheTQ implements Cache {
public ObjectArray<CacheObject> getAllChanged() {
ObjectArray<CacheObject> list = ObjectArray.newInstance();
for (CacheObject o = headMain.next; o != headMain; o = o.next) {
for (CacheObject o = headMain.cacheNext; o != headMain; o = o.cacheNext) {
if (o.isChanged()) {
list.add(o);
}
}
for (CacheObject o = headIn.next; o != headIn; o = o.next) {
for (CacheObject o = headIn.cacheNext; o != headIn; o = o.cacheNext) {
if (o.isChanged()) {
list.add(o);
}
......@@ -311,7 +310,7 @@ class CacheTQ implements Cache {
}
}
int index = rec.getPos() & mask;
rec.chained = values[index];
rec.cacheChained = values[index];
values[index] = rec;
if (!(rec instanceof CacheHead)) {
recordCount++;
......
......@@ -235,8 +235,8 @@ public class Query<T> {
return this;
}
public Query<T> groupBy(Object... groupByExpressions) {
this.groupByExpressions = groupByExpressions;
public Query<T> groupBy(Object... groupBy) {
this.groupByExpressions = groupBy;
return this;
}
......
......@@ -61,7 +61,7 @@ class SelectTable <T> {
}
}
void appendSQLAsJoin(SQLStatement stat, Query<T> query) {
void appendSQLAsJoin(SQLStatement stat, Query<T> q) {
if (outerJoin) {
stat.appendSQL(" LEFT OUTER JOIN ");
} else {
......@@ -71,7 +71,7 @@ class SelectTable <T> {
if (!joinConditions.isEmpty()) {
stat.appendSQL(" ON ");
for (Token token : joinConditions) {
token.appendSQL(stat, query);
token.appendSQL(stat, q);
stat.appendSQL(" ");
}
}
......
......@@ -153,22 +153,22 @@ class TableDefinition<T> {
}
private String getDataType(Field field) {
Class< ? > clazz = field.getType();
if (clazz == Integer.class) {
Class< ? > fieldClass = field.getType();
if (fieldClass == Integer.class) {
return "INT";
} else if (clazz == String.class) {
} else if (fieldClass == String.class) {
return "VARCHAR";
} else if (clazz == Double.class) {
} else if (fieldClass == Double.class) {
return "DOUBLE";
} else if (clazz == java.math.BigDecimal.class) {
} else if (fieldClass == java.math.BigDecimal.class) {
return "DECIMAL";
} else if (clazz == java.util.Date.class) {
} else if (fieldClass == java.util.Date.class) {
return "DATE";
} else if (clazz == java.sql.Date.class) {
} else if (fieldClass == java.sql.Date.class) {
return "DATE";
} else if (clazz == java.sql.Time.class) {
} else if (fieldClass == java.sql.Time.class) {
return "TIME";
} else if (clazz == java.sql.Timestamp.class) {
} else if (fieldClass == java.sql.Timestamp.class) {
return "TIMESTAMP";
}
return "VARCHAR";
......
......@@ -33,7 +33,7 @@ public class ClassReader {
private Token result;
private Stack<Token> stack = new Stack<Token>();
private ArrayList<Token> variables = new ArrayList<Token>();
private boolean end;
private boolean endOfMethod;
private boolean condition;
private int nextPc;
private Map<String, Object> fieldMap = new HashMap<String, Object>();
......@@ -44,9 +44,9 @@ public class ClassReader {
}
}
public Token decompile(Object instance, Map<String, Object> fieldMap, String methodName) {
this.fieldMap = fieldMap;
this.convertMethodName = methodName;
public Token decompile(Object instance, Map<String, Object> fields, String method) {
this.fieldMap = fields;
this.convertMethodName = method;
Class< ? > clazz = instance.getClass();
String className = clazz.getName();
debug("class name " + className);
......@@ -226,7 +226,7 @@ public class ClassReader {
private Token getResult() {
while (true) {
readByteCode();
if (end) {
if (endOfMethod) {
return stack.pop();
}
if (condition) {
......@@ -266,7 +266,7 @@ public class ClassReader {
int startPos = pos - startByteCode;
int opCode = readByte();
String op;
end = false;
endOfMethod = false;
condition = false;
nextPc = 0;
switch(opCode) {
......@@ -1165,29 +1165,29 @@ public class ClassReader {
// }
case 172:
op = "ireturn";
end = true;
endOfMethod = true;
break;
case 173:
op = "lreturn";
end = true;
endOfMethod = true;
break;
case 174:
op = "freturn";
end = true;
endOfMethod = true;
break;
case 175:
op = "dreturn";
end = true;
endOfMethod = true;
break;
case 176:
op = "areturn";
end = true;
endOfMethod = true;
break;
case 177:
op = "return";
// no value returned
stack.push(null);
end = true;
endOfMethod = true;
break;
// case 178:
// op = "getstatic " + getField(readShort());
......@@ -1224,8 +1224,8 @@ public class ClassReader {
break;
}
case 183: {
String methodName = getMethod(readShort());
op = "invokespecial " + methodName;
String method = getMethod(readShort());
op = "invokespecial " + method;
break;
}
case 184:
......@@ -1414,8 +1414,8 @@ public class ClassReader {
return new String(chars, 0, j);
}
private int getAbsolutePos(int pos, int offset) {
return pos - startByteCode - 1 + (short) offset;
private int getAbsolutePos(int start, int offset) {
return start - startByteCode - 1 + (short) offset;
}
private int readByte() {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论