wpeview: Build the native glue without C++ exceptions - #289
Merged
Conversation
alexgcastro
requested review from
aperezdc,
juanjosanchez,
neodesys,
spenap and
svillar
August 4, 2026 19:58
neodesys
approved these changes
Aug 5, 2026
aperezdc
approved these changes
Aug 5, 2026
aperezdc
approved these changes
Aug 5, 2026
Stop using C++ exceptions for JNI error handling and compile with -fno-exceptions. Unrecoverable usage errors (missing class, method or field, native method registration failures, JNIEnv setup) now log and abort through JNI::fatalError, matching the previous outcome where the exception aborted library loading. Runtime failures use the new JNI::clearJavaException helper: it logs the pending Java exception description (Throwable.toString()) and clears it, void method invocations return a success boolean, and value returning helpers fall back to a default value. This removes all the try/catch blocks at the JNI boundaries, which report their specific context through the invocation result instead; JNI::Class lookup by name keeps returning a null class so Init.cpp can probe for optional classes. Cleanup code that used to swallow exceptions (reference and string deleters running after the Java VM is gone) now uses the non-aborting JNI::tryGetCurrentThreadJNIEnv and skips the release. The JNI layer now includes Logging.h through the include path so the jni-test host harness provides its own stderr-based version, and its tests are adapted to the new invocation results.
alexgcastro
force-pushed
the
alex/no-exceptions-native-glue
branch
from
August 5, 2026 11:40
3f5e2f3 to
6aca101
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stop using C++ exceptions for JNI error handling and compile with -fno-exceptions. Unrecoverable usage errors (missing class, method or field, native method registration failures, JNIEnv setup) now log and abort through JNI::fatalError, matching the previous outcome where the exception aborted library loading. Runtime failures use the new JNI::clearJavaException helper: it logs and clears any pending Java exception, void method invocations return a success boolean, and value returning helpers fall back to a default value. This removes all the try/catch blocks at the JNI boundaries; JNI::Class lookup by name keeps returning a null class so Init.cpp can probe for optional classes.