From df6b808f49a1b82a325a9680acc50651376c250a Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Tue, 3 Dec 2024 19:52:39 -0800 Subject: [PATCH] Cleanup DesugarClassVisitorFactory --- buildSrc/src/main/java/DesugarClassVisitorFactory.kt | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/buildSrc/src/main/java/DesugarClassVisitorFactory.kt b/buildSrc/src/main/java/DesugarClassVisitorFactory.kt index a34ec1ec8..554911e0e 100644 --- a/buildSrc/src/main/java/DesugarClassVisitorFactory.kt +++ b/buildSrc/src/main/java/DesugarClassVisitorFactory.kt @@ -7,11 +7,14 @@ import org.objectweb.asm.MethodVisitor import org.objectweb.asm.Opcodes import org.objectweb.asm.Opcodes.ASM9 +private const val ZIP_ENTRY_CLASS_NAME = "java.util.zip.ZipEntry" private const val DESUGAR_CLASS_NAME = "com.topjohnwu.magisk.core.utils.Desugar" private const val ZIP_ENTRY_GET_TIME_DESC = "()Ljava/nio/file/attribute/FileTime;" private const val DESUGAR_GET_TIME_DESC = "(Ljava/util/zip/ZipEntry;)Ljava/nio/file/attribute/FileTime;" +private fun ClassData.isTypeOf(name: String) = className == name || superClasses.contains(name) + abstract class DesugarClassVisitorFactory : AsmClassVisitorFactory { override fun createClassVisitor( classContext: ClassContext, @@ -45,14 +48,15 @@ abstract class DesugarClassVisitorFactory : AsmClassVisitorFactory