From 99eb7f391ba1fa33e280a3d5b7f61e3b1dfa255d Mon Sep 17 00:00:00 2001 From: Ilya Gorbunov Date: Tue, 28 Jul 2020 14:38:08 +0300 Subject: [PATCH] Fix doc wording around covariance/invariance --- core/builtins/native/kotlin/Collections.kt | 39 +++++++------------ .../collections/AbstractMutableCollection.kt | 4 +- .../kotlin/collections/AbstractMutableList.kt | 4 +- .../kotlin/collections/AbstractMutableMap.kt | 6 +-- .../kotlin/collections/AbstractMutableSet.kt | 4 +- .../stdlib/js-ir/builtins/Collections.kt | 29 ++++++++------ .../collections/AbstractMutableCollection.kt | 4 +- .../kotlin/collections/AbstractMutableList.kt | 5 ++- .../kotlin/collections/AbstractMutableMap.kt | 7 ++-- .../kotlin/collections/AbstractMutableSet.kt | 4 +- .../collections/AbstractMutableCollection.kt | 4 +- .../kotlin/collections/AbstractMutableList.kt | 4 +- .../kotlin/collections/AbstractMutableMap.kt | 6 +-- .../kotlin/collections/AbstractMutableSet.kt | 4 +- .../kotlin/collections/AbstractCollection.kt | 4 +- .../src/kotlin/collections/AbstractList.kt | 5 ++- .../src/kotlin/collections/AbstractMap.kt | 7 ++-- .../src/kotlin/collections/AbstractSet.kt | 4 +- .../builtins/native/kotlin/Collections.kt | 39 +++++++------------ 19 files changed, 85 insertions(+), 98 deletions(-) diff --git a/core/builtins/native/kotlin/Collections.kt b/core/builtins/native/kotlin/Collections.kt index 93106f5c1c0..caf6ab6212c 100644 --- a/core/builtins/native/kotlin/Collections.kt +++ b/core/builtins/native/kotlin/Collections.kt @@ -1,17 +1,6 @@ /* - * Copyright 2010-2015 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ package kotlin.collections @@ -21,7 +10,7 @@ import kotlin.internal.PlatformDependent /** * Classes that inherit from this interface can be represented as a sequence of elements that can * be iterated over. - * @param T the type of element being iterated over. The iterator is covariant on its element type. + * @param T the type of element being iterated over. The iterator is covariant in its element type. */ public interface Iterable { /** @@ -33,7 +22,7 @@ public interface Iterable { /** * Classes that inherit from this interface can be represented as a sequence of elements that can * be iterated over and that supports removing elements during iteration. - * @param T the type of element being iterated over. The mutable iterator is invariant on its element type. + * @param T the type of element being iterated over. The mutable iterator is invariant in its element type. */ public interface MutableIterable : Iterable { /** @@ -45,7 +34,7 @@ public interface MutableIterable : Iterable { /** * A generic collection of elements. Methods in this interface support only read-only access to the collection; * read/write access is supported through the [MutableCollection] interface. - * @param E the type of elements contained in the collection. The collection is covariant on its element type. + * @param E the type of elements contained in the collection. The collection is covariant in its element type. */ public interface Collection : Iterable { // Query Operations @@ -76,7 +65,7 @@ public interface Collection : Iterable { /** * A generic collection of elements that supports adding and removing elements. * - * @param E the type of elements contained in the collection. The mutable collection is invariant on its element type. + * @param E the type of elements contained in the collection. The mutable collection is invariant in its element type. */ public interface MutableCollection : Collection, MutableIterable { // Query Operations @@ -130,7 +119,7 @@ public interface MutableCollection : Collection, MutableIterable { /** * A generic ordered collection of elements. Methods in this interface support only read-only access to the list; * read/write access is supported through the [MutableList] interface. - * @param E the type of elements contained in the list. The list is covariant on its element type. + * @param E the type of elements contained in the list. The list is covariant in its element type. */ public interface List : Collection { // Query Operations @@ -185,7 +174,7 @@ public interface List : Collection { /** * A generic ordered collection of elements that supports adding and removing elements. - * @param E the type of elements contained in the list. The mutable list is invariant on its element type. + * @param E the type of elements contained in the list. The mutable list is invariant in its element type. */ public interface MutableList : List, MutableCollection { // Modification Operations @@ -252,7 +241,7 @@ public interface MutableList : List, MutableCollection { * A generic unordered collection of elements that does not support duplicate elements. * Methods in this interface support only read-only access to the set; * read/write access is supported through the [MutableSet] interface. - * @param E the type of elements contained in the set. The set is covariant on its element type. + * @param E the type of elements contained in the set. The set is covariant in its element type. */ public interface Set : Collection { // Query Operations @@ -269,7 +258,7 @@ public interface Set : Collection { /** * A generic unordered collection of elements that does not support duplicate elements, and supports * adding and removing elements. - * @param E the type of elements contained in the set. The mutable set is invariant on its element type. + * @param E the type of elements contained in the set. The mutable set is invariant in its element type. */ public interface MutableSet : Set, MutableCollection { // Query Operations @@ -299,9 +288,9 @@ public interface MutableSet : Set, MutableCollection { * the value corresponding to each key. Map keys are unique; the map holds only one value for each key. * Methods in this interface support only read-only access to the map; read-write access is supported through * the [MutableMap] interface. - * @param K the type of map keys. The map is invariant on its key type, as it + * @param K the type of map keys. The map is invariant in its key type, as it * can accept key as a parameter (of [containsKey] for example) and return it in [keys] set. - * @param V the type of map values. The map is covariant on its value type. + * @param V the type of map values. The map is covariant in its value type. */ public interface Map { // Query Operations @@ -377,8 +366,8 @@ public interface Map { /** * A modifiable collection that holds pairs of objects (keys and values) and supports efficiently retrieving * the value corresponding to each key. Map keys are unique; the map holds only one value for each key. - * @param K the type of map keys. The map is invariant on its key type. - * @param V the type of map values. The mutable map is invariant on its value type. + * @param K the type of map keys. The map is invariant in its key type. + * @param V the type of map values. The mutable map is invariant in its value type. */ public interface MutableMap : Map { // Modification Operations diff --git a/libraries/stdlib/common/src/kotlin/collections/AbstractMutableCollection.kt b/libraries/stdlib/common/src/kotlin/collections/AbstractMutableCollection.kt index d33851ba373..e8a78c3115f 100644 --- a/libraries/stdlib/common/src/kotlin/collections/AbstractMutableCollection.kt +++ b/libraries/stdlib/common/src/kotlin/collections/AbstractMutableCollection.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ @@ -8,7 +8,7 @@ package kotlin.collections /** * Provides a skeletal implementation of the [MutableCollection] interface. * - * @param E the type of elements contained in the collection. The collection is invariant on its element type. + * @param E the type of elements contained in the collection. The collection is invariant in its element type. */ @SinceKotlin("1.3") public expect abstract class AbstractMutableCollection : MutableCollection { diff --git a/libraries/stdlib/common/src/kotlin/collections/AbstractMutableList.kt b/libraries/stdlib/common/src/kotlin/collections/AbstractMutableList.kt index 572e78938d1..4df15c7271f 100644 --- a/libraries/stdlib/common/src/kotlin/collections/AbstractMutableList.kt +++ b/libraries/stdlib/common/src/kotlin/collections/AbstractMutableList.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ @@ -8,7 +8,7 @@ package kotlin.collections /** * Provides a skeletal implementation of the [MutableList] interface. * - * @param E the type of elements contained in the list. The list is invariant on its element type. + * @param E the type of elements contained in the list. The list is invariant in its element type. */ public expect abstract class AbstractMutableList : MutableList { protected constructor() diff --git a/libraries/stdlib/common/src/kotlin/collections/AbstractMutableMap.kt b/libraries/stdlib/common/src/kotlin/collections/AbstractMutableMap.kt index 69da38534b6..674c0b52106 100644 --- a/libraries/stdlib/common/src/kotlin/collections/AbstractMutableMap.kt +++ b/libraries/stdlib/common/src/kotlin/collections/AbstractMutableMap.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ @@ -10,8 +10,8 @@ package kotlin.collections * * The implementor is required to implement [entries] property, which should return mutable set of map entries, and [put] function. * - * @param K the type of map keys. The map is invariant on its key type. - * @param V the type of map values. The map is invariant on its value type. + * @param K the type of map keys. The map is invariant in its key type. + * @param V the type of map values. The map is invariant in its value type. */ @SinceKotlin("1.3") public expect abstract class AbstractMutableMap : MutableMap { diff --git a/libraries/stdlib/common/src/kotlin/collections/AbstractMutableSet.kt b/libraries/stdlib/common/src/kotlin/collections/AbstractMutableSet.kt index fb6fbbeb966..8ed4ca95b89 100644 --- a/libraries/stdlib/common/src/kotlin/collections/AbstractMutableSet.kt +++ b/libraries/stdlib/common/src/kotlin/collections/AbstractMutableSet.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ @@ -8,7 +8,7 @@ package kotlin.collections /** * Provides a skeletal implementation of the [MutableSet] interface. * - * @param E the type of elements contained in the set. The set is invariant on its element type. + * @param E the type of elements contained in the set. The set is invariant in its element type. */ @SinceKotlin("1.3") public expect abstract class AbstractMutableSet : MutableSet { diff --git a/libraries/stdlib/js-ir/builtins/Collections.kt b/libraries/stdlib/js-ir/builtins/Collections.kt index 1e8adc446fc..becf0aee8a6 100644 --- a/libraries/stdlib/js-ir/builtins/Collections.kt +++ b/libraries/stdlib/js-ir/builtins/Collections.kt @@ -1,3 +1,8 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + @file:Suppress( "NON_ABSTRACT_FUNCTION_WITH_NO_BODY", "MUST_BE_INITIALIZED_OR_BE_ABSTRACT", @@ -26,7 +31,7 @@ package kotlin.collections /** * Classes that inherit from this interface can be represented as a sequence of elements that can * be iterated over. - * @param T the type of element being iterated over. The iterator is covariant on its element type. + * @param T the type of element being iterated over. The iterator is covariant in its element type. */ public interface Iterable { /** @@ -38,7 +43,7 @@ public interface Iterable { /** * Classes that inherit from this interface can be represented as a sequence of elements that can * be iterated over and that supports removing elements during iteration. - * @param T the type of element being iterated over. The mutable iterator is invariant on its element type. + * @param T the type of element being iterated over. The mutable iterator is invariant in its element type. */ public interface MutableIterable : Iterable { /** @@ -50,7 +55,7 @@ public interface MutableIterable : Iterable { /** * A generic collection of elements. Methods in this interface support only read-only access to the collection; * read/write access is supported through the [MutableCollection] interface. - * @param E the type of elements contained in the collection. The collection is covariant on its element type. + * @param E the type of elements contained in the collection. The collection is covariant in its element type. */ public interface Collection : Iterable { // Query Operations @@ -81,7 +86,7 @@ public interface Collection : Iterable { /** * A generic collection of elements that supports adding and removing elements. * - * @param E the type of elements contained in the collection. The mutable collection is invariant on its element type. + * @param E the type of elements contained in the collection. The mutable collection is invariant in its element type. */ public interface MutableCollection : Collection, MutableIterable { // Query Operations @@ -135,7 +140,7 @@ public interface MutableCollection : Collection, MutableIterable { /** * A generic ordered collection of elements. Methods in this interface support only read-only access to the list; * read/write access is supported through the [MutableList] interface. - * @param E the type of elements contained in the list. The list is covariant on its element type. + * @param E the type of elements contained in the list. The list is covariant in its element type. */ public interface List : Collection { // Query Operations @@ -190,7 +195,7 @@ public interface List : Collection { /** * A generic ordered collection of elements that supports adding and removing elements. - * @param E the type of elements contained in the list. The mutable list is invariant on its element type. + * @param E the type of elements contained in the list. The mutable list is invariant in its element type. */ public interface MutableList : List, MutableCollection { // Modification Operations @@ -257,7 +262,7 @@ public interface MutableList : List, MutableCollection { * A generic unordered collection of elements that does not support duplicate elements. * Methods in this interface support only read-only access to the set; * read/write access is supported through the [MutableSet] interface. - * @param E the type of elements contained in the set. The set is covariant on its element type. + * @param E the type of elements contained in the set. The set is covariant in its element type. */ public interface Set : Collection { // Query Operations @@ -274,7 +279,7 @@ public interface Set : Collection { /** * A generic unordered collection of elements that does not support duplicate elements, and supports * adding and removing elements. - * @param E the type of elements contained in the set. The mutable set is invariant on its element type. + * @param E the type of elements contained in the set. The mutable set is invariant in its element type. */ public interface MutableSet : Set, MutableCollection { // Query Operations @@ -304,9 +309,9 @@ public interface MutableSet : Set, MutableCollection { * the value corresponding to each key. Map keys are unique; the map holds only one value for each key. * Methods in this interface support only read-only access to the map; read-write access is supported through * the [MutableMap] interface. - * @param K the type of map keys. The map is invariant on its key type, as it + * @param K the type of map keys. The map is invariant in its key type, as it * can accept key as a parameter (of [containsKey] for example) and return it in [keys] set. - * @param V the type of map values. The map is covariant on its value type. + * @param V the type of map values. The map is covariant in its value type. */ public interface Map { // Query Operations @@ -370,8 +375,8 @@ public interface Map { /** * A modifiable collection that holds pairs of objects (keys and values) and supports efficiently retrieving * the value corresponding to each key. Map keys are unique; the map holds only one value for each key. - * @param K the type of map keys. The map is invariant on its key type. - * @param V the type of map values. The mutable map is invariant on its value type. + * @param K the type of map keys. The map is invariant in its key type. + * @param V the type of map values. The mutable map is invariant in its value type. */ public interface MutableMap : Map { // Modification Operations diff --git a/libraries/stdlib/js/src/kotlin/collections/AbstractMutableCollection.kt b/libraries/stdlib/js/src/kotlin/collections/AbstractMutableCollection.kt index 636c44aaabd..10f77c4bf4e 100644 --- a/libraries/stdlib/js/src/kotlin/collections/AbstractMutableCollection.kt +++ b/libraries/stdlib/js/src/kotlin/collections/AbstractMutableCollection.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ @@ -8,7 +8,7 @@ package kotlin.collections /** * Provides a skeletal implementation of the [MutableCollection] interface. * - * @param E the type of elements contained in the collection. The collection is invariant on its element type. + * @param E the type of elements contained in the collection. The collection is invariant in its element type. */ public actual abstract class AbstractMutableCollection protected actual constructor() : AbstractCollection(), MutableCollection { diff --git a/libraries/stdlib/js/src/kotlin/collections/AbstractMutableList.kt b/libraries/stdlib/js/src/kotlin/collections/AbstractMutableList.kt index 778e1693e81..85e2254fbe1 100644 --- a/libraries/stdlib/js/src/kotlin/collections/AbstractMutableList.kt +++ b/libraries/stdlib/js/src/kotlin/collections/AbstractMutableList.kt @@ -1,7 +1,8 @@ /* - * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ + /* * Based on GWT AbstractList * Copyright 2007 Google Inc. @@ -13,7 +14,7 @@ package kotlin.collections /** * Provides a skeletal implementation of the [MutableList] interface. * - * @param E the type of elements contained in the list. The list is invariant on its element type. + * @param E the type of elements contained in the list. The list is invariant in its element type. */ public actual abstract class AbstractMutableList protected actual constructor() : AbstractMutableCollection(), MutableList { protected var modCount: Int = 0 diff --git a/libraries/stdlib/js/src/kotlin/collections/AbstractMutableMap.kt b/libraries/stdlib/js/src/kotlin/collections/AbstractMutableMap.kt index bc72c801f19..5fca74d9397 100644 --- a/libraries/stdlib/js/src/kotlin/collections/AbstractMutableMap.kt +++ b/libraries/stdlib/js/src/kotlin/collections/AbstractMutableMap.kt @@ -1,7 +1,8 @@ /* - * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ + /* * Based on GWT AbstractMap * Copyright 2007 Google Inc. @@ -14,8 +15,8 @@ package kotlin.collections * * The implementor is required to implement [entries] property, which should return mutable set of map entries, and [put] function. * - * @param K the type of map keys. The map is invariant on its key type. - * @param V the type of map values. The map is invariant on its value type. + * @param K the type of map keys. The map is invariant in its key type. + * @param V the type of map values. The map is invariant in its value type. */ public actual abstract class AbstractMutableMap protected actual constructor() : AbstractMap(), MutableMap { diff --git a/libraries/stdlib/js/src/kotlin/collections/AbstractMutableSet.kt b/libraries/stdlib/js/src/kotlin/collections/AbstractMutableSet.kt index 4b2254c8ade..42c8df2cef0 100644 --- a/libraries/stdlib/js/src/kotlin/collections/AbstractMutableSet.kt +++ b/libraries/stdlib/js/src/kotlin/collections/AbstractMutableSet.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ package kotlin.collections @@ -7,7 +7,7 @@ package kotlin.collections /** * Provides a skeletal implementation of the [MutableSet] interface. * - * @param E the type of elements contained in the set. The set is invariant on its element type. + * @param E the type of elements contained in the set. The set is invariant in its element type. */ public actual abstract class AbstractMutableSet protected actual constructor() : AbstractMutableCollection(), MutableSet { diff --git a/libraries/stdlib/jvm/src/kotlin/collections/AbstractMutableCollection.kt b/libraries/stdlib/jvm/src/kotlin/collections/AbstractMutableCollection.kt index d08d44c386b..0d0539639b0 100644 --- a/libraries/stdlib/jvm/src/kotlin/collections/AbstractMutableCollection.kt +++ b/libraries/stdlib/jvm/src/kotlin/collections/AbstractMutableCollection.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ @@ -10,7 +10,7 @@ import java.util.AbstractCollection /** * Provides a skeletal implementation of the [MutableCollection] interface. * - * @param E the type of elements contained in the collection. The collection is invariant on its element type. + * @param E the type of elements contained in the collection. The collection is invariant in its element type. */ @SinceKotlin("1.1") public actual abstract class AbstractMutableCollection protected actual constructor() : MutableCollection, AbstractCollection() { diff --git a/libraries/stdlib/jvm/src/kotlin/collections/AbstractMutableList.kt b/libraries/stdlib/jvm/src/kotlin/collections/AbstractMutableList.kt index a9b699d00a0..1290ad7b0b2 100644 --- a/libraries/stdlib/jvm/src/kotlin/collections/AbstractMutableList.kt +++ b/libraries/stdlib/jvm/src/kotlin/collections/AbstractMutableList.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ @@ -10,7 +10,7 @@ import java.util.AbstractList /** * Provides a skeletal implementation of the [MutableList] interface. * - * @param E the type of elements contained in the list. The list is invariant on its element type. + * @param E the type of elements contained in the list. The list is invariant in its element type. */ @SinceKotlin("1.1") public actual abstract class AbstractMutableList protected actual constructor() : MutableList, AbstractList() { diff --git a/libraries/stdlib/jvm/src/kotlin/collections/AbstractMutableMap.kt b/libraries/stdlib/jvm/src/kotlin/collections/AbstractMutableMap.kt index 67c5319fa28..7d7d9676c17 100644 --- a/libraries/stdlib/jvm/src/kotlin/collections/AbstractMutableMap.kt +++ b/libraries/stdlib/jvm/src/kotlin/collections/AbstractMutableMap.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ @@ -12,8 +12,8 @@ import java.util.AbstractMap * * The implementor is required to implement [entries] property, which should return mutable set of map entries, and [put] function. * - * @param K the type of map keys. The map is invariant on its key type. - * @param V the type of map values. The map is invariant on its value type. + * @param K the type of map keys. The map is invariant in its key type. + * @param V the type of map values. The map is invariant in its value type. */ @SinceKotlin("1.1") public actual abstract class AbstractMutableMap protected actual constructor() : MutableMap, AbstractMap() { diff --git a/libraries/stdlib/jvm/src/kotlin/collections/AbstractMutableSet.kt b/libraries/stdlib/jvm/src/kotlin/collections/AbstractMutableSet.kt index cfc51df31aa..7707b8a44db 100644 --- a/libraries/stdlib/jvm/src/kotlin/collections/AbstractMutableSet.kt +++ b/libraries/stdlib/jvm/src/kotlin/collections/AbstractMutableSet.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ @@ -10,7 +10,7 @@ import java.util.AbstractSet /** * Provides a skeletal implementation of the [MutableSet] interface. * - * @param E the type of elements contained in the set. The set is invariant on its element type. + * @param E the type of elements contained in the set. The set is invariant in its element type. */ @SinceKotlin("1.1") public actual abstract class AbstractMutableSet protected actual constructor() : MutableSet, AbstractSet() { diff --git a/libraries/stdlib/src/kotlin/collections/AbstractCollection.kt b/libraries/stdlib/src/kotlin/collections/AbstractCollection.kt index 762323006ef..a8cfa7a8daf 100644 --- a/libraries/stdlib/src/kotlin/collections/AbstractCollection.kt +++ b/libraries/stdlib/src/kotlin/collections/AbstractCollection.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ package kotlin.collections @@ -9,7 +9,7 @@ import kotlin.js.JsName /** * Provides a skeletal implementation of the read-only [Collection] interface. * - * @param E the type of elements contained in the collection. The collection is covariant on its element type. + * @param E the type of elements contained in the collection. The collection is covariant in its element type. */ @SinceKotlin("1.1") public abstract class AbstractCollection protected constructor() : Collection { diff --git a/libraries/stdlib/src/kotlin/collections/AbstractList.kt b/libraries/stdlib/src/kotlin/collections/AbstractList.kt index 818abfeff20..49c178211fa 100644 --- a/libraries/stdlib/src/kotlin/collections/AbstractList.kt +++ b/libraries/stdlib/src/kotlin/collections/AbstractList.kt @@ -1,7 +1,8 @@ /* - * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ + /* * Based on GWT AbstractList * Copyright 2007 Google Inc. @@ -14,7 +15,7 @@ package kotlin.collections * * This class is intended to help implementing read-only lists so it doesn't support concurrent modification tracking. * - * @param E the type of elements contained in the list. The list is covariant on its element type. + * @param E the type of elements contained in the list. The list is covariant in its element type. */ @SinceKotlin("1.1") public abstract class AbstractList protected constructor() : AbstractCollection(), List { diff --git a/libraries/stdlib/src/kotlin/collections/AbstractMap.kt b/libraries/stdlib/src/kotlin/collections/AbstractMap.kt index 6fd1683b190..1872870ee47 100644 --- a/libraries/stdlib/src/kotlin/collections/AbstractMap.kt +++ b/libraries/stdlib/src/kotlin/collections/AbstractMap.kt @@ -1,7 +1,8 @@ /* - * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ + /* * Based on GWT AbstractMap * Copyright 2007 Google Inc. @@ -14,8 +15,8 @@ package kotlin.collections * * The implementor is required to implement [entries] property, which should return read-only set of map entries. * - * @param K the type of map keys. The map is invariant on its key type. - * @param V the type of map values. The map is covariant on its value type. + * @param K the type of map keys. The map is invariant in its key type. + * @param V the type of map values. The map is covariant in its value type. */ @SinceKotlin("1.1") public abstract class AbstractMap protected constructor() : Map { diff --git a/libraries/stdlib/src/kotlin/collections/AbstractSet.kt b/libraries/stdlib/src/kotlin/collections/AbstractSet.kt index 3ca2c4e8839..ef7cfa61a5a 100644 --- a/libraries/stdlib/src/kotlin/collections/AbstractSet.kt +++ b/libraries/stdlib/src/kotlin/collections/AbstractSet.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ package kotlin.collections @@ -9,7 +9,7 @@ package kotlin.collections * * This class is intended to help implementing read-only sets so it doesn't support concurrent modification tracking. * - * @param E the type of elements contained in the set. The set is covariant on its element type. + * @param E the type of elements contained in the set. The set is covariant in its element type. */ @SinceKotlin("1.1") public abstract class AbstractSet protected constructor() : AbstractCollection(), Set { diff --git a/libraries/stdlib/wasm/builtins/native/kotlin/Collections.kt b/libraries/stdlib/wasm/builtins/native/kotlin/Collections.kt index 93106f5c1c0..caf6ab6212c 100644 --- a/libraries/stdlib/wasm/builtins/native/kotlin/Collections.kt +++ b/libraries/stdlib/wasm/builtins/native/kotlin/Collections.kt @@ -1,17 +1,6 @@ /* - * Copyright 2010-2015 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ package kotlin.collections @@ -21,7 +10,7 @@ import kotlin.internal.PlatformDependent /** * Classes that inherit from this interface can be represented as a sequence of elements that can * be iterated over. - * @param T the type of element being iterated over. The iterator is covariant on its element type. + * @param T the type of element being iterated over. The iterator is covariant in its element type. */ public interface Iterable { /** @@ -33,7 +22,7 @@ public interface Iterable { /** * Classes that inherit from this interface can be represented as a sequence of elements that can * be iterated over and that supports removing elements during iteration. - * @param T the type of element being iterated over. The mutable iterator is invariant on its element type. + * @param T the type of element being iterated over. The mutable iterator is invariant in its element type. */ public interface MutableIterable : Iterable { /** @@ -45,7 +34,7 @@ public interface MutableIterable : Iterable { /** * A generic collection of elements. Methods in this interface support only read-only access to the collection; * read/write access is supported through the [MutableCollection] interface. - * @param E the type of elements contained in the collection. The collection is covariant on its element type. + * @param E the type of elements contained in the collection. The collection is covariant in its element type. */ public interface Collection : Iterable { // Query Operations @@ -76,7 +65,7 @@ public interface Collection : Iterable { /** * A generic collection of elements that supports adding and removing elements. * - * @param E the type of elements contained in the collection. The mutable collection is invariant on its element type. + * @param E the type of elements contained in the collection. The mutable collection is invariant in its element type. */ public interface MutableCollection : Collection, MutableIterable { // Query Operations @@ -130,7 +119,7 @@ public interface MutableCollection : Collection, MutableIterable { /** * A generic ordered collection of elements. Methods in this interface support only read-only access to the list; * read/write access is supported through the [MutableList] interface. - * @param E the type of elements contained in the list. The list is covariant on its element type. + * @param E the type of elements contained in the list. The list is covariant in its element type. */ public interface List : Collection { // Query Operations @@ -185,7 +174,7 @@ public interface List : Collection { /** * A generic ordered collection of elements that supports adding and removing elements. - * @param E the type of elements contained in the list. The mutable list is invariant on its element type. + * @param E the type of elements contained in the list. The mutable list is invariant in its element type. */ public interface MutableList : List, MutableCollection { // Modification Operations @@ -252,7 +241,7 @@ public interface MutableList : List, MutableCollection { * A generic unordered collection of elements that does not support duplicate elements. * Methods in this interface support only read-only access to the set; * read/write access is supported through the [MutableSet] interface. - * @param E the type of elements contained in the set. The set is covariant on its element type. + * @param E the type of elements contained in the set. The set is covariant in its element type. */ public interface Set : Collection { // Query Operations @@ -269,7 +258,7 @@ public interface Set : Collection { /** * A generic unordered collection of elements that does not support duplicate elements, and supports * adding and removing elements. - * @param E the type of elements contained in the set. The mutable set is invariant on its element type. + * @param E the type of elements contained in the set. The mutable set is invariant in its element type. */ public interface MutableSet : Set, MutableCollection { // Query Operations @@ -299,9 +288,9 @@ public interface MutableSet : Set, MutableCollection { * the value corresponding to each key. Map keys are unique; the map holds only one value for each key. * Methods in this interface support only read-only access to the map; read-write access is supported through * the [MutableMap] interface. - * @param K the type of map keys. The map is invariant on its key type, as it + * @param K the type of map keys. The map is invariant in its key type, as it * can accept key as a parameter (of [containsKey] for example) and return it in [keys] set. - * @param V the type of map values. The map is covariant on its value type. + * @param V the type of map values. The map is covariant in its value type. */ public interface Map { // Query Operations @@ -377,8 +366,8 @@ public interface Map { /** * A modifiable collection that holds pairs of objects (keys and values) and supports efficiently retrieving * the value corresponding to each key. Map keys are unique; the map holds only one value for each key. - * @param K the type of map keys. The map is invariant on its key type. - * @param V the type of map values. The mutable map is invariant on its value type. + * @param K the type of map keys. The map is invariant in its key type. + * @param V the type of map values. The mutable map is invariant in its value type. */ public interface MutableMap : Map { // Modification Operations