Volatile forbidden for delegated properties (and checked for other use-site targets)

This commit is contained in:
Mikhail Glukhikh
2016-01-15 13:34:22 +03:00
parent b78d481bb1
commit ec909d0775
6 changed files with 25 additions and 10 deletions
@@ -1,7 +1,12 @@
import kotlin.jvm.Volatile
import kotlin.properties.Delegates
class My {
<!VOLATILE_ON_VALUE!>@Volatile<!> val x = 0
// ok
@Volatile var y = 1
<!VOLATILE_ON_DELEGATE!>@delegate:Volatile<!> var z: String by Delegates.observable("?") { prop, old, new -> old.hashCode() }
<!VOLATILE_ON_VALUE!>@field:Volatile<!> val w = 2
}