forked from ReVanced/revanced-patcher
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Classes not being written properly because of array shifting
We now use a MutableList to replace it at the proper index, and use a ListBackedSet, so we don't copy List's to Set's for no reason. This was a very bad issue. The array was shifted every time we removed the original class, the fact we even got a "working" dex file surprises me. Thankfully, this issue is now solved, and we lived happily after.
- Loading branch information
Showing
4 changed files
with
21 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
src/main/kotlin/app/revanced/patcher/util/ListBackedSet.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package app.revanced.patcher.util | ||
|
||
class ListBackedSet<E>(private val list: MutableList<E>) : MutableSet<E> { | ||
override val size get() = list.size | ||
override fun add(element: E) = list.add(element) | ||
override fun addAll(elements: Collection<E>) = list.addAll(elements) | ||
override fun clear() = list.clear() | ||
override fun iterator() = list.listIterator() | ||
override fun remove(element: E) = list.remove(element) | ||
override fun removeAll(elements: Collection<E>) = list.removeAll(elements) | ||
override fun retainAll(elements: Collection<E>) = list.retainAll(elements) | ||
override fun contains(element: E) = list.contains(element) | ||
override fun containsAll(elements: Collection<E>) = list.containsAll(elements) | ||
override fun isEmpty() = list.isEmpty() | ||
} |