Skip to content

Commit

Permalink
Fix a test
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaming32 committed Jan 5, 2024
1 parent a6ec3fb commit 7953080
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand All @@ -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()
}
}
4 changes: 4 additions & 0 deletions src/test/resources/mappings.srg
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 7953080

Please sign in to comment.