Unverified 提交 48573df2 authored 作者: Noel Grandin's avatar Noel Grandin 提交者: GitHub

Merge pull request #717 from katzyn/toArray

Fix for issue #311
...@@ -283,7 +283,7 @@ public class Bnf { ...@@ -283,7 +283,7 @@ public class Bnf {
} }
list.add(s); list.add(s);
} }
return list.toArray(new String[list.size()]); return list.toArray(new String[0]);
} }
/** /**
......
...@@ -234,9 +234,7 @@ public class DbContents { ...@@ -234,9 +234,7 @@ public class DbContents {
schemaList.add(schema); schemaList.add(schema);
} }
rs.close(); rs.close();
String[] list = new String[schemaList.size()]; return schemaList.toArray(new String[0]);
schemaList.toArray(list);
return list;
} }
private String getDefaultSchemaName(DatabaseMetaData meta) { private String getDefaultSchemaName(DatabaseMetaData meta) {
......
...@@ -117,8 +117,7 @@ public class DbSchema { ...@@ -117,8 +117,7 @@ public class DbSchema {
list.add(table); list.add(table);
} }
rs.close(); rs.close();
tables = new DbTableOrView[list.size()]; tables = list.toArray(new DbTableOrView[0]);
list.toArray(tables);
if (tables.length < SysProperties.CONSOLE_MAX_TABLES_LIST_COLUMNS) { if (tables.length < SysProperties.CONSOLE_MAX_TABLES_LIST_COLUMNS) {
for (DbTableOrView tab : tables) { for (DbTableOrView tab : tables) {
try { try {
...@@ -146,8 +145,7 @@ public class DbSchema { ...@@ -146,8 +145,7 @@ public class DbSchema {
list.add(new DbProcedure(this, rs)); list.add(new DbProcedure(this, rs));
} }
rs.close(); rs.close();
procedures = new DbProcedure[list.size()]; procedures = list.toArray(new DbProcedure[0]);
list.toArray(procedures);
if (procedures.length < SysProperties.CONSOLE_MAX_PROCEDURES_LIST_COLUMNS) { if (procedures.length < SysProperties.CONSOLE_MAX_PROCEDURES_LIST_COLUMNS) {
for (DbProcedure procedure : procedures) { for (DbProcedure procedure : procedures) {
procedure.readParameters(meta); procedure.readParameters(meta);
......
...@@ -98,8 +98,7 @@ public class DbTableOrView { ...@@ -98,8 +98,7 @@ public class DbTableOrView {
list.add(column); list.add(column);
} }
rs.close(); rs.close();
columns = new DbColumn[list.size()]; columns = list.toArray(new DbColumn[0]);
list.toArray(columns);
} }
} }
...@@ -913,7 +913,7 @@ public class Parser { ...@@ -913,7 +913,7 @@ public class Parser {
} }
} while (readIf(",")); } while (readIf(","));
read(")"); read(")");
return columns.toArray(new IndexColumn[columns.size()]); return columns.toArray(new IndexColumn[0]);
} }
private String[] parseColumnList() { private String[] parseColumnList() {
...@@ -922,7 +922,7 @@ public class Parser { ...@@ -922,7 +922,7 @@ public class Parser {
String columnName = readColumnIdentifier(); String columnName = readColumnIdentifier();
columns.add(columnName); columns.add(columnName);
} while (readIfMore()); } while (readIfMore());
return columns.toArray(new String[columns.size()]); return columns.toArray(new String[0]);
} }
private Column[] parseColumnList(Table table) { private Column[] parseColumnList(Table table) {
...@@ -938,7 +938,7 @@ public class Parser { ...@@ -938,7 +938,7 @@ public class Parser {
columns.add(column); columns.add(column);
} while (readIfMore()); } while (readIfMore());
} }
return columns.toArray(new Column[columns.size()]); return columns.toArray(new Column[0]);
} }
private Column parseColumn(Table table) { private Column parseColumn(Table table) {
...@@ -1117,7 +1117,7 @@ public class Parser { ...@@ -1117,7 +1117,7 @@ public class Parser {
} }
} while (readIfMore()); } while (readIfMore());
} }
command.addRow(values.toArray(new Expression[values.size()])); command.addRow(values.toArray(new Expression[0]));
} while (readIf(",")); } while (readIf(","));
} else { } else {
command.setQuery(parseSelect()); command.setQuery(parseSelect());
...@@ -1283,7 +1283,7 @@ public class Parser { ...@@ -1283,7 +1283,7 @@ public class Parser {
} }
} while (readIfMore()); } while (readIfMore());
} }
command.addRow(values.toArray(new Expression[values.size()])); command.addRow(values.toArray(new Expression[0]));
// the following condition will allow (..),; and (..); // the following condition will allow (..),; and (..);
} while (readIf(",") && readIf("(")); } while (readIf(",") && readIf("("));
} else if (readIf("SET")) { } else if (readIf("SET")) {
...@@ -1303,8 +1303,8 @@ public class Parser { ...@@ -1303,8 +1303,8 @@ public class Parser {
} }
values.add(expression); values.add(expression);
} while (readIf(",")); } while (readIf(","));
command.setColumns(columnList.toArray(new Column[columnList.size()])); command.setColumns(columnList.toArray(new Column[0]));
command.addRow(values.toArray(new Expression[values.size()])); command.addRow(values.toArray(new Expression[0]));
} else { } else {
command.setQuery(parseSelect()); command.setQuery(parseSelect());
} }
...@@ -1342,7 +1342,7 @@ public class Parser { ...@@ -1342,7 +1342,7 @@ public class Parser {
} }
} while (readIfMore()); } while (readIfMore());
} }
command.addRow(values.toArray(new Expression[values.size()])); command.addRow(values.toArray(new Expression[0]));
} while (readIf(",")); } while (readIf(","));
} else { } else {
command.setQuery(parseSelect()); command.setQuery(parseSelect());
...@@ -2712,8 +2712,7 @@ public class Parser { ...@@ -2712,8 +2712,7 @@ public class Parser {
} }
argList.add(readExpression()); argList.add(readExpression());
} }
args = new Expression[numArgs]; args = argList.toArray(new Expression[0]);
argList.toArray(args);
JavaFunction func = new JavaFunction(functionAlias, args); JavaFunction func = new JavaFunction(functionAlias, args);
return func; return func;
} }
...@@ -2724,8 +2723,7 @@ public class Parser { ...@@ -2724,8 +2723,7 @@ public class Parser {
params.add(readExpression()); params.add(readExpression());
} while (readIf(",")); } while (readIf(","));
read(")"); read(")");
Expression[] list = new Expression[params.size()]; Expression[] list = params.toArray(new Expression[0]);
params.toArray(list);
JavaAggregate agg = new JavaAggregate(aggregate, list, currentSelect); JavaAggregate agg = new JavaAggregate(aggregate, list, currentSelect);
currentSelect.setGroupQuery(); currentSelect.setGroupQuery();
return agg; return agg;
...@@ -3227,9 +3225,7 @@ public class Parser { ...@@ -3227,9 +3225,7 @@ public class Parser {
break; break;
} }
} }
Expression[] array = new Expression[list.size()]; r = new ExpressionList(list.toArray(new Expression[0]));
list.toArray(array);
r = new ExpressionList(array);
} else { } else {
read(")"); read(")");
} }
...@@ -4533,7 +4529,7 @@ public class Parser { ...@@ -4533,7 +4529,7 @@ public class Parser {
} }
read(")"); read(")");
original += ')'; original += ')';
enumerators = enumeratorList.toArray(new String[enumeratorList.size()]); enumerators = enumeratorList.toArray(new String[0]);
} }
try { try {
ValueEnum.check(enumerators); ValueEnum.check(enumerators);
...@@ -5756,9 +5752,7 @@ public class Parser { ...@@ -5756,9 +5752,7 @@ public class Parser {
while (readIf(",")) { while (readIf(",")) {
list.add(readAliasIdentifier()); list.add(readAliasIdentifier());
} }
String[] schemaNames = new String[list.size()]; command.setStringArray(list.toArray(new String[0]));
list.toArray(schemaNames);
command.setStringArray(schemaNames);
return command; return command;
} else if (readIf("JAVA_OBJECT_SERIALIZER")) { } else if (readIf("JAVA_OBJECT_SERIALIZER")) {
readIfEqualOrTo(); readIfEqualOrTo();
......
...@@ -387,7 +387,7 @@ public class Select extends Query { ...@@ -387,7 +387,7 @@ public class Select extends Query {
} }
sortColumns.add(exprCol.getColumn()); sortColumns.add(exprCol.getColumn());
} }
Column[] sortCols = sortColumns.toArray(new Column[sortColumns.size()]); Column[] sortCols = sortColumns.toArray(new Column[0]);
if (sortCols.length == 0) { if (sortCols.length == 0) {
// sort just on constants - can use scan index // sort just on constants - can use scan index
return topTableFilter.getTable().getScanIndex(session); return topTableFilter.getTable().getScanIndex(session);
...@@ -930,8 +930,7 @@ public class Select extends Query { ...@@ -930,8 +930,7 @@ public class Select extends Query {
isGroupSortedQuery = true; isGroupSortedQuery = true;
} }
} }
expressionArray = new Expression[expressions.size()]; expressionArray = expressions.toArray(new Expression[0]);
expressions.toArray(expressionArray);
isPrepared = true; isPrepared = true;
} }
...@@ -947,7 +946,7 @@ public class Select extends Query { ...@@ -947,7 +946,7 @@ public class Select extends Query {
list.add(f); list.add(f);
f = f.getJoin(); f = f.getJoin();
} while (f != null); } while (f != null);
TableFilter[] fs = list.toArray(new TableFilter[list.size()]); TableFilter[] fs = list.toArray(new TableFilter[0]);
// prepare join batch // prepare join batch
JoinBatch jb = null; JoinBatch jb = null;
for (int i = fs.length - 1; i >= 0; i--) { for (int i = fs.length - 1; i >= 0; i--) {
...@@ -982,8 +981,7 @@ public class Select extends Query { ...@@ -982,8 +981,7 @@ public class Select extends Query {
} }
private double preparePlan(boolean parse) { private double preparePlan(boolean parse) {
TableFilter[] topArray = topFilters.toArray( TableFilter[] topArray = topFilters.toArray(new TableFilter[0]);
new TableFilter[topFilters.size()]);
for (TableFilter t : topArray) { for (TableFilter t : topArray) {
t.setFullCondition(condition); t.setFullCondition(condition);
} }
...@@ -1058,8 +1056,7 @@ public class Select extends Query { ...@@ -1058,8 +1056,7 @@ public class Select extends Query {
// can not use the field sqlStatement because the parameter // can not use the field sqlStatement because the parameter
// indexes may be incorrect: ? may be in fact ?2 for a subquery // indexes may be incorrect: ? may be in fact ?2 for a subquery
// but indexes may be set manually as well // but indexes may be set manually as well
Expression[] exprList = expressions.toArray( Expression[] exprList = expressions.toArray(new Expression[0]);
new Expression[expressions.size()]);
StatementBuilder buff = new StatementBuilder(); StatementBuilder buff = new StatementBuilder();
for (TableFilter f : topFilters) { for (TableFilter f : topFilters) {
Table t = f.getTable(); Table t = f.getTable();
......
...@@ -348,8 +348,7 @@ public class SelectUnion extends Query { ...@@ -348,8 +348,7 @@ public class SelectUnion extends Query {
sort = prepareOrder(orderList, expressions.size()); sort = prepareOrder(orderList, expressions.size());
orderList = null; orderList = null;
} }
expressionArray = new Expression[expressions.size()]; expressionArray = expressions.toArray(new Expression[0]);
expressions.toArray(expressionArray);
} }
@Override @Override
...@@ -435,7 +434,7 @@ public class SelectUnion extends Query { ...@@ -435,7 +434,7 @@ public class SelectUnion extends Query {
DbException.throwInternalError("type=" + unionType); DbException.throwInternalError("type=" + unionType);
} }
buff.append('(').append(right.getPlanSQL()).append(')'); buff.append('(').append(right.getPlanSQL()).append(')');
Expression[] exprList = expressions.toArray(new Expression[expressions.size()]); Expression[] exprList = expressions.toArray(new Expression[0]);
if (sort != null) { if (sort != null) {
buff.append("\nORDER BY ").append(sort.getSQL(exprList, exprList.length)); buff.append("\nORDER BY ").append(sort.getSQL(exprList, exprList.length));
} }
......
...@@ -225,8 +225,7 @@ public class ConnectionInfo implements Cloneable { ...@@ -225,8 +225,7 @@ public class ConnectionInfo implements Cloneable {
} }
private void readProperties(Properties info) { private void readProperties(Properties info) {
Object[] list = new Object[info.size()]; Object[] list = info.keySet().toArray();
info.keySet().toArray(list);
DbSettings s = null; DbSettings s = null;
for (Object k : list) { for (Object k : list) {
String key = StringUtils.toUpperEnglish(k.toString()); String key = StringUtils.toUpperEnglish(k.toString());
......
...@@ -1677,9 +1677,7 @@ public class Database implements DataHandler { ...@@ -1677,9 +1677,7 @@ public class Database implements DataHandler {
if (includingSystemSession && lob != null) { if (includingSystemSession && lob != null) {
list.add(lob); list.add(lob);
} }
Session[] array = new Session[list.size()]; return list.toArray(new Session[0]);
list.toArray(array);
return array;
} }
/** /**
......
...@@ -168,8 +168,7 @@ public class FunctionAlias extends SchemaObjectBase { ...@@ -168,8 +168,7 @@ public class FunctionAlias extends SchemaObjectBase {
ErrorCode.PUBLIC_STATIC_JAVA_METHOD_NOT_FOUND_1, ErrorCode.PUBLIC_STATIC_JAVA_METHOD_NOT_FOUND_1,
methodName + " (" + className + ")"); methodName + " (" + className + ")");
} }
javaMethods = new JavaMethod[list.size()]; javaMethods = list.toArray(new JavaMethod[0]);
list.toArray(javaMethods);
// Sort elements. Methods with a variable number of arguments must be at // Sort elements. Methods with a variable number of arguments must be at
// the end. Reason: there could be one method without parameters and one // the end. Reason: there could be one method without parameters and one
// with a variable number. The one without parameters needs to be used // with a variable number. The one without parameters needs to be used
......
...@@ -1440,9 +1440,7 @@ public class Session extends SessionWithState { ...@@ -1440,9 +1440,7 @@ public class Session extends SessionWithState {
break; break;
} }
} }
Table[] list = new Table[copy.size()]; return copy.toArray(new Table[0]);
copy.toArray(list);
return list;
} }
/** /**
......
...@@ -2308,10 +2308,8 @@ public class Function extends Expression implements FunctionCall { ...@@ -2308,10 +2308,8 @@ public class Function extends Expression implements FunctionCall {
*/ */
public void doneWithParameters() { public void doneWithParameters() {
if (info.parameterCount == VAR_ARGS) { if (info.parameterCount == VAR_ARGS) {
int len = varArgs.size(); checkParameterCount(varArgs.size());
checkParameterCount(len); args = varArgs.toArray(new Expression[0]);
args = new Expression[len];
varArgs.toArray(args);
varArgs = null; varArgs = null;
} else { } else {
int len = args.length; int len = args.length;
......
...@@ -73,8 +73,7 @@ public class TableFunction extends Function { ...@@ -73,8 +73,7 @@ public class TableFunction extends Function {
} }
public void setColumns(ArrayList<Column> columns) { public void setColumns(ArrayList<Column> columns) {
this.columnList = new Column[columns.size()]; this.columnList = columns.toArray(new Column[0]);
columns.toArray(columnList);
} }
private ValueResultSet getTable(Session session, Expression[] argList, private ValueResultSet getTable(Session session, Expression[] argList,
......
...@@ -469,10 +469,8 @@ public class FullText { ...@@ -469,10 +469,8 @@ public class FullText {
Parser p = new Parser(session); Parser p = new Parser(session);
Expression expr = p.parseExpression(key); Expression expr = p.parseExpression(key);
addColumnData(columns, data, expr); addColumnData(columns, data, expr);
Object[] col = new Object[columns.size()]; Object[] col = columns.toArray();
columns.toArray(col); Object[] dat = data.toArray();
Object[] dat = new Object[columns.size()];
data.toArray(dat);
Object[][] columnData = { col, dat }; Object[][] columnData = { col, dat };
return columnData; return columnData;
} }
...@@ -907,8 +905,7 @@ public class FullText { ...@@ -907,8 +905,7 @@ public class FullText {
index = new IndexInfo(); index = new IndexInfo();
index.schema = schemaName; index.schema = schemaName;
index.table = tableName; index.table = tableName;
index.columns = new String[columnList.size()]; index.columns = columnList.toArray(new String[0]);
columnList.toArray(index.columns);
rs = meta.getColumns(null, rs = meta.getColumns(null,
StringUtils.escapeMetaDataPattern(schemaName), StringUtils.escapeMetaDataPattern(schemaName),
StringUtils.escapeMetaDataPattern(tableName), StringUtils.escapeMetaDataPattern(tableName),
......
...@@ -497,8 +497,7 @@ public class FullTextLucene extends FullText { ...@@ -497,8 +497,7 @@ public class FullTextLucene extends FullText {
columnList.add(rs.getString("COLUMN_NAME")); columnList.add(rs.getString("COLUMN_NAME"));
} }
columnTypes = new int[columnList.size()]; columnTypes = new int[columnList.size()];
columns = new String[columnList.size()]; columns = columnList.toArray(new String[0]);
columnList.toArray(columns);
rs = meta.getColumns(null, rs = meta.getColumns(null,
StringUtils.escapeMetaDataPattern(schemaName), StringUtils.escapeMetaDataPattern(schemaName),
StringUtils.escapeMetaDataPattern(tableName), StringUtils.escapeMetaDataPattern(tableName),
......
...@@ -359,8 +359,7 @@ public class ViewIndex extends BaseIndex implements SpatialIndex { ...@@ -359,8 +359,7 @@ public class ViewIndex extends BaseIndex implements SpatialIndex {
i++; i++;
} }
} }
columns = new Column[columnList.size()]; columns = columnList.toArray(new Column[0]);
columnList.toArray(columns);
// reconstruct the index columns from the masks // reconstruct the index columns from the masks
this.indexColumns = new IndexColumn[indexColumnCount]; this.indexColumns = new IndexColumn[indexColumnCount];
......
...@@ -201,8 +201,7 @@ public class JdbcXAConnection extends TraceObject implements XAConnection, ...@@ -201,8 +201,7 @@ public class JdbcXAConnection extends TraceObject implements XAConnection,
list.add(xid); list.add(xid);
} }
rs.close(); rs.close();
Xid[] result = new Xid[list.size()]; Xid[] result = list.toArray(new Xid[0]);
list.toArray(result);
if (list.size() > 0) { if (list.size() > 0) {
prepared = true; prepared = true;
} }
......
...@@ -209,7 +209,7 @@ public class SortOrder implements Comparator<Value[]> { ...@@ -209,7 +209,7 @@ public class SortOrder implements Comparator<Value[]> {
rows.set(0, Collections.min(rows, this)); rows.set(0, Collections.min(rows, this));
return; return;
} }
Value[][] arr = rows.toArray(new Value[rowsSize][]); Value[][] arr = rows.toArray(new Value[0][]);
Utils.sortTopN(arr, offset, limit, this); Utils.sortTopN(arr, offset, limit, this);
for (int i = 0, end = Math.min(offset + limit, rowsSize); i < end; i++) { for (int i = 0, end = Math.min(offset + limit, rowsSize); i < end; i++) {
rows.set(i, arr[i]); rows.set(i, arr[i]);
......
...@@ -46,8 +46,7 @@ public class WebServlet extends HttpServlet { ...@@ -46,8 +46,7 @@ public class WebServlet extends HttpServlet {
list.add(value); list.add(value);
} }
} }
String[] args = new String[list.size()]; String[] args = list.toArray(new String[0]);
list.toArray(args);
server = new WebServer(); server = new WebServer();
server.setAllowChunked(false); server.setAllowChunked(false);
server.init(args); server.init(args);
......
...@@ -131,8 +131,7 @@ public class FilePathSplit extends FilePathWrapper { ...@@ -131,8 +131,7 @@ public class FilePathSplit extends FilePathWrapper {
break; break;
} }
} }
FileChannel[] array = new FileChannel[list.size()]; FileChannel[] array = list.toArray(new FileChannel[0]);
list.toArray(array);
long maxLength = array[0].size(); long maxLength = array[0].size();
long length = maxLength; long length = maxLength;
if (array.length == 1) { if (array.length == 1) {
......
...@@ -54,10 +54,8 @@ public class Plan { ...@@ -54,10 +54,8 @@ public class Plan {
} }
}); });
} }
allConditions = new Expression[allCond.size()]; allConditions = allCond.toArray(new Expression[0]);
allCond.toArray(allConditions); allFilters = all.toArray(new TableFilter[0]);
allFilters = new TableFilter[all.size()];
all.toArray(allFilters);
} }
/** /**
......
...@@ -40,8 +40,7 @@ public abstract class TableBase extends Table { ...@@ -40,8 +40,7 @@ public abstract class TableBase extends Table {
this.tableEngineParams = data.tableEngineParams; this.tableEngineParams = data.tableEngineParams;
} }
setTemporary(data.temporary); setTemporary(data.temporary);
Column[] cols = new Column[data.columns.size()]; Column[] cols = data.columns.toArray(new Column[0]);
data.columns.toArray(cols);
setColumns(cols); setColumns(cols);
} }
......
...@@ -195,8 +195,7 @@ public class TableLink extends Table { ...@@ -195,8 +195,7 @@ public class TableLink extends Table {
throw DbException.get(ErrorCode.TABLE_OR_VIEW_NOT_FOUND_1, e, throw DbException.get(ErrorCode.TABLE_OR_VIEW_NOT_FOUND_1, e,
originalTable + "(" + e.toString() + ")"); originalTable + "(" + e.toString() + ")");
} }
Column[] cols = new Column[columnList.size()]; Column[] cols = columnList.toArray(new Column[0]);
columnList.toArray(cols);
setColumns(cols); setColumns(cols);
int id = getId(); int id = getId();
linkedIndex = new LinkedIndex(this, id, IndexColumn.wrap(cols), linkedIndex = new LinkedIndex(this, id, IndexColumn.wrap(cols),
...@@ -344,8 +343,7 @@ public class TableLink extends Table { ...@@ -344,8 +343,7 @@ public class TableLink extends Table {
"recognized columns of {1} total columns.", firstNull, list.size()); "recognized columns of {1} total columns.", firstNull, list.size());
list = list.subList(0, firstNull); list = list.subList(0, firstNull);
} }
Column[] cols = new Column[list.size()]; Column[] cols = list.toArray(new Column[0]);
list.toArray(cols);
Index index = new LinkedIndex(this, 0, IndexColumn.wrap(cols), indexType); Index index = new LinkedIndex(this, 0, IndexColumn.wrap(cols), indexType);
indexes.add(index); indexes.add(index);
} }
......
...@@ -198,8 +198,7 @@ public class TableView extends Table { ...@@ -198,8 +198,7 @@ public class TableView extends Table {
} }
list.add(col); list.add(col);
} }
cols = new Column[list.size()]; cols = list.toArray(new Column[0]);
list.toArray(cols);
createException = null; createException = null;
viewQuery = query; viewQuery = query;
} catch (DbException e) { } catch (DbException e) {
......
...@@ -361,8 +361,7 @@ public class Csv implements SimpleRowSource { ...@@ -361,8 +361,7 @@ public class Csv implements SimpleRowSource {
} }
} }
} }
columnNames = new String[list.size()]; columnNames = list.toArray(new String[0]);
list.toArray(columnNames);
} }
private static boolean isSimpleColumnName(String columnName) { private static boolean isSimpleColumnName(String columnName) {
......
...@@ -222,9 +222,7 @@ public class MultiDimension implements Comparator<long[]> { ...@@ -222,9 +222,7 @@ public class MultiDimension implements Comparator<long[]> {
ArrayList<long[]> list = New.arrayList(); ArrayList<long[]> list = New.arrayList();
addMortonRanges(list, min, max, len, 0); addMortonRanges(list, min, max, len, 0);
combineEntries(list, total); combineEntries(list, total);
long[][] ranges = new long[list.size()][2]; return list.toArray(new long[0][]);
list.toArray(ranges);
return ranges;
} }
private static int getSize(int[] min, int[] max, int len) { private static int getSize(int[] min, int[] max, int len) {
......
...@@ -156,8 +156,7 @@ public class JdbcUtils { ...@@ -156,8 +156,7 @@ public class JdbcUtils {
classNames.add(p); classNames.add(p);
} }
} }
allowedClassNamePrefixes = new String[prefixes.size()]; allowedClassNamePrefixes = prefixes.toArray(new String[0]);
prefixes.toArray(allowedClassNamePrefixes);
allowAllClasses = allowAll; allowAllClasses = allowAll;
allowedClassNames = classNames; allowedClassNames = classNames;
} }
......
...@@ -257,7 +257,7 @@ public class Profiler implements Runnable { ...@@ -257,7 +257,7 @@ public class Profiler implements Runnable {
stack.add(line); stack.add(line);
} }
if (stack.size() > 0) { if (stack.size() > 0) {
String[] s = stack.toArray(new String[stack.size()]); String[] s = stack.toArray(new String[0]);
list.add(s); list.add(s);
} }
} }
......
...@@ -492,9 +492,7 @@ public class StringUtils { ...@@ -492,9 +492,7 @@ public class StringUtils {
} }
String e = buff.toString(); String e = buff.toString();
list.add(trim ? e.trim() : e); list.add(trim ? e.trim() : e);
String[] array = new String[list.size()]; return list.toArray(new String[0]);
list.toArray(array);
return array;
} }
/** /**
......
...@@ -212,9 +212,7 @@ public class ValueArray extends Value { ...@@ -212,9 +212,7 @@ public class ValueArray extends Value {
} }
list.add(v); list.add(v);
} }
Value[] array = new Value[list.size()]; return get(list.toArray(new Value[0]));
list.toArray(array);
return get(array);
} }
} }
...@@ -57,8 +57,7 @@ public class TaskProcess { ...@@ -57,8 +57,7 @@ public class TaskProcess {
if (args != null && args.length > 0) { if (args != null && args.length > 0) {
list.addAll(Arrays.asList(args)); list.addAll(Arrays.asList(args));
} }
String[] procDef = new String[list.size()]; String[] procDef = list.toArray(new String[0]);
list.toArray(procDef);
process = Runtime.getRuntime().exec(procDef); process = Runtime.getRuntime().exec(procDef);
copyInThread(process.getErrorStream(), System.err); copyInThread(process.getErrorStream(), System.err);
reader = new BufferedReader(new InputStreamReader(process.getInputStream())); reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
......
...@@ -47,9 +47,7 @@ public class Expression { ...@@ -47,9 +47,7 @@ public class Expression {
exp.add(sql); exp.add(sql);
sql = ""; sql = "";
} }
String[] list = new String[exp.size()]; return exp.toArray(new String[0]);
exp.toArray(list);
return list;
} }
/** /**
......
...@@ -214,8 +214,7 @@ class Parser { ...@@ -214,8 +214,7 @@ class Parser {
values.add(parseValue().getValue()); values.add(parseValue().getValue());
} while (readIf(",")); } while (readIf(","));
read("}"); read("}");
String[] list = new String[values.size()]; String[] list = values.toArray(new String[0]);
values.toArray(list);
return new Arg(String[].class, list); return new Arg(String[].class, list);
} else if (readIf("BigDecimal")) { } else if (readIf("BigDecimal")) {
read("("); read("(");
......
...@@ -162,7 +162,6 @@ class Statement { ...@@ -162,7 +162,6 @@ class Statement {
} }
public void setArgs(ArrayList<Arg> list) { public void setArgs(ArrayList<Arg> list) {
args = new Arg[list.size()]; args = list.toArray(new Arg[0]);
list.toArray(args);
} }
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论