Package-level declarations

High-level typed access to Java methods, fields and arrays - Kotlin lambdas, ReadWriteProperty delegates and scoped DSLs. Everything here stays context(JniEnv, MemScope) / NativePlacement-friendly.

Methods

Fetch a method ID once, then call it as an ordinary function with reified types - no jArgs, no call<Type>Method:

// requires JniEnv and a NativePlacement / AutofreeScope
val add = clazz.methodId("add", "(II)I").asMethod<Int, Int, Int>()
val result = obj.add(2, 3) // 5
  • asMethod - instance methods (0 to 10 typed parameters, any return type).

  • asStaticMethod - static methods; the receiver is the class.

  • asConstructor - constructors; the receiver is the class, returns JObject?.

  • asNonvirtualMethod - non-virtual dispatch; the first parameter is the JClass to dispatch on.

Primitives in the type arguments must be non-null; reference types must be nullable.

Fields

Get or set a field through a Kotlin ReadWriteProperty - bind it once and use it like a property:

// requires JniEnv and an AutofreeScope
val jName: JString? by obj.stringField("name")
var name: String? by obj.stringField("name").asKotlin()

Instance: objectField, stringField, booleanField…doubleField, and generic field. Static: staticObjectField, staticStringField, staticIntField… and staticField.

Each has two forms:

  • Kotlin String name - encodes with String.modifiedUtf8 and throws if the field is missing.

  • CValuesRef<ByteVar> name - returns null when the field is not found; pass name.utf8 or name.modifiedUtf8.

Convert an object delegate to a specific type with asType, and to a Kotlin String (reading/writing JString?) with asKotlin. Fields can also be bound by a ready JFieldID.

Arrays and strings, in place

Instead of getElements → mutate → releaseElements(mode) pairs, mutate the body in a scope and choose how changes are applied:

val javaArray: JIntArray = …
javaArray.modify({ /* onError */ }) { carray, isCopy ->
// this: ModifyingArrayScope
carray[0] = 42
commit() // copy back, keep the buffer
// finalize() - copy back and free
// abort() - discard changes
}

Types

Link copied to clipboard

Special type that exposes methods commit, finalize and abort to simplify working with arrays. Is used in modify functions.

Functions

Link copied to clipboard

Alias for releasing an array with ApplyChangesMode.Commit.

Link copied to clipboard

Returns lambda which calls newObject and returns the result.

inline fun <P1, P2> JMethodID.asConstructor(): context(JniEnv, NativePlacement) JClass.(P1, P2) -> JObject?
inline fun <P1, P2, P3> JMethodID.asConstructor(): context(JniEnv, NativePlacement) JClass.(P1, P2, P3) -> JObject?
inline fun <P1, P2, P3, P4> JMethodID.asConstructor(): context(JniEnv, NativePlacement) JClass.(P1, P2, P3, P4) -> JObject?
inline fun <P1, P2, P3, P4, P5> JMethodID.asConstructor(): context(JniEnv, NativePlacement) JClass.(P1, P2, P3, P4, P5) -> JObject?
inline fun <P1, P2, P3, P4, P5, P6> JMethodID.asConstructor(): context(JniEnv, NativePlacement) JClass.(P1, P2, P3, P4, P5, P6) -> JObject?
inline fun <P1, P2, P3, P4, P5, P6, P7> JMethodID.asConstructor(): context(JniEnv, NativePlacement) JClass.(P1, P2, P3, P4, P5, P6, P7) -> JObject?
inline fun <P1, P2, P3, P4, P5, P6, P7, P8> JMethodID.asConstructor(): context(JniEnv, NativePlacement) JClass.(P1, P2, P3, P4, P5, P6, P7, P8) -> JObject?
inline fun <P1, P2, P3, P4, P5, P6, P7, P8, P9> JMethodID.asConstructor(): context(JniEnv, NativePlacement) JClass.(P1, P2, P3, P4, P5, P6, P7, P8, P9) -> JObject?
inline fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10> JMethodID.asConstructor(): context(JniEnv, NativePlacement) JClass.(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10) -> JObject?

Returns lambda which calls newObject setting arguments with jArgs and returns the result.

Link copied to clipboard

Simplifies usage of stringField and staticStringField allowing to pass Kotlin strings directly.

