aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/com/replaymod/gradle
diff options
context:
space:
mode:
authorJonas Herzig <jonas@spark-squared.com>2021-11-13 10:09:04 +0100
committerJonas Herzig <jonas@spark-squared.com>2021-11-13 10:28:09 +0100
commitf9fe968c431766ab0937f1b717700d2afa39c9bb (patch)
tree885b7f6051de70094b46a821d09d19d214961cea /src/main/kotlin/com/replaymod/gradle
parent26107cde7a9c47e444878736a9c34b64744c5f00 (diff)
downloadRemap-f9fe968c431766ab0937f1b717700d2afa39c9bb.tar.gz
Remap-f9fe968c431766ab0937f1b717700d2afa39c9bb.tar.bz2
Remap-f9fe968c431766ab0937f1b717700d2afa39c9bb.zip
Fix remapping of `@Invoker`s with unusual method names
Diffstat (limited to 'src/main/kotlin/com/replaymod/gradle')
-rw-r--r--src/main/kotlin/com/replaymod/gradle/remap/PsiMapper.kt6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/main/kotlin/com/replaymod/gradle/remap/PsiMapper.kt b/src/main/kotlin/com/replaymod/gradle/remap/PsiMapper.kt
index a71c4d1..210e2d4 100644
--- a/src/main/kotlin/com/replaymod/gradle/remap/PsiMapper.kt
+++ b/src/main/kotlin/com/replaymod/gradle/remap/PsiMapper.kt
@@ -437,7 +437,9 @@ internal class PsiMapper(
private fun remapAccessors(mapping: ClassMapping<*, *>) {
file.accept(object : JavaRecursiveElementVisitor() {
override fun visitMethod(method: PsiMethod) {
- val annotation = method.getAnnotation(CLASS_ACCESSOR) ?: method.getAnnotation(CLASS_INVOKER) ?: return
+ val accessorAnnotation = method.getAnnotation(CLASS_ACCESSOR)
+ val invokerAnnotation = method.getAnnotation(CLASS_INVOKER)
+ val annotation = accessorAnnotation ?: invokerAnnotation ?: return
val methodName = method.name
val targetByName = when {
@@ -451,7 +453,7 @@ internal class PsiMapper(
it.name == null || it.name == "value"
}?.literalValue ?: targetByName ?: throw IllegalArgumentException("Cannot determine accessor target for $method")
- val mapped = if (methodName.startsWith("invoke")) {
+ val mapped = if (invokerAnnotation != null) {
mapping.methodMappings.find { it.obfuscatedName == target }?.deobfuscatedName
} else {
mapping.findFieldMapping(target)?.deobfuscatedName