Pergunta

What happens if a JNI dll throws a Java exception, and the java method definition doesn't declare that exception (no throws clause)?

Code:

private native void jniDoSomething(int someValue);
Foi útil?

Solução

Exception will be thrown anyway. Just have checked this.

I think such behaviour is because that throws keyword doesn't affect the native code anyway. There is no ability to check if the native code throws the appropriate exception and even in header file there are no mentioning about exceptions.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top