Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如果 JNI dll 抛出 Java 异常,而 java 方法定义没有声明该异常(没有throws子句),会发生什么?
代码:
private native void jniDoSomething(int someValue);
无论如何都会抛出异常。刚刚检查过这个。
我认为这种行为是因为该throws关键字无论如何都不会影响本机代码。无法检查本机代码是否引发适当的异常,甚至在头文件中也没有提及异常。
throws