diff options
author | Jonas Herzig <jonas@spark-squared.com> | 2021-11-10 19:29:29 +0100 |
---|---|---|
committer | Jonas Herzig <jonas@spark-squared.com> | 2021-11-10 20:32:40 +0100 |
commit | 971ee3e3186f1515e382985ab23a8d32899c5a07 (patch) | |
tree | c2810cd7d53b4c774f737a0747b2d11b2cb371cf /src/main/kotlin/com/replaymod/gradle | |
parent | 6883c516e73f55062f27a5f98e306149896c4907 (diff) | |
download | Remap-971ee3e3186f1515e382985ab23a8d32899c5a07.tar.gz Remap-971ee3e3186f1515e382985ab23a8d32899c5a07.tar.bz2 Remap-971ee3e3186f1515e382985ab23a8d32899c5a07.zip |
Remap mixin injector target arguments even when method is not mapped
E.g. there are no mapping entries for constructors cause their name is always
`<init>` but we nevertheless want to remap their argument types.
We cannot determine whether the name is ambiguous in the mapped
environment (because that check is based on the mappings), so we always keep the
arguments when it previously had ones.
Diffstat (limited to 'src/main/kotlin/com/replaymod/gradle')
-rw-r--r-- | src/main/kotlin/com/replaymod/gradle/remap/PsiMapper.kt | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/main/kotlin/com/replaymod/gradle/remap/PsiMapper.kt b/src/main/kotlin/com/replaymod/gradle/remap/PsiMapper.kt index a2be57a..3adc4f1 100644 --- a/src/main/kotlin/com/replaymod/gradle/remap/PsiMapper.kt +++ b/src/main/kotlin/com/replaymod/gradle/remap/PsiMapper.kt @@ -339,14 +339,15 @@ internal class PsiMapper( }}") } targetMethods.firstOrNull() - } ?: continue - val mappedName = findMapping(targetMethod)?.deobfuscatedName ?: continue + } + val mappedName = targetMethod?.let(::findMapping)?.deobfuscatedName ?: targetName val ambiguousName = mapping.methodMappings.count { it.deobfuscatedName == mappedName } > 1 - val mapped = mappedName + if (ambiguousName) { - remapMethodDesc(ClassUtil.getAsmMethodSignature(targetMethod)) - } else { - "" + val mapped = mappedName + when { + ambiguousName && targetMethod != null -> + remapMethodDesc(ClassUtil.getAsmMethodSignature(targetMethod)) + targetDesc != null -> remapMethodDesc(targetDesc) + else -> "" } if (mapped != literalValue) { |