Remove unneeded default imports in stdlib and tests

This commit is contained in:
Alexander Udalov
2018-09-28 14:57:14 +02:00
parent 199ae3bac8
commit 55c8b35eee
67 changed files with 24 additions and 158 deletions
@@ -13,9 +13,6 @@ package kotlin.collections
// See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib
//
import kotlin.*
import kotlin.text.*
import kotlin.comparisons.*
import kotlin.random.*
/**
@@ -13,9 +13,6 @@ package kotlin.collections
// See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib
//
import kotlin.*
import kotlin.text.*
import kotlin.comparisons.*
import kotlin.random.*
/**
@@ -13,9 +13,6 @@ package kotlin.comparisons
// See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib
//
import kotlin.*
import kotlin.text.*
import kotlin.comparisons.*
import kotlin.random.*
/**
@@ -13,9 +13,6 @@ package kotlin.collections
// See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib
//
import kotlin.*
import kotlin.text.*
import kotlin.comparisons.*
import kotlin.random.*
/**
@@ -13,9 +13,6 @@ package kotlin.ranges
// See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib
//
import kotlin.*
import kotlin.text.*
import kotlin.comparisons.*
import kotlin.random.*
/**
@@ -13,9 +13,6 @@ package kotlin.sequences
// See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib
//
import kotlin.*
import kotlin.text.*
import kotlin.comparisons.*
import kotlin.random.*
/**
@@ -13,9 +13,6 @@ package kotlin.collections
// See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib
//
import kotlin.*
import kotlin.text.*
import kotlin.comparisons.*
import kotlin.random.*
/**
@@ -13,9 +13,6 @@ package kotlin.text
// See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib
//
import kotlin.*
import kotlin.text.*
import kotlin.comparisons.*
import kotlin.random.*
/**
@@ -13,9 +13,6 @@ package kotlin.collections
// See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib
//
import kotlin.*
import kotlin.text.*
import kotlin.comparisons.*
import kotlin.random.*
/**
@@ -13,9 +13,6 @@ package kotlin.ranges
// See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib
//
import kotlin.*
import kotlin.text.*
import kotlin.comparisons.*
import kotlin.random.*
/**
@@ -2,10 +2,10 @@
* 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.
*/
package kotlin.coroutines.experimental
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater
import kotlin.*
import kotlin.coroutines.experimental.intrinsics.COROUTINE_SUSPENDED
@PublishedApi
@@ -9,7 +9,6 @@
package kotlin.coroutines.experimental
import kotlin.*
import kotlin.coroutines.experimental.intrinsics.*
import kotlin.experimental.ExperimentalTypeInference
@@ -5,7 +5,6 @@
package kotlin.coroutines
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater
import kotlin.*
import kotlin.coroutines.intrinsics.CoroutineSingletons.*
import kotlin.coroutines.intrinsics.COROUTINE_SUSPENDED
import kotlin.coroutines.jvm.internal.CoroutineStackFrame
@@ -9,7 +9,6 @@
package kotlin.sequences
import kotlin.*
import kotlin.coroutines.*
import kotlin.coroutines.intrinsics.*
import kotlin.experimental.ExperimentalTypeInference
-2
View File
@@ -5,8 +5,6 @@
package kotlin
import kotlin.js.*
// TODO: Ignore FunctionN interfaces
public interface Function0<out R> : Function<R> {
@@ -3,9 +3,6 @@
* that can be found in the license/LICENSE.txt file.
*/
import kotlin.js.*
/** Concat regular Array's and TypedArray's into an Array.
*/
@PublishedApi
@@ -51,4 +48,4 @@ internal fun <T> primitiveArrayConcat(vararg args: T): T {
internal inline fun withType(type: String, array: dynamic): dynamic {
array.`$type$` = type
return array
}
}
@@ -13,9 +13,6 @@ package kotlin.collections
import kotlin.js.*
import primitiveArrayConcat
import withType
import kotlin.*
import kotlin.text.*
import kotlin.comparisons.*
/**
* Returns a [List] that wraps the original array.
@@ -11,9 +11,6 @@ package kotlin.collections
//
import kotlin.js.*
import kotlin.*
import kotlin.text.*
import kotlin.comparisons.*
/**
* Reverses elements in the list in-place.
@@ -11,9 +11,6 @@ package kotlin.comparisons
//
import kotlin.js.*
import kotlin.*
import kotlin.text.*
import kotlin.comparisons.*
/**
* Returns the greater of two values.
+1 -3
View File
@@ -2,11 +2,10 @@
* 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.
*/
package kotlin.dom
import org.w3c.dom.*
import kotlin.collections.*
/**
* Gets a value indicating whether this node is a TEXT_NODE or a CDATA_SECTION_NODE.
@@ -14,7 +13,6 @@ import kotlin.collections.*
public val Node.isText: Boolean
get() = nodeType == Node.TEXT_NODE || nodeType == Node.CDATA_SECTION_NODE
/**
* Gets a value indicating whether this node is an [Element].
*/
@@ -13,9 +13,6 @@ package kotlin.collections
// See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib
//
import kotlin.*
import kotlin.text.*
import kotlin.comparisons.*
/**
* Returns a list containing all elements that are instances of specified class.
@@ -13,9 +13,6 @@ package kotlin.collections
// See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib
//
import kotlin.*
import kotlin.text.*
import kotlin.comparisons.*
/**
* Returns a list containing all elements that are instances of specified class.
@@ -13,9 +13,6 @@ package kotlin.comparisons
// See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib
//
import kotlin.*
import kotlin.text.*
import kotlin.comparisons.*
/**
* Returns the greater of two values.
@@ -13,9 +13,6 @@ package kotlin.sequences
// See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib
//
import kotlin.*
import kotlin.text.*
import kotlin.comparisons.*
/**
* Returns a sequence containing all elements that are instances of specified class.
@@ -13,9 +13,6 @@ package kotlin.text
// See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib
//
import kotlin.*
import kotlin.text.*
import kotlin.comparisons.*
/**
* Returns a [SortedSet][java.util.SortedSet] of all characters.
@@ -8,7 +8,6 @@
package kotlin.collections
import kotlin.*
import kotlin.internal.InlineOnly
import kotlin.internal.apiVersionIsAtLeast
@@ -8,8 +8,6 @@
package kotlin.sequences
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
@@ -5,7 +5,6 @@
package kotlin.internal
import kotlin.*
import java.util.regex.MatchResult
import kotlin.random.FallbackThreadLocalRandom
import kotlin.random.Random
@@ -89,4 +88,4 @@ private fun getJavaVersion(): Int {
@PublishedApi
@SinceKotlin("1.2")
internal fun apiVersionIsAtLeast(major: Int, minor: Int, patch: Int) =
KotlinVersion.CURRENT.isAtLeast(major, minor, patch)
KotlinVersion.CURRENT.isAtLeast(major, minor, patch)
@@ -7,7 +7,6 @@
package kotlin.io
import kotlin.text.*
import java.io.InputStream
import java.nio.Buffer
import java.nio.ByteBuffer
@@ -219,4 +218,4 @@ private fun Buffer.flipBack() {
private fun CharBuffer.dequeue(): Char {
flip()
return get().also { compact() }
}
}
@@ -5,7 +5,6 @@
package kotlin.io
import kotlin.text.*
import java.io.File
import java.io.IOException
@@ -9,7 +9,6 @@
package kotlin.io
import java.io.File
import kotlin.*
/**
* Estimation of a root name by a given file name.
@@ -8,7 +8,6 @@
package kotlin.io
import kotlin.*
import java.io.File
import java.io.IOException
import java.util.Stack
@@ -8,11 +8,8 @@
package kotlin.io
import java.io.*
import java.util.*
import kotlin.*
import kotlin.text.*
import kotlin.comparisons.*
import java.io.File
import java.io.IOException
/**
* Creates an empty directory in the specified [directory], using the given [prefix] and [suffix] to generate its name.
@@ -5,8 +5,6 @@
package kotlin.jvm.internal.unsafe
import kotlin.*
private fun monitorEnter(@Suppress("UNUSED_PARAMETER") monitor: Any): Unit =
throw UnsupportedOperationException("This function can only be used privately")
@@ -8,8 +8,6 @@
package kotlin.ranges
import kotlin.*
/**
* A closed range of values of type `Float`.
*
@@ -6,8 +6,6 @@
@file:kotlin.jvm.JvmName("ProcessKt")
package kotlin.system
import kotlin.*
/**
* Terminates the currently running Java Virtual Machine. The
* argument serves as a status code; by convention, a nonzero status
@@ -19,4 +17,4 @@ import kotlin.*
public inline fun exitProcess(status: Int): Nothing {
System.exit(status)
throw RuntimeException("System.exit returned normally, while it was supposed to halt JVM.")
}
}
@@ -5,8 +5,6 @@
package kotlin.text
import kotlin.*
/**
* Represents the character general category in the Unicode specification.
*/
@@ -172,4 +170,4 @@ public enum class CharCategory(public val value: Int, public val code: String) {
public fun valueOf(category: Int): CharCategory = categoryMap[category] ?: throw IllegalArgumentException("Category #$category is not defined.")
}
}
}
@@ -5,8 +5,6 @@
package kotlin.text
import kotlin.*
/**
* Represents the Unicode directionality of a character.
* Character directionality is used to calculate the
@@ -2,14 +2,12 @@
* 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:kotlin.jvm.JvmMultifileClass
@file:kotlin.jvm.JvmName("CharsKt")
package kotlin.text
import kotlin.*
/**
* Returns `true` if this character (Unicode code point) is defined in Unicode.
*/
@@ -158,4 +156,4 @@ internal actual fun checkRadix(radix: Int): Int {
throw IllegalArgumentException("radix $radix was not in valid range ${Character.MIN_RADIX..Character.MAX_RADIX}")
}
return radix
}
}
@@ -9,9 +9,6 @@
package kotlin.text
import kotlin.*
/**
* Returns a string representation of this [Byte] value in the specified [radix].
*
@@ -8,7 +8,6 @@
package kotlin.math
import kotlin.*
import kotlin.internal.InlineOnly
import kotlin.math.Constants.LN2
import kotlin.math.Constants.taylor_2_bound
@@ -16,7 +15,6 @@ import kotlin.math.Constants.taylor_n_bound
import kotlin.math.Constants.upper_taylor_2_bound
import kotlin.math.Constants.upper_taylor_n_bound
import java.lang.Math as nativeMath
private object Constants {
@@ -6,12 +6,10 @@
package test.collections
import test.assertStaticAndRuntimeTypeIs
import kotlin.test.*
import kotlin.comparisons.*
import java.util.*
import test.io.deserializeFromHex
import test.io.serializeAndDeserialize
import java.util.*
import kotlin.test.*
class CollectionJVMTest {
@@ -8,7 +8,6 @@ package test.collections
import java.util.concurrent.ConcurrentHashMap
import java.util.concurrent.ConcurrentMap
import kotlin.test.*
import kotlin.comparisons.*
class MapJVMTest {
@Test fun createSortedMap() {
@@ -5,8 +5,6 @@
package test.utils
import kotlin.*
import kotlin.test.*
import kotlin.concurrent.thread
import test.io.serializeAndDeserialize
@@ -9,8 +9,6 @@
package kotlin.collections
import kotlin.*
/**
* Provides a skeletal implementation of the read-only [List] interface.
*
@@ -8,8 +8,6 @@
package kotlin.collections
import kotlin.*
import kotlin.comparisons.compareValues
import kotlin.contracts.*
internal object EmptyIterator : ListIterator<Nothing> {
@@ -2,14 +2,12 @@
* 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:kotlin.jvm.JvmMultifileClass
@file:kotlin.jvm.JvmName("CollectionsKt")
package kotlin.collections
import kotlin.*
private open class ReversedListReadOnly<out T>(private val delegate: List<T>) : AbstractList<T>() {
override val size: Int get() = delegate.size
override fun get(index: Int): T = delegate[reverseElementIndex(index)]
@@ -8,8 +8,6 @@
package kotlin.sequences
import kotlin.*
/**
* Given an [iterator] function constructs a [Sequence] that returns values through the [Iterator]
* provided by that function.
@@ -5,8 +5,6 @@
package kotlin.collections
import kotlin.*
internal fun checkWindowSizeStep(size: Int, step: Int) {
require(size > 0 && step > 0) {
if (size != step)
@@ -196,4 +194,4 @@ private class RingBuffer<T>(val capacity: Int) : AbstractList<T>(), RandomAccess
this[idx] = element
}
}
}
}
@@ -5,7 +5,6 @@
package kotlin.properties
import kotlin.*
import kotlin.reflect.KProperty
/**
@@ -5,7 +5,6 @@
package kotlin.random
import kotlin.*
import kotlin.math.nextDown
/**
@@ -8,8 +8,6 @@
package kotlin.ranges
import kotlin.*
/**
* Represents a range of floating point numbers.
* Extends [ClosedRange] interface providing custom operation [lessThanOrEquals] for comparing values of range domain type.
@@ -9,10 +9,6 @@
package kotlin.text
import kotlin.*
/**
* Parses the string as a signed [Byte] number and returns the result
* or `null` if the string is not a valid representation of a number.
@@ -180,4 +176,4 @@ public fun String.toLongOrNull(radix: Int): Long? {
}
internal fun numberFormatError(input: String): Nothing = throw NumberFormatException("Invalid number format: '$input'")
internal fun numberFormatError(input: String): Nothing = throw NumberFormatException("Invalid number format: '$input'")
@@ -6,14 +6,10 @@
@file:kotlin.jvm.JvmMultifileClass
@file:kotlin.jvm.JvmName("StringsKt")
package kotlin.text
import kotlin.*
import kotlin.comparisons.*
import kotlin.contracts.contract
/**
* Returns a sub sequence of this char sequence having leading and trailing characters matching the [predicate] removed.
*/
-1
View File
@@ -6,7 +6,6 @@
package test.comparisons
import kotlin.test.*
import kotlin.comparisons.*
data class Item(val name: String, val rating: Int) : Comparable<Item> {
public override fun compareTo(other: Item): Int {
@@ -4,6 +4,7 @@
*/
@file:Suppress("SIGNED_CONSTANT_CONVERTED_TO_UNSIGNED")
package test.collections
import test.assertStaticTypeIs
@@ -11,7 +12,6 @@ import test.assertTypeEquals
import test.collections.behaviors.*
import test.comparisons.STRING_CASE_INSENSITIVE_ORDER
import kotlin.test.*
import kotlin.comparisons.*
import kotlin.random.Random
fun <T> assertArrayNotSameButEquals(expected: Array<out T>, actual: Array<out T>, message: String = "") { assertTrue(expected !== actual && expected contentEquals actual, message) }
@@ -1433,4 +1433,4 @@ private class ArraySortedChecker<A, T>(val array: A, val comparator: Comparator<
array.sorted().iterator().assertSorted { a, b -> comparator.compare(a, b) <= 0 }
array.sortedDescending().iterator().assertSorted { a, b -> comparator.compare(a, b) >= 0 }
}
}
}
@@ -9,7 +9,6 @@ import test.assertStaticAndRuntimeTypeIs
import kotlin.test.*
import test.collections.behaviors.*
import test.comparisons.STRING_CASE_INSENSITIVE_ORDER
import kotlin.comparisons.*
import kotlin.math.sin
import kotlin.random.Random
@@ -6,7 +6,6 @@
package test.collections.binarySearch
import kotlin.test.*
import kotlin.comparisons.*
class ListBinarySearchTest {
@@ -6,7 +6,6 @@
package test.collections
import kotlin.test.*
import kotlin.comparisons.*
fun fibonacci(): Sequence<Int> {
// fibonacci terms
@@ -577,4 +576,4 @@ public class SequenceTest {
}
*/
}
}
@@ -6,7 +6,6 @@
package test.collections.js
import kotlin.test.*
import kotlin.comparisons.*
class JsCollectionsTest {
val TEST_LIST = arrayOf(2, 0, 9, 7, 1).toList()
@@ -6,7 +6,6 @@
package numbers
import kotlin.test.*
import kotlin.comparisons.*
val Double.Companion.values get() = listOf(0.0, NEGATIVE_INFINITY, MIN_VALUE, MAX_VALUE, POSITIVE_INFINITY, NaN)
val Float.Companion.values get() = listOf(0.0f, NEGATIVE_INFINITY, MIN_VALUE, MAX_VALUE, POSITIVE_INFINITY, NaN)
@@ -198,4 +197,4 @@ class NaNTotalOrderTest {
fun sequenceTMax() {
totalOrderMaxOf2<Comparable<Any>>({ a, b -> sequenceOf(a, b).max()!! }, "sequenceOf().max()")
}
}
}
@@ -5,10 +5,8 @@
package test.ranges
import kotlin.comparisons.*
import kotlin.test.*
class ProgressionLastElementTest {
private val MAX = Int.MAX_VALUE
+2 -3
View File
@@ -4,9 +4,8 @@
*/
@file:Suppress("NAMED_ARGUMENTS_NOT_ALLOWED") // for common tests
package test.text
import kotlin.text.*
package test.text
import kotlin.test.*
@@ -223,4 +222,4 @@ class RegexTest {
}
}
+1 -2
View File
@@ -5,7 +5,6 @@
package test.utils
import kotlin.*
import kotlin.test.*
class LazyTest {
@@ -43,4 +42,4 @@ class LazyTest {
assertEquals("1", lazyInt.toString())
assertEquals(1, callCount)
}
}
}
-1
View File
@@ -5,7 +5,6 @@
package test.utils
import kotlin.*
import kotlin.test.*
class TODOTest {
@@ -8,7 +8,6 @@ package org.jetbrains.kotlin.tools
import kotlinx.metadata.jvm.*
import org.objectweb.asm.Opcodes
import org.objectweb.asm.tree.*
import kotlin.comparisons.*
val ACCESS_NAMES = mapOf(
Opcodes.ACC_PUBLIC to "public",
@@ -187,4 +186,4 @@ private fun findAnnotation(annotationName: String, visibleAnnotations: List<Anno
visibleAnnotations?.firstOrNull { it.refersToName(annotationName) }
?: if (includeInvisible) invisibleAnnotations?.firstOrNull { it.refersToName(annotationName) } else null
fun AnnotationNode.refersToName(name: String) = desc.startsWith('L') && desc.endsWith(';') && desc.regionMatches(1, name, 0, name.length)
fun AnnotationNode.refersToName(name: String) = desc.startsWith('L') && desc.endsWith(';') && desc.regionMatches(1, name, 0, name.length)
@@ -94,9 +94,6 @@ fun List<MemberBuilder>.writeTo(file: File, platformSource: PlatformSourceFile)
writer.appendln("import withType")
}
}
writer.appendln("import kotlin.*")
writer.appendln("import kotlin.text.*")
writer.appendln("import kotlin.comparisons.*")
if (platform == Platform.Common) {
writer.appendln("import kotlin.random.*")
}