Skip to content

Commit

Permalink
Removes the Options around the function pointers
Browse files Browse the repository at this point in the history
None of the JNI 1.1 function pointers were optional, and neither
are any of the function pointers in later versions of the spec.

Having the `Option` implies that null pointer checks are required
but, more notably, they also suggest that null pointer checks could
be used for JNI >= 1.2 pointers, which could be a dangerous mistake
since these are effectively extending beyond the table of pointers
that was defined for JNI 1.1 and should be assumed to be invalid
pointers that mustn't be touched.

It's also notable that we have to call `GetVersion` to determine
the full set of pointers that are valid.

The original 1.1 spec did leave some gaps in the original table
that where filled with NULLs these were only to be used in future
versions (so there is never any optional pointer).

Recently the use of `Option` also raised some questions about our
ability to, infallibly, handle Rust panics when we want to map
a panic to a Java exception via JNI:

jni-rs/jni-rs#432 (comment)
  • Loading branch information
rib committed Jun 21, 2023
1 parent 4fba703 commit ebbf121
Showing 1 changed file with 1,074 additions and 1,230 deletions.
Loading

0 comments on commit ebbf121

Please sign in to comment.