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_reflect_Executable.cc b/runtime/native/java_lang_reflect_Executable.cc
index e37c14b..a5e70af 100644
--- a/runtime/native/java_lang_reflect_Executable.cc
+++ b/runtime/native/java_lang_reflect_Executable.cc
@@ -249,14 +249,14 @@
return 0;
}
-static jobject Executable_getMethodNameInternal(JNIEnv* env, jobject javaMethod) {
+static jstring Executable_getMethodNameInternal(JNIEnv* env, jobject javaMethod) {
ScopedFastNativeObjectAccess soa(env);
ArtMethod* method = ArtMethod::FromReflectedMethod(soa, javaMethod);
method = method->GetInterfaceMethodIfProxy(kRuntimePointerSize);
- return soa.AddLocalReference<jobject>(method->GetNameAsString(soa.Self()));
+ return soa.AddLocalReference<jstring>(method->GetNameAsString(soa.Self()));
}
-static jobject Executable_getMethodReturnTypeInternal(JNIEnv* env, jobject javaMethod) {
+static jclass Executable_getMethodReturnTypeInternal(JNIEnv* env, jobject javaMethod) {
ScopedFastNativeObjectAccess soa(env);
ArtMethod* method = ArtMethod::FromReflectedMethod(soa, javaMethod);
method = method->GetInterfaceMethodIfProxy(kRuntimePointerSize);
@@ -266,7 +266,7 @@
return nullptr;
}
- return soa.AddLocalReference<jobject>(return_type);
+ return soa.AddLocalReference<jclass>(return_type);
}
// TODO: Move this to mirror::Class ? Other mirror types that commonly appear