Check if method is declared by interface in VisibilityTransformer

Signed-off-by: Desetude <harry@desetude.com>
bzip2
Desetude 5 years ago committed by Graham
parent 04a919fffa
commit 5c8b031719
  1. 10
      deob/src/main/java/dev/openrs2/deob/transform/VisibilityTransformer.kt

@ -57,11 +57,6 @@ class VisibilityTransformer @Inject constructor(private val profile: Profile) :
classAccess: Int, classAccess: Int,
access: Int access: Int
): 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 val method = Type.getType(member.desc).sort == Type.METHOD
if (method) { if (method) {
if (member.name == "<clinit>") { if (member.name == "<clinit>") {
@ -81,6 +76,11 @@ class VisibilityTransformer @Inject constructor(private val profile: Profile) :
val partitionReferences = references[partition] val partitionReferences = references[partition]
val partitionOwners = partition.mapTo(mutableSetOf(), MemberRef::owner) 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 // pick the weakest access level based on references in our own code
val visibility = when { val visibility = when {
partitionReferences.all { it == member.owner } && !hasOverride && !abstract -> Opcodes.ACC_PRIVATE partitionReferences.all { it == member.owner } && !hasOverride && !abstract -> Opcodes.ACC_PRIVATE

Loading…
Cancel
Save