ART: Remove special RegisterNatives code
Remove the special-cased code in jni_internal that is now unused.
Test: m test-art-host
Change-Id: Ifbc97182339c44bd909c0932283354a9438b3c84
diff --git a/runtime/jni_internal.cc b/runtime/jni_internal.cc
index 6f36cab..2d0ea0c 100644
--- a/runtime/jni_internal.cc
+++ b/runtime/jni_internal.cc
@@ -106,10 +106,9 @@
static void ReportInvalidJNINativeMethod(const ScopedObjectAccess& soa,
ObjPtr<mirror::Class> c,
const char* kind,
- jint idx,
- bool return_errors)
+ jint idx)
REQUIRES_SHARED(Locks::mutator_lock_) {
- LOG(return_errors ? ::android::base::ERROR : ::android::base::FATAL)
+ LOG(ERROR)
<< "Failed to register native method in " << c->PrettyDescriptor()
<< " in " << c->GetDexCache()->GetLocation()->ToModifiedUtf8()
<< ": " << kind << " is null at index " << idx;
@@ -2145,13 +2144,10 @@
buf);
}
- static jint RegisterNatives(JNIEnv* env, jclass java_class, const JNINativeMethod* methods,
+ static jint RegisterNatives(JNIEnv* env,
+ jclass java_class,
+ const JNINativeMethod* methods,
jint method_count) {
- return RegisterNativeMethods(env, java_class, methods, method_count, true);
- }
-
- static jint RegisterNativeMethods(JNIEnv* env, jclass java_class, const JNINativeMethod* methods,
- jint method_count, bool return_errors) {
if (UNLIKELY(method_count < 0)) {
JavaVmExtFromEnv(env)->JniAbortF("RegisterNatives", "negative method count: %d",
method_count);
@@ -2172,13 +2168,13 @@
const char* sig = methods[i].signature;
const void* fnPtr = methods[i].fnPtr;
if (UNLIKELY(name == nullptr)) {
- ReportInvalidJNINativeMethod(soa, c.Get(), "method name", i, return_errors);
+ ReportInvalidJNINativeMethod(soa, c.Get(), "method name", i);
return JNI_ERR;
} else if (UNLIKELY(sig == nullptr)) {
- ReportInvalidJNINativeMethod(soa, c.Get(), "method signature", i, return_errors);
+ ReportInvalidJNINativeMethod(soa, c.Get(), "method signature", i);
return JNI_ERR;
} else if (UNLIKELY(fnPtr == nullptr)) {
- ReportInvalidJNINativeMethod(soa, c.Get(), "native function", i, return_errors);
+ ReportInvalidJNINativeMethod(soa, c.Get(), "native function", i);
return JNI_ERR;
}
bool is_fast = false;
@@ -2244,19 +2240,15 @@
}
if (m == nullptr) {
- c->DumpClass(
- LOG_STREAM(return_errors
- ? ::android::base::ERROR
- : ::android::base::FATAL_WITHOUT_ABORT),
- mirror::Class::kDumpClassFullDetail);
- LOG(return_errors ? ::android::base::ERROR : ::android::base::FATAL)
+ c->DumpClass(LOG_STREAM(ERROR), mirror::Class::kDumpClassFullDetail);
+ LOG(ERROR)
<< "Failed to register native method "
<< c->PrettyDescriptor() << "." << name << sig << " in "
<< c->GetDexCache()->GetLocation()->ToModifiedUtf8();
ThrowNoSuchMethodError(soa, c.Get(), name, sig, "static or non-static");
return JNI_ERR;
} else if (!m->IsNative()) {
- LOG(return_errors ? ::android::base::ERROR : ::android::base::FATAL)
+ LOG(ERROR)
<< "Failed to register non-native method "
<< c->PrettyDescriptor() << "." << name << sig
<< " as native";