From 6c6edca8f9baba53bb464d9f836a544b2f4a19cb Mon Sep 17 00:00:00 2001 From: Sychic <47618543+Sychic@users.noreply.github.com> Date: Fri, 26 May 2023 10:17:03 -0400 Subject: Add support for `call`-style `@Invoker`s (#15) Fixes #13 --- src/main/kotlin/com/replaymod/gradle/remap/PsiMapper.kt | 1 + .../com/replaymod/gradle/remap/mapper/mixin/TestMixinAccessors.kt | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/src/main/kotlin/com/replaymod/gradle/remap/PsiMapper.kt b/src/main/kotlin/com/replaymod/gradle/remap/PsiMapper.kt index 1c5ac67..5dba364 100644 --- a/src/main/kotlin/com/replaymod/gradle/remap/PsiMapper.kt +++ b/src/main/kotlin/com/replaymod/gradle/remap/PsiMapper.kt @@ -444,6 +444,7 @@ internal class PsiMapper( val methodName = method.name val targetByName = when { methodName.startsWith("invoke") -> methodName.substring(6) + methodName.startsWith("call") -> methodName.substring(4) methodName.startsWith("is") -> methodName.substring(2) methodName.startsWith("get") || methodName.startsWith("set") -> methodName.substring(3) else -> null diff --git a/src/test/kotlin/com/replaymod/gradle/remap/mapper/mixin/TestMixinAccessors.kt b/src/test/kotlin/com/replaymod/gradle/remap/mapper/mixin/TestMixinAccessors.kt index 6d9fb38..0492569 100644 --- a/src/test/kotlin/com/replaymod/gradle/remap/mapper/mixin/TestMixinAccessors.kt +++ b/src/test/kotlin/com/replaymod/gradle/remap/mapper/mixin/TestMixinAccessors.kt @@ -14,6 +14,10 @@ class TestMixinAccessors { void invokeAMethod(); @org.spongepowered.asm.mixin.gen.Invoker("aMethod") void invokeBMethod(); + @org.spongepowered.asm.mixin.gen.Invoker + void callAMethod(); + @org.spongepowered.asm.mixin.gen.Invoker("aMethod") + void callBMethod(); } """.trimIndent()) shouldBe """ @org.spongepowered.asm.mixin.Mixin(b.pkg.B.class) @@ -22,6 +26,10 @@ class TestMixinAccessors { void invokeAMethod(); @org.spongepowered.asm.mixin.gen.Invoker void invokeBMethod(); + @org.spongepowered.asm.mixin.gen.Invoker("bMethod") + void callAMethod(); + @org.spongepowered.asm.mixin.gen.Invoker + void callBMethod(); } """.trimIndent() } -- cgit