From 5c8b0317191b35b42a7921f60601c467db50c318 Mon Sep 17 00:00:00 2001 From: Desetude Date: Sat, 16 May 2020 20:19:57 +0100 Subject: [PATCH] Check if method is declared by interface in VisibilityTransformer Signed-off-by: Desetude --- .../openrs2/deob/transform/VisibilityTransformer.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/deob/src/main/java/dev/openrs2/deob/transform/VisibilityTransformer.kt b/deob/src/main/java/dev/openrs2/deob/transform/VisibilityTransformer.kt index aa246425c6..d0be1eb591 100644 --- a/deob/src/main/java/dev/openrs2/deob/transform/VisibilityTransformer.kt +++ b/deob/src/main/java/dev/openrs2/deob/transform/VisibilityTransformer.kt @@ -57,11 +57,6 @@ class VisibilityTransformer @Inject constructor(private val profile: Profile) : classAccess: Int, access: Int ): Int { - if (classAccess and Opcodes.ACC_INTERFACE != 0) { - // interface members are always public - return Opcodes.ACC_PUBLIC - } - val method = Type.getType(member.desc).sort == Type.METHOD if (method) { if (member.name == "") { @@ -81,6 +76,11 @@ class VisibilityTransformer @Inject constructor(private val profile: Profile) : val partitionReferences = references[partition] val partitionOwners = partition.mapTo(mutableSetOf(), MemberRef::owner) + val declaredByInterface = partitionOwners.any { classPath[it]!!.`interface` } + if (declaredByInterface) { + return Opcodes.ACC_PUBLIC + } + // pick the weakest access level based on references in our own code val visibility = when { partitionReferences.all { it == member.owner } && !hasOverride && !abstract -> Opcodes.ACC_PRIVATE