StdLib cleanup: get rid of platformName and platformStatic usages

This commit is contained in:
Ilya Gorbunov
2015-09-29 21:29:08 +03:00
parent 404b228954
commit 70d064052b
6 changed files with 11 additions and 17 deletions
@@ -4,7 +4,6 @@
package kotlin
import java.util.*
import kotlin.platform.platformName
/**
* Returns the value for the given key, or the implicit default value for this map.
@@ -40,7 +39,7 @@ public fun <K, V> Map<K, V>.withDefault(default: (key: K) -> V): Map<K, V> =
*
* When this map already have an implicit default value provided with a former call to [withDefault], it is being replaced by this call.
*/
@platformName("withDefaultMutable")
@kotlin.jvm.JvmName("withDefaultMutable")
public fun <K, V> MutableMap<K, V>.withDefault(default: (key: K) -> V): MutableMap<K, V> =
when (this) {
is MutableMapWithDefault -> this.map.withDefault(default)
@@ -19,7 +19,6 @@
package kotlin
import java.util.AbstractList
import kotlin.platform.platformName
private open class ReversedListReadOnly<T>(protected open val delegate: List<T>) : AbstractList<T>() {
override val size: Int get() = delegate.size()
@@ -49,6 +48,6 @@ public fun <T> List<T>.asReversed(): List<T> = ReversedListReadOnly(this)
* Returns a reversed mutable view of the original mutable List.
* All changes made in the original list will be reflected in the reversed one and vice versa.
*/
@platformName("asReversedMutable")
@kotlin.jvm.JvmName("asReversedMutable")
public fun <T> MutableList<T>.asReversed(): MutableList<T> = ReversedList(this)
@@ -3,7 +3,6 @@ package kotlin.properties
import java.io.Serializable
import java.util.NoSuchElementException
import kotlin.platform.platformName
// extensions for Map and MutableMap
@@ -25,7 +24,7 @@ public fun <V> Map<in String, *>.get(thisRef: Any?, property: PropertyMetadata):
*
* @throws NoSuchElementException when the map doesn't contain value for the property name and doesn't provide an implicit default (see [withDefault]).
*/
@platformName("getVar")
@kotlin.jvm.JvmName("getVar")
public fun <V> MutableMap<in String, in V>.get(thisRef: Any?, property: PropertyMetadata): V = getOrImplicitDefault(property.name) as V
/**
@@ -1,7 +1,6 @@
package kotlin
import java.nio.charset.*
import kotlin.platform.*
/**
* Constant definitions for the standard [charsets](Charset). These
@@ -12,38 +11,38 @@ public object Charsets {
/**
* Eight-bit UCS Transformation Format.
*/
@platformStatic
@JvmStatic
public val UTF_8: Charset = Charset.forName("UTF-8")
/**
* Sixteen-bit UCS Transformation Format, byte order identified by an
* optional byte-order mark.
*/
@platformStatic
@JvmStatic
public val UTF_16: Charset = Charset.forName("UTF-16")
/**
* Sixteen-bit UCS Transformation Format, big-endian byte order.
*/
@platformStatic
@JvmStatic
public val UTF_16BE: Charset = Charset.forName("UTF-16BE")
/**
* Sixteen-bit UCS Transformation Format, little-endian byte order.
*/
@platformStatic
@JvmStatic
public val UTF_16LE: Charset = Charset.forName("UTF-16LE")
/**
* Seven-bit ASCII, a.k.a. ISO646-US, a.k.a. the Basic Latin block of the
* Unicode character set.
*/
@platformStatic
@JvmStatic
public val US_ASCII: Charset = Charset.forName("US-ASCII")
/**
* ISO Latin Alphabet No. 1, a.k.a. ISO-LATIN-1.
*/
@platformStatic
@JvmStatic
public val ISO_8859_1: Charset = Charset.forName("ISO-8859-1")
}
+1 -2
View File
@@ -5,7 +5,6 @@
package kotlin
import java.util.NoSuchElementException
import kotlin.platform.platformName
import kotlin.text.MatchResult
import kotlin.text.Regex
@@ -154,7 +153,7 @@ public fun String.padEnd(length: Int, padChar: Char = ' '): String {
/** Returns `true` if the string is not `null` and not empty */
@Deprecated("Use !isNullOrEmpty() or isNullOrEmpty().not() for nullable strings.", ReplaceWith("this != null && this.isNotEmpty()"))
@platformName("isNotEmptyNullable")
@kotlin.jvm.JvmName("isNotEmptyNullable")
public fun String?.isNotEmpty(): Boolean = this != null && this.length() > 0
/**
+1 -2
View File
@@ -18,7 +18,6 @@
package kotlin
import java.util.Comparator
import kotlin.platform.platformName
/**
* Compares two values using the specified sequence of functions to calculate the result of the comparison.
@@ -48,7 +47,7 @@ public fun <T : Any> compareValuesBy(a: T?, b: T?, vararg functions: (T) -> Comp
* compare as equal, the result of that comparison is returned.
*/
// TODO: Remove platformName after M13
@platformName("compareValuesByNullable")
@kotlin.jvm.JvmName("compareValuesByNullable")
public fun <T> compareValuesBy(a: T, b: T, vararg selectors: (T) -> Comparable<*>?): Int {
require(selectors.size() > 0)
for (fn in selectors) {