1
0
mirror of https://github.com/i-net-software/JWebAssembly.git synced 2025-03-25 23:47:51 +01:00

We need to list the used fields in the hierarchy

This commit is contained in:
Volker Berlin 2019-12-24 14:25:25 +01:00
parent 2ebc771c55
commit 2da919c9fd

@ -19,7 +19,6 @@ package de.inetsoftware.jwebassembly.module;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
@ -221,6 +220,8 @@ public class TypeManager {
* for types of fields * for types of fields
* @param libraries * @param libraries
* for loading the class files if not in the cache * for loading the class files if not in the cache
* @param allNeededFields
* for recursive call list this all used fields
* @throws IOException * @throws IOException
* if any I/O error occur on loading or writing * if any I/O error occur on loading or writing
*/ */
@ -230,7 +231,13 @@ public class TypeManager {
throw new WasmException( "Missing class: " + className, -1 ); throw new WasmException( "Missing class: " + className, -1 );
} }
allNeededFields.addAll( neededFields ); {
// list all used fields
StructType type = types.structTypes.get( className );
if( type != null ) {
allNeededFields.addAll( type.neededFields );
}
}
ConstantClass superClass = classFile.getSuperClass(); ConstantClass superClass = classFile.getSuperClass();
if( superClass != null ) { if( superClass != null ) {