diff --git a/compiler/testData/codegen/box/builtinStubMethods/Map.kt b/compiler/testData/codegen/box/builtinStubMethods/Map.kt index dae89e07c5d..4a6a7eb54e3 100644 --- a/compiler/testData/codegen/box/builtinStubMethods/Map.kt +++ b/compiler/testData/codegen/box/builtinStubMethods/Map.kt @@ -1,12 +1,12 @@ class MyMap: Map { override val size: Int get() = 0 override val isEmpty: Boolean get() = true - override fun containsKey(key: Any?): Boolean = false - override fun containsValue(value: Any?): Boolean = false - override fun get(key: Any?): V? = null - override fun keySet(): Set = throw UnsupportedOperationException() - override fun values(): Collection = throw UnsupportedOperationException() - override fun entrySet(): Set> = throw UnsupportedOperationException() + override fun containsKey(key: K): Boolean = false + override fun containsValue(value: V): Boolean = false + override fun get(key: K): V? = null + override val keys: Set get() = throw UnsupportedOperationException() + override val values: Collection get() = throw UnsupportedOperationException() + override val entries: Set> get() = throw UnsupportedOperationException() } fun expectUoe(block: () -> Unit) { diff --git a/compiler/testData/codegen/box/builtinStubMethods/MapWithAllImplementations.kt b/compiler/testData/codegen/box/builtinStubMethods/MapWithAllImplementations.kt index 8a3ff2b93b9..6f6dfb95114 100644 --- a/compiler/testData/codegen/box/builtinStubMethods/MapWithAllImplementations.kt +++ b/compiler/testData/codegen/box/builtinStubMethods/MapWithAllImplementations.kt @@ -1,15 +1,15 @@ class MyMap: Map { override val size: Int get() = 0 override val isEmpty: Boolean get() = true - override fun containsKey(key: Any?): Boolean = false - override fun containsValue(value: Any?): Boolean = false - override fun get(key: Any?): V? = null - override fun keySet(): Set = throw UnsupportedOperationException() - override fun values(): Collection = throw UnsupportedOperationException() - override fun entrySet(): Set> = throw UnsupportedOperationException() + override fun containsKey(key: K): Boolean = false + override fun containsValue(value: V): Boolean = false + override fun get(key: K): V? = null + override val keys: Set get() = throw UnsupportedOperationException() + override val values: Collection get() = throw UnsupportedOperationException() + override val entries: Set> get() = throw UnsupportedOperationException() public fun put(key: K, value: V): V? = null - public fun remove(key: Any?): V? = null + public fun remove(key: K): V? = null public fun putAll(m: Map) {} public fun clear() {} } diff --git a/compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/abstractMap.kt b/compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/abstractMap.kt index 1a7f0ae1eb2..facb63971a1 100644 --- a/compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/abstractMap.kt +++ b/compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/abstractMap.kt @@ -2,7 +2,7 @@ import java.util.AbstractMap import java.util.Collections class A : AbstractMap() { - override fun entrySet(): MutableSet> = Collections.emptySet() + override val entries: MutableSet> get() = Collections.emptySet() } fun box(): String { @@ -14,9 +14,9 @@ fun box(): String { a.putAll(b) a.clear() - a.keySet() - a.values() - a.entrySet() + a.keys + a.values + a.entries return "OK" } diff --git a/compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/hashMap.kt b/compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/hashMap.kt index 246391e18d9..047a105083f 100644 --- a/compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/hashMap.kt +++ b/compiler/testData/codegen/box/builtinStubMethods/extendJavaCollections/hashMap.kt @@ -12,9 +12,9 @@ fun box(): String { a.putAll(b) a.clear() - a.keySet() - a.values() - a.entrySet() + a.keys + a.values + a.entries return "OK" } diff --git a/compiler/testData/codegen/box/builtinsProperties/maps.kt b/compiler/testData/codegen/box/builtinsProperties/maps.kt index 6a78de99b6a..4e5876465f8 100644 --- a/compiler/testData/codegen/box/builtinsProperties/maps.kt +++ b/compiler/testData/codegen/box/builtinsProperties/maps.kt @@ -5,27 +5,27 @@ class A : Map { throw UnsupportedOperationException() } - override fun containsKey(key: Any?): Boolean { + override fun containsKey(key: String): Boolean { throw UnsupportedOperationException() } - override fun containsValue(value: Any?): Boolean { + override fun containsValue(value: String): Boolean { throw UnsupportedOperationException() } - override fun get(key: Any?): String? { + override fun get(key: String): String? { throw UnsupportedOperationException() } - override fun keySet(): Set { + override val keys: Set get() { throw UnsupportedOperationException() } - override fun values(): Collection { + override val values: Collection get() { throw UnsupportedOperationException() } - override fun entrySet(): Set> { + override val entries: Set> get() { throw UnsupportedOperationException() } } diff --git a/compiler/testData/codegen/box/delegatedProperty/propertyMetadataShouldBeCached.kt b/compiler/testData/codegen/box/delegatedProperty/propertyMetadataShouldBeCached.kt index 65a1868cf89..0d23fb5beec 100644 --- a/compiler/testData/codegen/box/delegatedProperty/propertyMetadataShouldBeCached.kt +++ b/compiler/testData/codegen/box/delegatedProperty/propertyMetadataShouldBeCached.kt @@ -39,8 +39,8 @@ fun box(): String { A.bar = baz + a.foo baz + A.bar - if (metadatas.keySet().size != 3) - return "Fail: only three instances of PropertyMetadata should have been created\n${metadatas.keySet()}" + if (metadatas.keys.size != 3) + return "Fail: only three instances of PropertyMetadata should have been created\n${metadatas.keys}" return "OK" } diff --git a/compiler/testData/diagnostics/tests/Builders.kt b/compiler/testData/diagnostics/tests/Builders.kt index b3bfbf4bf99..414ae97fe3a 100644 --- a/compiler/testData/diagnostics/tests/Builders.kt +++ b/compiler/testData/diagnostics/tests/Builders.kt @@ -85,7 +85,7 @@ abstract class Tag(val name : String) : Element() { private fun renderAttributes() : String? { val builder = StringBuilder() - for (a in attributes.keySet()) { + for (a in attributes.keys) { builder.append(" $a=\"${attributes[a]}\"") } return builder.toString() diff --git a/compiler/testData/diagnostics/tests/library/Collections.kt b/compiler/testData/diagnostics/tests/library/Collections.kt index fa539a3b6f6..c861322ee7c 100644 --- a/compiler/testData/diagnostics/tests/library/Collections.kt +++ b/compiler/testData/diagnostics/tests/library/Collections.kt @@ -92,19 +92,19 @@ fun testMutableSet(s: MutableSet, t: T) { } fun testMap(m: Map) { - val set: Set = m.keySet() - val collection: Collection = m.values() - val set1: Set> = m.entrySet() + val set: Set = m.keys + val collection: Collection = m.values + val set1: Set> = m.entries - val mutableSet: MutableSet = m.keySet() - val mutableCollection: MutableCollection = m.values() - val mutableSet1: MutableSet> = m.entrySet() + val mutableSet: MutableSet = m.keys + val mutableCollection: MutableCollection = m.values + val mutableSet1: MutableSet> = m.entries } fun testMutableMap(m: MutableMap) { - val mutableSet: MutableSet = m.keySet() - val mutableCollection: MutableCollection = m.values() - val mutableSet1: MutableSet> = m.entrySet() + val mutableSet: MutableSet = m.keys + val mutableCollection: MutableCollection = m.values + val mutableSet1: MutableSet> = m.entries } fun array(vararg t: T): Array {} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/platformTypes/methodCall/multipleExactBoundsNullable.txt b/compiler/testData/diagnostics/tests/platformTypes/methodCall/multipleExactBoundsNullable.txt index 6e23798d13e..055e25f3f55 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/methodCall/multipleExactBoundsNullable.txt +++ b/compiler/testData/diagnostics/tests/platformTypes/methodCall/multipleExactBoundsNullable.txt @@ -4,24 +4,24 @@ public fun foo(/*0*/ delegateResolver: ResolverForProject : java.util.AbstractMap { public/*package*/ constructor MyMap() + public open override /*1*/ val entries: kotlin.MutableSet> public open override /*1*/ /*fake_override*/ val isEmpty: kotlin.Boolean invisible_fake final override /*1*/ /*fake_override*/ var keySet: kotlin.(Mutable)Set! + public open override /*1*/ /*fake_override*/ val keys: kotlin.MutableSet public open override /*1*/ /*fake_override*/ val size: kotlin.Int invisible_fake final override /*1*/ /*fake_override*/ var values: kotlin.(Mutable)Collection! + public open override /*1*/ /*fake_override*/ val values: kotlin.MutableCollection public open override /*1*/ /*fake_override*/ fun clear(): kotlin.Unit protected/*protected and package*/ open override /*1*/ /*fake_override*/ fun clone(): kotlin.Any! - public open override /*1*/ /*fake_override*/ fun containsKey(/*0*/ key: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun containsValue(/*0*/ value: kotlin.Any?): kotlin.Boolean - @java.lang.Override() public open override /*1*/ fun entrySet(): kotlin.MutableSet> + public open override /*1*/ /*fake_override*/ fun containsKey(/*0*/ key: K!): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun containsValue(/*0*/ value: V!): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun get(/*0*/ key: kotlin.Any?): V? + public open override /*1*/ /*fake_override*/ fun get(/*0*/ key: K!): V? public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun keySet(): kotlin.MutableSet public open override /*1*/ /*fake_override*/ fun put(/*0*/ key: K!, /*1*/ value: V!): V? public open override /*1*/ /*fake_override*/ fun putAll(/*0*/ m: kotlin.Map): kotlin.Unit - public open override /*1*/ /*fake_override*/ fun remove(/*0*/ key: kotlin.Any?): V? + public open override /*1*/ /*fake_override*/ fun remove(/*0*/ key: K!): V? public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - public open override /*1*/ /*fake_override*/ fun values(): kotlin.MutableCollection // Static members invisible_fake open override /*1*/ /*fake_override*/ fun eq(/*0*/ p0: kotlin.Any!, /*1*/ p1: kotlin.Any!): kotlin.Boolean diff --git a/compiler/testData/diagnostics/tests/platformTypes/supertypeTypeArguments.txt b/compiler/testData/diagnostics/tests/platformTypes/supertypeTypeArguments.txt index 555af905e8f..27606eec4dd 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/supertypeTypeArguments.txt +++ b/compiler/testData/diagnostics/tests/platformTypes/supertypeTypeArguments.txt @@ -1,25 +1,27 @@ package public interface ExtMap : kotlin.Map { + public abstract override /*1*/ /*fake_override*/ val entries: kotlin.Set> public abstract override /*1*/ /*fake_override*/ val isEmpty: kotlin.Boolean + public abstract override /*1*/ /*fake_override*/ val keys: kotlin.Set public abstract override /*1*/ /*fake_override*/ val size: kotlin.Int - public abstract override /*1*/ /*fake_override*/ fun containsKey(/*0*/ key: kotlin.Any?): kotlin.Boolean - public abstract override /*1*/ /*fake_override*/ fun containsValue(/*0*/ value: kotlin.Any?): kotlin.Boolean - public abstract override /*1*/ /*fake_override*/ fun entrySet(): kotlin.Set> + public abstract override /*1*/ /*fake_override*/ val values: kotlin.Collection + public abstract override /*1*/ /*fake_override*/ fun containsKey(/*0*/ key: K): kotlin.Boolean + public abstract override /*1*/ /*fake_override*/ fun containsValue(/*0*/ value: V): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public abstract override /*1*/ /*fake_override*/ fun get(/*0*/ key: kotlin.Any?): V? + public abstract override /*1*/ /*fake_override*/ fun get(/*0*/ key: K): V? public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public abstract override /*1*/ /*fake_override*/ fun keySet(): kotlin.Set public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - public abstract override /*1*/ /*fake_override*/ fun values(): kotlin.Collection } public final class HashMapEx : java.util.HashMap, ExtMap { public constructor HashMapEx() + public open override /*2*/ /*fake_override*/ val entries: kotlin.MutableSet> invisible_fake final override /*1*/ /*fake_override*/ var entrySet: kotlin.(Mutable)Set!>! invisible_fake final override /*1*/ /*fake_override*/ val hashSeed: kotlin.Int public open override /*2*/ /*fake_override*/ val isEmpty: kotlin.Boolean invisible_fake final override /*1*/ /*fake_override*/ var keySet: kotlin.(Mutable)Set! + public open override /*2*/ /*fake_override*/ val keys: kotlin.MutableSet invisible_fake final override /*1*/ /*fake_override*/ val loadFactor: kotlin.Float invisible_fake final override /*1*/ /*fake_override*/ var modCount: kotlin.Int invisible_fake final override /*1*/ /*fake_override*/ var size: kotlin.Int @@ -28,24 +30,23 @@ public final class HashMapEx : java.util.HashMap, ExtMap invisible_fake final override /*1*/ /*fake_override*/ var threshold: kotlin.Int invisible_fake final override /*1*/ /*fake_override*/ var useAltHashing: kotlin.Boolean invisible_fake final override /*1*/ /*fake_override*/ var values: kotlin.(Mutable)Collection! + public open override /*2*/ /*fake_override*/ val values: kotlin.MutableCollection invisible_fake open override /*1*/ /*fake_override*/ fun addEntry(/*0*/ p0: kotlin.Int, /*1*/ p1: K!, /*2*/ p2: V!, /*3*/ p3: kotlin.Int): kotlin.Unit invisible_fake open override /*1*/ /*fake_override*/ fun capacity(): kotlin.Int public open override /*1*/ /*fake_override*/ fun clear(): kotlin.Unit public open override /*1*/ /*fake_override*/ fun clone(): kotlin.Any - public open override /*2*/ /*fake_override*/ fun containsKey(/*0*/ key: kotlin.Any?): kotlin.Boolean + public open override /*2*/ /*fake_override*/ fun containsKey(/*0*/ key: K): kotlin.Boolean invisible_fake open override /*1*/ /*fake_override*/ fun containsNullValue(): kotlin.Boolean - public open override /*2*/ /*fake_override*/ fun containsValue(/*0*/ value: kotlin.Any?): kotlin.Boolean + public open override /*2*/ /*fake_override*/ fun containsValue(/*0*/ value: V): kotlin.Boolean invisible_fake open override /*1*/ /*fake_override*/ fun createEntry(/*0*/ p0: kotlin.Int, /*1*/ p1: K!, /*2*/ p2: V!, /*3*/ p3: kotlin.Int): kotlin.Unit - public open override /*2*/ /*fake_override*/ fun entrySet(): kotlin.MutableSet> invisible_fake open override /*1*/ /*fake_override*/ fun entrySet0(): kotlin.(Mutable)Set!>! public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*2*/ /*fake_override*/ fun get(/*0*/ key: kotlin.Any?): V? + public open override /*2*/ /*fake_override*/ fun get(/*0*/ key: K): V? invisible_fake final override /*1*/ /*fake_override*/ fun getEntry(/*0*/ p0: kotlin.Any!): java.util.HashMap.Entry! invisible_fake open override /*1*/ /*fake_override*/ fun getForNullKey(): V! invisible_fake final override /*1*/ /*fake_override*/ fun hash(/*0*/ p0: kotlin.Any!): kotlin.Int public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int invisible_fake open override /*1*/ /*fake_override*/ fun init(): kotlin.Unit - public open override /*2*/ /*fake_override*/ fun keySet(): kotlin.MutableSet invisible_fake open override /*1*/ /*fake_override*/ fun loadFactor(): kotlin.Float invisible_fake open override /*1*/ /*fake_override*/ fun newEntryIterator(): kotlin.(Mutable)Iterator!>! invisible_fake open override /*1*/ /*fake_override*/ fun newKeyIterator(): kotlin.(Mutable)Iterator! @@ -56,12 +57,11 @@ public final class HashMapEx : java.util.HashMap, ExtMap invisible_fake open override /*1*/ /*fake_override*/ fun putForCreate(/*0*/ p0: K!, /*1*/ p1: V!): kotlin.Unit invisible_fake open override /*1*/ /*fake_override*/ fun putForNullKey(/*0*/ p0: V!): V! invisible_fake open override /*1*/ /*fake_override*/ fun readObject(/*0*/ p0: java.io.ObjectInputStream!): kotlin.Unit - public open override /*1*/ /*fake_override*/ fun remove(/*0*/ key: kotlin.Any?): V? + public open override /*1*/ /*fake_override*/ fun remove(/*0*/ key: K): V? invisible_fake final override /*1*/ /*fake_override*/ fun removeEntryForKey(/*0*/ p0: kotlin.Any!): java.util.HashMap.Entry! invisible_fake final override /*1*/ /*fake_override*/ fun removeMapping(/*0*/ p0: kotlin.Any!): java.util.HashMap.Entry! invisible_fake open override /*1*/ /*fake_override*/ fun resize(/*0*/ p0: kotlin.Int): kotlin.Unit public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String invisible_fake open override /*1*/ /*fake_override*/ fun transfer(/*0*/ p0: kotlin.Array<(out) java.util.HashMap.Entry<(raw) kotlin.Any!, (raw) kotlin.Any!>!>!, /*1*/ p1: kotlin.Boolean): kotlin.Unit - public open override /*2*/ /*fake_override*/ fun values(): kotlin.MutableCollection invisible_fake open override /*1*/ /*fake_override*/ fun writeObject(/*0*/ p0: java.io.ObjectOutputStream!): kotlin.Unit } diff --git a/idea/testData/refactoring/extractFunction/typeParameters/typeParameterNotResolvableInTargetScope.kt b/idea/testData/refactoring/extractFunction/typeParameters/typeParameterNotResolvableInTargetScope.kt index 30e66d0a030..924999e8344 100644 --- a/idea/testData/refactoring/extractFunction/typeParameters/typeParameterNotResolvableInTargetScope.kt +++ b/idea/testData/refactoring/extractFunction/typeParameters/typeParameterNotResolvableInTargetScope.kt @@ -1,6 +1,6 @@ // WITH_RUNTIME // PARAM_TYPES: Foo -// PARAM_TYPES: kotlin.String, Comparable, CharSequence, java.io.Serializable, kotlin.Any +// PARAM_TYPES: kotlin.String // PARAM_DESCRIPTOR: internal final class Foo defined in root package // PARAM_DESCRIPTOR: value-parameter val l: kotlin.String defined in Foo.test diff --git a/idea/testData/refactoring/extractFunction/typeParameters/typeParameterNotResolvableInTargetScope.kt.after b/idea/testData/refactoring/extractFunction/typeParameters/typeParameterNotResolvableInTargetScope.kt.after index 9ed325c9e7c..aae6940fe6c 100644 --- a/idea/testData/refactoring/extractFunction/typeParameters/typeParameterNotResolvableInTargetScope.kt.after +++ b/idea/testData/refactoring/extractFunction/typeParameters/typeParameterNotResolvableInTargetScope.kt.after @@ -1,6 +1,6 @@ // WITH_RUNTIME // PARAM_TYPES: Foo -// PARAM_TYPES: kotlin.String, Comparable, CharSequence, java.io.Serializable, kotlin.Any +// PARAM_TYPES: kotlin.String // PARAM_DESCRIPTOR: internal final class Foo defined in root package // PARAM_DESCRIPTOR: value-parameter val l: kotlin.String defined in Foo.test diff --git a/idea/testData/refactoring/extractFunction/typeParameters/typeParameterResolvableInTargetScope.kt b/idea/testData/refactoring/extractFunction/typeParameters/typeParameterResolvableInTargetScope.kt index 21ff6a52ab9..f6a780d058e 100644 --- a/idea/testData/refactoring/extractFunction/typeParameters/typeParameterResolvableInTargetScope.kt +++ b/idea/testData/refactoring/extractFunction/typeParameters/typeParameterResolvableInTargetScope.kt @@ -1,5 +1,5 @@ // WITH_RUNTIME -// PARAM_TYPES: kotlin.String, Comparable, CharSequence, java.io.Serializable, kotlin.Any +// PARAM_TYPES: kotlin.String // PARAM_DESCRIPTOR: value-parameter val l: kotlin.String defined in Foo.test import java.util.* diff --git a/idea/testData/refactoring/extractFunction/typeParameters/typeParameterResolvableInTargetScope.kt.after b/idea/testData/refactoring/extractFunction/typeParameters/typeParameterResolvableInTargetScope.kt.after index 8be1f6d1dce..34e112a81e3 100644 --- a/idea/testData/refactoring/extractFunction/typeParameters/typeParameterResolvableInTargetScope.kt.after +++ b/idea/testData/refactoring/extractFunction/typeParameters/typeParameterResolvableInTargetScope.kt.after @@ -1,5 +1,5 @@ // WITH_RUNTIME -// PARAM_TYPES: kotlin.String, Comparable, CharSequence, java.io.Serializable, kotlin.Any +// PARAM_TYPES: kotlin.String // PARAM_DESCRIPTOR: value-parameter val l: kotlin.String defined in Foo.test import java.util.*