Lines Matching refs:Array
156 // But you must include it for an array of any reference type.
346 jbooleanArray array = env_->NewBooleanArray(10);
348 EXPECT_EQ(env_->GetByteArrayElements(reinterpret_cast<jbyteArray>(array), &is_copy), nullptr);
350 check_jni ? "incompatible array type boolean[] expected byte[]"
351 : "attempt to get byte primitive array elements with an object of type boolean[]");
352 EXPECT_EQ(env_->GetShortArrayElements(reinterpret_cast<jshortArray>(array), &is_copy), nullptr);
354 check_jni ? "incompatible array type boolean[] expected short[]"
355 : "attempt to get short primitive array elements with an object of type boolean[]");
356 EXPECT_EQ(env_->GetCharArrayElements(reinterpret_cast<jcharArray>(array), &is_copy), nullptr);
358 check_jni ? "incompatible array type boolean[] expected char[]"
359 : "attempt to get char primitive array elements with an object of type boolean[]");
360 EXPECT_EQ(env_->GetIntArrayElements(reinterpret_cast<jintArray>(array), &is_copy), nullptr);
362 check_jni ? "incompatible array type boolean[] expected int[]"
363 : "attempt to get int primitive array elements with an object of type boolean[]");
364 EXPECT_EQ(env_->GetLongArrayElements(reinterpret_cast<jlongArray>(array), &is_copy), nullptr);
366 check_jni ? "incompatible array type boolean[] expected long[]"
367 : "attempt to get long primitive array elements with an object of type boolean[]");
368 EXPECT_EQ(env_->GetFloatArrayElements(reinterpret_cast<jfloatArray>(array), &is_copy), nullptr);
370 check_jni ? "incompatible array type boolean[] expected float[]"
371 : "attempt to get float primitive array elements with an object of type boolean[]");
372 EXPECT_EQ(env_->GetDoubleArrayElements(reinterpret_cast<jdoubleArray>(array), &is_copy), nullptr);
374 check_jni ? "incompatible array type boolean[] expected double[]"
375 : "attempt to get double primitive array elements with an object of type boolean[]");
380 check_jni ? "incompatible array type byte[] expected boolean[]"
381 : "attempt to get boolean primitive array elements with an object of type byte[]");
386 check_jni ? "jarray argument has non-array type: java.lang.String"
387 : "attempt to get boolean primitive array elements with an object of type java.lang.String");
396 jbooleanArray array = env_->NewBooleanArray(10);
397 ASSERT_TRUE(array != nullptr);
399 jboolean* elements = env_->GetBooleanArrayElements(array, &is_copy);
401 env_->ReleaseByteArrayElements(reinterpret_cast<jbyteArray>(array),
404 check_jni ? "incompatible array type boolean[] expected byte[]"
405 : "attempt to release byte primitive array elements with an object of type boolean[]");
406 env_->ReleaseShortArrayElements(reinterpret_cast<jshortArray>(array),
409 check_jni ? "incompatible array type boolean[] expected short[]"
410 : "attempt to release short primitive array elements with an object of type boolean[]");
411 env_->ReleaseCharArrayElements(reinterpret_cast<jcharArray>(array),
414 check_jni ? "incompatible array type boolean[] expected char[]"
415 : "attempt to release char primitive array elements with an object of type boolean[]");
416 env_->ReleaseIntArrayElements(reinterpret_cast<jintArray>(array),
419 check_jni ? "incompatible array type boolean[] expected int[]"
420 : "attempt to release int primitive array elements with an object of type boolean[]");
421 env_->ReleaseLongArrayElements(reinterpret_cast<jlongArray>(array),
424 check_jni ? "incompatible array type boolean[] expected long[]"
425 : "attempt to release long primitive array elements with an object of type boolean[]");
426 env_->ReleaseFloatArrayElements(reinterpret_cast<jfloatArray>(array),
429 check_jni ? "incompatible array type boolean[] expected float[]"
430 : "attempt to release float primitive array elements with an object of type boolean[]");
431 env_->ReleaseDoubleArrayElements(reinterpret_cast<jdoubleArray>(array),
434 check_jni ? "incompatible array type boolean[] expected double[]"
435 : "attempt to release double primitive array elements with an object of type boolean[]");
437 // Don't leak the elements array.
438 env_->ReleaseBooleanArrayElements(array, elements, 0);
441 jbyteArray array = env_->NewByteArray(10);
443 jbyte* elements = env_->GetByteArrayElements(array, &is_copy);
445 env_->ReleaseBooleanArrayElements(reinterpret_cast<jbooleanArray>(array),
448 check_jni ? "incompatible array type byte[] expected boolean[]"
449 : "attempt to release boolean primitive array elements with an object of type byte[]");
454 check_jni ? "jarray argument has non-array type: java.lang.String"
455 : "attempt to release boolean primitive array elements with an object of type "
458 // Don't leak the elements array.
459 env_->ReleaseByteArrayElements(array, elements, 0);
471 jni_abort_catcher.Check(check_jni ? "jarray argument has non-array type: java.lang.String"
472 : "expected primitive array, given java.lang.String");
474 jni_abort_catcher.Check(check_jni ? "jarray argument has non-array type: java.lang.String"
475 : "expected primitive array, given java.lang.String");
484 jbooleanArray array = env_->NewBooleanArray(kLength);
485 ASSERT_TRUE(array != nullptr);
487 env_->GetByteArrayRegion(reinterpret_cast<jbyteArray>(array), 0, kLength,
490 check_jni ? "incompatible array type boolean[] expected byte[]"
491 : "attempt to get region of byte primitive array elements with an object of type boolean[]");
492 env_->GetShortArrayRegion(reinterpret_cast<jshortArray>(array), 0, kLength,
495 check_jni ? "incompatible array type boolean[] expected short[]"
496 : "attempt to get region of short primitive array elements with an object of type boolean[]");
497 env_->GetCharArrayRegion(reinterpret_cast<jcharArray>(array), 0, kLength,
500 check_jni ? "incompatible array type boolean[] expected char[]"
501 : "attempt to get region of char primitive array elements with an object of type boolean[]");
502 env_->GetIntArrayRegion(reinterpret_cast<jintArray>(array), 0, kLength,
505 check_jni ? "incompatible array type boolean[] expected int[]"
506 : "attempt to get region of int primitive array elements with an object of type boolean[]");
507 env_->GetLongArrayRegion(reinterpret_cast<jlongArray>(array), 0, kLength,
510 check_jni ? "incompatible array type boolean[] expected long[]"
511 : "attempt to get region of long primitive array elements with an object of type boolean[]");
512 env_->GetFloatArrayRegion(reinterpret_cast<jfloatArray>(array), 0, kLength,
515 check_jni ? "incompatible array type boolean[] expected float[]"
516 : "attempt to get region of float primitive array elements with an object of type boolean[]");
517 env_->GetDoubleArrayRegion(reinterpret_cast<jdoubleArray>(array), 0, kLength,
520 check_jni ? "incompatible array type boolean[] expected double[]"
521 : "attempt to get region of double primitive array elements with an object of type boolean[]");
526 check_jni ? "incompatible array type byte[] expected boolean[]"
527 : "attempt to get region of boolean primitive array elements with an object of type byte[]");
531 jni_abort_catcher.Check(check_jni ? "jarray argument has non-array type: java.lang.String"
532 : "attempt to get region of boolean primitive array elements with an object of type "
542 jbooleanArray array = env_->NewBooleanArray(kLength);
543 ASSERT_TRUE(array != nullptr);
545 env_->SetByteArrayRegion(reinterpret_cast<jbyteArray>(array), 0, kLength,
548 check_jni ? "incompatible array type boolean[] expected byte[]"
549 : "attempt to set region of byte primitive array elements with an object of type boolean[]");
550 env_->SetShortArrayRegion(reinterpret_cast<jshortArray>(array), 0, kLength,
553 check_jni ? "incompatible array type boolean[] expected short[]"
554 : "attempt to set region of short primitive array elements with an object of type boolean[]");
555 env_->SetCharArrayRegion(reinterpret_cast<jcharArray>(array), 0, kLength,
558 check_jni ? "incompatible array type boolean[] expected char[]"
559 : "attempt to set region of char primitive array elements with an object of type boolean[]");
560 env_->SetIntArrayRegion(reinterpret_cast<jintArray>(array), 0, kLength,
563 check_jni ? "incompatible array type boolean[] expected int[]"
564 : "attempt to set region of int primitive array elements with an object of type boolean[]");
565 env_->SetLongArrayRegion(reinterpret_cast<jlongArray>(array), 0, kLength,
568 check_jni ? "incompatible array type boolean[] expected long[]"
569 : "attempt to set region of long primitive array elements with an object of type boolean[]");
570 env_->SetFloatArrayRegion(reinterpret_cast<jfloatArray>(array), 0, kLength,
573 check_jni ? "incompatible array type boolean[] expected float[]"
574 : "attempt to set region of float primitive array elements with an object of type boolean[]");
575 env_->SetDoubleArrayRegion(reinterpret_cast<jdoubleArray>(array), 0, kLength,
578 check_jni ? "incompatible array type boolean[] expected double[]"
579 : "attempt to set region of double primitive array elements with an object of type boolean[]");
584 check_jni ? "incompatible array type byte[] expected boolean[]"
585 : "attempt to set region of boolean primitive array elements with an object of type byte[]");
589 jni_abort_catcher.Check(check_jni ? "jarray argument has non-array type: java.lang.String"
590 : "attempt to set region of boolean primitive array elements with an object of type "
603 jni_abort_catcher.Check(check_jni ? "negative jsize: -1" : "negative array length: -1");
607 : "negative array length: -2147483648");
1033 /* Allocate an negative sized array and check it has the right failure type. */ \
1035 jni_abort_catcher.Check("negative array length: -1"); \
1037 jni_abort_catcher.Check("negative array length: -2147483648"); \
1038 /* Pass the array as null. */ \
1050 scalar_type ## Array a = env_->new_fn(size); \
1057 /* Allocate an array and check it has the right type and length. */ \
1058 scalar_type ## Array a = env_->new_fn(size); \
1117 /* Copy back the whole array. */ \
1207 // Negative array length checks.
1255 // Attempt to incorrect create an array of strings with initial value of string arrays.
1258 jni_abort_catcher.Check("cannot assign object of type 'java.lang.String[]' to array with element "
1648 jobjectArray array = env_->NewObjectArray(1, java_lang_Class, nullptr);
1649 EXPECT_NE(array, nullptr);
1650 EXPECT_EQ(env_->GetObjectArrayElement(array, 0), nullptr);
1651 env_->SetObjectArrayElement(array, 0, java_lang_Class);
1652 EXPECT_TRUE(env_->IsSameObject(env_->GetObjectArrayElement(array, 0), java_lang_Class));
1655 env_->SetObjectArrayElement(array, -1, java_lang_Class);
1659 env_->SetObjectArrayElement(array, 1, java_lang_Class);
1663 env_->SetObjectArrayElement(array, 0, env_->NewStringUTF("not a jclass!"));
1666 // Null as array should fail.