runtime/jni: inclusive language fixes
Based on:
https://source.android.com/setup/contribute/respectful-code
Bug: 161896447
Bug: 161850439
Bug: 161336379
Test: m (comment updates only).
Change-Id: I68af1c77703424bc3b8fdfe963350171dd713aa7
diff --git a/runtime/jni/check_jni.cc b/runtime/jni/check_jni.cc
index 3206011..1626357 100644
--- a/runtime/jni/check_jni.cc
+++ b/runtime/jni/check_jni.cc
@@ -2729,8 +2729,8 @@
JniValueType args[2] = {{.E = env}, {.L = buf}};
if (sc.Check(soa, true, "EL", args)) {
JniValueType result;
- // Note: this is implemented in the base environment by a GetLongField which will sanity
- // check the type of buf in GetLongField above.
+ // Note: this is implemented in the base environment by a GetLongField which will check the
+ // type of buf in GetLongField above.
result.p = baseEnv(env)->GetDirectBufferAddress(env, buf);
if (sc.Check(soa, false, "p", &result)) {
return const_cast<void*>(result.p);
@@ -2746,8 +2746,8 @@
JniValueType args[2] = {{.E = env}, {.L = buf}};
if (sc.Check(soa, true, "EL", args)) {
JniValueType result;
- // Note: this is implemented in the base environment by a GetIntField which will sanity
- // check the type of buf in GetIntField above.
+ // Note: this is implemented in the base environment by a GetIntField which will check the
+ // type of buf in GetIntField above.
result.J = baseEnv(env)->GetDirectBufferCapacity(env, buf);
if (sc.Check(soa, false, "J", &result)) {
return result.J;
diff --git a/runtime/jni/java_vm_ext.cc b/runtime/jni/java_vm_ext.cc
index e5b3d4d..e085cd9 100644
--- a/runtime/jni/java_vm_ext.cc
+++ b/runtime/jni/java_vm_ext.cc
@@ -59,9 +59,11 @@
using android::base::StringAppendF;
using android::base::StringAppendV;
-static constexpr size_t kGlobalsMax = 51200; // Arbitrary sanity check. (Must fit in 16 bits.)
+// Maximum number of global references (must fit in 16 bits).
+static constexpr size_t kGlobalsMax = 51200;
-static constexpr size_t kWeakGlobalsMax = 51200; // Arbitrary sanity check. (Must fit in 16 bits.)
+// Maximum number of weak global references (must fit in 16 bits).
+static constexpr size_t kWeakGlobalsMax = 51200;
bool JavaVMExt::IsBadJniVersion(int version) {
// We don't support JNI_VERSION_1_1. These are the only other valid versions.
diff --git a/runtime/jni/java_vm_ext_test.cc b/runtime/jni/java_vm_ext_test.cc
index 4a7b1ca..0363cdb 100644
--- a/runtime/jni/java_vm_ext_test.cc
+++ b/runtime/jni/java_vm_ext_test.cc
@@ -151,7 +151,7 @@
ASSERT_EQ(JNI_OK, ok);
std::vector<jobject> global_refs_;
- jobject local_ref = env->NewStringUTF("Dummy");
+ jobject local_ref = env->NewStringUTF("Hello");
for (size_t i = 0; i < 2000; ++i) {
global_refs_.push_back(env->NewGlobalRef(local_ref));
}
diff --git a/runtime/jni/jni_env_ext.cc b/runtime/jni/jni_env_ext.cc
index cf6a22c..6e46c24 100644
--- a/runtime/jni/jni_env_ext.cc
+++ b/runtime/jni/jni_env_ext.cc
@@ -40,7 +40,7 @@
using android::base::StringPrintf;
static constexpr size_t kMonitorsInitial = 32; // Arbitrary.
-static constexpr size_t kMonitorsMax = 4096; // Arbitrary sanity check.
+static constexpr size_t kMonitorsMax = 4096; // Maximum number of monitors held by JNI code.
const JNINativeInterface* JNIEnvExt::table_override_ = nullptr;
diff --git a/runtime/jni/jni_env_ext.h b/runtime/jni/jni_env_ext.h
index 2c7ba3b..5d4304d 100644
--- a/runtime/jni/jni_env_ext.h
+++ b/runtime/jni/jni_env_ext.h
@@ -37,7 +37,7 @@
} // namespace mirror
// Number of local references in the indirect reference table. The value is arbitrary but
-// low enough that it forces sanity checks.
+// low enough that it forces integrity checks.
static constexpr size_t kLocalsInitial = 512;
class JNIEnvExt : public JNIEnv {