Link copied to clipboard
inline fun <R> JMethodID.asMethod(): context(JniEnv, NativePlacement) JObject.() -> R

Unifies usage of call<type>Method methods, returning lambda which internally calls method with appropriate type and returns the result.

inline fun <P1, R> JMethodID.asMethod(): context(JniEnv, NativePlacement) JObject.(P1) -> R
inline fun <P1, P2, R> JMethodID.asMethod(): context(JniEnv, NativePlacement) JObject.(P1, P2) -> R
inline fun <P1, P2, P3, R> JMethodID.asMethod(): context(JniEnv, NativePlacement) JObject.(P1, P2, P3) -> R
inline fun <P1, P2, P3, P4, R> JMethodID.asMethod(): context(JniEnv, NativePlacement) JObject.(P1, P2, P3, P4) -> R
inline fun <P1, P2, P3, P4, P5, R> JMethodID.asMethod(): context(JniEnv, NativePlacement) JObject.(P1, P2, P3, P4, P5) -> R
inline fun <P1, P2, P3, P4, P5, P6, R> JMethodID.asMethod(): context(JniEnv, NativePlacement) JObject.(P1, P2, P3, P4, P5, P6) -> R
inline fun <P1, P2, P3, P4, P5, P6, P7, R> JMethodID.asMethod(): context(JniEnv, NativePlacement) JObject.(P1, P2, P3, P4, P5, P6, P7) -> R
inline fun <P1, P2, P3, P4, P5, P6, P7, P8, R> JMethodID.asMethod(): context(JniEnv, NativePlacement) JObject.(P1, P2, P3, P4, P5, P6, P7, P8) -> R
inline fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, R> JMethodID.asMethod(): context(JniEnv, NativePlacement) JObject.(P1, P2, P3, P4, P5, P6, P7, P8, P9) -> R
inline fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, R> JMethodID.asMethod(): context(JniEnv, NativePlacement) JObject.(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10) -> R

Unifies usage of call<type>Method methods, returning lambda which internally calls method with appropriate type setting arguments with jArgs and returns the result.

Link copied to clipboard

Unifies usage of callNonvirtual<type>Method methods, returning lambda which internally calls method with appropriate type and returns the result.

inline fun <P1, P2, P3, R> JMethodID.asNonvirtualMethod(): context(JniEnv, NativePlacement) JObject.(JClass, P1, P2, P3) -> R
inline fun <P1, P2, P3, P4, R> JMethodID.asNonvirtualMethod(): context(JniEnv, NativePlacement) JObject.(JClass, P1, P2, P3, P4) -> R
inline fun <P1, P2, P3, P4, P5, R> JMethodID.asNonvirtualMethod(): context(JniEnv, NativePlacement) JObject.(JClass, P1, P2, P3, P4, P5) -> R
inline fun <P1, P2, P3, P4, P5, P6, R> JMethodID.asNonvirtualMethod(): context(JniEnv, NativePlacement) JObject.(JClass, P1, P2, P3, P4, P5, P6) -> R
inline fun <P1, P2, P3, P4, P5, P6, P7, R> JMethodID.asNonvirtualMethod(): context(JniEnv, NativePlacement) JObject.(JClass, P1, P2, P3, P4, P5, P6, P7) -> R
inline fun <P1, P2, P3, P4, P5, P6, P7, P8, R> JMethodID.asNonvirtualMethod(): context(JniEnv, NativePlacement) JObject.(JClass, P1, P2, P3, P4, P5, P6, P7, P8) -> R
inline fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, R> JMethodID.asNonvirtualMethod(): context(JniEnv, NativePlacement) JObject.(JClass, P1, P2, P3, P4, P5, P6, P7, P8, P9) -> R
inline fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, R> JMethodID.asNonvirtualMethod(): context(JniEnv, NativePlacement) JObject.(JClass, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10) -> R

Unifies usage of callNonvirtual<type>Method methods, returning lambda which internally calls method with appropriate type setting arguments with jArgs and returns the result.

Link copied to clipboard
inline fun <R> JMethodID.asStaticMethod(): context(JniEnv, NativePlacement) JClass.() -> R

Unifies usage of callStatic<type>Method methods, returning lambda which internally calls method with appropriate type and returns the result.

