Remove JvmVersion annotation and its usages

This commit is contained in:
Ilya Gorbunov
2018-04-13 22:15:19 +03:00
parent 1eca402332
commit 2c74b91de4
95 changed files with 2 additions and 229 deletions
@@ -1,22 +0,0 @@
/*
* Copyright 2010-2017 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:JvmVersion
package kotlin.jvm
@Target(AnnotationTarget.FILE, AnnotationTarget.CLASS, AnnotationTarget.PROPERTY, AnnotationTarget.CONSTRUCTOR, AnnotationTarget.FUNCTION)
@Retention(AnnotationRetention.SOURCE)
internal annotation class JvmVersion(public val minimum: Int = 6, public val maximum: Int = 100)
@@ -1,22 +0,0 @@
/*
* Copyright 2010-2017 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:JvmVersion
package kotlin.jvm
@Target(AnnotationTarget.FILE, AnnotationTarget.CLASS, AnnotationTarget.PROPERTY, AnnotationTarget.CONSTRUCTOR, AnnotationTarget.FUNCTION)
@Retention(AnnotationRetention.SOURCE)
internal annotation class JvmVersion(public val minimum: Int = 6, public val maximum: Int = 100)
@@ -22,15 +22,14 @@ sourceSets {
"test" {}
}
val copySources by task<Copy> {
val copySources by task<Sync> {
val stdlibProjectDir = project(":kotlin-stdlib").projectDir
from(stdlibProjectDir.resolve("runtime"))
.include("kotlin/TypeAliases.kt",
"kotlin/text/TypeAliases.kt")
from(stdlibProjectDir.resolve("src"))
.include("kotlin/collections/TypeAliases.kt",
"kotlin/jvm/JvmVersion.kt")
.include("kotlin/collections/TypeAliases.kt")
from(stdlibProjectDir.resolve("../src"))
.include("kotlin/util/Standard.kt",
"kotlin/internal/Annotations.kt",
@@ -1,6 +1,5 @@
@file:kotlin.jvm.JvmMultifileClass
@file:kotlin.jvm.JvmName("ArraysKt")
@file:kotlin.jvm.JvmVersion
package kotlin.collections
@@ -1,6 +1,5 @@
@file:kotlin.jvm.JvmMultifileClass
@file:kotlin.jvm.JvmName("CollectionsKt")
@file:kotlin.jvm.JvmVersion
package kotlin.collections
@@ -1,6 +1,5 @@
@file:kotlin.jvm.JvmMultifileClass
@file:kotlin.jvm.JvmName("ComparisonsKt")
@file:kotlin.jvm.JvmVersion
package kotlin.comparisons
@@ -1,6 +1,5 @@
@file:kotlin.jvm.JvmMultifileClass
@file:kotlin.jvm.JvmName("SequencesKt")
@file:kotlin.jvm.JvmVersion
package kotlin.sequences
@@ -1,6 +1,5 @@
@file:kotlin.jvm.JvmMultifileClass
@file:kotlin.jvm.JvmName("StringsKt")
@file:kotlin.jvm.JvmVersion
package kotlin.text
@@ -3,7 +3,6 @@
* that can be found in the license/LICENSE.txt file.
*/
@file:JvmVersion
package kotlin.collections
import java.util.AbstractCollection
@@ -3,7 +3,6 @@
* that can be found in the license/LICENSE.txt file.
*/
@file:JvmVersion
package kotlin.collections
import java.util.AbstractList
@@ -3,7 +3,6 @@
* that can be found in the license/LICENSE.txt file.
*/
@file:JvmVersion
package kotlin.collections
import java.util.AbstractMap
@@ -3,7 +3,6 @@
* that can be found in the license/LICENSE.txt file.
*/
@file:JvmVersion
package kotlin.collections
import java.util.AbstractSet
@@ -5,7 +5,6 @@
@file:kotlin.jvm.JvmMultifileClass
@file:kotlin.jvm.JvmName("ArraysKt")
@file:kotlin.jvm.JvmVersion
package kotlin.collections
@@ -15,7 +15,6 @@ import kotlin.*
* The returned list is serializable.
* @sample samples.collections.Collections.Lists.singletonReadOnlyList
*/
@JvmVersion
public fun <T> listOf(element: T): List<T> = java.util.Collections.singletonList(element)
@@ -24,23 +23,19 @@ public fun <T> listOf(element: T): List<T> = java.util.Collections.singletonList
* in the order they are returned by the enumeration.
* @sample samples.collections.Collections.Lists.listFromEnumeration
*/
@JvmVersion
@kotlin.internal.InlineOnly
public inline fun <T> java.util.Enumeration<T>.toList(): List<T> = java.util.Collections.list(this)
@JvmVersion
@kotlin.internal.InlineOnly
internal actual inline fun copyToArrayImpl(collection: Collection<*>): Array<Any?> =
kotlin.jvm.internal.collectionToArray(collection)
@JvmVersion
@kotlin.internal.InlineOnly
internal actual inline fun <T> copyToArrayImpl(collection: Collection<*>, array: Array<T>): Array<T> =
kotlin.jvm.internal.collectionToArray(collection, array as Array<Any?>) as Array<T>
// copies typed varargs array to array of objects
@JvmVersion
internal actual fun <T> Array<out T>.copyToArrayOfAny(isVarargs: Boolean): Array<out Any?> =
if (isVarargs && this.javaClass == Array<Any?>::class.java)
// if the array came from varargs and already is array of Any, copying isn't required
@@ -17,7 +17,6 @@ package kotlin.collections
* @sample samples.collections.Collections.Transformations.groupingByEachCount
*/
@SinceKotlin("1.1")
@JvmVersion
public actual fun <T, K> Grouping<T, K>.eachCount(): Map<K, Int> =
// fold(0) { acc, e -> acc + 1 } optimized for boxing
foldTo(destination = mutableMapOf(),
@@ -32,7 +31,6 @@ public actual fun <T, K> Grouping<T, K>.eachCount(): Map<K, Int> =
* @return a [Map] associating the key of each group with the sum of elements in the group.
*/
@SinceKotlin("1.X")
@JvmVersion
public inline fun <T, K> Grouping<T, K>.eachSumOf(valueSelector: (T) -> Int): Map<K, Int> =
// fold(0) { acc, e -> acc + valueSelector(e)} optimized for boxing
foldTo( destination = mutableMapOf(),
@@ -43,7 +41,6 @@ public inline fun <T, K> Grouping<T, K>.eachSumOf(valueSelector: (T) -> Int): Ma
@JvmVersion
@PublishedApi
@kotlin.internal.InlineOnly
@Suppress("UNCHECKED_CAST") // tricks with erased generics go here, do not repeat on reified platforms
@@ -12,7 +12,6 @@ package kotlin.collections
* Creates an [Iterator] for an [java.util.Enumeration], allowing to use it in `for` loops.
* @sample samples.collections.Iterators.iteratorForEnumeration
*/
@kotlin.jvm.JvmVersion
public operator fun <T> java.util.Enumeration<T>.iterator(): Iterator<T> = object : Iterator<T> {
override fun hasNext(): Boolean = hasMoreElements()
@@ -1,6 +1,5 @@
@file:kotlin.jvm.JvmMultifileClass
@file:kotlin.jvm.JvmName("MapsKt")
@file:kotlin.jvm.JvmVersion
package kotlin.collections
@@ -20,7 +19,6 @@ import java.util.concurrent.ConcurrentMap
*
* @sample samples.collections.Maps.Instantiation.mapFromPairs
*/
@JvmVersion
public fun <K, V> mapOf(pair: Pair<K, V>): Map<K, V> = java.util.Collections.singletonMap(pair.first, pair.second)
@@ -78,12 +76,10 @@ public inline fun Map<String, String>.toProperties(): Properties
// creates a singleton copy of map, if there is specialization available in target platform, otherwise returns itself
@kotlin.jvm.JvmVersion
@kotlin.internal.InlineOnly
internal actual inline fun <K, V> Map<K, V>.toSingletonMapOrSelf(): Map<K, V> = toSingletonMap()
// creates a singleton copy of map
@kotlin.jvm.JvmVersion
internal actual fun <K, V> Map<out K, V>.toSingletonMap(): Map<K, V>
= with (entries.iterator().next()) { java.util.Collections.singletonMap(key, value) }
@@ -10,13 +10,11 @@ package kotlin.collections
@Deprecated("Use sortWith(comparator) instead.", ReplaceWith("this.sortWith(comparator)"), level = DeprecationLevel.ERROR)
@JvmVersion
@kotlin.internal.InlineOnly
@Suppress("UNUSED_PARAMETER")
public inline fun <T> MutableList<T>.sort(comparator: Comparator<in T>): Unit = throw NotImplementedError()
@Deprecated("Use sortWith(Comparator(comparison)) instead.", ReplaceWith("this.sortWith(Comparator(comparison))"), level = DeprecationLevel.ERROR)
@JvmVersion
@kotlin.internal.InlineOnly
@Suppress("UNUSED_PARAMETER")
public inline fun <T> MutableList<T>.sort(comparison: (T, T) -> Int): Unit = throw NotImplementedError()
@@ -25,7 +23,6 @@ public inline fun <T> MutableList<T>.sort(comparison: (T, T) -> Int): Unit = thr
/**
* Sorts elements in the list in-place according to their natural sort order.
*/
@kotlin.jvm.JvmVersion
public actual fun <T : Comparable<T>> MutableList<T>.sort(): Unit {
if (size > 1) java.util.Collections.sort(this)
}
@@ -33,7 +30,6 @@ public actual fun <T : Comparable<T>> MutableList<T>.sort(): Unit {
/**
* Sorts elements in the list in-place according to the order specified with [comparator].
*/
@kotlin.jvm.JvmVersion
public actual fun <T> MutableList<T>.sortWith(comparator: Comparator<in T>): Unit {
if (size > 1) java.util.Collections.sort(this, comparator)
}
@@ -43,7 +39,6 @@ public actual fun <T> MutableList<T>.sortWith(comparator: Comparator<in T>): Uni
*
* Each element in the list gets replaced with the [value].
*/
@kotlin.jvm.JvmVersion
@kotlin.internal.InlineOnly
@SinceKotlin("1.2")
public actual inline fun <T> MutableList<T>.fill(value: T) {
@@ -54,7 +49,6 @@ public actual inline fun <T> MutableList<T>.fill(value: T) {
/**
* Randomly shuffles elements in this mutable list.
*/
@kotlin.jvm.JvmVersion
@kotlin.internal.InlineOnly
@SinceKotlin("1.2")
public actual inline fun <T> MutableList<T>.shuffle() {
@@ -64,7 +58,6 @@ public actual inline fun <T> MutableList<T>.shuffle() {
/**
* Randomly shuffles elements in this mutable list using the specified [random] instance as the source of randomness.
*/
@kotlin.jvm.JvmVersion
@kotlin.internal.InlineOnly
@SinceKotlin("1.2")
public inline fun <T> MutableList<T>.shuffle(random: java.util.Random) {
@@ -74,7 +67,6 @@ public inline fun <T> MutableList<T>.shuffle(random: java.util.Random) {
/**
* Returns a new list with the elements of this list randomly shuffled.
*/
@kotlin.jvm.JvmVersion
@SinceKotlin("1.2")
public actual fun <T> Iterable<T>.shuffled(): List<T> = toMutableList().apply { shuffle() }
@@ -82,6 +74,5 @@ public actual fun <T> Iterable<T>.shuffled(): List<T> = toMutableList().apply {
* Returns a new list with the elements of this list randomly shuffled
* using the specified [random] instance as the source of randomness.
*/
@kotlin.jvm.JvmVersion
@SinceKotlin("1.2")
public fun <T> Iterable<T>.shuffled(random: java.util.Random): List<T> = toMutableList().apply { shuffle(random) }
@@ -14,12 +14,10 @@ import kotlin.*
* Creates a sequence that returns all values from this enumeration. The sequence is constrained to be iterated only once.
* @sample samples.collections.Sequences.Building.sequenceFromEnumeration
*/
@kotlin.jvm.JvmVersion
@kotlin.internal.InlineOnly
public inline fun<T> java.util.Enumeration<T>.asSequence(): Sequence<T> = this.iterator().asSequence()
@kotlin.jvm.JvmVersion
internal actual class ConstrainedOnceSequence<T> actual constructor(sequence: Sequence<T>) : Sequence<T> {
private val sequenceRef = java.util.concurrent.atomic.AtomicReference(sequence)
@@ -13,19 +13,16 @@ package kotlin.collections
* Returns an immutable set containing only the specified object [element].
* The returned set is serializable.
*/
@JvmVersion
public fun <T> setOf(element: T): Set<T> = java.util.Collections.singleton(element)
/**
* Returns a new [java.util.SortedSet] with the given elements.
*/
@JvmVersion
public fun <T> sortedSetOf(vararg elements: T): java.util.TreeSet<T> = elements.toCollection(java.util.TreeSet<T>())
/**
* Returns a new [java.util.SortedSet] with the given [comparator] and elements.
*/
@JvmVersion
public fun <T> sortedSetOf(comparator: Comparator<in T>, vararg elements: T): java.util.TreeSet<T> = elements.toCollection(java.util.TreeSet<T>(comparator))
@@ -1,5 +1,3 @@
@file:kotlin.jvm.JvmVersion
@file:Suppress("ACTUAL_WITHOUT_EXPECT") // for building kotlin-stdlib-minimal-for-test
package kotlin.collections
@@ -14,7 +14,6 @@
* limitations under the License.
*/
@file:JvmVersion
@file:JvmName("LocksKt")
package kotlin.concurrent
@@ -1,4 +1,3 @@
@file:JvmVersion
@file:JvmName("ThreadsKt")
package kotlin.concurrent
@@ -1,4 +1,3 @@
@file:JvmVersion
@file:JvmName("TimersKt")
package kotlin.concurrent
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@file:kotlin.jvm.JvmVersion
package kotlin.coroutines.experimental
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater
@@ -16,7 +16,6 @@
@file:kotlin.jvm.JvmName("IntrinsicsKt")
@file:kotlin.jvm.JvmMultifileClass
@file:kotlin.jvm.JvmVersion
package kotlin.coroutines.experimental.intrinsics
import kotlin.coroutines.experimental.*
@@ -63,7 +62,6 @@ public actual inline fun <R, T> (suspend R.() -> T).startCoroutineUninterceptedO
* state machine of the coroutine and may result in arbitrary behaviour or exception.
*/
@SinceKotlin("1.1")
@kotlin.jvm.JvmVersion
public actual fun <T> (suspend () -> T).createCoroutineUnchecked(
completion: Continuation<T>
): Continuation<Unit> =
@@ -86,7 +84,6 @@ public actual fun <T> (suspend () -> T).createCoroutineUnchecked(
* state machine of the coroutine and may result in arbitrary behaviour or exception.
*/
@SinceKotlin("1.1")
@kotlin.jvm.JvmVersion
public actual fun <R, T> (suspend R.() -> T).createCoroutineUnchecked(
receiver: R,
completion: Continuation<T>
@@ -101,7 +98,6 @@ public actual fun <R, T> (suspend R.() -> T).createCoroutineUnchecked(
// INTERNAL DEFINITIONS
@kotlin.jvm.JvmVersion
private inline fun <T> buildContinuationByInvokeCall(
completion: Continuation<T>,
crossinline block: () -> Any?
@@ -14,7 +14,6 @@
* limitations under the License.
*/
@file:JvmVersion
package kotlin.coroutines.experimental.jvm.internal
import java.lang.IllegalStateException
@@ -14,7 +14,6 @@
* limitations under the License.
*/
@file:JvmVersion
@file:JvmName("CoroutineIntrinsics")
package kotlin.coroutines.experimental.jvm.internal
@@ -1,4 +1,3 @@
@file:JvmVersion
package kotlin.internal
import kotlin.*
@@ -15,7 +15,6 @@
*/
@file:JvmName("CloseableKt")
@file:JvmVersion
package kotlin.io
import java.io.Closeable
@@ -1,4 +1,3 @@
@file:JvmVersion
@file:JvmName("ConsoleKt")
package kotlin.io
@@ -1,4 +1,3 @@
@file:JvmVersion
@file:JvmName("ConstantsKt")
package kotlin.io
@@ -1,4 +1,3 @@
@file:JvmVersion
package kotlin.io
import kotlin.text.*
@@ -1,4 +1,3 @@
@file:JvmVersion
@file:JvmMultifileClass
@file:JvmName("FilesKt")
package kotlin.io
@@ -1,4 +1,3 @@
@file:JvmVersion
@file:JvmName("ByteStreamsKt")
package kotlin.io
@@ -1,4 +1,3 @@
@file:JvmVersion
@file:JvmName("TextStreamsKt")
package kotlin.io
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@file:JvmVersion
package kotlin.io
// to use in shared code without imports
@@ -1,4 +1,3 @@
@file:JvmVersion
@file:JvmMultifileClass
@file:JvmName("FilesKt")
package kotlin.io
@@ -1,4 +1,3 @@
@file:JvmVersion
@file:JvmMultifileClass
@file:JvmName("FilesKt")
package kotlin.io
@@ -1,4 +1,3 @@
@file:JvmVersion
@file:JvmMultifileClass
@file:JvmName("FilesKt")
package kotlin.io
@@ -2,7 +2,6 @@
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the license/LICENSE.txt file.
*/
@file:JvmVersion
package kotlin.jvm
@@ -1,21 +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:JvmVersion
package kotlin.jvm
@Target(AnnotationTarget.FILE, AnnotationTarget.CLASS, AnnotationTarget.PROPERTY, AnnotationTarget.CONSTRUCTOR, AnnotationTarget.FUNCTION)
@Retention(AnnotationRetention.SOURCE)
internal annotation class JvmVersion(public val minimum: Int = 6, public val maximum: Int = 100)
@@ -14,7 +14,6 @@
* limitations under the License.
*/
@file:JvmVersion
package kotlin.jvm.internal.unsafe
import kotlin.*
@@ -14,7 +14,6 @@ import kotlin.*
*
* Numbers are compared with the ends of this range according to IEEE-754.
*/
@JvmVersion
private class ClosedFloatRange (
start: Float,
endInclusive: Float
@@ -46,7 +45,6 @@ private class ClosedFloatRange (
* Numbers are compared with the ends of this range according to IEEE-754.
* @sample samples.ranges.Ranges.rangeFromFloat
*/
@JvmVersion
@SinceKotlin("1.1")
public operator fun Float.rangeTo(that: Float): ClosedFloatingPointRange<Float> = ClosedFloatRange(this, that)
@@ -1,5 +1,4 @@
@file:kotlin.jvm.JvmName("ProcessKt")
@file:kotlin.jvm.JvmVersion
package kotlin.system
import kotlin.*
@@ -1,5 +1,4 @@
@file:kotlin.jvm.JvmName("TimingKt")
@file:kotlin.jvm.JvmVersion
package kotlin.system
/**
@@ -1,4 +1,3 @@
@file:JvmVersion
package kotlin.text
import kotlin.*
@@ -1,4 +1,3 @@
@file:JvmVersion
package kotlin.text
import kotlin.*
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@file:kotlin.jvm.JvmVersion
@file:kotlin.jvm.JvmMultifileClass
@file:kotlin.jvm.JvmName("CharsKt")
@@ -1,5 +1,4 @@
@file:JvmName("CharsetsKt")
@file:JvmVersion
package kotlin.text
import java.nio.charset.*
@@ -1,4 +1,3 @@
@file:kotlin.jvm.JvmVersion
@file:kotlin.jvm.JvmMultifileClass
@file:kotlin.jvm.JvmName("StringsKt")
@@ -7,7 +6,6 @@ package kotlin.text
/**
* Sets the character at the specified [index] to the specified [value].
*/
@kotlin.jvm.JvmVersion
@kotlin.internal.InlineOnly
public inline operator fun StringBuilder.set(index: Int, value: Char): Unit = this.setCharAt(index, value)
@@ -18,7 +18,6 @@ import kotlin.*
* @throws IllegalArgumentException when [radix] is not a valid radix for number to string conversion.
*/
@SinceKotlin("1.1")
@kotlin.jvm.JvmVersion
@kotlin.internal.InlineOnly
public inline fun Byte.toString(radix: Int): String = this.toInt().toString(checkRadix(radix))
@@ -28,7 +27,6 @@ public inline fun Byte.toString(radix: Int): String = this.toInt().toString(chec
* @throws IllegalArgumentException when [radix] is not a valid radix for number to string conversion.
*/
@SinceKotlin("1.1")
@kotlin.jvm.JvmVersion
@kotlin.internal.InlineOnly
public inline fun Short.toString(radix: Int): String = this.toInt().toString(checkRadix(radix))
@@ -38,7 +36,6 @@ public inline fun Short.toString(radix: Int): String = this.toInt().toString(che
* @throws IllegalArgumentException when [radix] is not a valid radix for number to string conversion.
*/
@SinceKotlin("1.1")
@kotlin.jvm.JvmVersion
@kotlin.internal.InlineOnly
public inline fun Int.toString(radix: Int): String = java.lang.Integer.toString(this, checkRadix(radix))
@@ -48,14 +45,12 @@ public inline fun Int.toString(radix: Int): String = java.lang.Integer.toString(
* @throws IllegalArgumentException when [radix] is not a valid radix for number to string conversion.
*/
@SinceKotlin("1.1")
@kotlin.jvm.JvmVersion
@kotlin.internal.InlineOnly
public inline fun Long.toString(radix: Int): String = java.lang.Long.toString(this, checkRadix(radix))
/**
* Returns `true` if the contents of this string is equal to the word "true", ignoring case, and `false` otherwise.
*/
@kotlin.jvm.JvmVersion
@kotlin.internal.InlineOnly
public actual inline fun String.toBoolean(): Boolean = java.lang.Boolean.parseBoolean(this)
@@ -63,7 +58,6 @@ public actual inline fun String.toBoolean(): Boolean = java.lang.Boolean.parseBo
* Parses the string as a signed [Byte] number and returns the result.
* @throws NumberFormatException if the string is not a valid representation of a number.
*/
@kotlin.jvm.JvmVersion
@kotlin.internal.InlineOnly
public actual inline fun String.toByte(): Byte = java.lang.Byte.parseByte(this)
@@ -73,7 +67,6 @@ public actual inline fun String.toByte(): Byte = java.lang.Byte.parseByte(this)
* @throws IllegalArgumentException when [radix] is not a valid radix for string to number conversion.
*/
@SinceKotlin("1.1")
@kotlin.jvm.JvmVersion
@kotlin.internal.InlineOnly
public actual inline fun String.toByte(radix: Int): Byte = java.lang.Byte.parseByte(this, checkRadix(radix))
@@ -82,7 +75,6 @@ public actual inline fun String.toByte(radix: Int): Byte = java.lang.Byte.parseB
* Parses the string as a [Short] number and returns the result.
* @throws NumberFormatException if the string is not a valid representation of a number.
*/
@kotlin.jvm.JvmVersion
@kotlin.internal.InlineOnly
public actual inline fun String.toShort(): Short = java.lang.Short.parseShort(this)
@@ -92,7 +84,6 @@ public actual inline fun String.toShort(): Short = java.lang.Short.parseShort(th
* @throws IllegalArgumentException when [radix] is not a valid radix for string to number conversion.
*/
@SinceKotlin("1.1")
@kotlin.jvm.JvmVersion
@kotlin.internal.InlineOnly
public actual inline fun String.toShort(radix: Int): Short = java.lang.Short.parseShort(this, checkRadix(radix))
@@ -100,7 +91,6 @@ public actual inline fun String.toShort(radix: Int): Short = java.lang.Short.par
* Parses the string as an [Int] number and returns the result.
* @throws NumberFormatException if the string is not a valid representation of a number.
*/
@kotlin.jvm.JvmVersion
@kotlin.internal.InlineOnly
public actual inline fun String.toInt(): Int = java.lang.Integer.parseInt(this)
@@ -110,7 +100,6 @@ public actual inline fun String.toInt(): Int = java.lang.Integer.parseInt(this)
* @throws IllegalArgumentException when [radix] is not a valid radix for string to number conversion.
*/
@SinceKotlin("1.1")
@kotlin.jvm.JvmVersion
@kotlin.internal.InlineOnly
public actual inline fun String.toInt(radix: Int): Int = java.lang.Integer.parseInt(this, checkRadix(radix))
@@ -118,7 +107,6 @@ public actual inline fun String.toInt(radix: Int): Int = java.lang.Integer.parse
* Parses the string as a [Long] number and returns the result.
* @throws NumberFormatException if the string is not a valid representation of a number.
*/
@kotlin.jvm.JvmVersion
@kotlin.internal.InlineOnly
public actual inline fun String.toLong(): Long = java.lang.Long.parseLong(this)
@@ -128,7 +116,6 @@ public actual inline fun String.toLong(): Long = java.lang.Long.parseLong(this)
* @throws IllegalArgumentException when [radix] is not a valid radix for string to number conversion.
*/
@SinceKotlin("1.1")
@kotlin.jvm.JvmVersion
@kotlin.internal.InlineOnly
public actual inline fun String.toLong(radix: Int): Long = java.lang.Long.parseLong(this, checkRadix(radix))
@@ -136,7 +123,6 @@ public actual inline fun String.toLong(radix: Int): Long = java.lang.Long.parseL
* Parses the string as a [Float] number and returns the result.
* @throws NumberFormatException if the string is not a valid representation of a number.
*/
@kotlin.jvm.JvmVersion
@kotlin.internal.InlineOnly
public actual inline fun String.toFloat(): Float = java.lang.Float.parseFloat(this)
@@ -144,7 +130,6 @@ public actual inline fun String.toFloat(): Float = java.lang.Float.parseFloat(th
* Parses the string as a [Double] number and returns the result.
* @throws NumberFormatException if the string is not a valid representation of a number.
*/
@kotlin.jvm.JvmVersion
@kotlin.internal.InlineOnly
public actual inline fun String.toDouble(): Double = java.lang.Double.parseDouble(this)
@@ -154,7 +139,6 @@ public actual inline fun String.toDouble(): Double = java.lang.Double.parseDoubl
* or `null` if the string is not a valid representation of a number.
*/
@SinceKotlin("1.1")
@kotlin.jvm.JvmVersion
public actual fun String.toFloatOrNull(): Float? = screenFloatValue(this, java.lang.Float::parseFloat)
/**
@@ -162,7 +146,6 @@ public actual fun String.toFloatOrNull(): Float? = screenFloatValue(this, java.l
* or `null` if the string is not a valid representation of a number.
*/
@SinceKotlin("1.1")
@kotlin.jvm.JvmVersion
public actual fun String.toDoubleOrNull(): Double? = screenFloatValue(this, java.lang.Double::parseDouble)
/**
@@ -170,7 +153,6 @@ public actual fun String.toDoubleOrNull(): Double? = screenFloatValue(this, java
* @throws NumberFormatException if the string is not a valid representation of a number.
*/
@SinceKotlin("1.2")
@kotlin.jvm.JvmVersion
@kotlin.internal.InlineOnly
public inline fun String.toBigInteger(): java.math.BigInteger =
java.math.BigInteger(this)
@@ -181,7 +163,6 @@ public inline fun String.toBigInteger(): java.math.BigInteger =
* @throws IllegalArgumentException when [radix] is not a valid radix for string to number conversion.
*/
@SinceKotlin("1.2")
@kotlin.jvm.JvmVersion
@kotlin.internal.InlineOnly
public inline fun String.toBigInteger(radix: Int): java.math.BigInteger =
java.math.BigInteger(this, checkRadix(radix))
@@ -191,7 +172,6 @@ public inline fun String.toBigInteger(radix: Int): java.math.BigInteger =
* or `null` if the string is not a valid representation of a number.
*/
@SinceKotlin("1.2")
@kotlin.jvm.JvmVersion
public fun String.toBigIntegerOrNull(): java.math.BigInteger? = toBigIntegerOrNull(10)
/**
@@ -201,7 +181,6 @@ public fun String.toBigIntegerOrNull(): java.math.BigInteger? = toBigIntegerOrNu
* @throws IllegalArgumentException when [radix] is not a valid radix for string to number conversion.
*/
@SinceKotlin("1.2")
@kotlin.jvm.JvmVersion
public fun String.toBigIntegerOrNull(radix: Int): java.math.BigInteger? {
checkRadix(radix)
val length = this.length
@@ -225,7 +204,6 @@ public fun String.toBigIntegerOrNull(radix: Int): java.math.BigInteger? {
* @throws NumberFormatException if the string is not a valid representation of a number.
*/
@SinceKotlin("1.2")
@kotlin.jvm.JvmVersion
@kotlin.internal.InlineOnly
public inline fun String.toBigDecimal(): java.math.BigDecimal =
java.math.BigDecimal(this)
@@ -238,7 +216,6 @@ public inline fun String.toBigDecimal(): java.math.BigDecimal =
* @throws ArithmeticException if the rounding is needed, but the rounding mode is [java.math.RoundingMode.UNNECESSARY].
*/
@SinceKotlin("1.2")
@kotlin.jvm.JvmVersion
@kotlin.internal.InlineOnly
public inline fun String.toBigDecimal(mathContext: java.math.MathContext): java.math.BigDecimal =
java.math.BigDecimal(this, mathContext)
@@ -248,7 +225,6 @@ public inline fun String.toBigDecimal(mathContext: java.math.MathContext): java.
* or `null` if the string is not a valid representation of a number.
*/
@SinceKotlin("1.2")
@kotlin.jvm.JvmVersion
public fun String.toBigDecimalOrNull(): java.math.BigDecimal? =
screenFloatValue(this) { it.toBigDecimal() }
@@ -260,14 +236,12 @@ public fun String.toBigDecimalOrNull(): java.math.BigDecimal? =
* @throws ArithmeticException if the rounding is needed, but the rounding mode is [java.math.RoundingMode.UNNECESSARY].
*/
@SinceKotlin("1.2")
@kotlin.jvm.JvmVersion
public fun String.toBigDecimalOrNull(mathContext: java.math.MathContext): java.math.BigDecimal? =
screenFloatValue(this) { it.toBigDecimal(mathContext) }
/**
* Recommended floating point number validation RegEx from the javadoc of `java.lang.Double.valueOf(String)`
*/
@kotlin.jvm.JvmVersion
private object ScreenFloatValueRegEx {
@JvmField val value = run {
val Digits = "(\\p{Digit}+)"
@@ -287,7 +261,6 @@ private object ScreenFloatValueRegEx {
}
}
@kotlin.jvm.JvmVersion
private inline fun <T> screenFloatValue(str: String, parse: (String) -> T): T? {
return try {
if (ScreenFloatValueRegEx.value.matches(str))
@@ -1,4 +1,3 @@
@file:kotlin.jvm.JvmVersion
@file:kotlin.jvm.JvmMultifileClass
@file:kotlin.jvm.JvmName("StringsKt")
@file:Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN")
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@file:JvmVersion
package kotlin.text
import java.util.Collections
@@ -14,6 +14,5 @@ package kotlin.text
*
* Provides the way to use Regex API on the instances of [java.util.regex.Pattern].
*/
@JvmVersion
@kotlin.internal.InlineOnly
public inline fun java.util.regex.Pattern.toRegex(): Regex = Regex(this)
@@ -1,4 +1,3 @@
@file:kotlin.jvm.JvmVersion
@file:kotlin.jvm.JvmMultifileClass
@file:kotlin.jvm.JvmName("PreconditionsKt")
package kotlin
@@ -16,7 +16,6 @@
@file:kotlin.jvm.JvmMultifileClass
@file:kotlin.jvm.JvmName("MathKt")
@file:kotlin.jvm.JvmVersion
package kotlin
@@ -16,7 +16,6 @@
@file:kotlin.jvm.JvmMultifileClass
@file:kotlin.jvm.JvmName("MathKt")
@file:kotlin.jvm.JvmVersion
package kotlin
@@ -1,6 +1,5 @@
@file:kotlin.jvm.JvmMultifileClass
@file:kotlin.jvm.JvmName("ExceptionsKt")
@file:kotlin.jvm.JvmVersion
@file:Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN")
package kotlin
@@ -18,7 +18,6 @@ package kotlin
* Note that the returned instance uses itself to synchronize on. Do not synchronize from external code on
* the returned instance as it may cause accidental deadlock. Also this behavior can be changed in the future.
*/
@kotlin.jvm.JvmVersion
public actual fun <T> lazy(initializer: () -> T): Lazy<T> = SynchronizedLazyImpl(initializer)
/**
@@ -31,7 +30,6 @@ public actual fun <T> lazy(initializer: () -> T): Lazy<T> = SynchronizedLazyImpl
* to synchronize on. Do not synchronize from external code on the returned instance as it may cause accidental deadlock.
* Also this behavior can be changed in the future.
*/
@kotlin.jvm.JvmVersion
public actual fun <T> lazy(mode: LazyThreadSafetyMode, initializer: () -> T): Lazy<T> =
when (mode) {
LazyThreadSafetyMode.SYNCHRONIZED -> SynchronizedLazyImpl(initializer)
@@ -50,12 +48,10 @@ public actual fun <T> lazy(mode: LazyThreadSafetyMode, initializer: () -> T): La
* in this case do not synchronize from external code on the returned instance as it may cause accidental deadlock.
* Also this behavior can be changed in the future.
*/
@kotlin.jvm.JvmVersion
public actual fun <T> lazy(lock: Any?, initializer: () -> T): Lazy<T> = SynchronizedLazyImpl(initializer, lock)
@JvmVersion
private class SynchronizedLazyImpl<out T>(initializer: () -> T, lock: Any? = null) : Lazy<T>, Serializable {
private var initializer: (() -> T)? = initializer
@Volatile private var _value: Any? = UNINITIALIZED_VALUE
@@ -92,7 +88,6 @@ private class SynchronizedLazyImpl<out T>(initializer: () -> T, lock: Any? = nul
}
@kotlin.jvm.JvmVersion
private class SafePublicationLazyImpl<out T>(initializer: () -> T) : Lazy<T>, Serializable {
@Volatile private var initializer: (() -> T)? = initializer
@Volatile private var _value: Any? = UNINITIALIZED_VALUE
@@ -14,7 +14,6 @@
* limitations under the License.
*/
@file:JvmVersion
@file:JvmMultifileClass
@file:JvmName("MathKt")
@@ -1,6 +1,5 @@
@file:kotlin.jvm.JvmMultifileClass
@file:kotlin.jvm.JvmName("MathKt")
@file:kotlin.jvm.JvmVersion
package kotlin
/**
@@ -1,4 +1,3 @@
@file:JvmVersion
@file:kotlin.jvm.JvmMultifileClass
@file:kotlin.jvm.JvmName("StandardKt")
package kotlin
@@ -1,4 +1,3 @@
@file:kotlin.jvm.JvmVersion
package test.exceptions
import kotlin.test.*
@@ -1,4 +1,3 @@
@file:kotlin.jvm.JvmVersion
package test.collections
import test.assertStaticAndRuntimeTypeIs
@@ -14,7 +14,6 @@
* limitations under the License.
*/
@file:kotlin.jvm.JvmVersion
package test.collections
import java.util.*
@@ -1,4 +1,3 @@
@file:kotlin.jvm.JvmVersion
package test.collections
import kotlin.test.*
@@ -1,4 +1,3 @@
@file:kotlin.jvm.JvmVersion
package test.collections
import java.util.concurrent.ConcurrentHashMap
@@ -3,7 +3,6 @@
* that can be found in the license/LICENSE.txt file.
*/
@file:JvmVersion
package test.collections
import kotlin.test.*
@@ -1,4 +1,3 @@
@file:kotlin.jvm.JvmVersion
package test.collections
import kotlin.test.*
@@ -1,4 +1,3 @@
@file:kotlin.jvm.JvmVersion
package test.concurrent
import kotlin.concurrent.*
@@ -1,4 +1,3 @@
@file:kotlin.jvm.JvmVersion
package test.concurrent
import java.util.*
-1
View File
@@ -4,7 +4,6 @@
*/
@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
@file:kotlin.jvm.JvmVersion
package test.io
import org.junit.Test
@@ -1,4 +1,3 @@
@file:kotlin.jvm.JvmVersion
package test.io
import java.io.File
-1
View File
@@ -1,4 +1,3 @@
@file:kotlin.jvm.JvmVersion
package test.io
import java.io.*
@@ -1,4 +1,3 @@
@file:kotlin.jvm.JvmVersion
package test.io
import kotlin.test.*
@@ -1,4 +1,3 @@
@file:kotlin.jvm.JvmVersion
package test.io
import kotlin.test.*
@@ -1,4 +1,3 @@
@file:kotlin.jvm.JvmVersion
package test.io
import java.io.*
-1
View File
@@ -14,7 +14,6 @@
* limitations under the License.
*/
@file:JvmVersion
package test.collections.js
public actual fun <V> stringMapOf(vararg pairs: Pair<String, V>): HashMap<String, V> = hashMapOf<String, V>(*pairs)
@@ -1,4 +1,3 @@
@file:kotlin.jvm.JvmVersion
package test.numbers
import java.math.BigInteger
@@ -14,7 +14,6 @@
* limitations under the License.
*/
@file:kotlin.jvm.JvmVersion
package test.numbers
import kotlin.test.*
@@ -1,4 +1,3 @@
@file:kotlin.jvm.JvmVersion
package test.numbers
import kotlin.test.*
@@ -1,4 +1,3 @@
@file:kotlin.jvm.JvmVersion
package test.numbers
import java.math.BigDecimal
@@ -3,7 +3,6 @@
* that can be found in the license/LICENSE.txt file.
*/
@file:JvmVersion
package test.properties.delegation.lazy
import kotlin.test.*
@@ -1,4 +1,3 @@
@file:kotlin.jvm.JvmVersion
package test.ranges
import java.lang.Integer.MAX_VALUE as MaxI
@@ -1,4 +1,3 @@
@file:kotlin.jvm.JvmVersion
@file:Suppress("DEPRECATION", "DEPRECATED_JAVA_ANNOTATION")
package test.reflection
@@ -18,18 +18,14 @@ package test
import kotlin.test.assertEquals
@JvmVersion
public actual fun assertTypeEquals(expected: Any?, actual: Any?) {
assertEquals(expected?.javaClass, actual?.javaClass)
}
@JvmVersion
public actual fun randomInt(limit: Int): Int = (Math.random() * limit).toInt()
@kotlin.jvm.JvmVersion
private val isJava6 = System.getProperty("java.version").startsWith("1.6.")
@kotlin.jvm.JvmVersion
internal actual fun String.removeLeadingPlusOnJava6(): String =
if (isJava6) removePrefix("+") else this
@@ -1,4 +1,3 @@
@file:kotlin.jvm.JvmVersion
package test.text
import kotlin.test.*
@@ -14,7 +14,6 @@
* limitations under the License.
*/
@file:kotlin.jvm.JvmVersion
package test.text
import kotlin.test.*
@@ -1,4 +1,3 @@
@file:kotlin.jvm.JvmVersion
package test.text
import kotlin.test.*
@@ -1,4 +1,3 @@
@file:kotlin.jvm.JvmVersion
package test.text
import test.collections.assertArrayNotSameButEquals
@@ -3,7 +3,6 @@
* that can be found in the license/LICENSE.txt file.
*/
@file:JvmVersion
package test.text
import test.*
@@ -11,21 +10,18 @@ import kotlin.test.*
class StringNumberConversionJVMTest {
@JvmVersion
@Test fun toIntArabicDigits() {
compareConversion({ it.toInt() }, { it.toIntOrNull() }) {
assertProduces("٢٣١٩٦٠", 231960)
}
}
@JvmVersion
@Test fun toLongArabicDigits() {
compareConversion({ it.toLong() }, { it.toLongOrNull() }) {
assertProduces("٢٣١٩٦٠٧٧٨٤٥٩", 231960778459)
}
}
@kotlin.jvm.JvmVersion
@Test fun toFloat() {
compareConversion(String::toFloat, String::toFloatOrNull) {
assertProduces("77.0", 77.0f)
@@ -38,7 +34,6 @@ class StringNumberConversionJVMTest {
}
@kotlin.jvm.JvmVersion
@Test fun toHexDouble() {
compareConversion(String::toDouble, String::toDoubleOrNull, ::doubleTotalOrderEquals) {
assertProduces("0x77p1", (0x77 shl 1).toDouble())
@@ -49,7 +44,6 @@ class StringNumberConversionJVMTest {
}
@kotlin.jvm.JvmVersion
@Test fun byteToStringWithRadix() {
assertEquals("7a", 0x7a.toByte().toString(16))
assertEquals("-80", Byte.MIN_VALUE.toString(radix = 16))
@@ -60,7 +54,6 @@ class StringNumberConversionJVMTest {
assertFailsWith<IllegalArgumentException>("Expected to fail with radix 1") { 1.toByte().toString(radix = 1) }
}
@kotlin.jvm.JvmVersion
@Test fun shortToStringWithRadix() {
assertEquals("7FFF", 0x7FFF.toShort().toString(radix = 16).toUpperCase())
assertEquals("-8000", (-0x8000).toShort().toString(radix = 16))
@@ -70,7 +63,6 @@ class StringNumberConversionJVMTest {
assertFailsWith<IllegalArgumentException>("Expected to fail with radix 1") { 1.toShort().toString(radix = 1) }
}
@kotlin.jvm.JvmVersion
@Test fun intToStringWithRadix() {
assertEquals("-ff", (-255).toString(radix = 16))
assertEquals("1100110", 102.toString(radix = 2))
@@ -80,7 +72,6 @@ class StringNumberConversionJVMTest {
}
@kotlin.jvm.JvmVersion
@Test fun longToStringWithRadix() {
assertEquals("7f11223344556677", 0x7F11223344556677.toString(radix = 16))
assertEquals("hazelnut", 1356099454469L.toString(radix = 36))
@@ -90,7 +81,6 @@ class StringNumberConversionJVMTest {
assertFailsWith<IllegalArgumentException>("Expected to fail with radix 1") { 1L.toString(radix = 1) }
}
@kotlin.jvm.JvmVersion
@Test fun toBigInteger() {
compareConversion(String::toBigInteger, String::toBigIntegerOrNull) {
assertProduces("0", java.math.BigInteger.ZERO)
@@ -118,7 +108,6 @@ class StringNumberConversionJVMTest {
}
}
@kotlin.jvm.JvmVersion
@Test fun toBigDecimal() {
fun bd(value: String) = java.math.BigDecimal(value)
compareConversion(String::toBigDecimal, String::toBigDecimalOrNull) {
@@ -3,7 +3,6 @@
* that can be found in the license/LICENSE.txt file.
*/
@file:JvmVersion
package test.utils
import kotlin.test.*
@@ -1,4 +1,3 @@
@file:kotlin.jvm.JvmVersion
package test.utils
@@ -72,8 +72,6 @@ fun List<MemberBuilder>.writeTo(file: File, platformSource: PlatformSourceFile)
}
writer.appendln("@file:kotlin.jvm.JvmName(\"${sourceFile.jvmClassName}\")")
if (platform == Platform.JVM)
writer.appendln("@file:kotlin.jvm.JvmVersion")
writer.appendln()
writer.append("package ${sourceFile.packageName ?: "kotlin"}\n\n")