From e810197e2aa64534f2e8637165d884cbefbce8ae Mon Sep 17 00:00:00 2001 From: Lucaskyy Date: Sat, 9 Apr 2022 22:44:57 +0200 Subject: [PATCH] revert: previous commits check for dupes in dexFile, not cache This reverts commit aed4fd9a3c9e7f96c1e2c54b831c3fe7d3d720a2. This reverts commit 622138736dca6c0161171330801b7b5666594ec7. --- src/main/kotlin/app/revanced/patcher/Patcher.kt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main/kotlin/app/revanced/patcher/Patcher.kt b/src/main/kotlin/app/revanced/patcher/Patcher.kt index a0f2ba77..533f89fb 100644 --- a/src/main/kotlin/app/revanced/patcher/Patcher.kt +++ b/src/main/kotlin/app/revanced/patcher/Patcher.kt @@ -43,16 +43,14 @@ class Patcher( fun addFiles(vararg files: File, throwOnDuplicates: Boolean = false) { for (file in files) { val dexFile = MultiDexIO.readDexFile(true, files[0], NAMER, null, null) - val classes = mutableSetOf() for (classDef in dexFile.classes) { - if (classes.add(classDef.type)) { // has duplicate + if (cache.classes.any { it.type == classDef.type }) { + // TODO: Use logger and warn about duplicate classes if (throwOnDuplicates) throw Exception("Class ${classDef.type} has already been added to the patcher.") - continue } cache.classes.add(classDef) } - classes.clear() } } /**