From 79530807256fd0e7c1a44b206c2e0625ded74053 Mon Sep 17 00:00:00 2001 From: "Josiah (Gaming32) Glosson" Date: Fri, 5 Jan 2024 12:03:26 -0600 Subject: [PATCH] Fix a test --- .../remap/mapper/mixin/TestMixinInjections.kt | 17 --------- .../gradle/remap/misc/TestMiscJavaCode.kt | 35 ++++++++++++++----- src/test/resources/mappings.srg | 4 +++ 3 files changed, 31 insertions(+), 25 deletions(-) diff --git a/src/test/kotlin/com/replaymod/gradle/remap/mapper/mixin/TestMixinInjections.kt b/src/test/kotlin/com/replaymod/gradle/remap/mapper/mixin/TestMixinInjections.kt index aa13fdd..3aca4d9 100644 --- a/src/test/kotlin/com/replaymod/gradle/remap/mapper/mixin/TestMixinInjections.kt +++ b/src/test/kotlin/com/replaymod/gradle/remap/mapper/mixin/TestMixinInjections.kt @@ -290,21 +290,4 @@ class TestMixinInjections { } """.trimIndent() } - - @Test - fun `remaps synthetic bridges that change the return type inside inner classes inside inner classes`() { - TestData.remap(""" - @org.spongepowered.asm.mixin.Mixin(a.pkg.A.InnerB.InnerC.class) - class MixinA { - @org.spongepowered.asm.mixin.injection.Inject(method = "getA()La/pkg/A${'$'}InnerB${'$'}InnerC") - private void test() {} - } - """.trimIndent()) shouldBe """ - @org.spongepowered.asm.mixin.Mixin(b.pkg.B.InnerB.InnerC.class) - class MixinA { - @org.spongepowered.asm.mixin.injection.Inject(method = "getB()Lb/pkg/B${'$'}InnerB${'$'}InnerC") - private void test() {} - } - """.trimIndent() - } } \ No newline at end of file diff --git a/src/test/kotlin/com/replaymod/gradle/remap/misc/TestMiscJavaCode.kt b/src/test/kotlin/com/replaymod/gradle/remap/misc/TestMiscJavaCode.kt index 0a11f01..5ad0020 100644 --- a/src/test/kotlin/com/replaymod/gradle/remap/misc/TestMiscJavaCode.kt +++ b/src/test/kotlin/com/replaymod/gradle/remap/misc/TestMiscJavaCode.kt @@ -8,15 +8,15 @@ class TestMiscJavaCode { @Test fun `remaps methods that have synthetic bridges that change the return type`() { TestData.remap(""" - public class Test { - public static void test() { + class Test { + void test() { final a.pkg.A value = null; value.aGeneratedSynthetic(); } } """.trimIndent()) shouldBe """ - public class Test { - public static void test() { + class Test { + void test() { final b.pkg.B value = null; value.bGeneratedSynthetic(); } @@ -27,19 +27,38 @@ class TestMiscJavaCode { @Test fun `remaps methods that are called on the return value of another method when using synthetic bridges that change the return type`() { TestData.remap(""" - public class Test { - public static void test() { + class Test { + void test() { final a.pkg.A value = null; value.aGeneratedSynthetic().aGeneratedSynthetic().aGeneratedSynthetic(); } } """.trimIndent()) shouldBe """ - public class Test { - public static void test() { + class Test { + void test() { final b.pkg.B value = null; value.bGeneratedSynthetic().bGeneratedSynthetic().bGeneratedSynthetic(); } } """.trimIndent() } + + @Test + fun `remaps synthetic bridges that change the return type inside inner classes inside inner classes`() { + TestData.remap(""" + class Test { + void test() { + a.pkg.A.InnerC.InnerD value = null; + value.getA(); + } + } + """.trimIndent()) shouldBe """ + class Test { + void test() { + b.pkg.B.InnerC.InnerD value = null; + value.getB(); + } + } + """.trimIndent() + } } diff --git a/src/test/resources/mappings.srg b/src/test/resources/mappings.srg index b3c7d86..838248f 100644 --- a/src/test/resources/mappings.srg +++ b/src/test/resources/mappings.srg @@ -35,6 +35,10 @@ CL: a/pkg/A$Inner b/pkg/B$Inner FD: a/pkg/A$Inner/aField b/pkg/B$Inner/bField CL: a/pkg/A$InnerA b/pkg/B$InnerB CL: a/pkg/A$GenericA b/pkg/B$GenericB +CL: a/pkg/A$InnerC b/pkg/B$InnerC +MD: a/pkg/A$InnerC/getA ()La/pkg/A$InnerC; b/pkg/B$InnerC/getB ()Lb/pkg/B$InnerC; +CL: a/pkg/A$InnerC$InnerD b/pkg/B$InnerC$InnerD +MD: a/pkg/A$InnerC$InnerD/getA ()La/pkg/A$InnerC$InnerD; b/pkg/B$InnerC$InnerD/getB ()Lb/pkg/B$InnerC$InnerD; CL: a/pkg/AParent b/pkg/BParent MD: a/pkg/AParent/aParentMethod ()V b/pkg/BParent/bParentMethod ()V MD: a/pkg/AParent/aGeneratedSynthetic ()La/pkg/AParent; b/pkg/BParent/bGeneratedSynthetic ()Lb/pkg/BParent;