From c3190bbae3303de6fb2965d6be37e994d68b568b Mon Sep 17 00:00:00 2001 From: Ilya Gorbunov Date: Tue, 17 Nov 2015 22:54:22 +0300 Subject: [PATCH] Migrate type parameter list syntax. --- libraries/stdlib/src/kotlin/collections/Sets.kt | 16 ++++++++-------- libraries/stdlib/src/kotlin/util/Lazy.kt | 8 ++++---- .../stdlib/test/collections/CollectionJVMTest.kt | 2 +- .../stdlib/test/collections/ComparisonDSL.kt | 6 +++--- libraries/stdlib/test/js/MapJsTest.kt | 4 ++-- libraries/stdlib/test/js/SetJsTest.kt | 4 ++-- libraries/stdlib/test/utils/LazyJVMTest.kt | 2 +- 7 files changed, 21 insertions(+), 21 deletions(-) diff --git a/libraries/stdlib/src/kotlin/collections/Sets.kt b/libraries/stdlib/src/kotlin/collections/Sets.kt index 1d930145dad..8e7b0dcda5c 100644 --- a/libraries/stdlib/src/kotlin/collections/Sets.kt +++ b/libraries/stdlib/src/kotlin/collections/Sets.kt @@ -24,19 +24,19 @@ internal object EmptySet : Set, Serializable { /** Returns an empty read-only set. The returned set is serializable (JVM). */ -public fun emptySet(): Set = EmptySet +public fun emptySet(): Set = EmptySet /** Returns a new read-only ordered set with the given elements. The returned set is serializable (JVM). */ -public fun setOf(vararg values: T): Set = if (values.size > 0) values.toSet() else emptySet() +public fun setOf(vararg values: T): Set = if (values.size > 0) values.toSet() else emptySet() /** Returns an empty read-only set. The returned set is serializable (JVM). */ -public fun setOf(): Set = emptySet() +public fun setOf(): Set = emptySet() /** Returns a new [HashSet] with the given elements. */ -public fun hashSetOf(vararg values: T): HashSet = values.toCollection(HashSet(mapCapacity(values.size))) +public fun hashSetOf(vararg values: T): HashSet = values.toCollection(HashSet(mapCapacity(values.size))) /** Returns a new [LinkedHashSet] with the given elements. */ -public fun linkedSetOf(vararg values: T): LinkedHashSet = values.toCollection(LinkedHashSet(mapCapacity(values.size))) +public fun linkedSetOf(vararg values: T): LinkedHashSet = values.toCollection(LinkedHashSet(mapCapacity(values.size))) /** Returns this Set if it's not `null` and the empty set otherwise. */ public fun Set?.orEmpty(): Set = this ?: emptySet() @@ -46,17 +46,17 @@ public fun Set?.orEmpty(): Set = this ?: emptySet() * The returned set is serializable. */ @JvmVersion -public fun setOf(value: T): Set = Collections.singleton(value) +public fun setOf(value: T): Set = Collections.singleton(value) /** * Returns a new [SortedSet] with the given elements. */ @JvmVersion -public fun sortedSetOf(vararg values: T): TreeSet = values.toCollection(TreeSet()) +public fun sortedSetOf(vararg values: T): TreeSet = values.toCollection(TreeSet()) /** * Returns a new [SortedSet] with the given [comparator] and elements. */ @JvmVersion -public fun sortedSetOf(comparator: Comparator, vararg values: T): TreeSet = values.toCollection(TreeSet(comparator)) +public fun sortedSetOf(comparator: Comparator, vararg values: T): TreeSet = values.toCollection(TreeSet(comparator)) diff --git a/libraries/stdlib/src/kotlin/util/Lazy.kt b/libraries/stdlib/src/kotlin/util/Lazy.kt index 27ca7f624ff..c7d6979130b 100644 --- a/libraries/stdlib/src/kotlin/util/Lazy.kt +++ b/libraries/stdlib/src/kotlin/util/Lazy.kt @@ -22,7 +22,7 @@ public abstract class Lazy internal constructor() { /** * Creates a new instance of the [Lazy] that is already initialized with the specified [value]. */ -public fun lazyOf(value: T): Lazy = InitializedLazyImpl(value) +public fun lazyOf(value: T): Lazy = InitializedLazyImpl(value) /** * Creates a new instance of the [Lazy] that uses the specified initialization function [initializer] @@ -34,7 +34,7 @@ public fun lazyOf(value: T): Lazy = InitializedLazyImpl(value) * the returned instance as it may cause accidental deadlock. Also this behavior can be changed in the future. */ @kotlin.jvm.JvmVersion -public fun lazy(initializer: () -> T): Lazy = SynchronizedLazyImpl(initializer) +public fun lazy(initializer: () -> T): Lazy = SynchronizedLazyImpl(initializer) /** * Creates a new instance of the [Lazy] that uses the specified initialization function [initializer] @@ -47,7 +47,7 @@ public fun lazy(initializer: () -> T): Lazy = SynchronizedLazyImpl(initial * Also this behavior can be changed in the future. */ @kotlin.jvm.JvmVersion -public fun lazy(mode: LazyThreadSafetyMode, initializer: () -> T): Lazy = +public fun lazy(mode: LazyThreadSafetyMode, initializer: () -> T): Lazy = when (mode) { LazyThreadSafetyMode.SYNCHRONIZED -> SynchronizedLazyImpl(initializer) LazyThreadSafetyMode.PUBLICATION -> SafePublicationLazyImpl(initializer) @@ -66,7 +66,7 @@ public fun lazy(mode: LazyThreadSafetyMode, initializer: () -> T): Lazy = * Also this behavior can be changed in the future. */ @kotlin.jvm.JvmVersion -public fun lazy(lock: Any?, initializer: () -> T): Lazy = SynchronizedLazyImpl(initializer, lock) +public fun lazy(lock: Any?, initializer: () -> T): Lazy = SynchronizedLazyImpl(initializer, lock) /** * An extension to delegate a read-only property of type [T] to an instance of [Lazy]. diff --git a/libraries/stdlib/test/collections/CollectionJVMTest.kt b/libraries/stdlib/test/collections/CollectionJVMTest.kt index 2488b6289f3..bde8833dbd6 100644 --- a/libraries/stdlib/test/collections/CollectionJVMTest.kt +++ b/libraries/stdlib/test/collections/CollectionJVMTest.kt @@ -183,7 +183,7 @@ class CollectionJVMTest { assertTrue(value === result) } - private fun serializeAndDeserialize(value: T): T { + private fun serializeAndDeserialize(value: T): T { val outputStream = ByteArrayOutputStream() val objectOutputStream = ObjectOutputStream(outputStream) diff --git a/libraries/stdlib/test/collections/ComparisonDSL.kt b/libraries/stdlib/test/collections/ComparisonDSL.kt index 563132e7789..d0298812d60 100644 --- a/libraries/stdlib/test/collections/ComparisonDSL.kt +++ b/libraries/stdlib/test/collections/ComparisonDSL.kt @@ -2,7 +2,7 @@ package test.collections import kotlin.test.* -public fun compare(expected: T, actual: T, block:CompareContext.() -> Unit) { +public fun compare(expected: T, actual: T, block:CompareContext.() -> Unit) { CompareContext(expected, actual).block() } @@ -11,11 +11,11 @@ public class CompareContext(public val expected: T, public val actual: T) public fun equals(message: String = "") { assertEquals(expected, actual, message) } - public fun propertyEquals

(message: String = "", getter: T.() -> P) { + public fun

propertyEquals(message: String = "", getter: T.() -> P) { assertEquals(expected.getter(), actual.getter(), message) } public fun propertyFails(getter: T.() -> Unit) { assertFailEquals({expected.getter()}, {actual.getter()}) } - public fun compareProperty

(getter: T.() -> P, block: CompareContext

.() -> Unit) { + public fun

compareProperty(getter: T.() -> P, block: CompareContext

.() -> Unit) { compare(expected.getter(), actual.getter(), block) } diff --git a/libraries/stdlib/test/js/MapJsTest.kt b/libraries/stdlib/test/js/MapJsTest.kt index dfab09e6186..6916fea13fd 100644 --- a/libraries/stdlib/test/js/MapJsTest.kt +++ b/libraries/stdlib/test/js/MapJsTest.kt @@ -8,7 +8,7 @@ import org.junit.Test as test class ComplexMapJsTest : MapJsTest() { // Helper function with generic parameter to force to use ComlpexHashMap - fun doTest>() { + fun > doTest() { HashMap() HashMap(3) HashMap(3, 0.5f) @@ -488,5 +488,5 @@ abstract class MapJsTest { return map } - fun genericHashMapOf(vararg values: Pair) = hashMapOf(*values) + fun genericHashMapOf(vararg values: Pair) = hashMapOf(*values) } diff --git a/libraries/stdlib/test/js/SetJsTest.kt b/libraries/stdlib/test/js/SetJsTest.kt index 8dafeb5959a..a6047c0493f 100644 --- a/libraries/stdlib/test/js/SetJsTest.kt +++ b/libraries/stdlib/test/js/SetJsTest.kt @@ -8,7 +8,7 @@ import java.util.LinkedHashSet class ComplexSetJsTest : SetJsTest() { // Helper function with generic parameter to force to use ComlpexHashMap - fun doTest() { + fun doTest() { HashSet() HashSet(3) HashSet(3, 0.5f) @@ -257,5 +257,5 @@ abstract class SetJsTest { return set } - fun genericHashSetOf(vararg values: T) = hashSetOf(*values) + fun genericHashSetOf(vararg values: T) = hashSetOf(*values) } diff --git a/libraries/stdlib/test/utils/LazyJVMTest.kt b/libraries/stdlib/test/utils/LazyJVMTest.kt index 97649fbd09b..19bad2a3622 100644 --- a/libraries/stdlib/test/utils/LazyJVMTest.kt +++ b/libraries/stdlib/test/utils/LazyJVMTest.kt @@ -86,7 +86,7 @@ class LazyJVMTest { } - private fun serializeAndDeserialize(value: T): T { + private fun serializeAndDeserialize(value: T): T { val outputStream = ByteArrayOutputStream() val objectOutputStream = ObjectOutputStream(outputStream)