Skip to content

Commit 31ed06e

Browse files
committed
chore: openrewrite migration
1 parent 12e30a2 commit 31ed06e

93 files changed

Lines changed: 973 additions & 960 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

console/src/main/java/com/arcadedb/console/TerminalParser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public ParsedLine parse(final String line, final int cursor, final ParseContext
8888

8989
if (cursor == line.length()) {
9090
wordIndex = words.size() - 1;
91-
wordCursor = words.get(words.size() - 1).length();
91+
wordCursor = words.getLast().length();
9292
rawWordCursor = cursor - rawWordStart;
9393
rawWordLength = rawWordCursor;
9494
}

e2e/src/test/java/com/arcadedb/e2e/JdbcQueriesTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ private static void printResultSet(ResultSet rs) throws SQLException {
311311
StringBuilder separator = new StringBuilder();
312312
for (int i = 1; i <= columnCount; i++) {
313313
String columnName = metaData.getColumnName(i);
314-
header.append(String.format("| %-20s ", columnName));
314+
header.append("| %-20s ".formatted(columnName));
315315
separator.append("+----------------------");
316316
}
317317
header.append("|");
@@ -329,7 +329,7 @@ private static void printResultSet(ResultSet rs) throws SQLException {
329329
value = value != null ? value : "null";
330330
if (value.length() > 20)
331331
value = value.substring(0, 17) + "...";
332-
row.append(String.format("| %-20s ", value));
332+
row.append("| %-20s ".formatted(value));
333333
}
334334
row.append("|");
335335
System.out.println(row);

engine/src/main/java/com/arcadedb/GlobalConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ public Object call(final Object value) {
211211

212212
ASYNC_OPERATIONS_QUEUE_IMPL("arcadedb.asyncOperationsQueueImpl", SCOPE.DATABASE,
213213
"Queue implementation to use between 'standard' and 'fast'. 'standard' consumes less CPU than the 'fast' implementation, but it could be slower with high loads",
214-
String.class, "standard", Set.of(new String[] { "standard", "fast" })),
214+
String.class, "standard", Set.of("standard", "fast" )),
215215

216216
ASYNC_OPERATIONS_QUEUE_SIZE("arcadedb.asyncOperationsQueueSize", SCOPE.DATABASE,
217217
"Size of the total asynchronous operation queues (it is divided by the number of parallel threads in the pool)",

engine/src/main/java/com/arcadedb/Profiler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ public synchronized JSONObject toJSON() {
202202
json.put("ramOsTotal", new JSONObject().put("space", osTotalMem));
203203

204204
final double cpuLoad = ManagementFactory.getPlatformMXBean(
205-
com.sun.management.OperatingSystemMXBean.class).getSystemCpuLoad();
205+
com.sun.management.OperatingSystemMXBean.class).getCpuLoad();
206206
json.put("cpuLoad", new JSONObject().put("perc", cpuLoad * 100));
207207
}
208208

engine/src/main/java/com/arcadedb/database/DatabaseContext.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ public Binary getTemporaryBuffer2() {
175175
public TransactionContext getLastTransaction() {
176176
if (transactions.isEmpty())
177177
return null;
178-
return transactions.get(transactions.size() - 1);
178+
return transactions.getLast();
179179
}
180180

181181
public void pushTransaction(final TransactionContext tx) {
@@ -191,9 +191,9 @@ public TransactionContext popIfNotLastTransaction() {
191191
return null;
192192

193193
if (transactions.size() > 1)
194-
return transactions.remove(transactions.size() - 1);
194+
return transactions.removeLast();
195195

196-
return transactions.get(0);
196+
return transactions.getFirst();
197197
}
198198

199199
public int getMaxNested() {

engine/src/main/java/com/arcadedb/database/LocalDatabase.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import com.arcadedb.ContextConfiguration;
2222
import com.arcadedb.GlobalConfiguration;
2323
import com.arcadedb.Profiler;
24+
import com.arcadedb.database.Record;
2425
import com.arcadedb.database.async.DatabaseAsyncExecutor;
2526
import com.arcadedb.database.async.DatabaseAsyncExecutorImpl;
2627
import com.arcadedb.database.async.ErrorCallback;

engine/src/main/java/com/arcadedb/database/RID.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public RID(final BasicDatabase database, String value) {
7474
value = value.substring(1);
7575

7676
final List<String> parts = CodeUtils.split(value, ':', 2);
77-
this.bucketId = Integer.parseInt(parts.get(0));
77+
this.bucketId = Integer.parseInt(parts.getFirst());
7878
this.offset = Long.parseLong(parts.get(1));
7979
}
8080

@@ -89,7 +89,7 @@ else if (value instanceof String string)
8989
public static boolean is(final String valueAsString) {
9090
if (valueAsString.length() > 3 && valueAsString.charAt(0) == '#') {
9191
final List<String> parts = CodeUtils.split(valueAsString.substring(1), ':', 3);
92-
return parts.size() == 2 && NumberUtils.isIntegerNumber(parts.get(0)) && NumberUtils.isIntegerNumber(parts.get(1));
92+
return parts.size() == 2 && NumberUtils.isIntegerNumber(parts.getFirst()) && NumberUtils.isIntegerNumber(parts.get(1));
9393
}
9494
return false;
9595
}

engine/src/main/java/com/arcadedb/database/TransactionContext.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
package com.arcadedb.database;
2020

2121
import com.arcadedb.GlobalConfiguration;
22+
import com.arcadedb.database.Record;
2223
import com.arcadedb.engine.BasePage;
2324
import com.arcadedb.engine.ComponentFile;
2425
import com.arcadedb.engine.ImmutablePage;

engine/src/main/java/com/arcadedb/engine/Dictionary.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ public void updateName(final String oldName, final String newName) {
188188

189189
final Integer newIndex = dictionaryMap.get(newName);
190190
if (newIndex == null)
191-
dictionaryMap.putIfAbsent(newName, oldIndexes.get(0)); // IF ALREADY PRESENT, USE THE PREVIOUS KEY INDEX
191+
dictionaryMap.putIfAbsent(newName, oldIndexes.getFirst()); // IF ALREADY PRESENT, USE THE PREVIOUS KEY INDEX
192192

193193
} catch (final IOException e) {
194194
try {

engine/src/main/java/com/arcadedb/engine/LocalBucket.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,7 +1129,7 @@ private List<int[]> computePageHoles(final List<int[]> orderedRecordContentInPag
11291129
final int[] pointer = orderedRecordContentInPage.get(i);
11301130
final int lastPointerEnd = lastPointer[0] + lastPointer[1];
11311131
if (pointer[0] != lastPointerEnd) {
1132-
final int[] lastHole = holes.isEmpty() ? null : holes.get(holes.size() - 1);
1132+
final int[] lastHole = holes.isEmpty() ? null : holes.getLast();
11331133
if (lastHole != null && lastHole[0] + lastHole[1] == pointer[0]) {
11341134
// UPDATE PREVIOUS HOLE
11351135
lastHole[1] += pointer[1];
@@ -1716,7 +1716,7 @@ public void gatherPageStatistics() {
17161716

17171717
int freeSpaceInPage = getPageSize() - contentHeaderSize;
17181718
if (!orderedRecordContentInPage.isEmpty()) {
1719-
final int[] lastRecord = orderedRecordContentInPage.get(orderedRecordContentInPage.size() - 1);
1719+
final int[] lastRecord = orderedRecordContentInPage.getLast();
17201720
freeSpaceInPage = getPageSize() - (lastRecord[0] + lastRecord[1]);
17211721
}
17221722

0 commit comments

Comments
 (0)