aboutsummaryrefslogtreecommitdiff
path: root/src/test/kotlin/com/replaymod/gradle/remap
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/kotlin/com/replaymod/gradle/remap')
-rw-r--r--src/test/kotlin/com/replaymod/gradle/remap/mapper/kotlin/TestKotlinSyntheticProperties.kt44
-rw-r--r--src/test/kotlin/com/replaymod/gradle/remap/util/TestData.kt4
2 files changed, 48 insertions, 0 deletions
diff --git a/src/test/kotlin/com/replaymod/gradle/remap/mapper/kotlin/TestKotlinSyntheticProperties.kt b/src/test/kotlin/com/replaymod/gradle/remap/mapper/kotlin/TestKotlinSyntheticProperties.kt
index d0f6fc2..b77978a 100644
--- a/src/test/kotlin/com/replaymod/gradle/remap/mapper/kotlin/TestKotlinSyntheticProperties.kt
+++ b/src/test/kotlin/com/replaymod/gradle/remap/mapper/kotlin/TestKotlinSyntheticProperties.kt
@@ -97,4 +97,48 @@ class TestKotlinSyntheticProperties {
}
""".trimIndent()
}
+
+ @Test
+ fun `does not convert getter to synthetic property if it would be shadowed by a field with the same name`() {
+ TestData.remapKt("""
+ import a.pkg.A
+ val v = A().getConflictingFieldWithoutConflict()
+ """.trimIndent()) shouldBe """
+ import b.pkg.B
+ val v = B().getConflictingField()
+ """.trimIndent()
+ }
+
+ @Test
+ fun `does convert getter to synthetic property if the field which it would be shadowed by is inaccessible`() {
+ TestData.remapKt("""
+ import a.pkg.A
+ val v = A().getA()
+ """.trimIndent()) shouldBe """
+ import b.pkg.B
+ val v = B().b
+ """.trimIndent()
+ }
+
+ @Test
+ fun `convert synthetic property to getter if it would be shadowed by a field with the same name`() {
+ TestData.remapKt("""
+ import a.pkg.A
+ val v = A().conflictingFieldWithoutConflict
+ """.trimIndent()) shouldBe """
+ import b.pkg.B
+ val v = B().getConflictingField()
+ """.trimIndent()
+ }
+
+ @Test
+ fun `does not convert synthetic property to getter if the field which it would be shadowed by is inaccessible`() {
+ TestData.remapKt("""
+ import a.pkg.A
+ val v = A().a
+ """.trimIndent()) shouldBe """
+ import b.pkg.B
+ val v = B().b
+ """.trimIndent()
+ }
}
diff --git a/src/test/kotlin/com/replaymod/gradle/remap/util/TestData.kt b/src/test/kotlin/com/replaymod/gradle/remap/util/TestData.kt
index adb6f52..c40635c 100644
--- a/src/test/kotlin/com/replaymod/gradle/remap/util/TestData.kt
+++ b/src/test/kotlin/com/replaymod/gradle/remap/util/TestData.kt
@@ -41,6 +41,10 @@ object TestData {
findClasspathEntry("org.spongepowered.asm.mixin.Mixin"),
findClasspathEntry("a.pkg.A"),
)
+ remappedClasspath = arrayOf(
+ findClasspathEntry("org.spongepowered.asm.mixin.Mixin"),
+ findClasspathEntry("b.pkg.B"),
+ )
patternAnnotation = "remap.Pattern"
}