diff --git a/asm/src/main/java/dev/openrs2/asm/classpath/AsmClassMetadata.kt b/asm/src/main/java/dev/openrs2/asm/classpath/AsmClassMetadata.kt index f98ce56864..e4e72fd073 100644 --- a/asm/src/main/java/dev/openrs2/asm/classpath/AsmClassMetadata.kt +++ b/asm/src/main/java/dev/openrs2/asm/classpath/AsmClassMetadata.kt @@ -27,8 +27,7 @@ class AsmClassMetadata( override val methods get() = clazz.methods.map { MemberDesc(it) }.toList() - override fun isNative(method: MemberDesc): Boolean { - val m = clazz.methods.find { it.name == method.name && it.desc == method.desc } ?: return false - return m.access and Opcodes.ACC_NATIVE != 0 + override fun getAccess(method: MemberDesc): Int? { + return clazz.methods.find { it.name == method.name && it.desc == method.desc }?.access } } diff --git a/asm/src/main/java/dev/openrs2/asm/classpath/ClassMetadata.kt b/asm/src/main/java/dev/openrs2/asm/classpath/ClassMetadata.kt index f593af7f4b..0a3b80beff 100644 --- a/asm/src/main/java/dev/openrs2/asm/classpath/ClassMetadata.kt +++ b/asm/src/main/java/dev/openrs2/asm/classpath/ClassMetadata.kt @@ -11,7 +11,7 @@ abstract class ClassMetadata { abstract val fields: List abstract val methods: List - abstract fun isNative(method: MemberDesc): Boolean + abstract fun getAccess(method: MemberDesc): Int? fun isOverride(method: MemberDesc): Boolean { val superClass = this.superClass diff --git a/asm/src/main/java/dev/openrs2/asm/classpath/ReflectionClassMetadata.kt b/asm/src/main/java/dev/openrs2/asm/classpath/ReflectionClassMetadata.kt index a8884ea1c8..e8ca3eddc7 100644 --- a/asm/src/main/java/dev/openrs2/asm/classpath/ReflectionClassMetadata.kt +++ b/asm/src/main/java/dev/openrs2/asm/classpath/ReflectionClassMetadata.kt @@ -2,7 +2,6 @@ package dev.openrs2.asm.classpath import dev.openrs2.asm.MemberDesc import org.objectweb.asm.Type -import java.lang.reflect.Modifier private val Class<*>.asmName: String get() = name.replace('.', '/') @@ -29,9 +28,8 @@ class ReflectionClassMetadata(private val classPath: ClassPath, private val claz override val methods get() = clazz.declaredMethods.map { MemberDesc(it.name, Type.getMethodDescriptor(it)) }.toList() - override fun isNative(method: MemberDesc): Boolean { - val m = clazz.declaredMethods.find { it.name == method.name && Type.getMethodDescriptor(it) == method.desc } - ?: return false - return Modifier.isNative(m.modifiers) + override fun getAccess(method: MemberDesc): Int? { + return clazz.declaredMethods.find { it.name == method.name && Type.getMethodDescriptor(it) == method.desc } + ?.modifiers } } diff --git a/deob/src/main/java/dev/openrs2/deob/remap/TypedRemapper.kt b/deob/src/main/java/dev/openrs2/deob/remap/TypedRemapper.kt index be64c0360c..19f6ec147c 100644 --- a/deob/src/main/java/dev/openrs2/deob/remap/TypedRemapper.kt +++ b/deob/src/main/java/dev/openrs2/deob/remap/TypedRemapper.kt @@ -7,6 +7,7 @@ import dev.openrs2.asm.classpath.ClassMetadata import dev.openrs2.asm.classpath.ClassPath import dev.openrs2.common.collect.DisjointSet import dev.openrs2.common.indefiniteArticle +import org.objectweb.asm.Opcodes import org.objectweb.asm.Type import org.objectweb.asm.commons.Remapper @@ -196,7 +197,8 @@ class TypedRemapper private constructor( return true } - if (clazz.isNative(MemberDesc(method))) { + val access = clazz.getAccess(MemberDesc(method)) + if (access != null && (access and Opcodes.ACC_NATIVE) != 0) { return true } }