Rust bindings to the JNI
Clone or download
dmitry-timofeev Fix safe methods checking exceptions (#124)
Do not check for exceptions in exception-safe JNI methods that
unnecessarily check for exceptions:
PushLocalFrame, DeleteGlobalRef and ReleaseStringUTFChars.

Add a regression test for PushLocalFrame verifying 
that push_local_frame returns Err if it cannot allocate a frame.

Safe methods are defined in the spec: 
https://docs.oracle.com/javase/10/docs/specs/jni/design.html#exception-handling

As of Java 10, the list is the following:
> When there is a pending exception, the JNI functions
that are safe to call are:

ExceptionOccurred()
ExceptionDescribe()
ExceptionClear()
ExceptionCheck()
ReleaseStringChars()
ReleaseStringUTFChars() *
ReleaseStringCritical()
Release<Type>ArrayElements()
ReleasePrimitiveArrayCritical()
DeleteLocalRef()
DeleteGlobalRef() *
DeleteWeakGlobalRef()
MonitorExit()
PushLocalFrame() *
PopLocalFrame()
DetachCurrentThread()

 '*' marks affected methods in Rust JNI
Latest commit 4f792fc Sep 21, 2018

README.md