Have mutable collection interfaces specified explicitly to get rid of platform types in parameter and return types.

This commit is contained in:
Ilya Gorbunov
2016-10-13 22:16:30 +03:00
parent 06b72e608e
commit 703ee6bd78
5 changed files with 10 additions and 9 deletions
@@ -4,6 +4,6 @@ package kotlin.collections
import java.util.AbstractCollection
@SinceKotlin("1.1")
public abstract class AbstractMutableCollection<E> protected constructor() : AbstractCollection<E>() {
public abstract class AbstractMutableCollection<E> protected constructor() : MutableCollection<E>, AbstractCollection<E>() {
abstract override fun add(element: E): Boolean
}
@@ -4,7 +4,7 @@ package kotlin.collections
import java.util.AbstractList
@SinceKotlin("1.1")
public abstract class AbstractMutableList<E> protected constructor() : AbstractList<E>() {
public abstract class AbstractMutableList<E> protected constructor() : MutableList<E>, AbstractList<E>() {
abstract override fun set(index: Int, element: E): E
abstract override fun removeAt(index: Int): E
abstract override fun add(index: Int, element: E)
@@ -4,6 +4,6 @@ package kotlin.collections
import java.util.AbstractMap
@SinceKotlin("1.1")
public abstract class AbstractMutableMap<K, V> protected constructor() : AbstractMap<K, V>() {
public abstract class AbstractMutableMap<K, V> protected constructor() : MutableMap<K, V>, AbstractMap<K, V>() {
abstract override fun put(key: K, value: V): V?
}
@@ -4,6 +4,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?
public abstract class AbstractMutableSet<E> protected constructor() : MutableSet<E>, AbstractSet<E>() {
// nothing to make abstract
// it's a class rather than typealias in order to have bridge for `size` generated and nice non-platform types in methods
}