Fix Volatile usages in common and JS code
This commit is contained in:
@@ -17,10 +17,8 @@
|
|||||||
package kotlin.sequences
|
package kotlin.sequences
|
||||||
|
|
||||||
internal class ConstrainedOnceSequence<T>(sequence: Sequence<T>) : Sequence<T> {
|
internal class ConstrainedOnceSequence<T>(sequence: Sequence<T>) : Sequence<T> {
|
||||||
@Volatile private var sequenceRef: Sequence<T>? = sequence
|
private var sequenceRef: Sequence<T>? = sequence
|
||||||
//private val lock = Any()
|
|
||||||
|
|
||||||
//TODO: Synchronize with the synchonized() method
|
|
||||||
override fun iterator(): Iterator<T> {
|
override fun iterator(): Iterator<T> {
|
||||||
val sequence = sequenceRef ?: throw IllegalStateException("This sequence can be consumed only once.")
|
val sequence = sequenceRef ?: throw IllegalStateException("This sequence can be consumed only once.")
|
||||||
sequenceRef = null
|
sequenceRef = null
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ public abstract class AbstractMap<K, out V> protected constructor() : Map<K, V>
|
|||||||
* Accessing this property first time creates a keys view from [entries].
|
* Accessing this property first time creates a keys view from [entries].
|
||||||
* All subsequent accesses just return the created instance.
|
* All subsequent accesses just return the created instance.
|
||||||
*/
|
*/
|
||||||
private @Volatile var _keys: Set<K>? = null
|
private @kotlin.jvm.Volatile var _keys: Set<K>? = null
|
||||||
override val keys: Set<K> get() {
|
override val keys: Set<K> get() {
|
||||||
if (_keys == null) {
|
if (_keys == null) {
|
||||||
_keys = object : AbstractSet<K>() {
|
_keys = object : AbstractSet<K>() {
|
||||||
@@ -121,7 +121,7 @@ public abstract class AbstractMap<K, out V> protected constructor() : Map<K, V>
|
|||||||
* Accessing this property first time creates a values view from [entries].
|
* Accessing this property first time creates a values view from [entries].
|
||||||
* All subsequent accesses just return the created instance.
|
* All subsequent accesses just return the created instance.
|
||||||
*/
|
*/
|
||||||
private @Volatile var _values: Collection<V>? = null
|
private @kotlin.jvm.Volatile var _values: Collection<V>? = null
|
||||||
override val values: Collection<V> get() {
|
override val values: Collection<V> get() {
|
||||||
if (_values == null) {
|
if (_values == null) {
|
||||||
_values = object : AbstractCollection<V>() {
|
_values = object : AbstractCollection<V>() {
|
||||||
|
|||||||
Reference in New Issue
Block a user