Annotate all new API with SinceKotlin in kotlin-stdlib and kotlin-test

This commit is contained in:
Ilya Gorbunov
2016-10-12 04:24:37 +03:00
parent a8f381cabc
commit a57321dea8
13 changed files with 15 additions and 0 deletions
@@ -15,6 +15,7 @@
*/
package kotlin.collections
@SinceKotlin("1.1")
public abstract class AbstractCollection<out E> protected constructor() : Collection<E> {
abstract override val size: Int
abstract override fun iterator(): Iterator<E>
@@ -20,6 +20,7 @@
package kotlin.collections
@SinceKotlin("1.1")
public abstract class AbstractList<out E> protected constructor() : AbstractCollection<E>(), List<E> {
abstract override val size: Int
abstract override fun get(index: Int): E
@@ -20,6 +20,7 @@
package kotlin.collections
@SinceKotlin("1.1")
public abstract class AbstractMap<K, out V> protected constructor() : Map<K, V> {
override fun containsKey(key: K): Boolean {
@@ -3,6 +3,7 @@ package kotlin.collections
import java.util.AbstractCollection
@SinceKotlin("1.1")
public abstract class AbstractMutableCollection<E> protected constructor() : AbstractCollection<E>() {
abstract override fun add(element: E): Boolean
}
@@ -3,6 +3,7 @@ package kotlin.collections
import java.util.AbstractList
@SinceKotlin("1.1")
public abstract class AbstractMutableList<E> protected constructor() : AbstractList<E>() {
abstract override fun set(index: Int, element: E): E
abstract override fun removeAt(index: Int): E
@@ -3,6 +3,7 @@ package kotlin.collections
import java.util.AbstractMap
@SinceKotlin("1.1")
public abstract class AbstractMutableMap<K, V> protected constructor() : AbstractMap<K, V>() {
abstract override fun put(key: K, value: V): V?
}
@@ -3,6 +3,7 @@ package kotlin.collections
import java.util.AbstractSet
@SinceKotlin("1.1")
public abstract class AbstractMutableSet<E> protected constructor() : AbstractSet<E>() {
// nothing to make abstract, maybe leave it typealias then?
}
@@ -15,6 +15,7 @@
*/
package kotlin.collections
@SinceKotlin("1.1")
public abstract class AbstractSet<out E> protected constructor() : AbstractCollection<E>(), Set<E> {
override fun equals(other: Any?): Boolean {
@@ -445,6 +445,7 @@ public fun <K, V, M : MutableMap<in K, in V>> Sequence<Pair<K, V>>.toMap(destina
*
* The returned map preserves the entry iteration order of the original map.
*/
@SinceKotlin("1.1")
public fun <K, V> Map<out K, V>.toMap(): Map<K, V> = when (size) {
0 -> emptyMap()
1 -> toSingletonMap()
@@ -456,11 +457,13 @@ public fun <K, V> Map<out K, V>.toMap(): Map<K, V> = when (size) {
*
* The returned map preserves the entry iteration order of the original map.
*/
@SinceKotlin("1.1")
public fun <K, V> Map<out K, V>.toMutableMap(): MutableMap<K, V> = LinkedHashMap(this)
/**
* Populates and returns the [destination] mutable map with key-value pairs from the given map.
*/
@SinceKotlin("1.1")
public fun <K, V, M : MutableMap<in K, in V>> Map<out K, V>.toMap(destination: M): M
= destination.apply { putAll(this@toMap) }
@@ -22,6 +22,7 @@ internal open class PlatformImplementations {
}
}
@SinceKotlin("1.1")
@kotlin.internal.InlineExposed
internal fun platformCloseSuppressed(instance: Closeable, cause: Throwable) = IMPLEMENTATIONS.closeSuppressed(instance, cause)
@@ -15,6 +15,7 @@ public inline fun buildString(builderAction: StringBuilder.() -> Unit): String =
* Builds new string by populating newly created [StringBuilder] initialized with the given [capacity]
* using provided [builderAction] and then converting it to [String].
*/
@SinceKotlin("1.1")
@kotlin.internal.InlineOnly
public inline fun buildString(capacity: Int, builderAction: StringBuilder.() -> Unit): String =
StringBuilder(capacity).apply(builderAction).toString()
@@ -41,6 +41,7 @@ public interface MatchGroupCollection : Collection<MatchGroup?> {
/**
* Extends [MatchGroupCollection] by introducing a way to get matched groups by name, when regex supports it.
*/
@SinceKotlin("1.1")
public interface MatchNamedGroupCollection : MatchGroupCollection {
/**
* Returns a named group with the specified [name].