diff --git a/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/impl/RelocatorRemapper.groovy b/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/impl/RelocatorRemapper.groovy index b994463d1..29d590c49 100644 --- a/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/impl/RelocatorRemapper.groovy +++ b/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/impl/RelocatorRemapper.groovy @@ -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 + } + } +} \ No newline at end of file