ART: Improve class initializer and constructor verification.

DEX file verifier checks additional properties of class initializers
and constructors:

(i) Names match expected <clinit> / <init>.
(ii) The method descriptor for <clinit> is ()V.
(iii) The return type of <init> is V.
(iV) No other names start with '<'.

Bug:  31313719
Change-Id: I60bffa6561e1bae353f97c42377ea556bfa790af
Test: m test-art-host-gtest-dex_file_verifier_test
diff --git a/runtime/dex_file_verifier.h b/runtime/dex_file_verifier.h
index 0327367..ae20613 100644
--- a/runtime/dex_file_verifier.h
+++ b/runtime/dex_file_verifier.h
@@ -153,13 +153,15 @@
   const char* CheckLoadStringByIdx(dex::StringIndex idx, const char* error_fmt);
   const char* CheckLoadStringByTypeIdx(dex::TypeIndex type_idx, const char* error_fmt);
 
-  // Load a field/method Id by index. Checks whether the index is in bounds, printing the error if
-  // not. If there is an error, null is returned.
+  // Load a field/method/proto Id by index. Checks whether the index is in bounds, printing the
+  // error if not. If there is an error, null is returned.
   const DexFile::FieldId* CheckLoadFieldId(uint32_t idx, const char* error_fmt);
   const DexFile::MethodId* CheckLoadMethodId(uint32_t idx, const char* error_fmt);
+  const DexFile::ProtoId* CheckLoadProtoId(uint32_t idx, const char* error_fmt);
 
   void ErrorStringPrintf(const char* fmt, ...)
       __attribute__((__format__(__printf__, 2, 3))) COLD_ATTR;
+  bool FailureReasonIsSet() const { return failure_reason_.size() != 0; }
 
   // Retrieve class index and class access flag from the given member. index is the member index,
   // which is taken as either a field or a method index (as designated by is_field). The result,
@@ -177,15 +179,20 @@
   bool CheckFieldAccessFlags(uint32_t idx,
                              uint32_t field_access_flags,
                              uint32_t class_access_flags,
-                             std::string* error_msg);
+                             std::string* error_message);
+
   // Check validity of the given method and access flags, in the context of a class with the given
   // second access flags.
   bool CheckMethodAccessFlags(uint32_t method_index,
                               uint32_t method_access_flags,
                               uint32_t class_access_flags,
+                              uint32_t constructor_flags_by_name,
                               bool has_code,
                               bool expect_direct,
-                              std::string* error_msg);
+                              std::string* error_message);
+
+  // Check validity of given method if it's a constructor or class initializer.
+  bool CheckConstructorProperties(uint32_t method_index, uint32_t constructor_flags);
 
   const DexFile* const dex_file_;
   const uint8_t* const begin_;