Migrate header to expect in libraries projects

This commit is contained in:
Stanislav Erokhin
2017-09-15 15:51:55 +03:00
parent 7cd5eeb24d
commit 481cbd0850
14 changed files with 110 additions and 110 deletions
@@ -16,7 +16,7 @@
package kotlin.collections
open header class ArrayList<E> : MutableList<E> {
open expect class ArrayList<E> : MutableList<E> {
constructor(capacity: Int)
constructor()
constructor(c: Collection<E>)
@@ -52,7 +52,7 @@ open header class ArrayList<E> : MutableList<E> {
override fun subList(fromIndex: Int, toIndex: Int): MutableList<E>
}
open header class HashMap<K, V> : MutableMap<K, V> {
open expect class HashMap<K, V> : MutableMap<K, V> {
constructor()
constructor(initialCapacity: Int)
constructor(initialCapacity: Int, loadFactor: Float)
@@ -75,14 +75,14 @@ open header class HashMap<K, V> : MutableMap<K, V> {
override val entries: MutableSet<MutableMap.MutableEntry<K, V>>
}
open header class LinkedHashMap<K, V> : HashMap<K, V> {
open expect class LinkedHashMap<K, V> : HashMap<K, V> {
constructor()
constructor(initialCapacity: Int)
constructor(initialCapacity: Int, loadFactor: Float)
constructor(original: Map<out K, V>)
}
open header class HashSet<E> : MutableSet<E> {
open expect class HashSet<E> : MutableSet<E> {
constructor()
constructor(initialCapacity: Int)
constructor(initialCapacity: Int, loadFactor: Float)
@@ -104,17 +104,17 @@ open header class HashSet<E> : MutableSet<E> {
override fun clear()
}
open header class LinkedHashSet<E> : HashSet<E> {
open expect class LinkedHashSet<E> : HashSet<E> {
constructor()
constructor(initialCapacity: Int)
constructor(initialCapacity: Int, loadFactor: Float)
constructor(c: Collection<E>)
}
header interface RandomAccess
expect interface RandomAccess
header abstract class AbstractMutableList<E> : MutableList<E> {
expect abstract class AbstractMutableList<E> : MutableList<E> {
protected constructor()
// From List
@@ -144,19 +144,19 @@ header abstract class AbstractMutableList<E> : MutableList<E> {
// From collections.kt
/** Returns the array if it's not `null`, or an empty array otherwise. */
header inline fun <reified T> Array<out T>?.orEmpty(): Array<out T>
expect inline fun <reified T> Array<out T>?.orEmpty(): Array<out T>
header inline fun <reified T> Collection<T>.toTypedArray(): Array<T>
expect inline fun <reified T> Collection<T>.toTypedArray(): Array<T>
header fun <T : Comparable<T>> MutableList<T>.sort(): Unit
header fun <T> MutableList<T>.sortWith(comparator: Comparator<in T>): Unit
expect fun <T : Comparable<T>> MutableList<T>.sort(): Unit
expect fun <T> MutableList<T>.sortWith(comparator: Comparator<in T>): Unit
// from Grouping.kt
public header fun <T, K> Grouping<T, K>.eachCount(): Map<K, Int>
// public header inline fun <T, K> Grouping<T, K>.eachSumOf(valueSelector: (T) -> Int): Map<K, Int>
public expect fun <T, K> Grouping<T, K>.eachCount(): Map<K, Int>
// public expect inline fun <T, K> Grouping<T, K>.eachSumOf(valueSelector: (T) -> Int): Map<K, Int>
internal header fun copyToArrayImpl(collection: Collection<*>): Array<Any?>
internal expect fun copyToArrayImpl(collection: Collection<*>): Array<Any?>
internal header fun <T> copyToArrayImpl(collection: Collection<*>, array: Array<T>): Array<T>
internal expect fun <T> copyToArrayImpl(collection: Collection<*>, array: Array<T>): Array<T>
@@ -2,10 +2,10 @@ package kotlin.io
/** Prints a newline to the standard output stream. */
public header fun println()
public expect fun println()
/** Prints the given message and newline to the standard output stream. */
public header fun println(message: Any?)
public expect fun println(message: Any?)
/** Prints the given message to the standard output stream. */
public header fun print(message: Any?)
public expect fun print(message: Any?)
@@ -1,7 +1,7 @@
package kotlin.coroutines.experimental
@PublishedApi
internal header class SafeContinuation<in T> : Continuation<T> {
internal expect class SafeContinuation<in T> : Continuation<T> {
internal constructor(delegate: Continuation<T>, initialResult: Any?)
@PublishedApi
@@ -26,7 +26,7 @@ import kotlin.coroutines.experimental.Continuation
* coroutine using a reference to the suspending function.
*/
@SinceKotlin("1.1")
public header inline fun <T> (suspend () -> T).startCoroutineUninterceptedOrReturn(
public expect inline fun <T> (suspend () -> T).startCoroutineUninterceptedOrReturn(
completion: Continuation<T>
): Any?
@@ -38,18 +38,18 @@ public header inline fun <T> (suspend () -> T).startCoroutineUninterceptedOrRetu
* coroutine using a reference to the suspending function.
*/
@SinceKotlin("1.1")
public header inline fun <R, T> (suspend R.() -> T).startCoroutineUninterceptedOrReturn(
public expect inline fun <R, T> (suspend R.() -> T).startCoroutineUninterceptedOrReturn(
receiver: R,
completion: Continuation<T>
): Any?
@SinceKotlin("1.1")
public header fun <T> (suspend () -> T).createCoroutineUnchecked(
public expect fun <T> (suspend () -> T).createCoroutineUnchecked(
completion: Continuation<T>
): Continuation<Unit>
@SinceKotlin("1.1")
public header fun <R, T> (suspend R.() -> T).createCoroutineUnchecked(
public expect fun <R, T> (suspend R.() -> T).createCoroutineUnchecked(
receiver: R,
completion: Continuation<T>
): Continuation<Unit>
@@ -3,9 +3,9 @@ package kotlin.jvm
import kotlin.annotation.AnnotationTarget.*
@Target(FUNCTION, PROPERTY_GETTER, PROPERTY_SETTER, FILE)
header annotation class JvmName(val name: String)
expect annotation class JvmName(val name: String)
@Target(FILE)
header annotation class JvmMultifileClass
expect annotation class JvmMultifileClass
header annotation class JvmField
expect annotation class JvmField
+27 -27
View File
@@ -18,101 +18,101 @@ package kotlin
import kotlin.annotation.AnnotationTarget.*
open header class Error : Throwable {
open expect class Error : Throwable {
constructor()
constructor(message: String)
}
open header class Exception : Throwable {
open expect class Exception : Throwable {
constructor()
constructor(message: String)
}
open header class IllegalArgumentException : RuntimeException {
open expect class IllegalArgumentException : RuntimeException {
constructor()
constructor(message: String)
}
open header class IllegalStateException : RuntimeException {
open expect class IllegalStateException : RuntimeException {
constructor()
constructor(message: String)
}
open header class IndexOutOfBoundsException : RuntimeException {
open expect class IndexOutOfBoundsException : RuntimeException {
constructor()
constructor(message: String)
}
open header class NoSuchElementException : RuntimeException {
open expect class NoSuchElementException : RuntimeException {
constructor()
constructor(message: String)
}
open header class RuntimeException : Exception {
open expect class RuntimeException : Exception {
constructor()
constructor(message: String)
}
open header class UnsupportedOperationException : RuntimeException {
open expect class UnsupportedOperationException : RuntimeException {
constructor()
constructor(message: String)
}
// TODO: Provide typealias impl in stdlib-jvm
open header class AssertionError : Error {
open expect class AssertionError : Error {
constructor()
constructor(message: String)
}
header interface Comparator<T> {
expect interface Comparator<T> {
fun compare(a: T, b: T): Int
}
header inline fun <T> Comparator(crossinline comparison: (a: T, b: T) -> Int): Comparator<T>
expect inline fun <T> Comparator(crossinline comparison: (a: T, b: T) -> Int): Comparator<T>
// From kotlin.kt
internal header fun <T> arrayOfNulls(reference: Array<out T>, size: Int): Array<T>
internal inline header fun <K, V> Map<K, V>.toSingletonMapOrSelf(): Map<K, V>
internal inline header fun <K, V> Map<out K, V>.toSingletonMap(): Map<K, V>
internal inline header fun <T> Array<out T>.copyToArrayOfAny(isVarargs: Boolean): Array<out Any?>
internal expect fun <T> arrayOfNulls(reference: Array<out T>, size: Int): Array<T>
internal inline expect fun <K, V> Map<K, V>.toSingletonMapOrSelf(): Map<K, V>
internal inline expect fun <K, V> Map<out K, V>.toSingletonMap(): Map<K, V>
internal inline expect fun <T> Array<out T>.copyToArrayOfAny(isVarargs: Boolean): Array<out Any?>
internal header interface Serializable
internal expect interface Serializable
// From numbers.kt
header fun Double.isNaN(): Boolean
header fun Float.isNaN(): Boolean
header fun Double.isInfinite(): Boolean
header fun Float.isInfinite(): Boolean
header fun Double.isFinite(): Boolean
header fun Float.isFinite(): Boolean
expect fun Double.isNaN(): Boolean
expect fun Float.isNaN(): Boolean
expect fun Double.isInfinite(): Boolean
expect fun Float.isInfinite(): Boolean
expect fun Double.isFinite(): Boolean
expect fun Float.isFinite(): Boolean
// From concurrent.kt
@Target(PROPERTY, FIELD)
header annotation class Volatile
expect annotation class Volatile
inline header fun <R> synchronized(lock: Any, crossinline block: () -> R): R
inline expect fun <R> synchronized(lock: Any, crossinline block: () -> R): R
// from lazy.kt
public header fun <T> lazy(initializer: () -> T): Lazy<T>
public expect fun <T> lazy(initializer: () -> T): Lazy<T>
/**
* Creates a new instance of the [Lazy] that uses the specified initialization function [initializer].
*
* The [mode] parameter is ignored. */
public header fun <T> lazy(mode: LazyThreadSafetyMode, initializer: () -> T): Lazy<T>
public expect fun <T> lazy(mode: LazyThreadSafetyMode, initializer: () -> T): Lazy<T>
/**
* Creates a new instance of the [Lazy] that uses the specified initialization function [initializer].
*
* The [lock] parameter is ignored.
*/
public header fun <T> lazy(lock: Any?, initializer: () -> T): Lazy<T>
public expect fun <T> lazy(lock: Any?, initializer: () -> T): Lazy<T>
@@ -1,6 +1,6 @@
package kotlin.sequences
internal header class ConstrainedOnceSequence<T> : Sequence<T> {
internal expect class ConstrainedOnceSequence<T> : Sequence<T> {
constructor(sequence: Sequence<T>)
override fun iterator(): Iterator<T>
+49 -49
View File
@@ -16,13 +16,13 @@
package kotlin.text
header interface Appendable {
expect interface Appendable {
fun append(c: Char): Appendable
fun append(csq: CharSequence?): Appendable
fun append(csq: CharSequence?, start: Int, end: Int): Appendable
}
header class StringBuilder : Appendable, CharSequence {
expect class StringBuilder : Appendable, CharSequence {
constructor()
constructor(capacity: Int)
constructor(seq: CharSequence)
@@ -38,7 +38,7 @@ header class StringBuilder : Appendable, CharSequence {
fun append(obj: Any?): StringBuilder
}
header class Regex {
expect class Regex {
constructor(pattern: String)
constructor(pattern: String, option: RegexOption)
constructor(pattern: String, options: Set<RegexOption>)
@@ -65,11 +65,11 @@ header class Regex {
}
}
header class MatchGroup {
expect class MatchGroup {
val value: String
}
header enum class RegexOption {
expect enum class RegexOption {
IGNORE_CASE,
MULTILINE
}
@@ -77,50 +77,50 @@ header enum class RegexOption {
// From char.kt
header fun Char.isWhitespace(): Boolean
header fun Char.toLowerCase(): Char
header fun Char.toUpperCase(): Char
header fun Char.isHighSurrogate(): Boolean
header fun Char.isLowSurrogate(): Boolean
expect fun Char.isWhitespace(): Boolean
expect fun Char.toLowerCase(): Char
expect fun Char.toUpperCase(): Char
expect fun Char.isHighSurrogate(): Boolean
expect fun Char.isLowSurrogate(): Boolean
// From string.kt
internal header fun String.nativeIndexOf(str: String, fromIndex: Int): Int
internal header fun String.nativeLastIndexOf(str: String, fromIndex: Int): Int
internal header fun String.nativeStartsWith(s: String, position: Int): Boolean
internal header fun String.nativeEndsWith(s: String): Boolean
internal expect fun String.nativeIndexOf(str: String, fromIndex: Int): Int
internal expect fun String.nativeLastIndexOf(str: String, fromIndex: Int): Int
internal expect fun String.nativeStartsWith(s: String, position: Int): Boolean
internal expect fun String.nativeEndsWith(s: String): Boolean
public header fun String.substring(startIndex: Int): String
public header fun String.substring(startIndex: Int, endIndex: Int): String
public expect fun String.substring(startIndex: Int): String
public expect fun String.substring(startIndex: Int, endIndex: Int): String
public header inline fun String.toUpperCase(): String
public header inline fun String.toLowerCase(): String
public header inline fun String.capitalize(): String
public header inline fun String.decapitalize(): String
public header fun CharSequence.repeat(n: Int): String
public expect inline fun String.toUpperCase(): String
public expect inline fun String.toLowerCase(): String
public expect inline fun String.capitalize(): String
public expect inline fun String.decapitalize(): String
public expect fun CharSequence.repeat(n: Int): String
// TOOD: requires optional parameters (and named!)
header fun String.replace(oldChar: Char, newChar: Char): String
header fun String.replace(oldChar: Char, newChar: Char, ignoreCase: Boolean): String
header fun String.replace(oldValue: String, newValue: String): String
header fun String.replace(oldValue: String, newValue: String, ignoreCase: Boolean): String
header fun String.replaceFirst(oldChar: Char, newChar: Char): String
header fun String.replaceFirst(oldChar: Char, newChar: Char, ignoreCase: Boolean): String
header fun String.replaceFirst(oldValue: String, newValue: String): String
header fun String.replaceFirst(oldValue: String, newValue: String, ignoreCase: Boolean): String
header fun String?.equals(other: String?): Boolean
header fun String?.equals(other: String?, ignoreCase: Boolean): Boolean
expect fun String.replace(oldChar: Char, newChar: Char): String
expect fun String.replace(oldChar: Char, newChar: Char, ignoreCase: Boolean): String
expect fun String.replace(oldValue: String, newValue: String): String
expect fun String.replace(oldValue: String, newValue: String, ignoreCase: Boolean): String
expect fun String.replaceFirst(oldChar: Char, newChar: Char): String
expect fun String.replaceFirst(oldChar: Char, newChar: Char, ignoreCase: Boolean): String
expect fun String.replaceFirst(oldValue: String, newValue: String): String
expect fun String.replaceFirst(oldValue: String, newValue: String, ignoreCase: Boolean): String
expect fun String?.equals(other: String?): Boolean
expect fun String?.equals(other: String?, ignoreCase: Boolean): Boolean
// From stringsCode.kt
internal inline header fun String.nativeIndexOf(ch: Char, fromIndex: Int): Int
internal inline header fun String.nativeLastIndexOf(ch: Char, fromIndex: Int): Int
internal inline expect fun String.nativeIndexOf(ch: Char, fromIndex: Int): Int
internal inline expect fun String.nativeLastIndexOf(ch: Char, fromIndex: Int): Int
header fun CharSequence.isBlank(): Boolean
header fun CharSequence.regionMatches(thisOffset: Int, other: CharSequence, otherOffset: Int, length: Int, ignoreCase: Boolean): Boolean
expect fun CharSequence.isBlank(): Boolean
expect fun CharSequence.regionMatches(thisOffset: Int, other: CharSequence, otherOffset: Int, length: Int, ignoreCase: Boolean): Boolean
@@ -128,76 +128,76 @@ header fun CharSequence.regionMatches(thisOffset: Int, other: CharSequence, othe
* 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.
*/
header fun String.toByte(): Byte
expect fun String.toByte(): Byte
/**
* 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.
*/
header fun String.toByte(radix: Int): Byte
expect fun String.toByte(radix: Int): Byte
/**
* Parses the string as a [Short] number and returns the result.
* @throws NumberFormatException if the string is not a valid representation of a number.
*/
header fun String.toShort(): Short
expect fun String.toShort(): Short
/**
* Parses the string as a [Short] number and returns the result.
* @throws NumberFormatException if the string is not a valid representation of a number.
*/
header fun String.toShort(radix: Int): Short
expect fun String.toShort(radix: Int): Short
/**
* Parses the string as an [Int] number and returns the result.
* @throws NumberFormatException if the string is not a valid representation of a number.
*/
header fun String.toInt(): Int
expect fun String.toInt(): Int
/**
* Parses the string as an [Int] number and returns the result.
* @throws NumberFormatException if the string is not a valid representation of a number.
*/
header fun String.toInt(radix: Int): Int
expect fun String.toInt(radix: Int): Int
/**
* Parses the string as a [Long] number and returns the result.
* @throws NumberFormatException if the string is not a valid representation of a number.
*/
header fun String.toLong(): Long
expect fun String.toLong(): Long
/**
* Parses the string as a [Long] number and returns the result.
* @throws NumberFormatException if the string is not a valid representation of a number.
*/
header fun String.toLong(radix: Int): Long
expect fun String.toLong(radix: Int): Long
/**
* Parses the string as a [Double] number and returns the result.
* @throws NumberFormatException if the string is not a valid representation of a number.
*/
header fun String.toDouble(): Double
expect fun String.toDouble(): Double
/**
* Parses the string as a [Float] number and returns the result.
* @throws NumberFormatException if the string is not a valid representation of a number.
*/
header fun String.toFloat(): Float
expect fun String.toFloat(): Float
/**
* Parses the string as a [Double] number and returns the result
* or `null` if the string is not a valid representation of a number.
*/
header fun String.toDoubleOrNull(): Double?
expect fun String.toDoubleOrNull(): Double?
/**
* Parses the string as a [Float] number and returns the result
* or `null` if the string is not a valid representation of a number.
*/
header fun String.toFloatOrNull(): Float?
expect fun String.toFloatOrNull(): Float?
@PublishedApi
internal header fun checkRadix(radix: Int): Int
internal header fun digitOf(char: Char, radix: Int): Int
internal expect fun checkRadix(radix: Int): Int
internal expect fun digitOf(char: Char, radix: Int): Int