提交 297910b0 authored 作者: igor-suhorukov's avatar igor-suhorukov

Remove explicit unboxing

上级 9cd06d96
...@@ -624,7 +624,7 @@ public class SysProperties { ...@@ -624,7 +624,7 @@ public class SysProperties {
String s = Utils.getProperty(key, null); String s = Utils.getProperty(key, null);
if (s != null) { if (s != null) {
try { try {
return Integer.decode(s).intValue(); return Integer.decode(s);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
// ignore // ignore
} }
......
...@@ -614,7 +614,7 @@ public final class DateTimeFunctions { ...@@ -614,7 +614,7 @@ public final class DateTimeFunctions {
if (p == null) { if (p == null) {
throw DbException.getInvalidValueException("date part", part); throw DbException.getInvalidValueException("date part", part);
} }
return p.intValue(); return p;
} }
/** /**
......
...@@ -619,7 +619,7 @@ public class FullText { ...@@ -619,7 +619,7 @@ public class FullText {
if (wId == null) { if (wId == null) {
continue; continue;
} }
prepSelectMapByWordId.setInt(1, wId.intValue()); prepSelectMapByWordId.setInt(1, wId);
ResultSet rs = prepSelectMapByWordId.executeQuery(); ResultSet rs = prepSelectMapByWordId.executeQuery();
while (rs.next()) { while (rs.next()) {
Integer rId = rs.getInt(1); Integer rId = rs.getInt(1);
......
...@@ -3187,7 +3187,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet, JdbcResultS ...@@ -3187,7 +3187,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet, JdbcResultS
if (index == null) { if (index == null) {
throw DbException.get(ErrorCode.COLUMN_NOT_FOUND_1, columnLabel); throw DbException.get(ErrorCode.COLUMN_NOT_FOUND_1, columnLabel);
} }
return index.intValue() + 1; return index + 1;
} }
for (int i = 0; i < columnCount; i++) { for (int i = 0; i < columnCount; i++) {
if (columnLabel.equalsIgnoreCase(result.getAlias(i))) { if (columnLabel.equalsIgnoreCase(result.getAlias(i))) {
......
...@@ -596,7 +596,7 @@ public class ObjectDataType implements DataType { ...@@ -596,7 +596,7 @@ public class ObjectDataType implements DataType {
return; return;
} }
buff.put((byte) TYPE_BYTE); buff.put((byte) TYPE_BYTE);
buff.put(((Byte) obj).byteValue()); buff.put((Byte) obj);
} }
@Override @Override
...@@ -637,7 +637,7 @@ public class ObjectDataType implements DataType { ...@@ -637,7 +637,7 @@ public class ObjectDataType implements DataType {
return; return;
} }
buff.put((byte) TYPE_CHAR); buff.put((byte) TYPE_CHAR);
buff.putChar(((Character) obj).charValue()); buff.putChar((Character) obj);
} }
@Override @Override
...@@ -678,7 +678,7 @@ public class ObjectDataType implements DataType { ...@@ -678,7 +678,7 @@ public class ObjectDataType implements DataType {
return; return;
} }
buff.put((byte) TYPE_SHORT); buff.put((byte) TYPE_SHORT);
buff.putShort(((Short) obj).shortValue()); buff.putShort((Short) obj);
} }
@Override @Override
......
...@@ -308,7 +308,7 @@ public class PgServer implements Service { ...@@ -308,7 +308,7 @@ public class PgServer implements Service {
@SuppressWarnings("unused") @SuppressWarnings("unused")
public static String getIndexColumn(Connection conn, int indexId, public static String getIndexColumn(Connection conn, int indexId,
Integer ordinalPosition, Boolean pretty) throws SQLException { Integer ordinalPosition, Boolean pretty) throws SQLException {
if (ordinalPosition == null || ordinalPosition.intValue() == 0) { if (ordinalPosition == null || ordinalPosition == 0) {
PreparedStatement prep = conn.prepareStatement( PreparedStatement prep = conn.prepareStatement(
"select sql from information_schema.indexes where id=?"); "select sql from information_schema.indexes where id=?");
prep.setInt(1, indexId); prep.setInt(1, indexId);
...@@ -322,7 +322,7 @@ public class PgServer implements Service { ...@@ -322,7 +322,7 @@ public class PgServer implements Service {
"select column_name from information_schema.indexes " + "select column_name from information_schema.indexes " +
"where id=? and ordinal_position=?"); "where id=? and ordinal_position=?");
prep.setInt(1, indexId); prep.setInt(1, indexId);
prep.setInt(2, ordinalPosition.intValue()); prep.setInt(2, ordinalPosition);
ResultSet rs = prep.executeQuery(); ResultSet rs = prep.executeQuery();
if (rs.next()) { if (rs.next()) {
return rs.getString(1); return rs.getString(1);
......
...@@ -1451,7 +1451,7 @@ public class WebApp { ...@@ -1451,7 +1451,7 @@ public class WebApp {
String s = sql; String s = sql;
for (Integer type : params) { for (Integer type : params) {
idx = s.indexOf('?'); idx = s.indexOf('?');
if (type.intValue() == 1) { if (type == 1) {
s = s.substring(0, idx) + random.nextInt(count) + s.substring(idx + 1); s = s.substring(0, idx) + random.nextInt(count) + s.substring(idx + 1);
} else { } else {
s = s.substring(0, idx) + i + s.substring(idx + 1); s = s.substring(0, idx) + i + s.substring(idx + 1);
...@@ -1471,7 +1471,7 @@ public class WebApp { ...@@ -1471,7 +1471,7 @@ public class WebApp {
for (int i = 0; !stop && i < count; i++) { for (int i = 0; !stop && i < count; i++) {
for (int j = 0; j < params.size(); j++) { for (int j = 0; j < params.size(); j++) {
Integer type = params.get(j); Integer type = params.get(j);
if (type.intValue() == 1) { if (type == 1) {
prep.setInt(j + 1, random.nextInt(count)); prep.setInt(j + 1, random.nextInt(count));
} else { } else {
prep.setInt(j + 1, i); prep.setInt(j + 1, i);
......
...@@ -161,7 +161,7 @@ public class FilePathSplit extends FilePathWrapper { ...@@ -161,7 +161,7 @@ public class FilePathSplit extends FilePathWrapper {
} }
private long getDefaultMaxLength() { private long getDefaultMaxLength() {
return 1L << Integer.decode(parse(name)[0]).intValue(); return 1L << Integer.decode(parse(name)[0]);
} }
private void closeAndThrow(int id, FileChannel[] array, FileChannel o, private void closeAndThrow(int id, FileChannel[] array, FileChannel o,
......
...@@ -44,7 +44,7 @@ public class SmallMap { ...@@ -44,7 +44,7 @@ public class SmallMap {
Iterator<Integer> it = map.keySet().iterator(); Iterator<Integer> it = map.keySet().iterator();
while (it.hasNext()) { while (it.hasNext()) {
Integer k = it.next(); Integer k = it.next();
if (k.intValue() + maxElements < lastId) { if (k + maxElements < lastId) {
it.remove(); it.remove();
} }
} }
......
...@@ -1196,23 +1196,23 @@ public class DataType { ...@@ -1196,23 +1196,23 @@ public class DataType {
} else if (x instanceof Value) { } else if (x instanceof Value) {
return (Value) x; return (Value) x;
} else if (x instanceof Long) { } else if (x instanceof Long) {
return ValueLong.get(((Long) x).longValue()); return ValueLong.get((Long) x);
} else if (x instanceof Integer) { } else if (x instanceof Integer) {
return ValueInt.get(((Integer) x).intValue()); return ValueInt.get((Integer) x);
} else if (x instanceof BigInteger) { } else if (x instanceof BigInteger) {
return ValueDecimal.get(new BigDecimal((BigInteger) x)); return ValueDecimal.get(new BigDecimal((BigInteger) x));
} else if (x instanceof BigDecimal) { } else if (x instanceof BigDecimal) {
return ValueDecimal.get((BigDecimal) x); return ValueDecimal.get((BigDecimal) x);
} else if (x instanceof Boolean) { } else if (x instanceof Boolean) {
return ValueBoolean.get(((Boolean) x).booleanValue()); return ValueBoolean.get((Boolean) x);
} else if (x instanceof Byte) { } else if (x instanceof Byte) {
return ValueByte.get(((Byte) x).byteValue()); return ValueByte.get((Byte) x);
} else if (x instanceof Short) { } else if (x instanceof Short) {
return ValueShort.get(((Short) x).shortValue()); return ValueShort.get((Short) x);
} else if (x instanceof Float) { } else if (x instanceof Float) {
return ValueFloat.get(((Float) x).floatValue()); return ValueFloat.get((Float) x);
} else if (x instanceof Double) { } else if (x instanceof Double) {
return ValueDouble.get(((Double) x).doubleValue()); return ValueDouble.get((Double) x);
} else if (x instanceof byte[]) { } else if (x instanceof byte[]) {
return ValueBytes.get((byte[]) x); return ValueBytes.get((byte[]) x);
} else if (x instanceof Date) { } else if (x instanceof Date) {
......
...@@ -145,7 +145,7 @@ public class Function { ...@@ -145,7 +145,7 @@ public class Function {
if (url.equals("jdbc:columnlist:connection")) { if (url.equals("jdbc:columnlist:connection")) {
return rs; return rs;
} }
for (int s = size.intValue(), x = 0; x < s; x++) { for (int s = size, x = 0; x < s; x++) {
for (int y = 0; y < s; y++) { for (int y = 0; y < s; y++) {
rs.addRow(x, y); rs.addRow(x, y);
} }
......
...@@ -71,8 +71,8 @@ public class FunctionMultiReturn { ...@@ -71,8 +71,8 @@ public class FunctionMultiReturn {
double a = rs.getDouble(2); double a = rs.getDouble(2);
Object o = rs.getObject(3); Object o = rs.getObject(3);
Object[] xy = (Object[]) o; Object[] xy = (Object[]) o;
double x = ((Double) xy[0]).doubleValue(); double x = (Double) xy[0];
double y = ((Double) xy[1]).doubleValue(); double y = (Double) xy[1];
System.out.println("(r=" + r + " a=" + a + ") :" + System.out.println("(r=" + r + " a=" + a + ") :" +
" (x=" + x + ", y=" + y + ")"); " (x=" + x + ", y=" + y + ")");
} }
...@@ -108,8 +108,8 @@ public class FunctionMultiReturn { ...@@ -108,8 +108,8 @@ public class FunctionMultiReturn {
rs.addColumn("X", Types.DOUBLE, 0, 0); rs.addColumn("X", Types.DOUBLE, 0, 0);
rs.addColumn("Y", Types.DOUBLE, 0, 0); rs.addColumn("Y", Types.DOUBLE, 0, 0);
if (r != null && alpha != null) { if (r != null && alpha != null) {
double x = r.doubleValue() * Math.cos(alpha.doubleValue()); double x = r * Math.cos(alpha);
double y = r.doubleValue() * Math.sin(alpha.doubleValue()); double y = r * Math.sin(alpha);
rs.addRow(x, y); rs.addRow(x, y);
} }
return rs; return rs;
...@@ -125,8 +125,8 @@ public class FunctionMultiReturn { ...@@ -125,8 +125,8 @@ public class FunctionMultiReturn {
* @return an array two values: x and y * @return an array two values: x and y
*/ */
public static Object[] polar2CartesianArray(Double r, Double alpha) { public static Object[] polar2CartesianArray(Double r, Double alpha) {
double x = r.doubleValue() * Math.cos(alpha.doubleValue()); double x = r * Math.cos(alpha);
double y = r.doubleValue() * Math.sin(alpha.doubleValue()); double y = r * Math.sin(alpha);
return new Object[]{x, y}; return new Object[]{x, y};
} }
......
...@@ -2375,10 +2375,10 @@ public class TestFunctions extends TestDb implements AggregateFunction { ...@@ -2375,10 +2375,10 @@ public class TestFunctions extends TestDb implements AggregateFunction {
sp != 1 || lp != 1 || byParam != 1) { sp != 1 || lp != 1 || byParam != 1) {
throw new AssertionError("params not 1/true"); throw new AssertionError("params not 1/true");
} }
if (rowCount.intValue() >= 1) { if (rowCount >= 1) {
rs.addRow(0, "Hello"); rs.addRow(0, "Hello");
} }
if (rowCount.intValue() >= 2) { if (rowCount >= 2) {
rs.addRow(1, "World"); rs.addRow(1, "World");
} }
} }
......
...@@ -693,19 +693,19 @@ public class TestResultSet extends TestDb { ...@@ -693,19 +693,19 @@ public class TestResultSet extends TestDb {
o = rs.getObject("value"); o = rs.getObject("value");
trace(o.getClass().getName()); trace(o.getClass().getName());
assertTrue(o instanceof Integer); assertTrue(o instanceof Integer);
assertTrue(((Integer) o).intValue() == -1); assertTrue((Integer) o == -1);
o = rs.getObject("value", Integer.class); o = rs.getObject("value", Integer.class);
trace(o.getClass().getName()); trace(o.getClass().getName());
assertTrue(o instanceof Integer); assertTrue(o instanceof Integer);
assertTrue(((Integer) o).intValue() == -1); assertTrue((Integer) o == -1);
o = rs.getObject(2); o = rs.getObject(2);
trace(o.getClass().getName()); trace(o.getClass().getName());
assertTrue(o instanceof Integer); assertTrue(o instanceof Integer);
assertTrue(((Integer) o).intValue() == -1); assertTrue((Integer) o == -1);
o = rs.getObject(2, Integer.class); o = rs.getObject(2, Integer.class);
trace(o.getClass().getName()); trace(o.getClass().getName());
assertTrue(o instanceof Integer); assertTrue(o instanceof Integer);
assertTrue(((Integer) o).intValue() == -1); assertTrue((Integer) o == -1);
assertTrue(rs.getBoolean("Value")); assertTrue(rs.getBoolean("Value"));
assertTrue(rs.getByte("Value") == (byte) -1); assertTrue(rs.getByte("Value") == (byte) -1);
assertTrue(rs.getShort("Value") == (short) -1); assertTrue(rs.getShort("Value") == (short) -1);
...@@ -816,7 +816,7 @@ public class TestResultSet extends TestDb { ...@@ -816,7 +816,7 @@ public class TestResultSet extends TestDb {
o = rs.getObject("value", Short.class); o = rs.getObject("value", Short.class);
trace(o.getClass().getName()); trace(o.getClass().getName());
assertTrue(o instanceof Short); assertTrue(o instanceof Short);
assertTrue(((Short) o).shortValue() == -1); assertTrue((Short) o == -1);
o = rs.getObject(2); o = rs.getObject(2);
trace(o.getClass().getName()); trace(o.getClass().getName());
assertTrue(o.getClass() == (SysProperties.OLD_RESULT_SET_GET_OBJECT ? Short.class : Integer.class)); assertTrue(o.getClass() == (SysProperties.OLD_RESULT_SET_GET_OBJECT ? Short.class : Integer.class));
...@@ -824,7 +824,7 @@ public class TestResultSet extends TestDb { ...@@ -824,7 +824,7 @@ public class TestResultSet extends TestDb {
o = rs.getObject(2, Short.class); o = rs.getObject(2, Short.class);
trace(o.getClass().getName()); trace(o.getClass().getName());
assertTrue(o instanceof Short); assertTrue(o instanceof Short);
assertTrue(((Short) o).shortValue() == -1); assertTrue((Short) o == -1);
assertTrue(rs.getBoolean("Value")); assertTrue(rs.getBoolean("Value"));
assertTrue(rs.getByte("Value") == (byte) -1); assertTrue(rs.getByte("Value") == (byte) -1);
assertTrue(rs.getInt("Value") == -1); assertTrue(rs.getInt("Value") == -1);
...@@ -935,11 +935,11 @@ public class TestResultSet extends TestDb { ...@@ -935,11 +935,11 @@ public class TestResultSet extends TestDb {
o = rs.getObject("value"); o = rs.getObject("value");
trace(o.getClass().getName()); trace(o.getClass().getName());
assertTrue(o instanceof Long); assertTrue(o instanceof Long);
assertTrue(((Long) o).longValue() == -1); assertTrue((Long) o == -1);
o = rs.getObject("value", Long.class); o = rs.getObject("value", Long.class);
trace(o.getClass().getName()); trace(o.getClass().getName());
assertTrue(o instanceof Long); assertTrue(o instanceof Long);
assertTrue(((Long) o).longValue() == -1); assertTrue((Long) o == -1);
o = rs.getObject("value", BigInteger.class); o = rs.getObject("value", BigInteger.class);
trace(o.getClass().getName()); trace(o.getClass().getName());
assertTrue(o instanceof BigInteger); assertTrue(o instanceof BigInteger);
...@@ -947,11 +947,11 @@ public class TestResultSet extends TestDb { ...@@ -947,11 +947,11 @@ public class TestResultSet extends TestDb {
o = rs.getObject(2); o = rs.getObject(2);
trace(o.getClass().getName()); trace(o.getClass().getName());
assertTrue(o instanceof Long); assertTrue(o instanceof Long);
assertTrue(((Long) o).longValue() == -1); assertTrue((Long) o == -1);
o = rs.getObject(2, Long.class); o = rs.getObject(2, Long.class);
trace(o.getClass().getName()); trace(o.getClass().getName());
assertTrue(o instanceof Long); assertTrue(o instanceof Long);
assertTrue(((Long) o).longValue() == -1); assertTrue((Long) o == -1);
o = rs.getObject(2, BigInteger.class); o = rs.getObject(2, BigInteger.class);
trace(o.getClass().getName()); trace(o.getClass().getName());
assertTrue(o instanceof BigInteger); assertTrue(o instanceof BigInteger);
......
...@@ -656,7 +656,7 @@ public class MinimalPerfectHash<K> { ...@@ -656,7 +656,7 @@ public class MinimalPerfectHash<K> {
if (index == 0) { if (index == 0) {
return o.hashCode(); return o.hashCode();
} else if (index < 8) { } else if (index < 8) {
long x = o.longValue(); long x = o;
x += index; x += index;
x = ((x >>> 32) ^ x) * 0x45d9f3b; x = ((x >>> 32) ^ x) * 0x45d9f3b;
x = ((x >>> 32) ^ x) * 0x45d9f3b; x = ((x >>> 32) ^ x) * 0x45d9f3b;
...@@ -664,7 +664,7 @@ public class MinimalPerfectHash<K> { ...@@ -664,7 +664,7 @@ public class MinimalPerfectHash<K> {
} }
// get the lower or higher 32 bit depending on the index // get the lower or higher 32 bit depending on the index
int shift = (index & 1) * 32; int shift = (index & 1) * 32;
return (int) (o.longValue() >>> shift); return (int) (o >>> shift);
} }
} }
......
...@@ -57,13 +57,13 @@ public class FileViewer extends Tool { ...@@ -57,13 +57,13 @@ public class FileViewer extends Tool {
} else if (arg.equals("-find")) { } else if (arg.equals("-find")) {
find = args[++i]; find = args[++i];
} else if (arg.equals("-start")) { } else if (arg.equals("-start")) {
start = Long.decode(args[++i]).longValue(); start = Long.decode(args[++i]);
} else if (arg.equals("-head")) { } else if (arg.equals("-head")) {
head = true; head = true;
} else if (arg.equals("-tail")) { } else if (arg.equals("-tail")) {
tail = true; tail = true;
} else if (arg.equals("-lines")) { } else if (arg.equals("-lines")) {
lines = Integer.decode(args[++i]).intValue(); lines = Integer.decode(args[++i]);
} else if (arg.equals("-quiet")) { } else if (arg.equals("-quiet")) {
quiet = true; quiet = true;
} else if (arg.equals("-help") || arg.equals("-?")) { } else if (arg.equals("-help") || arg.equals("-?")) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论