fix: val can be reassigned through backing field inside its own getter

This commit is contained in:
Svetlana Isakova
2012-12-18 16:38:38 +04:00
parent 58de1cabbc
commit 67d0d8b1a9
3 changed files with 50 additions and 6 deletions
@@ -0,0 +1,22 @@
package a
import java.util.HashSet
val a: MutableSet<String>? = null
get() {
if (a == null) {
$a = HashSet()
}
return a
}
class R {
val b: String? = null
get() {
if (b == null) {
$b = "b"
}
return b
}
}