Drop deprecations: functions that were converted to properties.

This commit is contained in:
Ilya Gorbunov
2016-01-16 18:03:21 +03:00
parent 2813840769
commit 768a23f7eb
11 changed files with 14 additions and 179 deletions
+4 -4
View File
@@ -17,16 +17,16 @@
package java.util
public fun <E> HashSet(c: Collection<E>): HashSet<E>
= HashSet<E>(c.size()).apply { addAll(c) }
= HashSet<E>(c.size).apply { addAll(c) }
public fun <E> LinkedHashSet(c: Collection<E>): HashSet<E>
= LinkedHashSet<E>(c.size()).apply { addAll(c) }
= LinkedHashSet<E>(c.size).apply { addAll(c) }
public fun <K, V> HashMap(m: Map<K, V>): HashMap<K, V>
= HashMap<K, V>(m.size()).apply { putAll(m) }
= HashMap<K, V>(m.size).apply { putAll(m) }
public fun <K, V> LinkedHashMap(m: Map<K, V>): LinkedHashMap<K, V>
= LinkedHashMap<K, V>(m.size()).apply { putAll(m) }
= LinkedHashMap<K, V>(m.size).apply { putAll(m) }
public fun <E> ArrayList(c: Collection<E>): ArrayList<E>
= ArrayList<E>().apply { asDynamic().array = c.toTypedArray<Any?>() } // black dynamic magic
@@ -16,7 +16,7 @@ public object Collections {
@Deprecated("Use list.reverse() instead.", ReplaceWith("list.reverse()"))
public fun <T> reverse(list: MutableList<T>): Unit {
val size = list.size()
val size = list.size
for (i in 0..(size / 2) - 1) {
val i2 = size - i - 1
val tmp = list[i]
+1 -1
View File
@@ -180,7 +180,7 @@ internal fun arrayCopyResize(source: dynamic, newSize: Int, defaultValue: Any?):
internal fun <T> arrayPlusCollection(array: dynamic, collection: Collection<T>): dynamic {
val result = array.slice(0)
result.length += collection.size()
result.length += collection.size
var index: Int = array.length
for (element in collection) result[index++] = element
return result
+3 -3
View File
@@ -56,7 +56,7 @@ public class Regex(pattern: String, options: Set<RegexOption>) {
public fun matches(input: CharSequence): Boolean {
nativePattern.reset()
val match = nativePattern.exec(input.toString())
return match != null && (match as RegExpMatch).index == 0 && nativePattern.lastIndex == input.length()
return match != null && (match as RegExpMatch).index == 0 && nativePattern.lastIndex == input.length
}
/** Indicates whether the regular expression can find at least one match in the specified [input]. */
@@ -114,7 +114,7 @@ public class Regex(pattern: String, options: Set<RegexOption>) {
if (match == null) return input.toString()
var lastStart = 0
val length = input.length()
val length = input.length
val sb = StringBuilder(length)
do {
val foundMatch = match!!
@@ -156,7 +156,7 @@ public class Regex(pattern: String, options: Set<RegexOption>) {
result.add(input.subSequence(lastStart, match.range.start).toString())
lastStart = match.range.endInclusive + 1
}
result.add(input.subSequence(lastStart, input.length()).toString())
result.add(input.subSequence(lastStart, input.length).toString())
return result
}
+5 -5
View File
@@ -12,7 +12,7 @@ public fun String.startsWith(prefix: String, ignoreCase: Boolean = false): Boole
if (!ignoreCase)
return nativeStartsWith(prefix, 0)
else
return regionMatches(0, prefix, 0, prefix.length(), ignoreCase)
return regionMatches(0, prefix, 0, prefix.length, ignoreCase)
}
/**
@@ -22,7 +22,7 @@ public fun String.startsWith(prefix: String, startIndex: Int, ignoreCase: Boolea
if (!ignoreCase)
return nativeStartsWith(prefix, startIndex)
else
return regionMatches(startIndex, prefix, 0, prefix.length(), ignoreCase)
return regionMatches(startIndex, prefix, 0, prefix.length, ignoreCase)
}
/**
@@ -32,17 +32,17 @@ public fun String.endsWith(suffix: String, ignoreCase: Boolean = false): Boolean
if (!ignoreCase)
return nativeEndsWith(suffix)
else
return regionMatches(length() - suffix.length(), suffix, 0, suffix.length(), ignoreCase)
return regionMatches(length - suffix.length, suffix, 0, suffix.length, ignoreCase)
}
public inline fun String.matches(regex : String) : Boolean {
val result = this.match(regex)
return result != null && result.size() > 0
return result != null && result.size > 0
}
public fun CharSequence.isBlank(): Boolean = length() == 0 || (if (this is String) this else this.toString()).matches("^[\\s\\xA0]+$")
public fun CharSequence.isBlank(): Boolean = length == 0 || (if (this is String) this else this.toString()).matches("^[\\s\\xA0]+$")
public fun String?.equals(other: String?, ignoreCase: Boolean = false): Boolean =
if (this == null)
@@ -1,52 +0,0 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@file:kotlin.jvm.JvmName("DeprecatedBuiltinsKt")
package kotlin
@Deprecated("Use property 'message' instead", ReplaceWith("this.message"))
public inline fun Throwable.getMessage(): String? = message
@Deprecated("Use property 'cause' instead", ReplaceWith("this.cause"))
public inline fun Throwable.getCause(): Throwable? = cause
@Deprecated("Use property 'size' instead", ReplaceWith("this.size"))
public inline fun Array<*>.size() = size
@Deprecated("Use property 'size' instead", ReplaceWith("this.size"))
public inline fun ByteArray.size() = size
@Deprecated("Use property 'size' instead", ReplaceWith("this.size"))
public inline fun CharArray.size() = size
@Deprecated("Use property 'size' instead", ReplaceWith("this.size"))
public inline fun ShortArray.size() = size
@Deprecated("Use property 'size' instead", ReplaceWith("this.size"))
public inline fun IntArray.size() = size
@Deprecated("Use property 'size' instead", ReplaceWith("this.size"))
public inline fun LongArray.size() = size
@Deprecated("Use property 'size' instead", ReplaceWith("this.size"))
public inline fun FloatArray.size() = size
@Deprecated("Use property 'size' instead", ReplaceWith("this.size"))
public inline fun DoubleArray.size() = size
@Deprecated("Use property 'size' instead", ReplaceWith("this.size"))
public inline fun BooleanArray.size() = size
@@ -40,53 +40,6 @@ public fun <@kotlin.internal.OnlyInputTypes T> MutableCollection<out T>.removeAl
*/
public fun <@kotlin.internal.OnlyInputTypes T> MutableCollection<out T>.retainAll(elements: Collection<T>): Boolean = (this as MutableCollection<T>).retainAll(elements)
@Deprecated("Use operator 'get' instead", ReplaceWith("this[index]"))
public fun CharSequence.charAt(index: Int): Char = this[index]
@Deprecated("Use property 'size' instead", ReplaceWith("size"))
public inline fun Collection<*>.size() = size
@Deprecated("Use property 'size' instead", ReplaceWith("size"))
public inline fun Map<*, *>.size() = size
@Deprecated("Use property 'key' instead", ReplaceWith("key"))
public fun <K, V> Map.Entry<K, V>.getKey(): K = key
@Deprecated("Use property 'value' instead.", ReplaceWith("value"))
public fun <K, V> Map.Entry<K, V>.getValue(): V = value
@Deprecated("Use 'removeAt' instead.", ReplaceWith("removeAt(index)"))
public fun <E> MutableList<E>.remove(index: Int): E = removeAt(index)
@Deprecated("Use property 'length' instead.", ReplaceWith("length"))
public fun CharSequence.length(): Int = length
@Deprecated("Use property 'keys' instead.", ReplaceWith("keys"))
public inline fun <K, V> Map<K, V>.keySet(): Set<K> = keys
@kotlin.jvm.JvmName("mutableKeys")
@Deprecated("Use property 'keys' instead.", ReplaceWith("keys"))
public fun <K, V> MutableMap<K, V>.keySet(): MutableSet<K> = keys
@Deprecated("Use property 'entries' instead.", ReplaceWith("entries"))
public inline fun <K, V> Map<K, V>.entrySet(): Set<Map.Entry<K, V>> = entries
@kotlin.jvm.JvmName("mutableEntrySet")
@Deprecated("Use property 'entries' instead.", ReplaceWith("entries"))
public fun <K, V> MutableMap<K, V>.entrySet(): MutableSet<MutableMap.MutableEntry<K, V>> = entries
@Deprecated("Use property 'values' instead.", ReplaceWith("values"))
public inline fun <K, V> Map<K, V>.values(): Collection<V> = values
@kotlin.jvm.JvmName("mutableValues")
@Deprecated("Use property 'values' instead.", ReplaceWith("values"))
public fun <K, V> MutableMap<K, V>.values(): MutableCollection<V> = values
/**
* Adds the specified [element] to this mutable collection.
*/
@@ -1,27 +0,0 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@file:kotlin.jvm.JvmMultifileClass
@file:kotlin.jvm.JvmName("EnumsKt")
package kotlin
@Deprecated("Use property ''name'' instead", ReplaceWith("this.name"))
public inline fun Enum<*>.name() = name
@Deprecated("Use property ''ordinal'' instead", ReplaceWith("this.ordinal"))
public inline fun Enum<*>.ordinal() = ordinal
@@ -99,24 +99,11 @@ public fun Char.isTitleCase(): Boolean = Character.isTitleCase(this)
*/
public fun Char.toTitleCase(): Char = Character.toTitleCase(this)
/**
* Returns a value indicating a character's general category.
*/
@Deprecated("Use 'category' property instead.", ReplaceWith("category"))
public fun Char.category(): CharCategory = category
/**
* Returns a value indicating a character's general category.
*/
public val Char.category: CharCategory get() = CharCategory.valueOf(Character.getType(this))
/**
* Returns the Unicode directionality property for the given character.
*/
@Deprecated("Use 'directionality' property instead.", ReplaceWith("directionality"))
public fun Char.directionality(): CharDirectionality = directionality
/**
* Returns the Unicode directionality property for the given character.
*/
@@ -33,22 +33,3 @@ public fun Double.isFinite(): Boolean = !isInfinite() && !isNaN()
* Returns `true` if the argument is a finite floating-point value; returns `false` otherwise (for `NaN` and infinity arguments).
*/
public fun Float.isFinite(): Boolean = !isInfinite() && !isNaN()
@Deprecated("Use toInt() instead.", ReplaceWith("toInt()"))
public fun Number.intValue(): Int = toInt()
@Deprecated("Use toLong() instead.", ReplaceWith("toLong()"))
public fun Number.longValue(): Long = toLong()
@Deprecated("Use toShort() instead.", ReplaceWith("toShort()"))
public fun Number.shortValue(): Short = toShort()
@Deprecated("Use toByte() instead.", ReplaceWith("toByte()"))
public fun Number.byteValue(): Byte = toByte()
@Deprecated("Use toDouble() instead.", ReplaceWith("toDouble()"))
public fun Number.doubleValue(): Double = toDouble()
@Deprecated("Use toFloat() instead.", ReplaceWith("toFloat()"))
public fun Number.floatValue(): Float = toFloat()
@@ -30,13 +30,6 @@ public fun Throwable.printStackTrace(stream: PrintStream): Unit {
jlt.printStackTrace(stream)
}
/**
* Returns the list of stack trace elements in a Kotlin stack trace.
*/
@Deprecated("Use 'stackTrace' property instead.", ReplaceWith("stackTrace"))
@JvmName("getStackTraceDeprecated")
public inline fun Throwable.getStackTrace(): Array<StackTraceElement> = stackTrace
/**
* Returns an array of stack trace elements representing the stack trace
* pertaining to this throwable.