diff options
author | Jonas Herzig <jonas@spark-squared.com> | 2021-11-11 15:06:54 +0100 |
---|---|---|
committer | Jonas Herzig <jonas@spark-squared.com> | 2021-11-11 15:06:54 +0100 |
commit | b4462eb6030f8e5a072ad4b6508d7a93d574522f (patch) | |
tree | 6b00df9b43c732069ec4a68c1e063ff6943936c9 /src/test/kotlin | |
parent | 62e3c5a678f10fc810605053289700014a16acd5 (diff) | |
download | Remap-b4462eb6030f8e5a072ad4b6508d7a93d574522f.tar.gz Remap-b4462eb6030f8e5a072ad4b6508d7a93d574522f.tar.bz2 Remap-b4462eb6030f8e5a072ad4b6508d7a93d574522f.zip |
Fix mixin @At target not considering mappings from parent classes
When remapping the @At `target` argument, we used to only look at the mappings
for the target class but we also need to consider mappings for its super classes
and interfaces.
This commit now searches for the target Psi method and then uses the regular
remap method for PsiMethod to get its properly mapped name.
Diffstat (limited to 'src/test/kotlin')
-rw-r--r-- | src/test/kotlin/com/replaymod/gradle/remap/mapper/TestMixinInjections.kt | 42 |
1 files changed, 42 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 3f8d55f..f01a832 100644 --- a/src/test/kotlin/com/replaymod/gradle/remap/mapper/TestMixinInjections.kt +++ b/src/test/kotlin/com/replaymod/gradle/remap/mapper/TestMixinInjections.kt @@ -137,4 +137,46 @@ class TestMixinInjections { } """.trimIndent() } + + @Test + fun `remaps @At target`() { + TestData.remap(""" + import org.spongepowered.asm.mixin.injection.At; + import org.spongepowered.asm.mixin.injection.Inject; + @org.spongepowered.asm.mixin.Mixin(a.pkg.A.class) + class MixinA { + @Inject(method = "aMethod", at = @At(target = "La/pkg/A;aInterfaceMethod()V")) + private void test() {} + } + """.trimIndent()) shouldBe """ + import org.spongepowered.asm.mixin.injection.At; + import org.spongepowered.asm.mixin.injection.Inject; + @org.spongepowered.asm.mixin.Mixin(b.pkg.B.class) + class MixinA { + @Inject(method = "bMethod", at = @At(target = "Lb/pkg/B;bInterfaceMethod()V")) + private void test() {} + } + """.trimIndent() + } + + @Test + fun `remaps @At target without mappings for target`() { + TestData.remap(""" + import org.spongepowered.asm.mixin.injection.At; + import org.spongepowered.asm.mixin.injection.Inject; + @org.spongepowered.asm.mixin.Mixin(a.pkg.A.class) + class MixinA { + @Inject(method = "aMethod", at = @At(target = "La/pkg/A;unmappedOverloaded(La/pkg/A;)V")) + private void test() {} + } + """.trimIndent()) shouldBe """ + import org.spongepowered.asm.mixin.injection.At; + import org.spongepowered.asm.mixin.injection.Inject; + @org.spongepowered.asm.mixin.Mixin(b.pkg.B.class) + class MixinA { + @Inject(method = "bMethod", at = @At(target = "Lb/pkg/B;unmappedOverloaded(Lb/pkg/B;)V")) + private void test() {} + } + """.trimIndent() + } }
\ No newline at end of file |