aboutsummaryrefslogtreecommitdiff
path: root/src/test/kotlin
diff options
context:
space:
mode:
authorJonas Herzig <jonas@spark-squared.com>2021-11-10 19:29:29 +0100
committerJonas Herzig <jonas@spark-squared.com>2021-11-10 20:32:40 +0100
commit971ee3e3186f1515e382985ab23a8d32899c5a07 (patch)
treec2810cd7d53b4c774f737a0747b2d11b2cb371cf /src/test/kotlin
parent6883c516e73f55062f27a5f98e306149896c4907 (diff)
downloadRemap-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/test/kotlin')
-rw-r--r--src/test/kotlin/com/replaymod/gradle/remap/mapper/TestMixinInjections.kt38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/test/kotlin/com/replaymod/gradle/remap/mapper/TestMixinInjections.kt b/src/test/kotlin/com/replaymod/gradle/remap/mapper/TestMixinInjections.kt
index 7b9750e..3f8d55f 100644
--- a/src/test/kotlin/com/replaymod/gradle/remap/mapper/TestMixinInjections.kt
+++ b/src/test/kotlin/com/replaymod/gradle/remap/mapper/TestMixinInjections.kt
@@ -99,4 +99,42 @@ class TestMixinInjections {
}
""".trimIndent()
}
+
+ @Test
+ fun `remaps qualified method argument without mappings for target`() {
+ TestData.remap("""
+ @org.spongepowered.asm.mixin.Mixin(a.pkg.A.class)
+ class MixinA {
+ @org.spongepowered.asm.mixin.injection.Inject(method = "unmappedOverloaded(La/pkg/A;)V")
+ private void test() {}
+ }
+ """.trimIndent()) shouldBe """
+ @org.spongepowered.asm.mixin.Mixin(b.pkg.B.class)
+ class MixinA {
+ @org.spongepowered.asm.mixin.injection.Inject(method = "unmappedOverloaded(Lb/pkg/B;)V")
+ private void test() {}
+ }
+ """.trimIndent()
+ }
+
+ @Test
+ fun `remaps constructor target`() {
+ TestData.remap("""
+ @org.spongepowered.asm.mixin.Mixin(a.pkg.A.class)
+ class MixinA {
+ @org.spongepowered.asm.mixin.injection.Inject(method = "<init>()V")
+ private void test() {}
+ @org.spongepowered.asm.mixin.injection.Inject(method = "<init>(La/pkg/A;)V")
+ private void testArg() {}
+ }
+ """.trimIndent()) shouldBe """
+ @org.spongepowered.asm.mixin.Mixin(b.pkg.B.class)
+ class MixinA {
+ @org.spongepowered.asm.mixin.injection.Inject(method = "<init>()V")
+ private void test() {}
+ @org.spongepowered.asm.mixin.injection.Inject(method = "<init>(Lb/pkg/B;)V")
+ private void testArg() {}
+ }
+ """.trimIndent()
+ }
} \ No newline at end of file