From 59b83679b3fd858fb2339859aa1014b5126c7725 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Tue, 26 Aug 2014 14:55:58 +0400 Subject: [PATCH] Minor in JS stdlib: made stdlib warning less -- suppressed some BASE_WITH_NULLABLE_UPPER_BOUND warnings and fix one extra out projection. --- js/js.libraries/src/core/core.kt | 1 + js/js.libraries/src/core/javautil.kt | 36 ++++++++++++++++------------ 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/js/js.libraries/src/core/core.kt b/js/js.libraries/src/core/core.kt index 8592866f4c8..d2f32a65532 100644 --- a/js/js.libraries/src/core/core.kt +++ b/js/js.libraries/src/core/core.kt @@ -10,6 +10,7 @@ public val noImpl : Nothing = throw Exception() // Drop this after KT-2093 will be fixed and restore MutableMap.set in Maps.kt from MapsJVM.kt /** Provides [] access to maps */ +[suppress("BASE_WITH_NULLABLE_UPPER_BOUND")] native public fun MutableMap.set(key: K, value: V): V? = noImpl library("println") diff --git a/js/js.libraries/src/core/javautil.kt b/js/js.libraries/src/core/javautil.kt index 2713cadedbc..454fabd3416 100644 --- a/js/js.libraries/src/core/javautil.kt +++ b/js/js.libraries/src/core/javautil.kt @@ -64,10 +64,13 @@ public open class ArrayList(capacity: Int = 0) : AbstractList() { library public open class LinkedList() : AbstractList() { - public override fun get(index: Int): E = js.noImpl - public override fun set(index: Int, element: E): E = js.noImpl - public override fun add(index: Int, element: E): Unit = js.noImpl + override fun get(index: Int): E = js.noImpl + override fun set(index: Int, element: E): E = js.noImpl + override fun add(index: Int, element: E): Unit = js.noImpl + + [suppress("BASE_WITH_NULLABLE_UPPER_BOUND")] public fun poll(): E? = js.noImpl + [suppress("BASE_WITH_NULLABLE_UPPER_BOUND")] public fun peek(): E? = js.noImpl public fun offer(e: E): Boolean = js.noImpl } @@ -92,18 +95,21 @@ public open class LinkedHashSet( library public open class HashMap(initialCapacity: Int = DEFAULT_INITIAL_CAPACITY, loadFactor: Float = DEFAULT_LOAD_FACTOR) : MutableMap { - public override fun size(): Int = js.noImpl - public override fun isEmpty(): Boolean = js.noImpl - public override fun get(key: Any?): V? = js.noImpl - public override fun containsKey(key: Any?): Boolean = js.noImpl - public override fun put(key: K, value: V): V = js.noImpl - public override fun putAll(m: Map): Unit = js.noImpl - public override fun remove(key: Any?): V? = js.noImpl - public override fun clear(): Unit = js.noImpl - public override fun containsValue(value: Any?): Boolean = js.noImpl - public override fun keySet(): MutableSet = js.noImpl - public override fun values(): MutableCollection = js.noImpl - public override fun entrySet(): MutableSet> = js.noImpl + override fun size(): Int = js.noImpl + override fun isEmpty(): Boolean = js.noImpl + [suppress("BASE_WITH_NULLABLE_UPPER_BOUND")] + override fun get(key: Any?): V? = js.noImpl + override fun containsKey(key: Any?): Boolean = js.noImpl + [suppress("BASE_WITH_NULLABLE_UPPER_BOUND")] + override fun put(key: K, value: V): V? = js.noImpl + override fun putAll(m: Map): Unit = js.noImpl + [suppress("BASE_WITH_NULLABLE_UPPER_BOUND")] + override fun remove(key: Any?): V? = js.noImpl + override fun clear(): Unit = js.noImpl + override fun containsValue(value: Any?): Boolean = js.noImpl + override fun keySet(): MutableSet = js.noImpl + override fun values(): MutableCollection = js.noImpl + override fun entrySet(): MutableSet> = js.noImpl } library