StdLib cleanup: deprecated usages
This commit is contained in:
@@ -165,10 +165,10 @@ public val NodeList.outerHTML: String
|
||||
get() = toList().map { it.innerHTML }.join("")
|
||||
|
||||
/** Returns an [Iterator] of all the next [Element] siblings */
|
||||
public fun Node.nextElements(): List<Element> = nextSiblings().filterIsInstance(javaClass<Element>())
|
||||
public fun Node.nextElements(): List<Element> = nextSiblings().filterIsInstance<Element>()
|
||||
|
||||
/** Returns an [Iterator] of all the previous [Element] siblings */
|
||||
public fun Node.previousElements(): List<Element> = previousSiblings().filterIsInstance(javaClass<Element>())
|
||||
public fun Node.previousElements(): List<Element> = previousSiblings().filterIsInstance<Element>()
|
||||
|
||||
|
||||
public var Element.classSet: MutableSet<String>
|
||||
|
||||
@@ -49,7 +49,7 @@ public fun createTempFile(prefix: String = "tmp", suffix: String? = null, direct
|
||||
* Returns this if this file is a directory, or the parent if it is a file inside a directory.
|
||||
*/
|
||||
public val File.directory: File
|
||||
get() = if (isDirectory()) this else parent!!
|
||||
get() = if (isDirectory()) this else parentFile!!
|
||||
|
||||
/**
|
||||
* Returns parent of this abstract path name, or `null` if it has no parent.
|
||||
|
||||
@@ -158,7 +158,7 @@ public enum class CharCategory(public val value: Int, public val code: String) {
|
||||
|
||||
|
||||
public companion object {
|
||||
private val categoryMap by Delegates.lazy { CharCategory.values().toMap { it.value } }
|
||||
private val categoryMap by lazy { CharCategory.values().toMap { it.value } }
|
||||
|
||||
public fun valueOf(category: Int): CharCategory = categoryMap[category] ?: throw IllegalArgumentException("Category #$category is not defined.")
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ public enum class CharDirectionality(public val value: Int) {
|
||||
|
||||
|
||||
public companion object {
|
||||
private val directionalityMap by Delegates.lazy { CharDirectionality.values().toMap { it.value } }
|
||||
private val directionalityMap by lazy { CharDirectionality.values().toMap { it.value } }
|
||||
|
||||
public fun valueOf(directionality: Int): CharDirectionality = directionalityMap[directionality] ?: throw IllegalArgumentException("Directionality #$directionality is not defined.")
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ class ComplexMapJsTest : MapJsTest() {
|
||||
doTest<String>()
|
||||
}
|
||||
|
||||
override fun <T : kotlin.Comparable<T>> Collection<T>.toNormalizedList(): List<T> = this.toSortedList()
|
||||
override fun <T : kotlin.Comparable<T>> Collection<T>.toNormalizedList(): List<T> = this.sorted()
|
||||
// hashMapOf returns ComlpexHashMap because it is Generic
|
||||
override fun emptyMutableMap(): MutableMap<String, Int> = genericHashMapOf()
|
||||
override fun emptyMutableMapWithNullableKeyValue(): MutableMap<String?, Int?> = genericHashMapOf()
|
||||
@@ -39,7 +39,7 @@ class PrimitiveMapJsTest : MapJsTest() {
|
||||
assertEquals(VALUES.toNormalizedList(), map.values().toNormalizedList())
|
||||
}
|
||||
|
||||
override fun <T : kotlin.Comparable<T>> Collection<T>.toNormalizedList(): List<T> = this.toSortedList()
|
||||
override fun <T : kotlin.Comparable<T>> Collection<T>.toNormalizedList(): List<T> = this.sorted()
|
||||
override fun emptyMutableMap(): MutableMap<String, Int> = HashMap()
|
||||
override fun emptyMutableMapWithNullableKeyValue(): MutableMap<String?, Int?> = HashMap()
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ class StringJVMTest {
|
||||
assertTrue {
|
||||
data.all { it.isJavaLetter() }
|
||||
}
|
||||
assertNot {
|
||||
assertFalse {
|
||||
data.all { it.isUpperCase() }
|
||||
}
|
||||
}
|
||||
@@ -113,7 +113,7 @@ class StringJVMTest {
|
||||
assertTrue {
|
||||
data.any() { it.isDigit() }
|
||||
}
|
||||
assertNot {
|
||||
assertFalse {
|
||||
data.any() { it.isUpperCase() }
|
||||
}
|
||||
}
|
||||
@@ -362,7 +362,7 @@ class StringJVMTest {
|
||||
|
||||
@test fun orderIgnoringCase() {
|
||||
val list = listOf("Beast", "Ast", "asterisk")
|
||||
assertEquals(listOf("Ast", "Beast", "asterisk"), list.sort())
|
||||
assertEquals(listOf("Ast", "asterisk", "Beast"), list.sortBy(String.CASE_INSENSITIVE_ORDER))
|
||||
assertEquals(listOf("Ast", "Beast", "asterisk"), list.sorted())
|
||||
assertEquals(listOf("Ast", "asterisk", "Beast"), list.sortedWith(String.CASE_INSENSITIVE_ORDER))
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -74,8 +74,8 @@ public class AnnotationListParseTest {
|
||||
}
|
||||
}
|
||||
|
||||
val actualAnnotationsSorted = actualAnnotations.toString().lines().filter { it.isNotEmpty() }.sort()
|
||||
val classDeclarationsSorted = annotationProvider.kotlinClasses.sort()
|
||||
val actualAnnotationsSorted = actualAnnotations.toString().lines().filter { it.isNotEmpty() }.sorted()
|
||||
val classDeclarationsSorted = annotationProvider.kotlinClasses.sorted()
|
||||
|
||||
val fileContents = (actualAnnotationsSorted + classDeclarationsSorted).joinToString("\n")
|
||||
assertEqualsToFile(expectedFile, fileContents)
|
||||
|
||||
Reference in New Issue
Block a user