inline fun <P1, R> JMethodID.asStaticMethod(): context(JniEnv, NativePlacement) JClass.(P1) -> R
inline fun <P1, P2, R> JMethodID.asStaticMethod(): context(JniEnv, NativePlacement) JClass.(P1, P2) -> R
inline fun <P1, P2, P3, R> JMethodID.asStaticMethod(): context(JniEnv, NativePlacement) JClass.(P1, P2, P3) -> R
inline fun <P1, P2, P3, P4, R> JMethodID.asStaticMethod(): context(JniEnv, NativePlacement) JClass.(P1, P2, P3, P4) -> R
inline fun <P1, P2, P3, P4, P5, R> JMethodID.asStaticMethod(): context(JniEnv, NativePlacement) JClass.(P1, P2, P3, P4, P5) -> R
inline fun <P1, P2, P3, P4, P5, P6, R> JMethodID.asStaticMethod(): context(JniEnv, NativePlacement) JClass.(P1, P2, P3, P4, P5, P6) -> R
inline fun <P1, P2, P3, P4, P5, P6, P7, R> JMethodID.asStaticMethod(): context(JniEnv, NativePlacement) JClass.(P1, P2, P3, P4, P5, P6, P7) -> R
inline fun <P1, P2, P3, P4, P5, P6, P7, P8, R> JMethodID.asStaticMethod(): context(JniEnv, NativePlacement) JClass.(P1, P2, P3, P4, P5, P6, P7, P8) -> R
inline fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, R> JMethodID.asStaticMethod(): context(JniEnv, NativePlacement) JClass.(P1, P2, P3, P4, P5, P6, P7, P8, P9) -> R
inline fun <P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, R> JMethodID.asStaticMethod(): context(JniEnv, NativePlacement) JClass.(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10) -> R

Unifies usage of callStatic<type>Method methods, returning lambda which internally calls method with appropriate type setting arguments with jArgs and returns the result.

Link copied to clipboard

Casts to any JObject descendant.

Link copied to clipboard
context(env: JniEnv, autofreeScope: AutofreeScope)
inline fun JObject.booleanField(name: String): ReadWriteProperty<Any?, Boolean>
context(env: JniEnv, autofreeScope: AutofreeScope)
inline fun JObject.booleanField(name: CValuesRef<ByteVar>): ReadWriteProperty<Any?, Boolean>?

Returns a ReadWriteProperty for boolean field of the object with the specified name.

Returns a ReadWriteProperty for boolean field of the object with the specified fieldId.

Link copied to clipboard
context(env: JniEnv, autofreeScope: AutofreeScope)
inline fun JObject.byteField(name: String): ReadWriteProperty<Any?, Byte>
context(env: JniEnv, autofreeScope: AutofreeScope)
inline fun JObject.byteField(name: CValuesRef<ByteVar>): ReadWriteProperty<Any?, Byte>?

Returns a ReadWriteProperty for byte field of the object with the specified name.

context(env: JniEnv)
fun JObject.byteField(fieldId: JFieldID): ReadWriteProperty<Any?, Byte>

Returns a ReadWriteProperty for byte field of the object with the specified fieldId.

Link copied to clipboard
context(env: JniEnv, autofreeScope: AutofreeScope)
inline fun JObject.charField(name: String): ReadWriteProperty<Any?, Char>
context(env: JniEnv, autofreeScope: AutofreeScope)
inline fun JObject.charField(name: CValuesRef<ByteVar>): ReadWriteProperty<Any?, Char>?

Returns a ReadWriteProperty for char field of the object with the specified name.

context(env: JniEnv)
fun JObject.charField(fieldId: JFieldID): ReadWriteProperty<Any?, Char>

Returns a ReadWriteProperty for char field of the object with the specified fieldId.

Link copied to clipboard

Alias for releasing an array with ApplyChangesMode.Commit.

Link copied to clipboard
context(env: JniEnv, autofreeScope: AutofreeScope)
inline fun JObject.doubleField(name: String): ReadWriteProperty<Any?, Double>
context(env: JniEnv, autofreeScope: AutofreeScope)
inline fun JObject.doubleField(name: CValuesRef<ByteVar>): ReadWriteProperty<Any?, Double>?

Returns a ReadWriteProperty for double field of the object with the specified name.

Returns a ReadWriteProperty for double field of the object with the specified fieldId.

