diff options
author | Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> | 2024-02-22 20:22:52 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2024-02-22 20:22:52 +0000 |
commit | 444ff8b1702da95ce180bb1ddc5a8e2abe1493c4 (patch) | |
tree | c080282ee08320b6dff662d4f7715748d30f2137 | |
parent | 88d74420e6ef7242bdf0741471f09d72a9b9b980 (diff) | |
parent | a6f23348ba1e372dcf4c705f1fc8e1cc15d8372a (diff) | |
download | docs-444ff8b1702da95ce180bb1ddc5a8e2abe1493c4.tar.gz |
Merge "Add rules about documenting JNI exceptions." into main
-rw-r--r-- | api-guidelines/ndk.md | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/api-guidelines/ndk.md b/api-guidelines/ndk.md index 66fb6e0..873e36a 100644 --- a/api-guidelines/ndk.md +++ b/api-guidelines/ndk.md @@ -313,6 +313,11 @@ the NDK documentation. **API authors do not need to manually update DAC.** number instead of the codename since that's what users need to know for their build.gradle files. Non-NDK APIs should consider doing this as well. +8. Potential pending exceptions should be limited to runtime issues such as + `OutOfMemory``or`ClassCastException`` unless clearly documented what the + other potential exceptions are and why they may occur (see also: + go/android-api-guidelines#throws ) + ## ABI stability guidelines <a name="abi-stability"></a> ### Prefer opaque structs <a name="opaque-structs"></a> @@ -563,6 +568,12 @@ and This helps apps to keep a clean JNI layer in their own code. +### JNI interop APIs should not clear pending exceptions + +Any exceptions thrown should be left pending for the caller to handle. Most +potential pending exceptions types must be documented. See +go/android-ndk-api-guidelines#well-documented. + ## Inlines <a name="inlines"></a> ### Inline functions may be used for simple wrappers <a name="inline-wrappers"></a> |