Skip to content

Commit 85b8460

Browse files
committed
remove warning: [deprecation] newArray(Ruby) in RubyArray has been deprecated
remove warning: [deprecation] append(IRubyObject) in RubyArray has been deprecated
1 parent 59ba043 commit 85b8460

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

src/java/arjdbc/jdbc/JdbcResult.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public class JdbcResult extends RubyObject {
3131
protected JdbcResult(ThreadContext context, RubyClass clazz, RubyJdbcConnection connection, ResultSet resultSet) throws SQLException {
3232
super(context.runtime, clazz);
3333

34-
values = context.runtime.newArray();
34+
values = RubyArray.newArray(context.runtime);
3535
this.connection = connection;
3636

3737
final ResultSetMetaData resultMetaData = resultSet.getMetaData();
@@ -111,7 +111,7 @@ private void processResultSet(final ThreadContext context, final ResultSet resul
111111
row[i] = connection.jdbcToRuby(context, runtime, i + 1, columnTypes[i], resultSet); // Result Set is 1 based
112112
}
113113

114-
values.append(RubyArray.newArrayNoCopy(context.runtime, row));
114+
values.push(RubyArray.newArrayNoCopy(context.runtime, row));
115115
}
116116
}
117117

src/java/arjdbc/jdbc/RubyJdbcConnection.java

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -495,13 +495,13 @@ public IRubyObject marked_savepoint_names(final ThreadContext context) {
495495
@SuppressWarnings("unchecked")
496496
final Map<IRubyObject, Savepoint> savepoints = getSavepoints(false);
497497
if ( savepoints != null ) {
498-
final RubyArray names = context.runtime.newArray(savepoints.size());
498+
final RubyArray names = RubyArray.newArray(context.runtime, savepoints.size());
499499
for ( Map.Entry<IRubyObject, ?> entry : savepoints.entrySet() ) {
500-
names.append( entry.getKey() ); // keys are RubyString instances
500+
names.push( entry.getKey() ); // keys are RubyString instances
501501
}
502502
return names;
503503
}
504-
return context.runtime.newEmptyArray();
504+
return RubyArray.newEmptyArray(context.runtime);
505505
}
506506

507507
protected Map<IRubyObject, Savepoint> getSavepoints(final ThreadContext context) {
@@ -1071,7 +1071,7 @@ private IRubyObject doExecuteQueryRaw(final ThreadContext context,
10711071
if (hasResult) {
10721072
return mapToRawResult(context, connection, statement.getResultSet(), false);
10731073
}
1074-
return context.runtime.newEmptyArray();
1074+
return RubyArray.newEmptyArray(context.runtime);
10751075
}
10761076
catch (final SQLException e) {
10771077
debugErrorSQL(context, query);
@@ -1238,7 +1238,7 @@ public IRubyObject supported_data_types(final ThreadContext context) throws SQLE
12381238
public IRubyObject primary_keys(ThreadContext context, IRubyObject tableName) throws SQLException {
12391239
@SuppressWarnings("unchecked")
12401240
List<IRubyObject> primaryKeys = (List) primaryKeys(context, tableName.toString());
1241-
return context.runtime.newArray(primaryKeys);
1241+
return RubyArray.newArray(context.runtime, primaryKeys);
12421242
}
12431243

12441244
protected static final int PRIMARY_KEYS_COLUMN_NAME = 4;
@@ -1422,11 +1422,11 @@ context, caseConvertIdentifierForRails(metaData, columnName)
14221422
// orders, (since AR 3.2) where, type, using (AR 4.0)
14231423
};
14241424

1425-
indexes.append( IndexDefinition.newInstance(context, args, Block.NULL_BLOCK) ); // IndexDefinition.new
1425+
indexes.push( IndexDefinition.newInstance(context, args, Block.NULL_BLOCK) ); // IndexDefinition.new
14261426
}
14271427

14281428
// one or more columns can be associated with an index
1429-
if ( currentColumns != null ) currentColumns.append(rubyColumnName);
1429+
if ( currentColumns != null ) currentColumns.push(rubyColumnName);
14301430
}
14311431

14321432
return indexes;
@@ -1493,7 +1493,7 @@ protected IRubyObject foreignKeys(final ThreadContext context, final String tabl
14931493
fKeys.add( FKDefinition.newInstance(context, from_table, to_table, options, Block.NULL_BLOCK) ); // ForeignKeyDefinition.new
14941494
}
14951495

