Lines Matching refs:env_

39     vm_->AttachCurrentThread(&env_, nullptr);  in SetUp()
41 ScopedLocalRef<jclass> aioobe(env_, in SetUp()
42 env_->FindClass("java/lang/ArrayIndexOutOfBoundsException")); in SetUp()
44 aioobe_ = reinterpret_cast<jclass>(env_->NewGlobalRef(aioobe.get())); in SetUp()
46 ScopedLocalRef<jclass> ase(env_, env_->FindClass("java/lang/ArrayStoreException")); in SetUp()
48 ase_ = reinterpret_cast<jclass>(env_->NewGlobalRef(ase.get())); in SetUp()
50 ScopedLocalRef<jclass> sioobe(env_, in SetUp()
51 env_->FindClass("java/lang/StringIndexOutOfBoundsException")); in SetUp()
53 sioobe_ = reinterpret_cast<jclass>(env_->NewGlobalRef(sioobe.get())); in SetUp()
57 ScopedObjectAccess soa(env_); in ExpectException()
58 EXPECT_TRUE(env_->ExceptionCheck()) in ExpectException()
60 jthrowable exception = env_->ExceptionOccurred(); in ExpectException()
62 env_->ExceptionClear(); in ExpectException()
63 EXPECT_TRUE(env_->IsInstanceOf(exception, exception_class)); in ExpectException()
68 env_->DeleteGlobalRef(aioobe_); in CleanUpJniEnv()
72 env_->DeleteGlobalRef(ase_); in CleanUpJniEnv()
76 env_->DeleteGlobalRef(sioobe_); in CleanUpJniEnv()
87 ScopedObjectAccess soa(env_); in GetPrimitiveClass()
94 EXPECT_NE(env_->FindClass(name), nullptr) << name; in ExpectClassFound()
95 EXPECT_FALSE(env_->ExceptionCheck()) << name; in ExpectClassFound()
100 EXPECT_EQ(env_->FindClass(name), nullptr) << name; in ExpectClassNotFound()
102 EXPECT_TRUE(env_->ExceptionCheck()) << name; in ExpectClassNotFound()
103 env_->ExceptionClear(); in ExpectClassNotFound()
114 env_->FindClass(nullptr); in FindClassTest()
132 EXPECT_EQ(env_->FindClass("java.lang.String"), nullptr); in FindClassTest()
133 EXPECT_FALSE(env_->ExceptionCheck()); in FindClassTest()
136 EXPECT_EQ(env_->FindClass("[Ljava.lang.String;"), nullptr); in FindClassTest()
137 EXPECT_FALSE(env_->ExceptionCheck()); in FindClassTest()
170 jclass c = env_->FindClass("java/lang/String"); in GetFieldIdBadArgumentTest()
173 jfieldID fid = env_->GetFieldID(nullptr, "count", "I"); in GetFieldIdBadArgumentTest()
177 fid = env_->GetFieldID(c, nullptr, "I"); in GetFieldIdBadArgumentTest()
181 fid = env_->GetFieldID(c, "count", nullptr); in GetFieldIdBadArgumentTest()
193 jclass c = env_->FindClass("java/lang/String"); in GetStaticFieldIdBadArgumentTest()
196 …jfieldID fid = env_->GetStaticFieldID(nullptr, "CASE_INSENSITIVE_ORDER", "Ljava/util/Comparator;"); in GetStaticFieldIdBadArgumentTest()
200 fid = env_->GetStaticFieldID(c, nullptr, "Ljava/util/Comparator;"); in GetStaticFieldIdBadArgumentTest()
204 fid = env_->GetStaticFieldID(c, "CASE_INSENSITIVE_ORDER", nullptr); in GetStaticFieldIdBadArgumentTest()
216 jmethodID method = env_->GetMethodID(nullptr, "<init>", "(Ljava/lang/String;)V"); in GetMethodIdBadArgumentTest()
220 jclass jlnsme = env_->FindClass("java/lang/NoSuchMethodError"); in GetMethodIdBadArgumentTest()
222 method = env_->GetMethodID(jlnsme, nullptr, "(Ljava/lang/String;)V"); in GetMethodIdBadArgumentTest()
226 method = env_->GetMethodID(jlnsme, "<init>", nullptr); in GetMethodIdBadArgumentTest()
238 jmethodID method = env_->GetStaticMethodID(nullptr, "valueOf", "(I)Ljava/lang/String;"); in GetStaticMethodIdBadArgumentTest()
242 jclass jlstring = env_->FindClass("java/lang/String"); in GetStaticMethodIdBadArgumentTest()
243 method = env_->GetStaticMethodID(jlstring, nullptr, "(I)Ljava/lang/String;"); in GetStaticMethodIdBadArgumentTest()
247 method = env_->GetStaticMethodID(jlstring, "valueOf", nullptr); in GetStaticMethodIdBadArgumentTest()
259 jclass c = env_->FindClass("java/lang/String"); in GetFromReflectedField_ToReflectedFieldBadArgumentTest()
261 jfieldID fid = env_->GetFieldID(c, "count", "I"); in GetFromReflectedField_ToReflectedFieldBadArgumentTest()
265 jobject field = env_->ToReflectedField(nullptr, fid, JNI_FALSE); in GetFromReflectedField_ToReflectedFieldBadArgumentTest()
273 field = env_->ToReflectedField(c, nullptr, JNI_FALSE); in GetFromReflectedField_ToReflectedFieldBadArgumentTest()
278 fid = env_->FromReflectedField(nullptr); in GetFromReflectedField_ToReflectedFieldBadArgumentTest()
290 jclass c = env_->FindClass("java/lang/String"); in GetFromReflectedMethod_ToReflectedMethodBadArgumentTest()
292 jmethodID mid = env_->GetMethodID(c, "<init>", "()V"); in GetFromReflectedMethod_ToReflectedMethodBadArgumentTest()
296 jobject method = env_->ToReflectedMethod(nullptr, mid, JNI_FALSE); in GetFromReflectedMethod_ToReflectedMethodBadArgumentTest()
304 method = env_->ToReflectedMethod(c, nullptr, JNI_FALSE); in GetFromReflectedMethod_ToReflectedMethodBadArgumentTest()
308 mid = env_->FromReflectedMethod(method); in GetFromReflectedMethod_ToReflectedMethodBadArgumentTest()
321 EXPECT_EQ(env_->RegisterNatives(nullptr, methods, 0), JNI_ERR); in RegisterAndUnregisterNativesBadArguments()
327 jclass jlobject = env_->FindClass("java/lang/Object"); in RegisterAndUnregisterNativesBadArguments()
328 EXPECT_EQ(env_->RegisterNatives(jlobject, nullptr, 1), JNI_ERR); in RegisterAndUnregisterNativesBadArguments()
332 EXPECT_EQ(env_->UnregisterNatives(nullptr), JNI_ERR); in RegisterAndUnregisterNativesBadArguments()
344 jbooleanArray array = env_->NewBooleanArray(10); in GetPrimitiveArrayElementsOfWrongType()
346 EXPECT_EQ(env_->GetByteArrayElements(reinterpret_cast<jbyteArray>(array), &is_copy), nullptr); in GetPrimitiveArrayElementsOfWrongType()
350 EXPECT_EQ(env_->GetShortArrayElements(reinterpret_cast<jshortArray>(array), &is_copy), nullptr); in GetPrimitiveArrayElementsOfWrongType()
354 EXPECT_EQ(env_->GetCharArrayElements(reinterpret_cast<jcharArray>(array), &is_copy), nullptr); in GetPrimitiveArrayElementsOfWrongType()
358 EXPECT_EQ(env_->GetIntArrayElements(reinterpret_cast<jintArray>(array), &is_copy), nullptr); in GetPrimitiveArrayElementsOfWrongType()
362 EXPECT_EQ(env_->GetLongArrayElements(reinterpret_cast<jlongArray>(array), &is_copy), nullptr); in GetPrimitiveArrayElementsOfWrongType()
366 EXPECT_EQ(env_->GetFloatArrayElements(reinterpret_cast<jfloatArray>(array), &is_copy), nullptr); in GetPrimitiveArrayElementsOfWrongType()
370 … EXPECT_EQ(env_->GetDoubleArrayElements(reinterpret_cast<jdoubleArray>(array), &is_copy), nullptr); in GetPrimitiveArrayElementsOfWrongType()
374 jbyteArray array2 = env_->NewByteArray(10); in GetPrimitiveArrayElementsOfWrongType()
375 EXPECT_EQ(env_->GetBooleanArrayElements(reinterpret_cast<jbooleanArray>(array2), &is_copy), in GetPrimitiveArrayElementsOfWrongType()
380 jobject object = env_->NewStringUTF("Test String"); in GetPrimitiveArrayElementsOfWrongType()
381 EXPECT_EQ(env_->GetBooleanArrayElements(reinterpret_cast<jbooleanArray>(object), &is_copy), in GetPrimitiveArrayElementsOfWrongType()
394 jbooleanArray array = env_->NewBooleanArray(10); in ReleasePrimitiveArrayElementsOfWrongType()
397 jboolean* elements = env_->GetBooleanArrayElements(array, &is_copy); in ReleasePrimitiveArrayElementsOfWrongType()
399 env_->ReleaseByteArrayElements(reinterpret_cast<jbyteArray>(array), in ReleasePrimitiveArrayElementsOfWrongType()
404 env_->ReleaseShortArrayElements(reinterpret_cast<jshortArray>(array), in ReleasePrimitiveArrayElementsOfWrongType()
409 env_->ReleaseCharArrayElements(reinterpret_cast<jcharArray>(array), in ReleasePrimitiveArrayElementsOfWrongType()
414 env_->ReleaseIntArrayElements(reinterpret_cast<jintArray>(array), in ReleasePrimitiveArrayElementsOfWrongType()
419 env_->ReleaseLongArrayElements(reinterpret_cast<jlongArray>(array), in ReleasePrimitiveArrayElementsOfWrongType()
424 env_->ReleaseFloatArrayElements(reinterpret_cast<jfloatArray>(array), in ReleasePrimitiveArrayElementsOfWrongType()
429 env_->ReleaseDoubleArrayElements(reinterpret_cast<jdoubleArray>(array), in ReleasePrimitiveArrayElementsOfWrongType()
436 env_->ReleaseBooleanArrayElements(array, elements, 0); in ReleasePrimitiveArrayElementsOfWrongType()
439 jbyteArray array = env_->NewByteArray(10); in ReleasePrimitiveArrayElementsOfWrongType()
441 jbyte* elements = env_->GetByteArrayElements(array, &is_copy); in ReleasePrimitiveArrayElementsOfWrongType()
443 env_->ReleaseBooleanArrayElements(reinterpret_cast<jbooleanArray>(array), in ReleasePrimitiveArrayElementsOfWrongType()
448 jobject object = env_->NewStringUTF("Test String"); in ReleasePrimitiveArrayElementsOfWrongType()
449 env_->ReleaseBooleanArrayElements(reinterpret_cast<jbooleanArray>(object), in ReleasePrimitiveArrayElementsOfWrongType()
457 env_->ReleaseByteArrayElements(array, elements, 0); in ReleasePrimitiveArrayElementsOfWrongType()
466 jobject object = env_->NewStringUTF("Test String"); in GetReleasePrimitiveArrayCriticalOfWrongType()
468 void* elements = env_->GetPrimitiveArrayCritical(reinterpret_cast<jarray>(object), &is_copy); in GetReleasePrimitiveArrayCriticalOfWrongType()
471 env_->ReleasePrimitiveArrayCritical(reinterpret_cast<jarray>(object), elements, 0); in GetReleasePrimitiveArrayCriticalOfWrongType()
482 jbooleanArray array = env_->NewBooleanArray(kLength); in GetPrimitiveArrayRegionElementsOfWrongType()
485 env_->GetByteArrayRegion(reinterpret_cast<jbyteArray>(array), 0, kLength, in GetPrimitiveArrayRegionElementsOfWrongType()
490 env_->GetShortArrayRegion(reinterpret_cast<jshortArray>(array), 0, kLength, in GetPrimitiveArrayRegionElementsOfWrongType()
495 env_->GetCharArrayRegion(reinterpret_cast<jcharArray>(array), 0, kLength, in GetPrimitiveArrayRegionElementsOfWrongType()
500 env_->GetIntArrayRegion(reinterpret_cast<jintArray>(array), 0, kLength, in GetPrimitiveArrayRegionElementsOfWrongType()
505 env_->GetLongArrayRegion(reinterpret_cast<jlongArray>(array), 0, kLength, in GetPrimitiveArrayRegionElementsOfWrongType()
510 env_->GetFloatArrayRegion(reinterpret_cast<jfloatArray>(array), 0, kLength, in GetPrimitiveArrayRegionElementsOfWrongType()
515 env_->GetDoubleArrayRegion(reinterpret_cast<jdoubleArray>(array), 0, kLength, in GetPrimitiveArrayRegionElementsOfWrongType()
520 jbyteArray array2 = env_->NewByteArray(10); in GetPrimitiveArrayRegionElementsOfWrongType()
521 env_->GetBooleanArrayRegion(reinterpret_cast<jbooleanArray>(array2), 0, kLength, in GetPrimitiveArrayRegionElementsOfWrongType()
526 jobject object = env_->NewStringUTF("Test String"); in GetPrimitiveArrayRegionElementsOfWrongType()
527 env_->GetBooleanArrayRegion(reinterpret_cast<jbooleanArray>(object), 0, kLength, in GetPrimitiveArrayRegionElementsOfWrongType()
540 jbooleanArray array = env_->NewBooleanArray(kLength); in SetPrimitiveArrayRegionElementsOfWrongType()
543 env_->SetByteArrayRegion(reinterpret_cast<jbyteArray>(array), 0, kLength, in SetPrimitiveArrayRegionElementsOfWrongType()
548 env_->SetShortArrayRegion(reinterpret_cast<jshortArray>(array), 0, kLength, in SetPrimitiveArrayRegionElementsOfWrongType()
553 env_->SetCharArrayRegion(reinterpret_cast<jcharArray>(array), 0, kLength, in SetPrimitiveArrayRegionElementsOfWrongType()
558 env_->SetIntArrayRegion(reinterpret_cast<jintArray>(array), 0, kLength, in SetPrimitiveArrayRegionElementsOfWrongType()
563 env_->SetLongArrayRegion(reinterpret_cast<jlongArray>(array), 0, kLength, in SetPrimitiveArrayRegionElementsOfWrongType()
568 env_->SetFloatArrayRegion(reinterpret_cast<jfloatArray>(array), 0, kLength, in SetPrimitiveArrayRegionElementsOfWrongType()
573 env_->SetDoubleArrayRegion(reinterpret_cast<jdoubleArray>(array), 0, kLength, in SetPrimitiveArrayRegionElementsOfWrongType()
578 jbyteArray array2 = env_->NewByteArray(10); in SetPrimitiveArrayRegionElementsOfWrongType()
579 env_->SetBooleanArrayRegion(reinterpret_cast<jbooleanArray>(array2), 0, kLength, in SetPrimitiveArrayRegionElementsOfWrongType()
584 jobject object = env_->NewStringUTF("Test String"); in SetPrimitiveArrayRegionElementsOfWrongType()
585 env_->SetBooleanArrayRegion(reinterpret_cast<jbooleanArray>(object), 0, kLength, in SetPrimitiveArrayRegionElementsOfWrongType()
597 jclass element_class = env_->FindClass("java/lang/String"); in NewObjectArrayBadArguments()
600 env_->NewObjectArray(-1, element_class, nullptr); in NewObjectArrayBadArguments()
603 env_->NewObjectArray(std::numeric_limits<jint>::min(), element_class, nullptr); in NewObjectArrayBadArguments()
611 JNIEnv* env_; member in art::JniInternalTest
618 jclass c = env_->FindClass("java/lang/String"); in TEST_F()
620 jobject o = env_->AllocObject(c); in TEST_F()
624 ASSERT_TRUE(env_->IsInstanceOf(o, c)); in TEST_F()
627 ASSERT_EQ(0, env_->GetIntField(o, env_->GetFieldID(c, "count", "I"))); in TEST_F()
631 ASSERT_EQ(JNI_VERSION_1_6, env_->GetVersion()); in TEST_F()
643 jclass jlnsfe = env_->FindClass("java/lang/NoSuchFieldError"); in TEST_F()
645 jclass c = env_->FindClass("java/lang/String"); in TEST_F()
649 jfieldID fid = env_->GetFieldID(c, "count", "J"); in TEST_F()
654 fid = env_->GetFieldID(c, "count", "Lrod/jane/freddy;"); in TEST_F()
659 fid = env_->GetFieldID(c, "Count", "I"); in TEST_F()
664 fid = env_->GetFieldID(c, "count", "I"); in TEST_F()
666 EXPECT_FALSE(env_->ExceptionCheck()); in TEST_F()
669 c = env_->FindClass("java/lang/StringBuilder"); in TEST_F()
670 fid = env_->GetFieldID(c, "count", "I"); in TEST_F()
673 EXPECT_FALSE(env_->ExceptionCheck()); in TEST_F()
676 fid = env_->GetFieldID(c, "CASE_INSENSITIVE_ORDER", "Ljava/util/Comparator;"); in TEST_F()
686 jclass jlnsfe = env_->FindClass("java/lang/NoSuchFieldError"); in TEST_F()
688 jclass c = env_->FindClass("java/lang/String"); in TEST_F()
692 jfieldID fid = env_->GetStaticFieldID(c, "CASE_INSENSITIVE_ORDER", "J"); in TEST_F()
697 fid = env_->GetStaticFieldID(c, "CASE_INSENSITIVE_ORDER", "Lrod/jane/freddy;"); in TEST_F()
702 fid = env_->GetStaticFieldID(c, "cASE_INSENSITIVE_ORDER", "Ljava/util/Comparator;"); in TEST_F()
707 fid = env_->GetStaticFieldID(c, "CASE_INSENSITIVE_ORDER", "Ljava/util/Comparator;"); in TEST_F()
710 EXPECT_FALSE(env_->ExceptionCheck()); in TEST_F()
713 fid = env_->GetStaticFieldID(c, "count", "I"); in TEST_F()
723 jclass jlobject = env_->FindClass("java/lang/Object"); in TEST_F()
724 jclass jlstring = env_->FindClass("java/lang/String"); in TEST_F()
725 jclass jlnsme = env_->FindClass("java/lang/NoSuchMethodError"); in TEST_F()
726 jclass jncrbc = env_->FindClass("java/nio/channels/ReadableByteChannel"); in TEST_F()
729 ASSERT_FALSE(env_->ExceptionCheck()); in TEST_F()
733 jmethodID method = env_->GetMethodID(jlobject, "foo", "()V"); in TEST_F()
738 method = env_->GetMethodID(jlobject, "equals", "(Ljava/lang/Object;)Z"); in TEST_F()
740 EXPECT_FALSE(env_->ExceptionCheck()); in TEST_F()
744 method = env_->GetMethodID(jlstring, "valueOf", "(I)Ljava/lang/String;"); in TEST_F()
749 method = env_->GetMethodID(jlnsme, "<init>", "(Ljava/lang/String;)V"); in TEST_F()
751 EXPECT_FALSE(env_->ExceptionCheck()); in TEST_F()
754 method = env_->GetMethodID(jncrbc, "close", "()V"); in TEST_F()
756 EXPECT_FALSE(env_->ExceptionCheck()); in TEST_F()
764 jclass jlobject = env_->FindClass("java/lang/Object"); in TEST_F()
768 method = env_->GetMethodID(jlobject, "<init>", "()V"); in TEST_F()
770 EXPECT_FALSE(env_->ExceptionCheck()); in TEST_F()
774 env_->CallVoidMethod(nullptr, method); in TEST_F()
779 jclass jlobject = env_->FindClass("java/lang/Object"); in TEST_F()
780 jclass jlnsme = env_->FindClass("java/lang/NoSuchMethodError"); in TEST_F()
783 ASSERT_FALSE(env_->ExceptionCheck()); in TEST_F()
787 jmethodID method = env_->GetStaticMethodID(jlobject, "foo", "()V"); in TEST_F()
793 method = env_->GetStaticMethodID(jlobject, "equals", "(Ljava/lang/Object;)Z"); in TEST_F()
798 jclass jlstring = env_->FindClass("java/lang/String"); in TEST_F()
799 method = env_->GetStaticMethodID(jlstring, "valueOf", "(I)Ljava/lang/String;"); in TEST_F()
801 EXPECT_FALSE(env_->ExceptionCheck()); in TEST_F()
809 jclass jlrField = env_->FindClass("java/lang/reflect/Field"); in TEST_F()
810 jclass c = env_->FindClass("java/lang/String"); in TEST_F()
812 jfieldID fid = env_->GetFieldID(c, "count", "I"); in TEST_F()
815 jobject field = env_->ToReflectedField(c, fid, JNI_FALSE); in TEST_F()
819 env_->DeleteLocalRef(env_->ToReflectedField(c, fid, JNI_FALSE)); in TEST_F()
822 ASSERT_TRUE(env_->IsInstanceOf(field, jlrField)); in TEST_F()
824 jfieldID fid2 = env_->FromReflectedField(field); in TEST_F()
827 jstring s = env_->NewStringUTF("poop"); in TEST_F()
828 ASSERT_EQ(4, env_->GetIntField(s, fid2)); in TEST_F()
836 jclass jlrMethod = env_->FindClass("java/lang/reflect/Method"); in TEST_F()
838 jclass jlrConstructor = env_->FindClass("java/lang/reflect/Constructor"); in TEST_F()
840 jclass c = env_->FindClass("java/lang/String"); in TEST_F()
843 jmethodID mid = env_->GetMethodID(c, "<init>", "()V"); in TEST_F()
846 jobject method = env_->ToReflectedMethod(c, mid, JNI_FALSE); in TEST_F()
850 env_->DeleteLocalRef(env_->ToReflectedMethod(c, mid, JNI_FALSE)); in TEST_F()
853 ASSERT_TRUE(env_->IsInstanceOf(method, jlrConstructor)); in TEST_F()
855 jmethodID mid2 = env_->FromReflectedMethod(method); in TEST_F()
858 jstring s = reinterpret_cast<jstring>(env_->AllocObject(c)); in TEST_F()
860 env_->CallVoidMethod(s, mid2); in TEST_F()
861 ASSERT_EQ(JNI_FALSE, env_->ExceptionCheck()); in TEST_F()
862 env_->ExceptionClear(); in TEST_F()
864 mid = env_->GetMethodID(c, "length", "()I"); in TEST_F()
867 method = env_->ToReflectedMethod(c, mid, JNI_FALSE); in TEST_F()
869 ASSERT_TRUE(env_->IsInstanceOf(method, jlrMethod)); in TEST_F()
871 mid2 = env_->FromReflectedMethod(method); in TEST_F()
874 s = env_->NewStringUTF("poop"); in TEST_F()
876 ASSERT_EQ(4, env_->CallIntMethod(s, mid2)); in TEST_F()
888 jclass jlobject = env_->FindClass("java/lang/Object"); in TEST_F()
889 jclass jlnsme = env_->FindClass("java/lang/NoSuchMethodError"); in TEST_F()
893 ASSERT_FALSE(env_->ExceptionCheck()); in TEST_F()
901 EXPECT_EQ(env_->RegisterNatives(jlobject, methods, 1), JNI_ERR); in TEST_F()
908 EXPECT_EQ(env_->RegisterNatives(jlobject, methods, 1), JNI_ERR); in TEST_F()
915 EXPECT_EQ(env_->RegisterNatives(jlobject, methods, 1), JNI_ERR); in TEST_F()
922 EXPECT_EQ(env_->RegisterNatives(jlobject, methods, 1), JNI_ERR); in TEST_F()
929 EXPECT_EQ(env_->RegisterNatives(jlobject, methods, 1), JNI_ERR); in TEST_F()
937 EXPECT_EQ(env_->RegisterNatives(jlobject, methods, 1), JNI_OK); in TEST_F()
939 EXPECT_FALSE(env_->ExceptionCheck()); in TEST_F()
940 EXPECT_EQ(env_->UnregisterNatives(jlobject), JNI_OK); in TEST_F()
945 EXPECT_EQ(env_->RegisterNatives(jlobject, methods, 0), JNI_OK); in TEST_F()
947 EXPECT_FALSE(env_->ExceptionCheck()); in TEST_F()
948 EXPECT_EQ(env_->UnregisterNatives(jlobject), JNI_OK); in TEST_F()
954 EXPECT_EQ(env_->RegisterNatives(jlobject, methods, i), JNI_ERR); in TEST_F()
957 EXPECT_FALSE(env_->ExceptionCheck()); in TEST_F()
960 EXPECT_EQ(env_->UnregisterNatives(jlnsme), JNI_OK); in TEST_F()
977 down_cast<JNIEnvExt*>(env_)->SetCheckJniEnabled(false); \
979 EXPECT_EQ(env_->new_fn(-1), nullptr); \
981 EXPECT_EQ(env_->new_fn(std::numeric_limits<jint>::min()), nullptr); \
984 EXPECT_EQ(0, env_->GetArrayLength(nullptr)); \
986 env_->get_region_fn(nullptr, 0, 0, nullptr); \
988 env_->set_region_fn(nullptr, 0, 0, nullptr); \
990 env_->get_elements_fn(nullptr, nullptr); \
992 env_->release_elements_fn(nullptr, nullptr, 0); \
995 scalar_type ## Array a = env_->new_fn(size); \
996 env_->get_region_fn(a, 0, size, nullptr); \
998 env_->set_region_fn(a, 0, size, nullptr); \
1000 down_cast<JNIEnvExt*>(env_)->SetCheckJniEnabled(true); \
1003 scalar_type ## Array a = env_->new_fn(size); \
1005 EXPECT_TRUE(env_->IsInstanceOf(a, env_->FindClass(expected_class_descriptor))); \
1006 EXPECT_EQ(size, env_->GetArrayLength(a)); \
1010 env_->get_region_fn(a, -1, 1, nullptr); \
1012 env_->set_region_fn(a, -1, 1, nullptr); \
1016 env_->get_region_fn(a, 0, -1, nullptr); \
1018 env_->set_region_fn(a, 0, -1, nullptr); \
1022 env_->get_region_fn(a, size - 1, size, nullptr); \
1024 env_->set_region_fn(a, size - 1, size, nullptr); \
1028 env_->get_region_fn(a, 2, 0, nullptr); \
1030 env_->get_region_fn(a, 123, 0, nullptr); \
1034 env_->set_region_fn(a, 2, 0, nullptr); \
1036 env_->set_region_fn(a, 123, 0, nullptr); \
1046 env_->set_region_fn(a, 0, size, &src_buf[0]); \
1048 env_->get_region_fn(a, 1, size - 2, &dst_buf[1]); \
1052 env_->get_region_fn(a, 0, 1, &dst_buf[0]); \
1053 env_->get_region_fn(a, size - 1, 1, &dst_buf[size - 1]); \
1057 env_->get_region_fn(a, 0, size, &dst_buf[0]); \
1061 void* v = env_->GetPrimitiveArrayCritical(a, nullptr); \
1064 env_->ReleasePrimitiveArrayCritical(a, v, 0); \
1066 scalar_type* xs = env_->get_elements_fn(a, nullptr); \
1069 env_->release_elements_fn(a, xs, 0); \
1130 jclass element_class = env_->FindClass("java/lang/String"); in TEST_F()
1132 jclass array_class = env_->FindClass("[Ljava/lang/String;"); in TEST_F()
1135 jobjectArray a = env_->NewObjectArray(0, element_class, nullptr); in TEST_F()
1137 EXPECT_TRUE(env_->IsInstanceOf(a, array_class)); in TEST_F()
1138 EXPECT_EQ(0, env_->GetArrayLength(a)); in TEST_F()
1140 a = env_->NewObjectArray(1, element_class, nullptr); in TEST_F()
1142 EXPECT_TRUE(env_->IsInstanceOf(a, array_class)); in TEST_F()
1143 EXPECT_EQ(1, env_->GetArrayLength(a)); in TEST_F()
1144 EXPECT_TRUE(env_->IsSameObject(env_->GetObjectArrayElement(a, 0), nullptr)); in TEST_F()
1161 env_->NewObjectArray(0, nullptr, nullptr); in TEST_F()
1164 env_->NewObjectArray(1, primitive_class, nullptr); in TEST_F()
1170 env_->NewObjectArray(0, nullptr, nullptr); in TEST_F()
1173 env_->NewObjectArray(1, primitive_class, nullptr); in TEST_F()
1181 jclass element_class = env_->FindClass("java/lang/String"); in TEST_F()
1183 jclass array_class = env_->FindClass("[Ljava/lang/String;"); in TEST_F()
1186 jstring s = env_->NewStringUTF("poop"); in TEST_F()
1187 jobjectArray a = env_->NewObjectArray(2, element_class, s); in TEST_F()
1189 EXPECT_TRUE(env_->IsInstanceOf(a, array_class)); in TEST_F()
1190 EXPECT_EQ(2, env_->GetArrayLength(a)); in TEST_F()
1191 EXPECT_TRUE(env_->IsSameObject(env_->GetObjectArrayElement(a, 0), s)); in TEST_F()
1192 EXPECT_TRUE(env_->IsSameObject(env_->GetObjectArrayElement(a, 1), s)); in TEST_F()
1196 env_->NewObjectArray(2, element_class, a); in TEST_F()
1205 EXPECT_EQ(0, env_->GetArrayLength(nullptr)); in TEST_F()
1208 EXPECT_EQ(JNI_ERR, env_->GetArrayLength(nullptr)); in TEST_F()
1214 jclass string_class = env_->FindClass("java/lang/String"); in TEST_F()
1216 jclass class_class = env_->FindClass("java/lang/Class"); in TEST_F()
1219 jstring s = env_->NewStringUTF("poop"); in TEST_F()
1220 jclass c = env_->GetObjectClass(s); in TEST_F()
1221 ASSERT_TRUE(env_->IsSameObject(string_class, c)); in TEST_F()
1223 jclass c2 = env_->GetObjectClass(c); in TEST_F()
1224 ASSERT_TRUE(env_->IsSameObject(class_class, env_->GetObjectClass(c2))); in TEST_F()
1228 EXPECT_EQ(env_->GetObjectClass(nullptr), nullptr); in TEST_F()
1233 jclass object_class = env_->FindClass("java/lang/Object"); in TEST_F()
1235 jclass string_class = env_->FindClass("java/lang/String"); in TEST_F()
1237 jclass runnable_interface = env_->FindClass("java/lang/Runnable"); in TEST_F()
1239 ASSERT_TRUE(env_->IsSameObject(object_class, env_->GetSuperclass(string_class))); in TEST_F()
1240 ASSERT_EQ(env_->GetSuperclass(object_class), nullptr); in TEST_F()
1241 ASSERT_TRUE(env_->IsSameObject(object_class, env_->GetSuperclass(runnable_interface))); in TEST_F()
1246 EXPECT_EQ(env_->GetSuperclass(nullptr), nullptr); in TEST_F()
1249 EXPECT_EQ(env_->GetSuperclass(nullptr), nullptr); in TEST_F()
1255 jclass object_class = env_->FindClass("java/lang/Object"); in TEST_F()
1257 jclass string_class = env_->FindClass("java/lang/String"); in TEST_F()
1262 ASSERT_TRUE(env_->IsAssignableFrom(string_class, object_class)); in TEST_F()
1263 ASSERT_FALSE(env_->IsAssignableFrom(object_class, string_class)); in TEST_F()
1265 jclass charsequence_interface = env_->FindClass("java/lang/CharSequence"); in TEST_F()
1270 ASSERT_TRUE(env_->IsAssignableFrom(string_class, charsequence_interface)); in TEST_F()
1271 ASSERT_FALSE(env_->IsAssignableFrom(charsequence_interface, string_class)); in TEST_F()
1274 jclass string_array_class = env_->FindClass("[Ljava/lang/String;"); in TEST_F()
1276 jclass object_array_class = env_->FindClass("[Ljava/lang/Object;"); in TEST_F()
1278 ASSERT_TRUE(env_->IsAssignableFrom(string_array_class, object_array_class)); in TEST_F()
1279 ASSERT_FALSE(env_->IsAssignableFrom(object_array_class, string_array_class)); in TEST_F()
1286 EXPECT_EQ(env_->IsAssignableFrom(nullptr, string_class), JNI_FALSE); in TEST_F()
1288 EXPECT_EQ(env_->IsAssignableFrom(object_class, nullptr), JNI_FALSE); in TEST_F()
1291 EXPECT_EQ(env_->IsAssignableFrom(nullptr, string_class), JNI_FALSE); in TEST_F()
1293 EXPECT_EQ(env_->IsAssignableFrom(object_class, nullptr), JNI_FALSE); in TEST_F()
1299 jclass local = env_->FindClass("java/lang/Object"); in TEST_F()
1301 EXPECT_EQ(JNILocalRefType, env_->GetObjectRefType(local)); in TEST_F()
1303 jobject global = env_->NewGlobalRef(local); in TEST_F()
1304 EXPECT_EQ(JNIGlobalRefType, env_->GetObjectRefType(global)); in TEST_F()
1306 jweak weak_global = env_->NewWeakGlobalRef(local); in TEST_F()
1307 EXPECT_EQ(JNIWeakGlobalRefType, env_->GetObjectRefType(weak_global)); in TEST_F()
1312 EXPECT_EQ(JNIInvalidRefType, env_->GetObjectRefType(invalid)); in TEST_F()
1319 EXPECT_EQ(JNIInvalidRefType, env_->GetObjectRefType(nullptr)); in TEST_F()
1326 jclass java_lang_Class = env_->FindClass("java/lang/Class"); in TEST_F()
1328 jobjectArray local_ref = env_->NewObjectArray(1, java_lang_Class, nullptr); in TEST_F()
1330 jweak weak_global = env_->NewWeakGlobalRef(local_ref); in TEST_F()
1332 env_->DeleteLocalRef(local_ref); in TEST_F()
1334 jobject new_global_ref = env_->NewGlobalRef(weak_global); in TEST_F()
1336 jobject new_local_ref = env_->NewLocalRef(weak_global); in TEST_F()
1341 EXPECT_EQ(env_->NewStringUTF(nullptr), nullptr); in TEST_F()
1344 s = env_->NewStringUTF(""); in TEST_F()
1346 EXPECT_EQ(0, env_->GetStringLength(s)); in TEST_F()
1347 EXPECT_EQ(0, env_->GetStringUTFLength(s)); in TEST_F()
1348 s = env_->NewStringUTF("hello"); in TEST_F()
1350 EXPECT_EQ(5, env_->GetStringLength(s)); in TEST_F()
1351 EXPECT_EQ(5, env_->GetStringUTFLength(s)); in TEST_F()
1354 s = env_->NewStringUTF("\xed\xa0\x81\xed\xb0\x80"); in TEST_F()
1356 EXPECT_EQ(2, env_->GetStringLength(s)); in TEST_F()
1359 EXPECT_EQ(4, env_->GetStringUTFLength(s)); in TEST_F()
1360 const char* chars = env_->GetStringUTFChars(s, nullptr); in TEST_F()
1362 env_->ReleaseStringUTFChars(s, chars); in TEST_F()
1365 const jchar* jchars = env_->GetStringChars(s, nullptr); in TEST_F()
1368 env_->ReleaseStringChars(s, jchars); in TEST_F()
1371 s = env_->NewStringUTF("\xed\xa0\x81\xed\xb0\x80 \xf0\x9f\x8f\xa0"); in TEST_F()
1376 EXPECT_EQ(5, env_->GetStringLength(s)); in TEST_F()
1377 jchars = env_->GetStringChars(s, nullptr); in TEST_F()
1384 env_->ReleaseStringChars(s, jchars); in TEST_F()
1386 EXPECT_EQ(9, env_->GetStringUTFLength(s)); in TEST_F()
1387 chars = env_->GetStringUTFChars(s, nullptr); in TEST_F()
1389 env_->ReleaseStringUTFChars(s, chars); in TEST_F()
1393 s = env_->NewStringUTF("\x24 \xc2\xa2 \xe2\x82\xac \xf0\x9f\x8f\xa0"); in TEST_F()
1395 EXPECT_EQ(8, env_->GetStringLength(s)); in TEST_F()
1396 EXPECT_EQ(13, env_->GetStringUTFLength(s)); in TEST_F()
1402 s = env_->NewString(chars, 0); in TEST_F()
1404 EXPECT_EQ(0, env_->GetStringLength(s)); in TEST_F()
1405 EXPECT_EQ(0, env_->GetStringUTFLength(s)); in TEST_F()
1406 s = env_->NewString(chars, 2); in TEST_F()
1408 EXPECT_EQ(2, env_->GetStringLength(s)); in TEST_F()
1409 EXPECT_EQ(2, env_->GetStringUTFLength(s)); in TEST_F()
1415 jstring s = env_->NewString(nullptr, 0); in TEST_F()
1417 EXPECT_EQ(0, env_->GetStringLength(s)); in TEST_F()
1422 env_->NewString(nullptr, 1); in TEST_F()
1429 env_->NewString(nullptr, -1); in TEST_F()
1431 env_->NewString(nullptr, std::numeric_limits<jint>::min()); in TEST_F()
1434 env_->NewString(nullptr, -1); in TEST_F()
1436 env_->NewString(nullptr, std::numeric_limits<jint>::min()); in TEST_F()
1446 jstring s = env_->NewStringUTF("hello"); in TEST_F()
1449 env_->GetStringRegion(s, -1, 0, nullptr); in TEST_F()
1451 env_->GetStringRegion(s, 0, -1, nullptr); in TEST_F()
1453 env_->GetStringRegion(s, 0, 10, nullptr); in TEST_F()
1455 env_->GetStringRegion(s, 10, 1, nullptr); in TEST_F()
1459 env_->GetStringRegion(s, 1, 2, &chars[1]); in TEST_F()
1466 env_->GetStringRegion(s, 2, 0, nullptr); in TEST_F()
1468 env_->GetStringRegion(s, 123, 0, nullptr); in TEST_F()
1471 env_->GetStringUTFRegion(s, -1, 0, nullptr); in TEST_F()
1473 env_->GetStringUTFRegion(s, 0, -1, nullptr); in TEST_F()
1475 env_->GetStringUTFRegion(s, 0, 10, nullptr); in TEST_F()
1477 env_->GetStringUTFRegion(s, 10, 1, nullptr); in TEST_F()
1481 env_->GetStringUTFRegion(s, 1, 2, &bytes[1]); in TEST_F()
1488 env_->GetStringUTFRegion(s, 2, 0, nullptr); in TEST_F()
1490 env_->GetStringUTFRegion(s, 123, 0, nullptr); in TEST_F()
1499 EXPECT_EQ(env_->GetStringUTFChars(nullptr, nullptr), nullptr); in TEST_F()
1504 EXPECT_EQ(env_->GetStringUTFChars(nullptr, nullptr), nullptr); in TEST_F()
1509 jstring s = env_->NewStringUTF("hello"); in TEST_F()
1512 const char* utf = env_->GetStringUTFChars(s, nullptr); in TEST_F()
1514 env_->ReleaseStringUTFChars(s, utf); in TEST_F()
1517 utf = env_->GetStringUTFChars(s, &is_copy); in TEST_F()
1520 env_->ReleaseStringUTFChars(s, utf); in TEST_F()
1524 jstring s = env_->NewStringUTF("hello"); in TEST_F()
1525 ScopedObjectAccess soa(env_); in TEST_F()
1530 const jchar* chars = env_->GetStringChars(s, nullptr); in TEST_F()
1536 env_->ReleaseStringChars(s, chars); in TEST_F()
1539 chars = env_->GetStringChars(s, &is_copy); in TEST_F()
1550 env_->ReleaseStringChars(s, chars); in TEST_F()
1554 jstring s = env_->NewStringUTF("hello"); in TEST_F()
1558 const jchar* chars = env_->GetStringCritical(s, nullptr); in TEST_F()
1564 env_->ReleaseStringCritical(s, chars); in TEST_F()
1567 chars = env_->GetStringCritical(s, &is_copy); in TEST_F()
1574 env_->ReleaseStringCritical(s, chars); in TEST_F()
1578 jclass java_lang_Class = env_->FindClass("java/lang/Class"); in TEST_F()
1581 jobjectArray array = env_->NewObjectArray(1, java_lang_Class, nullptr); in TEST_F()
1583 EXPECT_EQ(env_->GetObjectArrayElement(array, 0), nullptr); in TEST_F()
1584 env_->SetObjectArrayElement(array, 0, java_lang_Class); in TEST_F()
1585 EXPECT_TRUE(env_->IsSameObject(env_->GetObjectArrayElement(array, 0), java_lang_Class)); in TEST_F()
1588 env_->SetObjectArrayElement(array, -1, java_lang_Class); in TEST_F()
1592 env_->SetObjectArrayElement(array, 1, java_lang_Class); in TEST_F()
1596 env_->SetObjectArrayElement(array, 0, env_->NewStringUTF("not a jclass!")); in TEST_F()
1602 EXPECT_EQ(nullptr, env_->GetObjectArrayElement(nullptr, 0)); in TEST_F()
1604 env_->SetObjectArrayElement(nullptr, 0, nullptr); in TEST_F()
1607 EXPECT_EQ(nullptr, env_->GetObjectArrayElement(nullptr, 0)); in TEST_F()
1609 env_->SetObjectArrayElement(nullptr, 0, nullptr); in TEST_F()
1616 jfieldID fid = env_->GetStaticFieldID(c, field_name, sig); \
1618 env_->SetStatic ## type ## Field(c, fid, value1); \
1619 expect_eq(value1, env_->GetStatic ## type ## Field(c, fid)); \
1620 env_->SetStatic ## type ## Field(c, fid, value2); \
1621 expect_eq(value2, env_->GetStatic ## type ## Field(c, fid)); \
1626 env_->GetStatic ## type ## Field(nullptr, fid); \
1627 env_->SetStatic ## type ## Field(nullptr, fid, value1); \
1630 env_->GetStatic ## type ## Field(c, nullptr); \
1632 env_->SetStatic ## type ## Field(c, nullptr, value1); \
1636 env_->GetStatic ## type ## Field(nullptr, fid); \
1638 env_->SetStatic ## type ## Field(nullptr, fid, value1); \
1640 env_->GetStatic ## type ## Field(c, nullptr); \
1642 env_->SetStatic ## type ## Field(c, nullptr, value1); \
1649 jfieldID fid = env_->GetFieldID(c, field_name, sig); \
1651 env_->Set ## type ## Field(instance, fid, value1); \
1652 expect_eq(value1, env_->Get ## type ## Field(instance, fid)); \
1653 env_->Set ## type ## Field(instance, fid, value2); \
1654 expect_eq(value2, env_->Get ## type ## Field(instance, fid)); \
1658 env_->Get ## type ## Field(nullptr, fid); \
1660 env_->Set ## type ## Field(nullptr, fid, value1); \
1662 env_->Get ## type ## Field(instance, nullptr); \
1664 env_->Set ## type ## Field(instance, nullptr, value1); \
1667 env_->Get ## type ## Field(nullptr, fid); \
1669 env_->Set ## type ## Field(nullptr, fid, value1); \
1671 env_->Get ## type ## Field(instance, nullptr); \
1673 env_->Set ## type ## Field(instance, nullptr, value1); \
1685 jclass c = env_->FindClass("AllFields"); in TEST_F()
1687 jobject o = env_->AllocObject(c); in TEST_F()
1714 jclass c = env_->FindClass("AllFields"); in TEST_F()
1716 jobject o = env_->AllocObject(c); in TEST_F()
1719 jstring s1 = env_->NewStringUTF("hello"); in TEST_F()
1721 jstring s2 = env_->NewStringUTF("world"); in TEST_F()
1724 jfieldID s_fid = env_->GetStaticFieldID(c, "sObject", "Ljava/lang/Object;"); in TEST_F()
1726 jfieldID i_fid = env_->GetFieldID(c, "iObject", "Ljava/lang/Object;"); in TEST_F()
1729 env_->SetStaticObjectField(c, s_fid, s1); in TEST_F()
1730 ASSERT_TRUE(env_->IsSameObject(s1, env_->GetStaticObjectField(c, s_fid))); in TEST_F()
1731 env_->SetStaticObjectField(c, s_fid, s2); in TEST_F()
1732 ASSERT_TRUE(env_->IsSameObject(s2, env_->GetStaticObjectField(c, s_fid))); in TEST_F()
1734 env_->SetObjectField(o, i_fid, s1); in TEST_F()
1735 ASSERT_TRUE(env_->IsSameObject(s1, env_->GetObjectField(o, i_fid))); in TEST_F()
1736 env_->SetObjectField(o, i_fid, s2); in TEST_F()
1737 ASSERT_TRUE(env_->IsSameObject(s2, env_->GetObjectField(o, i_fid))); in TEST_F()
1741 EXPECT_EQ(env_->NewLocalRef(nullptr), nullptr); in TEST_F()
1745 jstring s = env_->NewStringUTF(""); in TEST_F()
1747 jobject o = env_->NewLocalRef(s); in TEST_F()
1751 EXPECT_EQ(JNILocalRefType, env_->GetObjectRefType(o)); in TEST_F()
1755 env_->DeleteLocalRef(nullptr); in TEST_F()
1762 jstring s = env_->NewStringUTF(""); in TEST_F()
1764 env_->DeleteLocalRef(s); in TEST_F()
1771 env_->DeleteLocalRef(s); in TEST_F()
1775 env_->DeleteLocalRef(s); in TEST_F()
1781 s = env_->NewStringUTF(""); in TEST_F()
1783 jobject o = env_->NewLocalRef(s); in TEST_F()
1786 env_->DeleteLocalRef(s); in TEST_F()
1787 env_->DeleteLocalRef(o); in TEST_F()
1795 ASSERT_EQ(JNI_OK, env_->PushLocalFrame(0)); in TEST_F()
1796 env_->PopLocalFrame(nullptr); in TEST_F()
1802 ASSERT_EQ(JNI_ERR, env_->PushLocalFrame(-1)); in TEST_F()
1805 ASSERT_EQ(JNI_ERR, env_->PushLocalFrame(8192)); in TEST_F()
1812 jobject original = env_->NewStringUTF(""); in TEST_F()
1817 ScopedObjectAccess soa(env_); in TEST_F()
1819 ASSERT_EQ(JNI_OK, env_->PushLocalFrame(4)); in TEST_F()
1820 outer = env_->NewLocalRef(original); in TEST_F()
1823 ASSERT_EQ(JNI_OK, env_->PushLocalFrame(4)); in TEST_F()
1824 inner1 = env_->NewLocalRef(outer); in TEST_F()
1825 inner2 = env_->NewStringUTF("survivor"); in TEST_F()
1826 EXPECT_NE(env_->PopLocalFrame(inner2), nullptr); in TEST_F()
1829 EXPECT_EQ(JNILocalRefType, env_->GetObjectRefType(original)); in TEST_F()
1830 EXPECT_EQ(JNILocalRefType, env_->GetObjectRefType(outer)); in TEST_F()
1833 EXPECT_EQ(JNIInvalidRefType, env_->GetObjectRefType(inner1)); in TEST_F()
1841 EXPECT_EQ(JNIInvalidRefType, env_->GetObjectRefType(inner2)); in TEST_F()
1845 EXPECT_EQ(env_->PopLocalFrame(nullptr), nullptr); in TEST_F()
1847 EXPECT_EQ(JNILocalRefType, env_->GetObjectRefType(original)); in TEST_F()
1849 EXPECT_EQ(JNIInvalidRefType, env_->GetObjectRefType(outer)); in TEST_F()
1851 EXPECT_EQ(JNIInvalidRefType, env_->GetObjectRefType(inner1)); in TEST_F()
1853 EXPECT_EQ(JNIInvalidRefType, env_->GetObjectRefType(inner2)); in TEST_F()
1858 EXPECT_EQ(env_->NewGlobalRef(nullptr), nullptr); in TEST_F()
1862 jstring s = env_->NewStringUTF(""); in TEST_F()
1864 jobject o = env_->NewGlobalRef(s); in TEST_F()
1868 EXPECT_EQ(env_->GetObjectRefType(o), JNIGlobalRefType); in TEST_F()
1872 env_->DeleteGlobalRef(nullptr); in TEST_F()
1879 jstring s = env_->NewStringUTF(""); in TEST_F()
1882 jobject o = env_->NewGlobalRef(s); in TEST_F()
1884 env_->DeleteGlobalRef(o); in TEST_F()
1891 env_->DeleteGlobalRef(o); in TEST_F()
1895 env_->DeleteGlobalRef(o); in TEST_F()
1901 jobject o1 = env_->NewGlobalRef(s); in TEST_F()
1903 jobject o2 = env_->NewGlobalRef(s); in TEST_F()
1906 env_->DeleteGlobalRef(o1); in TEST_F()
1907 env_->DeleteGlobalRef(o2); in TEST_F()
1911 EXPECT_EQ(env_->NewWeakGlobalRef(nullptr), nullptr); in TEST_F()
1915 jstring s = env_->NewStringUTF(""); in TEST_F()
1917 jobject o = env_->NewWeakGlobalRef(s); in TEST_F()
1921 EXPECT_EQ(env_->GetObjectRefType(o), JNIWeakGlobalRefType); in TEST_F()
1925 env_->DeleteWeakGlobalRef(nullptr); in TEST_F()
1932 jstring s = env_->NewStringUTF(""); in TEST_F()
1935 jobject o = env_->NewWeakGlobalRef(s); in TEST_F()
1937 env_->DeleteWeakGlobalRef(o); in TEST_F()
1944 env_->DeleteWeakGlobalRef(o); in TEST_F()
1948 env_->DeleteWeakGlobalRef(o); in TEST_F()
1954 jobject o1 = env_->NewWeakGlobalRef(s); in TEST_F()
1956 jobject o2 = env_->NewWeakGlobalRef(s); in TEST_F()
1959 env_->DeleteWeakGlobalRef(o1); in TEST_F()
1960 env_->DeleteWeakGlobalRef(o2); in TEST_F()
1965 env_->ExceptionClear(); in TEST_F()
1966 env_->ExceptionDescribe(); in TEST_F()
1970 jclass exception_class = env_->FindClass("java/lang/RuntimeException"); in TEST_F()
1972 jthrowable exception = reinterpret_cast<jthrowable>(env_->AllocObject(exception_class)); in TEST_F()
1975 EXPECT_EQ(JNI_OK, env_->Throw(exception)); in TEST_F()
1976 EXPECT_TRUE(env_->ExceptionCheck()); in TEST_F()
1977 jthrowable thrown_exception = env_->ExceptionOccurred(); in TEST_F()
1978 env_->ExceptionClear(); in TEST_F()
1979 EXPECT_TRUE(env_->IsSameObject(exception, thrown_exception)); in TEST_F()
1983 EXPECT_EQ(JNI_ERR, env_->Throw(nullptr)); in TEST_F()
1986 EXPECT_EQ(JNI_ERR, env_->Throw(nullptr)); in TEST_F()
1992 jclass exception_class = env_->FindClass("java/lang/RuntimeException"); in TEST_F()
1997 EXPECT_EQ(JNI_OK, env_->ThrowNew(exception_class, "hello world")); in TEST_F()
1998 EXPECT_TRUE(env_->ExceptionCheck()); in TEST_F()
1999 thrown_exception = env_->ExceptionOccurred(); in TEST_F()
2000 env_->ExceptionClear(); in TEST_F()
2001 EXPECT_TRUE(env_->IsInstanceOf(thrown_exception, exception_class)); in TEST_F()
2003 EXPECT_EQ(JNI_OK, env_->ThrowNew(exception_class, nullptr)); in TEST_F()
2004 EXPECT_TRUE(env_->ExceptionCheck()); in TEST_F()
2005 thrown_exception = env_->ExceptionOccurred(); in TEST_F()
2006 env_->ExceptionClear(); in TEST_F()
2007 EXPECT_TRUE(env_->IsInstanceOf(thrown_exception, exception_class)); in TEST_F()
2012 EXPECT_EQ(JNI_ERR, env_->ThrowNew(nullptr, nullptr)); in TEST_F()
2015 EXPECT_EQ(JNI_ERR, env_->ThrowNew(nullptr, nullptr)); in TEST_F()
2038 jclass buffer_class = env_->FindClass("java/nio/Buffer"); in TEST_F()
2042 jobject buffer = env_->NewDirectByteBuffer(bytes, sizeof(bytes)); in TEST_F()
2044 ASSERT_TRUE(env_->IsInstanceOf(buffer, buffer_class)); in TEST_F()
2045 ASSERT_EQ(env_->GetDirectBufferAddress(buffer), bytes); in TEST_F()
2046 ASSERT_EQ(env_->GetDirectBufferCapacity(buffer), static_cast<jlong>(sizeof(bytes))); in TEST_F()
2050 env_->NewDirectByteBuffer(bytes, static_cast<jlong>(INT_MAX) + 1); in TEST_F()
2060 jclass object_class = env_->FindClass("java/lang/Object"); in TEST_F()
2062 jobject object = env_->AllocObject(object_class); in TEST_F()
2066 jclass imse_class = env_->FindClass("java/lang/IllegalMonitorStateException"); in TEST_F()
2072 env_->MonitorExit(object); in TEST_F()
2073 EXPECT_TRUE(env_->ExceptionCheck()); in TEST_F()
2074 thrown_exception = env_->ExceptionOccurred(); in TEST_F()
2075 env_->ExceptionClear(); in TEST_F()
2076 EXPECT_TRUE(env_->IsInstanceOf(thrown_exception, imse_class)); in TEST_F()
2079 env_->MonitorEnter(object); in TEST_F()
2080 EXPECT_FALSE(env_->ExceptionCheck()); in TEST_F()
2082 env_->MonitorExit(object); in TEST_F()
2083 EXPECT_FALSE(env_->ExceptionCheck()); in TEST_F()
2088 env_->MonitorEnter(object); in TEST_F()
2089 EXPECT_FALSE(env_->ExceptionCheck()); in TEST_F()
2093 env_->MonitorExit(object); in TEST_F()
2094 EXPECT_FALSE(env_->ExceptionCheck()); in TEST_F()
2098 env_->MonitorExit(object); in TEST_F()
2099 EXPECT_TRUE(env_->ExceptionCheck()); in TEST_F()
2100 thrown_exception = env_->ExceptionOccurred(); in TEST_F()
2101 env_->ExceptionClear(); in TEST_F()
2102 EXPECT_TRUE(env_->IsInstanceOf(thrown_exception, imse_class)); in TEST_F()
2107 env_->MonitorEnter(nullptr); in TEST_F()
2109 env_->MonitorExit(nullptr); in TEST_F()