Replace native methods with methods from partial classes.

This commit is contained in:
Volker Berlin 2021-05-30 11:52:09 +02:00
parent e54fa767c1
commit 8fccc94615
2 changed files with 14 additions and 2 deletions

View File

@ -388,9 +388,12 @@ public class ClassFile {
String origClassName = partialClassFile.thisClass.getName();
ArrayList<MethodInfo> allMethods = new ArrayList<>( Arrays.asList( methods ) );
for( MethodInfo m : partialClassFile.methods ) {
if( getMethod( m.getName(), m.getType() ) == null ) {
m.setDeclaringClassFile( origClassName, this );
m.setDeclaringClassFile( origClassName, this );
MethodInfo origMethod = getMethod( m.getName(), m.getType() );
if( origMethod == null ) {
allMethods.add( m );
} else if( origMethod.isNative() ) {
allMethods.set( allMethods.indexOf( origMethod ), m );
}
}
methods = allMethods.toArray( methods );

View File

@ -101,6 +101,15 @@ public class MethodInfo implements Member {
return (accessFlags & 0x0008) > 0;
}
/**
* If the method is native
*
* @return true, if abstract
*/
public boolean isNative() {
return (accessFlags & 0x0100) > 0;
}
/**
* If the method is abstract
*