Unverified 提交 7a0c2456 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov 提交者: GitHub

Merge pull request #1637 from igor-suhorukov/master

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