Skip to content

Commit 73927d9

Browse files
committed
fix: do not call <clinit>()V when registering native methods
1 parent 4c1ed9a commit 73927d9

File tree

1 file changed

+0
-8
lines changed

1 file changed

+0
-8
lines changed

core-syscall/src/main/java/dev/tmpfs/libcoresyscall/core/impl/ArtMethodHelper.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -163,14 +163,6 @@ public static void registerNativeMethod(@NonNull Member method, long address) {
163163
throw new IllegalArgumentException("address overflow in 32-bit mode: " + Long.toHexString(address));
164164
}
165165
}
166-
try {
167-
Class<?> declaringClass = method.getDeclaringClass();
168-
// JNI specification says that the class needs to be initialized before the native method is registered
169-
Class.forName(declaringClass.getName(), true, declaringClass.getClassLoader());
170-
} catch (ClassNotFoundException e) {
171-
// should not happen
172-
throw ReflectHelper.unsafeThrow(e);
173-
}
174166
if (Build.VERSION.SDK_INT < 23) {
175167
Object artMethod = getArtMethodObjectBelowSdk23(method);
176168
if (artMethod == null) {

0 commit comments

Comments
 (0)