Add support for native methods with @WasmTextCode in @Partial classes

This commit is contained in:
Volker Berlin 2022-07-17 19:49:04 +02:00
parent c2655dbce2
commit 94be918c36
No known key found for this signature in database
GPG Key ID: 988423EF815BE4CB

View File

@ -391,15 +391,19 @@ public class ClassFile {
String origClassName = partialClassFile.thisClass.getName();
ArrayList<MethodInfo> allMethods = new ArrayList<>( Arrays.asList( methods ) );
for( MethodInfo m : partialClassFile.methods ) {
if( m.isNative() && m.getAnnotation( JWebAssembly.IMPORT_ANNOTATION ) == null ) {
// only a placeholder
if( m.isNative() && m.getAnnotation( JWebAssembly.IMPORT_ANNOTATION ) == null && m.getAnnotation( JWebAssembly.TEXTCODE_ANNOTATION ) == null ) {
// only a placeholder, use the original
continue;
}
if( "<clinit>".equals( m.getName() ) ) {
// can be fatal to override the static constructor
continue;
}
m.setDeclaringClassFile( origClassName, this );
MethodInfo origMethod = getMethod( m.getName(), m.getType() );
if( origMethod == null ) {
allMethods.add( m );
} else if( origMethod.isNative() ) {
} else {
allMethods.set( allMethods.indexOf( origMethod ), m );
}
}