Skip to content

Commit

Permalink
Fix RelocatorRemapper: do not map inner class name if not changed
Browse files Browse the repository at this point in the history
  • Loading branch information
Him188 committed Sep 16, 2022
1 parent 3844331 commit 9c0b051
Showing 1 changed file with 29 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,32 @@ class RelocatorRemapper extends Remapper {
mapPath(path.pathString)
}

}
@Override
String mapInnerClassName(String name, String ownerName, String innerName) {
final String remappedInnerName = this.mapType(name)

if (remappedInnerName == name) {
return innerName
} else {
int originSplit = name.lastIndexOf('/')
int remappedSplit = remappedInnerName.lastIndexOf('/')
if (originSplit != -1 && remappedSplit != -1) {
if (name.substring(originSplit) == remappedInnerName.substring(remappedSplit)) {
// class name not changed
return innerName
}
}
}

if (remappedInnerName.contains('$')) {
int index = remappedInnerName.lastIndexOf('$') + 1
while (index < remappedInnerName.length()
&& Character.isDigit(remappedInnerName.charAt(index))) {
index++
}
return remappedInnerName.substring(index)
} else {
return innerName
}
}
}

0 comments on commit 9c0b051

Please sign in to comment.