Fix transaction_test after libcore changes.

Compensate for long[][].class being in the boot image.

Test: m test-art-host-gtest
Bug: 164435690
Change-Id: I900a53b3d40fbd9d5696065e099c43b17121601a
diff --git a/runtime/transaction_test.cc b/runtime/transaction_test.cc
index 74725c2..2964427 100644
--- a/runtime/transaction_test.cc
+++ b/runtime/transaction_test.cc
@@ -655,31 +655,35 @@
   ASSERT_TRUE(instance_fields_test_object != nullptr);
   ASSERT_FALSE(heap->ObjectIsInBootImageSpace(instance_fields_test_object.Get()));
 
-  Handle<mirror::Class> long_array_dim2_class = hs.NewHandle(
-      class_linker_->FindClass(soa.Self(), "[[J", class_loader));
-  ASSERT_TRUE(long_array_dim2_class != nullptr);
-  ASSERT_FALSE(heap->ObjectIsInBootImageSpace(long_array_dim2_class.Get()));
-  ASSERT_TRUE(heap->ObjectIsInBootImageSpace(long_array_dim2_class->GetComponentType()));
-  Handle<mirror::Array> long_array_dim2 = hs.NewHandle(mirror::Array::Alloc(
+  // The `long[].class` should be in the boot image but `long[][][].class` should not.
+  // (We have seen `long[][].class` both present and missing from the boot image,
+  // depending on the libcore code, so we do not use it for this test.)
+  Handle<mirror::Class> long_array_dim3_class = hs.NewHandle(
+      class_linker_->FindClass(soa.Self(), "[[[J", class_loader));
+  ASSERT_TRUE(long_array_dim3_class != nullptr);
+  ASSERT_FALSE(heap->ObjectIsInBootImageSpace(long_array_dim3_class.Get()));
+  ASSERT_TRUE(heap->ObjectIsInBootImageSpace(
+      long_array_dim3_class->GetComponentType()->GetComponentType()));
+  Handle<mirror::Array> long_array_dim3 = hs.NewHandle(mirror::Array::Alloc(
       soa.Self(),
-      long_array_dim2_class.Get(),
+      long_array_dim3_class.Get(),
       /*component_count=*/ 1,
-      long_array_dim2_class->GetComponentSizeShift(),
+      long_array_dim3_class->GetComponentSizeShift(),
       heap->GetCurrentAllocator()));
-  ASSERT_TRUE(long_array_dim2 != nullptr);
-  ASSERT_FALSE(heap->ObjectIsInBootImageSpace(long_array_dim2.Get()));
+  ASSERT_TRUE(long_array_dim3 != nullptr);
+  ASSERT_FALSE(heap->ObjectIsInBootImageSpace(long_array_dim3.Get()));
   Handle<mirror::Array> long_array = hs.NewHandle(mirror::Array::Alloc(
       soa.Self(),
-      long_array_dim2_class->GetComponentType(),
+      long_array_dim3_class->GetComponentType()->GetComponentType(),
       /*component_count=*/ 1,
-      long_array_dim2_class->GetComponentType()->GetComponentSizeShift(),
+      long_array_dim3_class->GetComponentType()->GetComponentType()->GetComponentSizeShift(),
       heap->GetCurrentAllocator()));
   ASSERT_TRUE(long_array != nullptr);
   ASSERT_FALSE(heap->ObjectIsInBootImageSpace(long_array.Get()));
 
   // Use the Array's IfTable as an array from the boot image.
   Handle<mirror::ObjectArray<mirror::Object>> array_iftable =
-      hs.NewHandle(long_array_dim2_class->GetIfTable());
+      hs.NewHandle(long_array_dim3_class->GetIfTable());
   ASSERT_TRUE(array_iftable != nullptr);
   ASSERT_TRUE(heap->ObjectIsInBootImageSpace(array_iftable.Get()));
 
@@ -698,12 +702,12 @@
   // Instance field or array element not in boot image.
   // Do not check ReadConstraint(), it expects only static fields (checks for class object).
   EXPECT_FALSE(transaction.WriteConstraint(soa.Self(), instance_fields_test_object.Get()));
-  EXPECT_FALSE(transaction.WriteConstraint(soa.Self(), long_array_dim2.Get()));
+  EXPECT_FALSE(transaction.WriteConstraint(soa.Self(), long_array_dim3.Get()));
   // Write value constraints.
   EXPECT_FALSE(transaction.WriteValueConstraint(soa.Self(), static_fields_test_class.Get()));
   EXPECT_FALSE(transaction.WriteValueConstraint(soa.Self(), instance_fields_test_object.Get()));
-  EXPECT_TRUE(transaction.WriteValueConstraint(soa.Self(), long_array_dim2->GetClass()));
-  EXPECT_TRUE(transaction.WriteValueConstraint(soa.Self(), long_array_dim2.Get()));
+  EXPECT_TRUE(transaction.WriteValueConstraint(soa.Self(), long_array_dim3->GetClass()));
+  EXPECT_TRUE(transaction.WriteValueConstraint(soa.Self(), long_array_dim3.Get()));
   EXPECT_FALSE(transaction.WriteValueConstraint(soa.Self(), long_array->GetClass()));
   EXPECT_FALSE(transaction.WriteValueConstraint(soa.Self(), long_array.Get()));
 
@@ -722,7 +726,7 @@
   // Instance field or array element not in boot image.
   // Do not check ReadConstraint(), it expects only static fields (checks for class object).
   EXPECT_FALSE(strict_transaction.WriteConstraint(soa.Self(), instance_fields_test_object.Get()));
-  EXPECT_FALSE(strict_transaction.WriteConstraint(soa.Self(), long_array_dim2.Get()));
+  EXPECT_FALSE(strict_transaction.WriteConstraint(soa.Self(), long_array_dim3.Get()));
   // Static field in the same class.
   EXPECT_FALSE(strict_transaction.WriteConstraint(soa.Self(), static_field_class.Get()));
   EXPECT_FALSE(strict_transaction.ReadConstraint(soa.Self(), static_field_class.Get()));
@@ -731,8 +735,8 @@
   EXPECT_FALSE(
       strict_transaction.WriteValueConstraint(soa.Self(), instance_fields_test_object.Get()));
   // TODO: The following may be revised, see a TODO in Transaction::WriteValueConstraint().
-  EXPECT_FALSE(strict_transaction.WriteValueConstraint(soa.Self(), long_array_dim2->GetClass()));
-  EXPECT_FALSE(strict_transaction.WriteValueConstraint(soa.Self(), long_array_dim2.Get()));
+  EXPECT_FALSE(strict_transaction.WriteValueConstraint(soa.Self(), long_array_dim3->GetClass()));
+  EXPECT_FALSE(strict_transaction.WriteValueConstraint(soa.Self(), long_array_dim3.Get()));
   EXPECT_FALSE(strict_transaction.WriteValueConstraint(soa.Self(), long_array->GetClass()));
   EXPECT_FALSE(strict_transaction.WriteValueConstraint(soa.Self(), long_array.Get()));
 }