aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorJonas Herzig <jonas@spark-squared.com>2021-11-10 20:33:45 +0100
committerJonas Herzig <jonas@spark-squared.com>2021-11-10 20:33:45 +0100
commit62e3c5a678f10fc810605053289700014a16acd5 (patch)
tree68503b428c7783f1ea3b9b4c764b4815144146b1 /src/test
parent971ee3e3186f1515e382985ab23a8d32899c5a07 (diff)
downloadRemap-62e3c5a678f10fc810605053289700014a16acd5.tar.gz
Remap-62e3c5a678f10fc810605053289700014a16acd5.tar.bz2
Remap-62e3c5a678f10fc810605053289700014a16acd5.zip
Add test for anonymous inner class mixin target
To ensure the mixin target is being remapped, even though the corresponding PsiClass cannot be found.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/a/pkg/A.java1
-rw-r--r--src/test/java/b/pkg/B.java1
-rw-r--r--src/test/kotlin/com/replaymod/gradle/remap/mapper/TestMixinAnnotation.kt11
-rw-r--r--src/test/resources/mappings.srg1
4 files changed, 14 insertions, 0 deletions
diff --git a/src/test/java/a/pkg/A.java b/src/test/java/a/pkg/A.java
index 3143407..3e20f3e 100644
--- a/src/test/java/a/pkg/A.java
+++ b/src/test/java/a/pkg/A.java
@@ -35,6 +35,7 @@ public class A extends AParent implements AInterface {
@Override
public void aInterfaceMethod() {
+ new A() {};
}
public class Inner {
diff --git a/src/test/java/b/pkg/B.java b/src/test/java/b/pkg/B.java
index 030ffa2..3c71aae 100644
--- a/src/test/java/b/pkg/B.java
+++ b/src/test/java/b/pkg/B.java
@@ -35,6 +35,7 @@ public class B extends BParent implements BInterface {
@Override
public void bInterfaceMethod() {
+ new B() {};
}
public class Inner {
diff --git a/src/test/kotlin/com/replaymod/gradle/remap/mapper/TestMixinAnnotation.kt b/src/test/kotlin/com/replaymod/gradle/remap/mapper/TestMixinAnnotation.kt
index 1f9a3a2..595b65f 100644
--- a/src/test/kotlin/com/replaymod/gradle/remap/mapper/TestMixinAnnotation.kt
+++ b/src/test/kotlin/com/replaymod/gradle/remap/mapper/TestMixinAnnotation.kt
@@ -49,4 +49,15 @@ class TestMixinAnnotation {
class MixinA { @Shadow private int bField; }
""".trimIndent()
}
+
+ @Test
+ fun `remaps with anonymous inner class target`() {
+ TestData.remap("""
+ @org.spongepowered.asm.mixin.Mixin(targets = "a.pkg.A${'$'}1")
+ class MixinA {}
+ """.trimIndent()) shouldBe """
+ @org.spongepowered.asm.mixin.Mixin(targets = "b.pkg.B${'$'}1")
+ class MixinA {}
+ """.trimIndent()
+ }
} \ No newline at end of file
diff --git a/src/test/resources/mappings.srg b/src/test/resources/mappings.srg
index 22d63a9..4213107 100644
--- a/src/test/resources/mappings.srg
+++ b/src/test/resources/mappings.srg
@@ -6,6 +6,7 @@ MD: a/pkg/A/aOverloaded (I)V b/pkg/B/bOverloaded (I)V
MD: a/pkg/A/aOverloaded (Z)V b/pkg/B/bOverloaded (Z)V
MD: a/pkg/A/commonOverloaded (Ljava/lang/Object;)V b/pkg/B/commonOverloaded (Ljava/lang/Object;)V
MD: a/pkg/A/commonOverloaded (La/pkg/A;)V b/pkg/B/commonOverloaded (La/pkg/B;)V
+CL: a/pkg/A$1 b/pkg/B$1
CL: a/pkg/A$Inner b/pkg/B$Inner
FD: a/pkg/A$Inner/aField b/pkg/B$Inner/bField
CL: a/pkg/AParent b/pkg/BParent