staticMethodId

context(env: JniEnv, autofreeScope: AutofreeScope)
fun JClass.staticMethodId(name: CValuesRef<ByteVar>, sig: CValuesRef<ByteVar>): JMethodID?(source)

Returns the method ID for a static method of a class. The method is specified by its name and signature.

staticMethodId causes an uninitialized class to be initialized.

Receiver

a Java class object.

Return

a method ID, or null if the operation fails.

Parameters

name

the static method name in the null-terminated modified UTF-8.

sig

the method signature in the null-terminated modified UTF-8. Use String.modifiedUtf8 to get it, or if you are sure that your string doesn't have illegal characters you may use optimized String.utf8.

Throws

NoSuchMethodError

if the specified static method cannot be found.

ExceptionInInitializerError

if the class initializer fails due to an exception.

if the system runs out of memory.


context(env: JniEnv, autofreeScope: AutofreeScope)
inline fun JClass.staticMethodId(name: String, sig: String): JMethodID(source)

Alias for JClass.staticMethodId which accepts the method name and sig as Kotlin Strings.

Throws instead of returning null if the method cannot be found.