newObject

context(env: JniEnv)
fun JClass.newObject(methodId: JMethodID, args: JArguments): JObject?(source)

Constructs a new Java object. The methodId indicates which constructor method to invoke. This ID must be obtained by calling methodId with "<init>" as the method name and void (V) as the return type.

The receiver must not refer to an array class.

Return

a Java object, or null if the object cannot be constructed.

Throws

InstantiationException

if the class is an interface or an abstract class.

if the system runs out of memory.

other

Any exceptions thrown by the constructor.