Skip to content

Commit 78df2fe

Browse files
committed
Use isEmpty() instead of .size() == 0.
1 parent 99c473c commit 78df2fe

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

wasm/src/org.graalvm.wasm/src/org/graalvm/wasm/Linker.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ void resolveMemoryImport(WasmStore store, WasmInstance instance, ImportDescripto
502502
importedModuleName, importedMemoryName, instance.name()));
503503
}
504504
final WasmModule importedModule = importedInstance.module();
505-
if (importedModule.exportedMemories().size() == 0) {
505+
if (importedModule.exportedMemories().isEmpty()) {
506506
throw WasmException.create(Failure.UNKNOWN_IMPORT,
507507
String.format("The imported module '%s' does not export any memories, so cannot resolve memory '%s' imported in module '%s'.",
508508
importedModuleName, importedMemoryName, instance.name()));
@@ -791,7 +791,7 @@ void resolveTableImport(WasmStore store, WasmInstance instance, ImportDescriptor
791791
} else {
792792
final WasmModule importedModule = importedInstance.module();
793793
final String importedTableName = importDescriptor.memberName();
794-
if (importedModule.exportedTables().size() == 0) {
794+
if (importedModule.exportedTables().isEmpty()) {
795795
throw WasmException.create(Failure.UNKNOWN_IMPORT,
796796
String.format("The imported module '%s' does not export any tables, so cannot resolve table '%s' imported in module '%s'.",
797797
importedModuleName, importedTableName, instance.name()));

wasm/src/org.graalvm.wasm/src/org/graalvm/wasm/SymbolTable.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -985,7 +985,7 @@ void importTable(String moduleName, String tableName, int index, int initSize, i
985985

986986
void addTable(int index, int minSize, int maxSize, byte elemType, boolean referenceTypes) {
987987
if (!referenceTypes) {
988-
assertTrue(importedTables.size() == 0, "A table has already been imported in the module.", Failure.MULTIPLE_TABLES);
988+
assertTrue(importedTables.isEmpty(), "A table has already been imported in the module.", Failure.MULTIPLE_TABLES);
989989
assertTrue(tableCount == 0, "A table has already been declared in the module.", Failure.MULTIPLE_TABLES);
990990
}
991991
ensureTableCapacity(index);
@@ -1089,7 +1089,7 @@ public void importMemory(String moduleName, String memoryName, int index, long i
10891089

10901090
void addMemory(int index, long minSize, long maxSize, boolean indexType64, boolean shared, boolean multiMemory) {
10911091
if (!multiMemory) {
1092-
assertTrue(importedMemories.size() == 0, "A memory has already been imported in the module.", Failure.MULTIPLE_MEMORIES);
1092+
assertTrue(importedMemories.isEmpty(), "A memory has already been imported in the module.", Failure.MULTIPLE_MEMORIES);
10931093
assertTrue(memoryCount == 0, "A memory has already been declared in the module.", Failure.MULTIPLE_MEMORIES);
10941094
}
10951095
ensureMemoryCapacity(index);

0 commit comments

Comments
 (0)