Skip to content

Commit dfe2065

Browse files
committed
Hoist class to internal name conversion in RegisterNatives.
1 parent 81f57f0 commit dfe2065

File tree

1 file changed

+2
-2
lines changed
  • substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jni/functions

1 file changed

+2
-2
lines changed

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jni/functions/JNIFunctions.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -379,6 +379,7 @@ static JNIObjectHandle FindClass(JNIEnvironment env, CCharPointer cname) {
379379
static int RegisterNatives(JNIEnvironment env, JNIObjectHandle hclazz, JNINativeMethod methods, int nmethods) {
380380
Class<?> clazz = JNIObjectHandles.getObject(hclazz);
381381
Pointer p = (Pointer) methods;
382+
String declaringClass = MetaUtil.toInternalName(clazz.getName());
382383
for (int i = 0; i < nmethods; i++) {
383384
JNINativeMethod entry = (JNINativeMethod) p;
384385
CharSequence name = Utf8.wrapUtf8CString(entry.name());
@@ -393,7 +394,6 @@ static int RegisterNatives(JNIEnvironment env, JNIObjectHandle hclazz, JNINative
393394

394395
CFunctionPointer fnPtr = entry.fnPtr();
395396

396-
String declaringClass = MetaUtil.toInternalName(clazz.getName());
397397
JNINativeLinkage linkage = JNIReflectionDictionary.getLinkage(declaringClass, name, signature);
398398
if (linkage != null) {
399399
linkage.setEntryPoint(fnPtr);

0 commit comments

Comments
 (0)