summaryrefslogtreecommitdiff
path: root/runtime/class_loader_context.h
diff options
context:
space:
mode:
author Calin Juravle <calin@google.com> 2020-04-06 19:29:45 -0700
committer Calin Juravle <calin@google.com> 2020-04-08 23:49:43 +0000
commitb495e7ffac8782dd2fc7c1a7fa7c69da71d98c1c (patch)
tree723728edcc663257640a6d0b82785992174c6f1b /runtime/class_loader_context.h
parent82cc2a247d9fb9bb8d1d28a09d978f66d0b1c4dd (diff)
Log an error when an app loads duplicate dex files
Creating a class loader with duplicate dex files in its classpath is most likely an unintended bug. That leads to rejecting any compiled code and hurts performance by extracting in memory. Test: run-test gtest Bug: 149410951 Change-Id: Ieebb69c6bd03acbe95dd8bedb6101d70390b92d8
Diffstat (limited to 'runtime/class_loader_context.h')
-rw-r--r--runtime/class_loader_context.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/runtime/class_loader_context.h b/runtime/class_loader_context.h
index 42ecd3d688..31fd092153 100644
--- a/runtime/class_loader_context.h
+++ b/runtime/class_loader_context.h
@@ -166,6 +166,11 @@ class ClassLoaderContext {
bool verify_names = true,
bool verify_checksums = true) const;
+ // Checks if any of the given dex files is already loaded in the current class loader context.
+ // Returns the list of duplicate dex files (empty if there are no duplicates).
+ std::vector<const DexFile*> CheckForDuplicateDexFiles(
+ const std::vector<const DexFile*>& dex_files);
+
// Creates the class loader context from the given string.
// The format: ClassLoaderType1[ClasspathElem1:ClasspathElem2...];ClassLoaderType2[...]...
// ClassLoaderType is either "PCL" (PathClassLoader) or "DLC" (DelegateLastClassLoader).