aboutsummaryrefslogtreecommitdiff
path: root/src/test/kotlin/com/replaymod
diff options
context:
space:
mode:
authorJonas Herzig <me@johni0702.de>2022-05-27 08:47:10 +0200
committerJonas Herzig <me@johni0702.de>2022-05-27 08:55:53 +0200
commit97d6082a172ca1c3872f81470bf64c6a42d1a571 (patch)
tree2878d74abf154be3ab6f5daf2ced825a495457c3 /src/test/kotlin/com/replaymod
parent5504b2ff877609d3800d5fce4fbc36a3b01911a5 (diff)
downloadRemap-97d6082a172ca1c3872f81470bf64c6a42d1a571.tar.gz
Remap-97d6082a172ca1c3872f81470bf64c6a42d1a571.tar.bz2
Remap-97d6082a172ca1c3872f81470bf64c6a42d1a571.zip
Fix pattern applying non-field to left side of assignment
Diffstat (limited to 'src/test/kotlin/com/replaymod')
-rw-r--r--src/test/kotlin/com/replaymod/gradle/remap/pattern/TestFieldReference.kt33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/test/kotlin/com/replaymod/gradle/remap/pattern/TestFieldReference.kt b/src/test/kotlin/com/replaymod/gradle/remap/pattern/TestFieldReference.kt
index a3a6efc..d24d2e6 100644
--- a/src/test/kotlin/com/replaymod/gradle/remap/pattern/TestFieldReference.kt
+++ b/src/test/kotlin/com/replaymod/gradle/remap/pattern/TestFieldReference.kt
@@ -37,4 +37,37 @@ class TestFieldReference {
}
""".trimIndent()
}
+
+ @Test
+ fun `should not match final field on left side of assignment when replaced by non-field`() {
+ TestData.remap("test/Test.java", """
+ class Test {
+ Test field;
+ private void test() {
+ field = field;
+ this.field = this.field;
+ this.field.field = this.field.field;
+ }
+ }
+ """.trimIndent(), """
+ @remap.Pattern
+ private test.Test pattern(test.Test obj) {
+ return obj.field;
+ }
+ """.trimIndent(), """
+ @remap.Pattern
+ private test.Test pattern(test.Test obj) {
+ return matched(obj);
+ }
+ """.trimIndent()) shouldBe """
+ class Test {
+ Test field;
+ private void test() {
+ field = field;
+ this.field = matched(this);
+ matched(this).field = matched(matched(this));
+ }
+ }
+ """.trimIndent()
+ }
} \ No newline at end of file