1496-
return runtime.newArray(fKeys);
1496+
return RubyArray.newArray(runtime, fKeys);
14971497

14981498
} finally { close(fkInfoSet); }
14991499
});
@@ -2008,10 +2008,10 @@ protected IRubyObject mapToResult(final ThreadContext context, final Connection
20082008
final ResultSet resultSet, final ColumnData[] columns) throws SQLException {
20092009
final Ruby runtime = context.runtime;
20102010

2011-
final RubyArray resultRows = runtime.newArray();
2011+
final RubyArray resultRows = RubyArray.newArray(runtime);
20122012

20132013
while (resultSet.next()) {
2014-
resultRows.append(mapRow(context, runtime, columns, resultSet, this));
2014+
resultRows.push(mapRow(context, runtime, columns, resultSet, this));
20152015
}
20162016

20172017
return newResult(context, columns, resultRows);
@@ -2372,7 +2372,7 @@ protected IRubyObject arrayToRuby(final ThreadContext context,
23722372
try {
23732373
if ( value == null ) return context.nil;
23742374

2375-
final RubyArray array = runtime.newArray();
2375+
final RubyArray array = RubyArray.newArray(runtime);
23762376

23772377
final ResultSet arrayResult = value.getResultSet(); // 1: index, 2: value
23782378
final int baseType = value.getBaseType();
@@ -2393,7 +2393,7 @@ protected IRubyObject arrayToRuby(final ThreadContext context,
23932393
}
23942394

23952395
while ( arrayResult.next() ) {
2396-
array.append( jdbcToRuby(context, runtime, 2, baseType, arrayResult) );
2396+
array.push( jdbcToRuby(context, runtime, 2, baseType, arrayResult) );
23972397
}
23982398
arrayResult.close();
23992399

@@ -3077,7 +3077,7 @@ protected RubyArray mapTables(final ThreadContext context, final Connection conn
30773077
final RubyArray tables = RubyArray.newArray(context.runtime);
30783078
while ( tablesSet.next() ) {
30793079
String name = tablesSet.getString(TABLES_TABLE_NAME);
3080-
tables.append( cachedString(context, caseConvertIdentifierForRails(connection, name)) );
3080+
tables.push( cachedString(context, caseConvertIdentifierForRails(connection, name)) );
30813081
}
30823082
return tables;
30833083
}
@@ -3158,7 +3158,7 @@ protected RubyArray mapColumnsResult(final ThreadContext context,
31583158
final IRubyObject[] args = new IRubyObject[] {
31593159
columnName, defaultValue, type_metadata, nullable, tableName
31603160
};
3161-
columns.append( Column.newInstance(context, args, Block.NULL_BLOCK) );
3161+
columns.push( Column.newInstance(context, args, Block.NULL_BLOCK) );
31623162
}
31633163
return columns;
31643164
}
@@ -3230,10 +3230,10 @@ protected final IRubyObject doMapGeneratedKeys(final Ruby runtime,
32303230
}
32313231
}
32323232

3233-
final RubyArray keys = runtime.newArray();
3234-
if ( firstKey != null ) keys.append(firstKey); // singleResult == null
3233+
final RubyArray keys = RubyArray.newArray(runtime);
3234+
if ( firstKey != null ) keys.push(firstKey); // singleResult == null
32353235
while ( next ) {
3236-
keys.append( mapGeneratedKey(runtime, genKeys) );
3236+
keys.push( mapGeneratedKey(runtime, genKeys) );
32373237
next = genKeys.next();
32383238
}
32393239
return keys;
@@ -3266,11 +3266,11 @@ private IRubyObject mapToRawResult(final ThreadContext context,
32663266
final ColumnData[] columns = extractColumns(context, connection, resultSet, downCase);
32673267

32683268
final Ruby runtime = context.runtime;
3269-
final RubyArray results = runtime.newArray();
3269+
final RubyArray results = RubyArray.newArray(runtime);
32703270
// [ { 'col1': 1, 'col2': 2 }, { 'col1': 3, 'col2': 4 } ]
32713271

32723272
while ( resultSet.next() ) {
3273-
results.append(mapRawRow(context, runtime, columns, resultSet, this));
3273+
results.push(mapRawRow(context, runtime, columns, resultSet, this));
32743274
}
32753275
return results;
32763276
}

0 commit comments

Comments
 (0)