Link copied to clipboard
context(env: JniEnv)
inline fun <T> JObject.field(fieldId: JFieldID): ReadWriteProperty<Any?, T>

Unifies usage of *Field() functions.

Link copied to clipboard

Alias for releasing an array with ApplyChangesMode.Commit.

Link copied to clipboard
context(env: JniEnv, autofreeScope: AutofreeScope)
inline fun JObject.floatField(name: String): ReadWriteProperty<Any?, Float>
context(env: JniEnv, autofreeScope: AutofreeScope)
inline fun JObject.floatField(name: CValuesRef<ByteVar>): ReadWriteProperty<Any?, Float>?

Returns a ReadWriteProperty for float field of the object with the specified name.

Returns a ReadWriteProperty for float field of the object with the specified fieldId.

Link copied to clipboard
context(env: JniEnv, autofreeScope: AutofreeScope)
inline fun JObject.intField(name: String): ReadWriteProperty<Any?, Int>
context(env: JniEnv, autofreeScope: AutofreeScope)
inline fun JObject.intField(name: CValuesRef<ByteVar>): ReadWriteProperty<Any?, Int>?

Returns a ReadWriteProperty for int field of the object with the specified name.

context(env: JniEnv)
fun JObject.intField(fieldId: JFieldID): ReadWriteProperty<Any?, Int>

Returns a ReadWriteProperty for int field of the object with the specified fieldId.

Link copied to clipboard
context(env: JniEnv, autofreeScope: AutofreeScope)
inline fun JObject.longField(name: String): ReadWriteProperty<Any?, Long>
context(env: JniEnv, autofreeScope: AutofreeScope)
inline fun JObject.longField(name: CValuesRef<ByteVar>): ReadWriteProperty<Any?, Long>?

Returns a ReadWriteProperty for long field of the object with the specified name.

context(env: JniEnv)
fun JObject.longField(fieldId: JFieldID): ReadWriteProperty<Any?, Long>

Returns a ReadWriteProperty for long field of the object with the specified fieldId.

Link copied to clipboard
context(env: JniEnv, placement: NativePlacement)
inline fun JBooleanArray.modify(onError: () -> Unit, block: ModifyingArrayScope.(CArrayPointer<UByteVar>, isCopy: Boolean) -> Unit)

Alias for working with boolean array's elements via getElements and releasing it with releaseElements.

context(env: JniEnv, placement: NativePlacement)
inline fun JByteArray.modify(onError: () -> Unit, block: ModifyingArrayScope.(CArrayPointer<ByteVar>, isCopy: Boolean) -> Unit)

Alias for working with byte array's elements via JByteArray.getElements and releasing it with JByteArray.releaseElements.

context(env: JniEnv, placement: NativePlacement)
inline fun JCharArray.modify(onError: () -> Unit, block: ModifyingArrayScope.(CArrayPointer<UShortVar>, isCopy: Boolean) -> Unit)

Alias for working with char array's elements via JCharArray.getElements and releasing it with JCharArray.releaseElements.

context(env: JniEnv, placement: NativePlacement)
inline fun JDoubleArray.modify(onError: () -> Unit, block: ModifyingArrayScope.(CArrayPointer<DoubleVar>, isCopy: Boolean) -> Unit)

Alias for working with double array's elements via JDoubleArray.getElements and releasing it with JDoubleArray.releaseElements.

context(env: JniEnv, placement: NativePlacement)
inline fun JFloatArray.modify(onError: () -> Unit, block: ModifyingArrayScope.(CArrayPointer<FloatVar>, isCopy: Boolean) -> Unit)

Alias for working with float array's elements via JFloatArray.getElements and releasing it with JFloatArray.releaseElements.

context(env: JniEnv, placement: NativePlacement)
inline fun JIntArray.modify(onError: () -> Unit, block: ModifyingArrayScope.(CArrayPointer<IntVar>, isCopy: Boolean) -> Unit)

Alias for working with int array's elements via JIntArray.getElements and releasing it with JIntArray.releaseElements.

context(env: JniEnv, placement: NativePlacement)
inline fun JLongArray.modify(onError: () -> Unit, block: ModifyingArrayScope.(CArrayPointer<LongVar>, isCopy: Boolean) -> Unit)

Alias for working with long array's elements via JLongArray.getElements and releasing it with JLongArray.releaseElements.

