diff options
| author | 2024-12-02 15:03:21 +0000 | |
|---|---|---|
| committer | 2024-12-02 15:03:21 +0000 | |
| commit | 99f2d5ecf4f5879fea0d298b3cdf0824cfaef72c (patch) | |
| tree | 6ebc3b39c36f816a18f9d625670a3f6514716912 /runtime/class_linker.cc | |
| parent | 187316590e9a34c50723f149d63912f4455fcb36 (diff) | |
| parent | dd303e6a584f9fb09813ec4b643261c2b33b0b53 (diff) | |
Only constructor names can start with `<`. am: dd303e6a58
Original change: https://android-review.googlesource.com/c/platform/art/+/3380037
Change-Id: Ied53430d7d2e55582098c8e26ca758d00908d1dc
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'runtime/class_linker.cc')
| -rw-r--r-- | runtime/class_linker.cc | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc index 0c9b6e2f55..c2926ac263 100644 --- a/runtime/class_linker.cc +++ b/runtime/class_linker.cc @@ -4165,16 +4165,13 @@ void ClassLinker::LoadMethod(const DexFile& dex_file, } } else if (method_name[0] == '<') { // Fix broken access flags for initializers. Bug 11157540. - bool is_init = has_ascii_name("<init>", sizeof("<init>") - 1u); - bool is_clinit = has_ascii_name("<clinit>", sizeof("<clinit>") - 1u); - if (UNLIKELY(!is_init && !is_clinit)) { - LOG(WARNING) << "Unexpected '<' at start of method name " << method_name; - } else { - if (UNLIKELY((access_flags & kAccConstructor) == 0)) { - LOG(WARNING) << method_name << " didn't have expected constructor access flag in class " - << klass->PrettyDescriptor() << " in dex file " << dex_file.GetLocation(); - access_flags |= kAccConstructor; - } + // `DexFileVerifier` rejects method names starting with '<' other than constructors. + DCHECK(has_ascii_name("<init>", sizeof("<init>") - 1u) || + has_ascii_name("<clinit>", sizeof("<clinit>") - 1u)) << method_name; + if (UNLIKELY((access_flags & kAccConstructor) == 0)) { + LOG(WARNING) << method_name << " didn't have expected constructor access flag in class " + << klass->PrettyDescriptor() << " in dex file " << dex_file.GetLocation(); + access_flags |= kAccConstructor; } } |