native: Cleanup jni usage code
Make the C++ signature consistent with the JNI descriptor by using the
same type as the descriptor whenever possible.
e.g. "()Ljava/lang/String;" should actually be "jstring fn(JNIEnv*,jobject)"
instead of "jobject fn(JNIEnv*,jobject)".
Bug: 35325126
Change-Id: I72318525fc3b18b013b8d6fa604d8dd6b5dd4400
Test: make -j32 test-art-host # and also manually that it boots
diff --git a/runtime/native/java_lang_String.cc b/runtime/native/java_lang_String.cc
index 9295ff7..b5aea7c 100644
--- a/runtime/native/java_lang_String.cc
+++ b/runtime/native/java_lang_String.cc
@@ -37,7 +37,7 @@
return soa.Decode<mirror::String>(java_this)->CharAt(index);
}
-static jint String_compareTo(JNIEnv* env, jobject java_this, jobject java_rhs) {
+static jint String_compareTo(JNIEnv* env, jobject java_this, jstring java_rhs) {
ScopedFastNativeObjectAccess soa(env);
if (UNLIKELY(java_rhs == nullptr)) {
ThrowNullPointerException("rhs == null");
@@ -48,7 +48,7 @@
}
}
-static jstring String_concat(JNIEnv* env, jobject java_this, jobject java_string_arg) {
+static jstring String_concat(JNIEnv* env, jobject java_this, jstring java_string_arg) {
ScopedFastNativeObjectAccess soa(env);
if (UNLIKELY(java_string_arg == nullptr)) {
ThrowNullPointerException("string arg == null");