Fix jvmti bug when redefining a boot classpath class.
We were not using the right dex cache when registering the new dex file.
Test: test.py
Bug: 218984107
Change-Id: I43c581b46b4624ca9b1430dfe6164a04cb4089a1
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index 428136a..9d2755c 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -3753,6 +3753,7 @@
ObjPtr<mirror::DexCache> dex_cache) {
CHECK(dex_file != nullptr);
CHECK(dex_cache != nullptr) << dex_file->GetLocation();
+ CHECK_EQ(dex_cache->GetDexFile(), dex_file) << dex_file->GetLocation();
boot_class_path_.push_back(dex_file);
WriterMutexLock mu(Thread::Current(), *Locks::dex_lock_);
RegisterDexFileLocked(*dex_file, dex_cache, /* class_loader= */ nullptr);