renatosc / jnlua

Automatically exported from code.google.com/p/jnlua
0 stars 0 forks source link

Calls to JNI methods with pending exceptions in calljavafunction #15

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Run unit tests with -Xcheck:jni.

What is the expected output? What do you see instead?
Expected: no warnings.
Observed: A bunch of "WARNING in native method: JNI call made with exception 
pending" log entries.

What version of the product are you using? On what operating system?
JNLua 1.0.4, Java 1.7.0_55, Windows 8.1.

Please provide any additional information below.
See [1] for a list of methods that may be called with pending exceptions. In 
particular, SetLongField (indirectly) called from [2] and NewObject called from 
[3] are not in that list. However, they are called in case of exceptions before 
the exception is cleared with ExceptionClear [4]. Some reordering of these 
calls (ExceptionClear as the first statement in the if branch, setluathread 
after it and in the (new) else branch) avoids these warnings.

Note: since they are only warnings I am not quite sure if/how they influence 
program logic.

[1] http://developer.android.com/training/articles/perf-jni.html#exceptions
[2] 
https://code.google.com/p/jnlua/source/browse/trunk/jnlua/src/main/c/jnlua.c#217
8
[3] 
https://code.google.com/p/jnlua/source/browse/trunk/jnlua/src/main/c/jnlua.c#218
7
[4] 
https://code.google.com/p/jnlua/source/browse/trunk/jnlua/src/main/c/jnlua.c#219
3

Original issue reported on code.google.com by fnuecke on 20 Aug 2014 at 12:18