diff options
author | Jonas Herzig <jonas@spark-squared.com> | 2021-11-12 14:19:18 +0100 |
---|---|---|
committer | Jonas Herzig <jonas@spark-squared.com> | 2021-11-13 10:28:09 +0100 |
commit | 358136a97feff6fd0586fe04a39adbc7ced381c1 (patch) | |
tree | f632b21008fa758d25632b51b0dab9aefd8eb599 /src/test/kotlin/com/replaymod/gradle/remap/mapper | |
parent | 3ee08cbce94a4e7e1ce668f06f5a612cd9f1e677 (diff) | |
download | Remap-358136a97feff6fd0586fe04a39adbc7ced381c1.tar.gz Remap-358136a97feff6fd0586fe04a39adbc7ced381c1.tar.bz2 Remap-358136a97feff6fd0586fe04a39adbc7ced381c1.zip |
Consider location of expression when determining field accessibility
A protected field is not accessible unless we are referencing it from within a
class which extends its owner. Therefore, we may use a synthetic property with
the same name as long as we do not have access to the field.
Diffstat (limited to 'src/test/kotlin/com/replaymod/gradle/remap/mapper')
-rw-r--r-- | src/test/kotlin/com/replaymod/gradle/remap/mapper/kotlin/TestKotlinSyntheticProperties.kt | 16 |
1 files changed, 16 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 20b65b9..65459f2 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 @@ -103,9 +103,15 @@ class TestKotlinSyntheticProperties { TestData.remapKt(""" import a.pkg.A val v = A().getConflictingFieldWithoutConflict() + class C : A() { + val v = getProtectedFieldWithoutConflict() + } """.trimIndent()) shouldBe """ import b.pkg.B val v = B().getConflictingField() + class C : B() { + val v = getProtectedField() + } """.trimIndent() } @@ -114,9 +120,11 @@ class TestKotlinSyntheticProperties { TestData.remapKt(""" import a.pkg.A val v = A().getA() + val v = A().getProtectedFieldWithoutConflict() """.trimIndent()) shouldBe """ import b.pkg.B val v = B().b + val v = B().protectedField """.trimIndent() } @@ -125,9 +133,15 @@ class TestKotlinSyntheticProperties { TestData.remapKt(""" import a.pkg.A val v = A().conflictingFieldWithoutConflict + class C : A() { + val v = protectedFieldWithoutConflict + } """.trimIndent()) shouldBe """ import b.pkg.B val v = B().getConflictingField() + class C : B() { + val v = getProtectedField() + } """.trimIndent() } @@ -136,9 +150,11 @@ class TestKotlinSyntheticProperties { TestData.remapKt(""" import a.pkg.A val v = A().a + val v = A().protectedFieldWithoutConflict """.trimIndent()) shouldBe """ import b.pkg.B val v = B().b + val v = B().protectedField """.trimIndent() } |