Improve documentation about StringFactory.newStringFromChars.
Make it clear that the native method requires its third
argument to be non-null, and therefore that the intrinsics
do not need a null check for it.
Bug: 27378573
Change-Id: Id2f78ceb0f7674f1066bc3f216b738358ca25542
diff --git a/runtime/native/java_lang_StringFactory.cc b/runtime/native/java_lang_StringFactory.cc
index 34d6a37..5a219ef 100644
--- a/runtime/native/java_lang_StringFactory.cc
+++ b/runtime/native/java_lang_StringFactory.cc
@@ -50,8 +50,10 @@
return soa.AddLocalReference<jstring>(result);
}
+// The char array passed as `java_data` must not be a null reference.
static jstring StringFactory_newStringFromChars(JNIEnv* env, jclass, jint offset,
jint char_count, jcharArray java_data) {
+ DCHECK(java_data != nullptr);
ScopedFastNativeObjectAccess soa(env);
StackHandleScope<1> hs(soa.Self());
Handle<mirror::CharArray> char_array(hs.NewHandle(soa.Decode<mirror::CharArray*>(java_data)));