fix(java): the JVM crash when using jdk 8 (#1372)

The Optional::isEmpty does not exist in java 8, so we should use
isPresent instead
This commit is contained in:
Beinan
2024-06-08 22:43:41 -07:00
committed by GitHub
parent 72f339a0b3
commit 3c62806b6a

View File

@@ -175,8 +175,8 @@ impl JNIEnvExt for JNIEnv<'_> {
if obj.is_null() {
return Ok(None);
}
let is_empty = self.call_method(obj, "isEmpty", "()Z", &[])?;
if is_empty.z()? {
let is_present = self.call_method(obj, "isPresent", "()Z", &[])?;
if !is_present.z()? {
// TODO(lu): put get java object into here cuz can only get java Object
Ok(None)
} else {