context(env: JniEnv, placement: NativePlacement)
inline fun JShortArray.modify(onError: () -> Unit, block: ModifyingArrayScope.(CArrayPointer<ShortVar>, isCopy: Boolean) -> Unit)

Alias for working with short array's elements via JShortArray.getElements and releasing it with JShortArray.releaseElements.

Link copied to clipboard
context(env: JniEnv, placement: NativePlacement)
inline fun JString.modifyChars(onError: () -> Unit, block: (CArrayPointer<UShortVar>, isCopy: Boolean) -> Unit)

Alias for safely retrieving a string's chars via getChars and releasing it with releaseChars.

Link copied to clipboard
context(env: JniEnv, placement: NativePlacement)
inline fun <T : CPrimitiveVar> JPrimitiveArray<T>.modifyCritical(onError: () -> Unit, block: ModifyingArrayScope.(CArrayPointer<*>, isCopy: Boolean) -> Unit)

Alias for working with primitive array's elements via JPrimitiveArray.getElementsCritical. and releasing it with JPrimitiveArray.releaseElementsCritical.

context(env: JniEnv, placement: NativePlacement)
inline fun JString.modifyCritical(onError: () -> Unit, block: (CArrayPointer<UShortVar>, isCopy: Boolean) -> Unit)

Alias for safely retrieving a string's chars via getCharsCritical and releaseCharsCritical.

Link copied to clipboard
context(env: JniEnv, placement: NativePlacement)
inline fun JString.modifyUTFChars(onError: () -> Unit, block: (CArrayPointer<ByteVar>, isCopy: Boolean) -> Unit)

Alias for safely retrieving a string's bytes via getUTFChars and releasing it with releaseUTFChars.

Link copied to clipboard

Returns a ReadWriteProperty for Object field of the object with the specified fieldId.

context(env: JniEnv, autofreeScope: AutofreeScope)
inline fun JObject.objectField(name: String, sig: String): ReadWriteProperty<Any?, JObject?>
context(env: JniEnv, autofreeScope: AutofreeScope)
inline fun JObject.objectField(name: CValuesRef<ByteVar>, sig: CValuesRef<ByteVar>): ReadWriteProperty<Any?, JObject?>?

Returns a ReadWriteProperty for Object field of the object with the specified name and sig.

Link copied to clipboard
context(env: JniEnv, autofreeScope: AutofreeScope)
inline fun JObject.shortField(name: String): ReadWriteProperty<Any?, Short>
context(env: JniEnv, autofreeScope: AutofreeScope)
inline fun JObject.shortField(name: CValuesRef<ByteVar>): ReadWriteProperty<Any?, Short>?

Returns a ReadWriteProperty for short field of the object with the specified name.

Returns a ReadWriteProperty for short field of the object with the specified fieldId.

Link copied to clipboard
context(env: JniEnv, autofreeScope: AutofreeScope)
inline fun JClass.staticBooleanField(name: String): ReadWriteProperty<Any?, Boolean>
context(env: JniEnv, autofreeScope: AutofreeScope)
inline fun JClass.staticBooleanField(name: CValuesRef<ByteVar>): ReadWriteProperty<Any?, Boolean>?

Returns a ReadWriteProperty for static boolean field of the class with the specified name.

Returns a ReadWriteProperty for static boolean field of the class with the specified fieldId.

Link copied to clipboard
context(env: JniEnv, autofreeScope: AutofreeScope)
inline fun JClass.staticByteField(name: String): ReadWriteProperty<Any?, Byte>
context(env: JniEnv, autofreeScope: AutofreeScope)
inline fun JClass.staticByteField(name: CValuesRef<ByteVar>): ReadWriteProperty<Any?, Byte>?

Returns a ReadWriteProperty for static byte field of the class with the specified name.

Returns a ReadWriteProperty for static byte field of the class with the specified fieldId.

Link copied to clipboard
context(env: JniEnv, autofreeScope: AutofreeScope)
inline fun JClass.staticCharField(name: String): ReadWriteProperty<Any?, Char>
context(env: JniEnv, autofreeScope: AutofreeScope)
inline fun JClass.staticCharField(name: CValuesRef<ByteVar>): ReadWriteProperty<Any?, Char>?

Returns a ReadWriteProperty for static char field of the class with the specified name.

