Improve diagnostics when non-String passed as a jstring.
For my particular bug, the cause was obvious by inspection of the calling
code, but this might be useful in harder cases.
Before:
W(17868) JNI WARNING: jstring 0x3600001 points to non-string object (Check_GetStringUTFChars) (dalvikvm)
Change-Id: I883a99936b8c2cd79c5a691f7c335245ff50b34f
After:
W(19680) JNI WARNING: jstring 0x3600001 points to object of type Llibcore/io/Posix; (Check_GetStringUTFChars) (dalvikvm)
diff --git a/vm/CheckJni.c b/vm/CheckJni.c
index 76ad85b..5478eb1 100644
--- a/vm/CheckJni.c
+++ b/vm/CheckJni.c
@@ -583,8 +583,8 @@
* we're doing it again over in checkObject().
*/
if (dvmIsValidObject(obj))
- LOGW("JNI WARNING: jstring %p points to non-string object (%s)",
- jstr, func);
+ LOGW("JNI WARNING: jstring %p points to object of type %s (%s)",
+ jstr, obj->clazz->descriptor, func);
else
LOGW("JNI WARNING: jstring %p is not a valid object (%s)", jstr,
func);