Skip to content

Commit

Permalink
Revert Dex2Jar (#721)
Browse files Browse the repository at this point in the history
* Revert attempts to fix Dex2Jar

* Revert to v64 of Dex2Jar
  • Loading branch information
Syer10 authored Oct 17, 2023
1 parent 150416b commit 029f445
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 32 deletions.
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -254,7 +224,7 @@ object BytecodeEditor {
super.visitMethodInsn(
opcode,
owner.replaceDirectly(),
name.replaceMethodIndirectly(owner),
name,
desc.replaceIndirectly(),
itf,
)
Expand Down

0 comments on commit 029f445

Please sign in to comment.