Returns a ReadWriteProperty for static char field of the class with the specified fieldId.

Link copied to clipboard
context(env: JniEnv, autofreeScope: AutofreeScope)
inline fun JClass.staticDoubleField(name: String): ReadWriteProperty<Any?, Double>
context(env: JniEnv, autofreeScope: AutofreeScope)
inline fun JClass.staticDoubleField(name: CValuesRef<ByteVar>): ReadWriteProperty<Any?, Double>?

Returns a ReadWriteProperty for static double field of the class with the specified name.

Returns a ReadWriteProperty for static double field of the class with the specified fieldId.

Link copied to clipboard
context(env: JniEnv)
inline fun <T> JClass.staticField(fieldId: JFieldID): ReadWriteProperty<Any?, T>

Unifies usage of static*Field() functions.

Link copied to clipboard
context(env: JniEnv, autofreeScope: AutofreeScope)
inline fun JClass.staticFloatField(name: String): ReadWriteProperty<Any?, Float>
context(env: JniEnv, autofreeScope: AutofreeScope)
inline fun JClass.staticFloatField(name: CValuesRef<ByteVar>): ReadWriteProperty<Any?, Float>?

Returns a ReadWriteProperty for static float field of the class with the specified name.

Returns a ReadWriteProperty for static float field of the class with the specified fieldId.

Link copied to clipboard
context(env: JniEnv, autofreeScope: AutofreeScope)
inline fun JClass.staticIntField(name: String): ReadWriteProperty<Any?, Int>
context(env: JniEnv, autofreeScope: AutofreeScope)
inline fun JClass.staticIntField(name: CValuesRef<ByteVar>): ReadWriteProperty<Any?, Int>?

Returns a ReadWriteProperty for static int field of the class with the specified name.

Returns a ReadWriteProperty for static int field of the class with the specified fieldId.

Link copied to clipboard
context(env: JniEnv, autofreeScope: AutofreeScope)
inline fun JClass.staticLongField(name: String): ReadWriteProperty<Any?, Long>
context(env: JniEnv, autofreeScope: AutofreeScope)
inline fun JClass.staticLongField(name: CValuesRef<ByteVar>): ReadWriteProperty<Any?, Long>?

Returns a ReadWriteProperty for static long field of the class with the specified name.

Returns a ReadWriteProperty for static long field of the class with the specified fieldId.

Link copied to clipboard

Returns a ReadWriteProperty for static Object field of the class with the specified fieldId.

context(env: JniEnv, autofreeScope: AutofreeScope)
inline fun JClass.staticObjectField(name: String, sig: String): ReadWriteProperty<Any?, JObject?>
context(env: JniEnv, autofreeScope: AutofreeScope)
inline fun JClass.staticObjectField(name: CValuesRef<ByteVar>, sig: CValuesRef<ByteVar>): ReadWriteProperty<Any?, JObject?>?

Returns a ReadWriteProperty for static Object field of the class with the specified name and sig.

Link copied to clipboard
context(env: JniEnv, autofreeScope: AutofreeScope)
inline fun JClass.staticShortField(name: String): ReadWriteProperty<Any?, Short>
context(env: JniEnv, autofreeScope: AutofreeScope)
inline fun JClass.staticShortField(name: CValuesRef<ByteVar>): ReadWriteProperty<Any?, Short>?

Returns a ReadWriteProperty for static short field of the class with the specified name.

Returns a ReadWriteProperty for static short field of the class with the specified fieldId.

Link copied to clipboard
context(env: JniEnv, autofreeScope: AutofreeScope)
inline fun JClass.staticStringField(name: String): ReadWriteProperty<Any?, JString?>
context(env: JniEnv, autofreeScope: AutofreeScope)
inline fun JClass.staticStringField(name: CValuesRef<ByteVar>): ReadWriteProperty<Any?, JString?>?

Alias for staticObjectField with sig = "Ljava/lang/String;".

Link copied to clipboard
context(env: JniEnv, autofreeScope: AutofreeScope)
inline fun JObject.stringField(name: String): ReadWriteProperty<Any?, JString?>
context(env: JniEnv, autofreeScope: AutofreeScope)
inline fun JObject.stringField(name: CValuesRef<ByteVar>): ReadWriteProperty<Any?, JString?>?

Alias for objectField with sig = "Ljava/lang/String;".