Follow up to #460 which did this in JNI mode, but now the FFM mode does not do this so we have inconcistency between the modes.
We should probably move the check into Java BEFORE doing the downcall, rather than throwing from the swift thunk -- then the code can be shared betweeh the two modes.