From 029f445d0a7b5a58de8c5c88b4aec71106fe9821 Mon Sep 17 00:00:00 2001 From: Mitchell Syer Date: Mon, 16 Oct 2023 20:13:06 -0400 Subject: [PATCH] Revert Dex2Jar (#721) * Revert attempts to fix Dex2Jar * Revert to v64 of Dex2Jar --- gradle/libs.versions.toml | 2 +- .../manga/impl/util/BytecodeEditor.kt | 32 +------------------ 2 files changed, 2 insertions(+), 32 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index ce8bc113..5508a041 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -6,7 +6,7 @@ okhttp = "5.0.0-alpha.11" # Major version is locked by Tachiyomi extensions javalin = "4.6.8" # Javalin 5.0.0+ requires Java 11 jackson = "2.13.3" # jackson version locked by javalin, ref: `io.javalin.core.util.OptionalDependency` exposed = "0.40.1" -dex2jar = "v74" +dex2jar = "v64" # Stuck until https://github.com/ThexXTURBOXx/dex2jar/issues/27 is fixed rhino = "1.7.14" settings = "1.0.0-RC" twelvemonkeys = "3.9.4" diff --git a/server/src/main/kotlin/suwayomi/tachidesk/manga/impl/util/BytecodeEditor.kt b/server/src/main/kotlin/suwayomi/tachidesk/manga/impl/util/BytecodeEditor.kt index 23e485ad..625eb102 100644 --- a/server/src/main/kotlin/suwayomi/tachidesk/manga/impl/util/BytecodeEditor.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/manga/impl/util/BytecodeEditor.kt @@ -119,36 +119,6 @@ object BytecodeEditor { return classReference } - /** - * List of methods that will be fixed. Remove once https://github.com/ThexXTURBOXx/dex2jar/issues/27 - * is fixed. - */ - private val methodsToFix = - mapOf( - ("kotlin/time/Duration" to "getInWholeMilliseconds_impl") to "getInWholeMilliseconds-impl", - ("kotlin/Result" to "constructor_impl") to "constructor-impl", - ("kotlin/Result" to "isFailure_impl") to "isFailure-impl", - ) - - /** - * Replace references to the method, used in places that have - * other text around the class references - * - * @param clazz Class the method is in - * - * @return [String] with method reference replaced, or null if [String] or [clazz] was null - */ - private fun String?.replaceMethodIndirectly(clazz: String?): String? { - if (clazz == null || this == null) return this - var method: String = this - methodsToFix.forEach { - if (clazz == it.key.first) { - method = method.replace(it.key.second, it.value) - } - } - return method - } - /** * Replace all references to certain classes inside the class file * with ones that behave more like Androids @@ -254,7 +224,7 @@ object BytecodeEditor { super.visitMethodInsn( opcode, owner.replaceDirectly(), - name.replaceMethodIndirectly(owner), + name, desc.replaceIndirectly(), itf, )