Clinits may not have the kAccConstructor flag.
Bug: 11157540
Set the clinit access flag when we load the method and warn about badly
formed access flags.
Change-Id: I515c692095051f84f98510722ab764591185918e
diff --git a/runtime/mirror/class.cc b/runtime/mirror/class.cc
index b16c2f7..2b0b1e1 100644
--- a/runtime/mirror/class.cc
+++ b/runtime/mirror/class.cc
@@ -500,6 +500,7 @@
if (method->IsConstructor() && method->IsStatic()) {
if (kIsDebugBuild) {
MethodHelper mh(method);
+ CHECK(mh.IsClassInitializer());
CHECK_STREQ(mh.GetName(), "<clinit>");
CHECK_STREQ(mh.GetSignature().ToString().c_str(), "()V");
}
diff --git a/runtime/mirror/object_test.cc b/runtime/mirror/object_test.cc
index 1e610f2..4c5f90c 100644
--- a/runtime/mirror/object_test.cc
+++ b/runtime/mirror/object_test.cc
@@ -270,7 +270,7 @@
Class* klass =
class_linker_->FindClass("LStaticsFromCode;", soa.Decode<ClassLoader*>(class_loader));
- ArtMethod* clinit = klass->FindDirectMethod("<clinit>", "()V");
+ ArtMethod* clinit = klass->FindClassInitializer();
const DexFile::StringId* klass_string_id = dex_file->FindStringId("LStaticsFromCode;");
ASSERT_TRUE(klass_string_id != NULL);
const DexFile::TypeId* klass_type_id = dex_file->FindTypeId(