diff options
author | 2023-11-17 17:02:09 +0000 | |
---|---|---|
committer | 2023-11-17 19:09:04 +0000 | |
commit | cb7cfe5dec30e5ec802cfd4eb872f9a7669bac8e (patch) | |
tree | 6d1e16fa34128a451809ea24b5c6f34106d8986b /runtime/class_loader_context.cc | |
parent | de6567b8fc3a08ac70ffbfef0fb4d73009b1d895 (diff) |
Fix the ClassLoaderContext mismatch error message.
Before this change, ClassLoaderContext encoding relied on
`info.opened_dex_files`. This doesn't work for the error message
presentation because we no longer open dex files for ClassLoaderContext
verification since https://r.android.com/1531339. This problem leads to
empty dex paths in the error message and causes confusion. Note that it
does not affect the correctness of ClassLoaderContext verification.
This change fixes the presentation problem.
Bug: 311126962
Test: m test-art-host-gtest-art_runtime_tests
Change-Id: I83972aba7d06a086b7684e2c7ac7640e135e0ee0
Diffstat (limited to 'runtime/class_loader_context.cc')
-rw-r--r-- | runtime/class_loader_context.cc | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/runtime/class_loader_context.cc b/runtime/class_loader_context.cc index afdbb4a38a..e6cb6d6f8e 100644 --- a/runtime/class_loader_context.cc +++ b/runtime/class_loader_context.cc @@ -696,20 +696,17 @@ void ClassLoaderContext::EncodeContextInternal(const ClassLoaderInfo& info, } } - for (size_t k = 0; k < info.opened_dex_files.size();) { - const std::unique_ptr<const DexFile>& dex_file = info.opened_dex_files[k]; - uint32_t checksum = DexFileLoader::GetMultiDexChecksum(info.opened_dex_files, &k); - CHECK(!DexFileLoader::IsMultiDexLocation(dex_file->GetLocation())); - + DCHECK_EQ(info.classpath.size(), info.checksums.size()); + for (size_t i = 0; i < info.classpath.size(); i++) { if (for_dex2oat) { // De-duplicate locations. - bool new_insert = seen_locations.insert(dex_file->GetLocation()).second; + bool new_insert = seen_locations.insert(info.classpath[i]).second; if (!new_insert) { continue; } } - std::string location = dex_file->GetLocation(); + std::string location = info.classpath[i]; // If there is a stored class loader remap, fix up the multidex strings. if (!remap.empty()) { auto it = remap.find(location); @@ -720,7 +717,7 @@ void ClassLoaderContext::EncodeContextInternal(const ClassLoaderInfo& info, // dex2oat does not need the checksums. if (!for_dex2oat) { - checksums.push_back(checksum); + checksums.push_back(info.checksums[i]); } } EncodeClassPath(base_dir, locations, checksums, info.type, out); |