Do not record dependencies on arrays.

We do not record dependencies on arrays with component types in
the compiled DEX files, as the only thing that might change is their
access flags. If we were to change these flags in a breaking way, we would
need to enforce full verification again anyways.

Saves on doing type resolution during vdex update.

Test: test-art-host
Change-Id: Ib85e172a5cb99c2999eed8b6b37390aa6b5cac37
diff --git a/compiler/verifier_deps_test.cc b/compiler/verifier_deps_test.cc
index 23f54d7..85ae61f 100644
--- a/compiler/verifier_deps_test.cc
+++ b/compiler/verifier_deps_test.cc
@@ -539,21 +539,9 @@
   ASSERT_TRUE(HasAssignable("Ljava/util/TimeZone;", "Ljava/util/SimpleTimeZone;", true));
 }
 
-TEST_F(VerifierDepsTest, Assignable_BothArrays_Erroneous) {
-  ASSERT_TRUE(TestAssignabilityRecording(/* dst */ "[[Ljava/util/TimeZone;",
-                                         /* src */ "[[LMyErroneousTimeZone;",
-                                         /* is_strict */ true,
-                                         /* is_assignable */ true));
-  // If the component type of an array is erroneous, we record the dependency on
-  // the array type.
-  ASSERT_FALSE(HasAssignable("[[Ljava/util/TimeZone;", "[[LMyErroneousTimeZone;", true));
-  ASSERT_TRUE(HasAssignable("[Ljava/util/TimeZone;", "[LMyErroneousTimeZone;", true));
-  ASSERT_FALSE(HasAssignable("Ljava/util/TimeZone;", "LMyErroneousTimeZone;", true));
-}
-
-  // We test that VerifierDeps does not try to optimize by storing assignability
-  // of the component types. This is due to the fact that the component type may
-  // be an erroneous class, even though the array type has resolved status.
+// We test that VerifierDeps does not try to optimize by storing assignability
+// of the component types. This is due to the fact that the component type may
+// be an erroneous class, even though the array type has resolved status.
 
 TEST_F(VerifierDepsTest, Assignable_ArrayToInterface1) {
   ASSERT_TRUE(TestAssignabilityRecording(/* dst */ "Ljava/io/Serializable;",
@@ -608,16 +596,6 @@
   ASSERT_TRUE(HasClass("Ljava/lang/Thread;", true, "public"));
 }
 
-TEST_F(VerifierDepsTest, ArgumentType_ResolvedReferenceArray) {
-  ASSERT_TRUE(VerifyMethod("ArgumentType_ResolvedReferenceArray"));
-  ASSERT_TRUE(HasClass("[Ljava/lang/Thread;", true, "public final abstract"));
-}
-
-TEST_F(VerifierDepsTest, ArgumentType_ResolvedPrimitiveArray) {
-  ASSERT_TRUE(VerifyMethod("ArgumentType_ResolvedPrimitiveArray"));
-  ASSERT_TRUE(HasClass("[B", true, "public final abstract"));
-}
-
 TEST_F(VerifierDepsTest, ArgumentType_UnresolvedClass) {
   ASSERT_TRUE(VerifyMethod("ArgumentType_UnresolvedClass"));
   ASSERT_TRUE(HasClass("LUnresolvedClass;", false));
@@ -714,11 +692,6 @@
   ASSERT_TRUE(HasClass("LUnresolvedClass;", false));
 }
 
-TEST_F(VerifierDepsTest, NewArray_Resolved) {
-  ASSERT_TRUE(VerifyMethod("NewArray_Resolved"));
-  ASSERT_TRUE(HasClass("[Ljava/lang/IllegalStateException;", true, "public final abstract"));
-}
-
 TEST_F(VerifierDepsTest, NewArray_Unresolved) {
   ASSERT_TRUE(VerifyMethod("NewArray_Unresolved"));
   ASSERT_TRUE(HasClass("[LUnresolvedClass;", false));
diff --git a/runtime/verifier/verifier_deps.cc b/runtime/verifier/verifier_deps.cc
index 4cebb7b..5f94a1b 100644
--- a/runtime/verifier/verifier_deps.cc
+++ b/runtime/verifier/verifier_deps.cc
@@ -249,11 +249,12 @@
   if (dex_cache == nullptr) {
     // This is a synthesized class, in this case always an array. They are not
     // defined in the compiled DEX files and therefore are part of the classpath.
-    // We could avoid recording dependencies on arrays with component types in
-    // the compiled DEX files but we choose to record them anyway so as to
-    // record the access flags VM sets for array classes.
+    // We do not record dependencies on arrays with component types in
+    // the compiled DEX files, as the only thing that might change is their
+    // access flags. If we were to change these flags in a breaking way, we would
+    // need to enforce full verification again anyways by updating the vdex version.
     DCHECK(klass->IsArrayClass()) << klass->PrettyDescriptor();
-    return true;
+    return false;
   }
 
   const DexFile* dex_file = dex_cache->GetDexFile();