Add hand-written headers for common stdlib
This commit is contained in:
@@ -0,0 +1,124 @@
|
||||
package kotlin.collections
|
||||
|
||||
open header class ArrayList<E> : MutableList<E> {
|
||||
constructor(capacity: Int)
|
||||
constructor()
|
||||
constructor(c: Collection<E>)
|
||||
|
||||
// From List
|
||||
override val size: Int
|
||||
override fun isEmpty(): Boolean
|
||||
override fun contains(element: @UnsafeVariance E): Boolean
|
||||
override fun containsAll(elements: Collection<@UnsafeVariance E>): Boolean
|
||||
override operator fun get(index: Int): E
|
||||
override fun indexOf(element: @UnsafeVariance E): Int
|
||||
override fun lastIndexOf(element: @UnsafeVariance E): Int
|
||||
|
||||
// From MutableCollection
|
||||
override fun iterator(): MutableIterator<E>
|
||||
|
||||
// From MutableList
|
||||
override fun add(element: E): Boolean
|
||||
override fun remove(element: E): Boolean
|
||||
override fun addAll(elements: Collection<E>): Boolean
|
||||
override fun addAll(index: Int, elements: Collection<E>): Boolean
|
||||
override fun removeAll(elements: Collection<E>): Boolean
|
||||
override fun retainAll(elements: Collection<E>): Boolean
|
||||
override fun clear()
|
||||
override operator fun set(index: Int, element: E): E
|
||||
override fun add(index: Int, element: E)
|
||||
override fun removeAt(index: Int): E
|
||||
override fun listIterator(): MutableListIterator<E>
|
||||
override fun listIterator(index: Int): MutableListIterator<E>
|
||||
override fun subList(fromIndex: Int, toIndex: Int): MutableList<E>
|
||||
}
|
||||
|
||||
open header class HashMap<K, V> : MutableMap<K, V> {
|
||||
constructor(initialCapacity: Int)
|
||||
constructor()
|
||||
|
||||
// From Map
|
||||
override val size: Int
|
||||
override fun isEmpty(): Boolean
|
||||
override fun containsKey(key: K): Boolean
|
||||
override fun containsValue(value: @UnsafeVariance V): Boolean
|
||||
override operator fun get(key: K): V?
|
||||
|
||||
// From MutableMap
|
||||
override fun put(key: K, value: V): V?
|
||||
override fun remove(key: K): V?
|
||||
override fun putAll(from: Map<out K, V>)
|
||||
override fun clear()
|
||||
override val keys: MutableSet<K>
|
||||
override val values: MutableCollection<V>
|
||||
override val entries: MutableSet<MutableMap.MutableEntry<K, V>>
|
||||
}
|
||||
|
||||
open header class LinkedHashMap<K, V> : HashMap<K, V> {
|
||||
constructor(initialCapacity: Int)
|
||||
constructor()
|
||||
constructor(m: Map<out K, V>)
|
||||
}
|
||||
|
||||
open header class HashSet<E> : MutableSet<E> {
|
||||
constructor()
|
||||
constructor(initialCapacity: Int)
|
||||
|
||||
// From Set
|
||||
override val size: Int
|
||||
override fun isEmpty(): Boolean
|
||||
override fun contains(element: @UnsafeVariance E): Boolean
|
||||
override fun containsAll(elements: Collection<@UnsafeVariance E>): Boolean
|
||||
|
||||
// From MutableSet
|
||||
override fun iterator(): MutableIterator<E>
|
||||
override fun add(element: E): Boolean
|
||||
override fun remove(element: E): Boolean
|
||||
override fun addAll(elements: Collection<E>): Boolean
|
||||
override fun removeAll(elements: Collection<E>): Boolean
|
||||
override fun retainAll(elements: Collection<E>): Boolean
|
||||
override fun clear()
|
||||
}
|
||||
|
||||
open header class LinkedHashSet<E> : HashSet<E> {
|
||||
constructor(initialCapacity: Int)
|
||||
constructor()
|
||||
constructor(c: Collection<E>)
|
||||
}
|
||||
|
||||
header interface RandomAccess
|
||||
|
||||
|
||||
header abstract class AbstractMutableList<E> : MutableList<E> {
|
||||
protected constructor()
|
||||
|
||||
// From List
|
||||
override fun isEmpty(): Boolean
|
||||
override fun contains(element: @UnsafeVariance E): Boolean
|
||||
override fun containsAll(elements: Collection<@UnsafeVariance E>): Boolean
|
||||
override fun indexOf(element: @UnsafeVariance E): Int
|
||||
override fun lastIndexOf(element: @UnsafeVariance E): Int
|
||||
|
||||
// From MutableCollection
|
||||
override fun iterator(): MutableIterator<E>
|
||||
|
||||
// From MutableList
|
||||
override fun add(element: E): Boolean
|
||||
override fun remove(element: E): Boolean
|
||||
override fun addAll(elements: Collection<E>): Boolean
|
||||
override fun addAll(index: Int, elements: Collection<E>): Boolean
|
||||
override fun removeAll(elements: Collection<E>): Boolean
|
||||
override fun retainAll(elements: Collection<E>): Boolean
|
||||
override fun clear()
|
||||
override fun listIterator(): MutableListIterator<E>
|
||||
override fun listIterator(index: Int): MutableListIterator<E>
|
||||
override fun subList(fromIndex: Int, toIndex: Int): MutableList<E>
|
||||
}
|
||||
|
||||
|
||||
// From collections.kt
|
||||
|
||||
header 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
|
||||
@@ -0,0 +1,11 @@
|
||||
package kotlin.jvm
|
||||
|
||||
import kotlin.annotation.AnnotationTarget.*
|
||||
|
||||
@Target(FUNCTION, PROPERTY_GETTER, PROPERTY_SETTER, FILE)
|
||||
header annotation class JvmName(val name: String)
|
||||
|
||||
@Target(FILE)
|
||||
header annotation class JvmMultifileClass
|
||||
|
||||
header annotation class JvmField
|
||||
@@ -0,0 +1,67 @@
|
||||
package kotlin
|
||||
|
||||
import kotlin.annotation.AnnotationTarget.*
|
||||
|
||||
open header class Error : Throwable {
|
||||
constructor(message: String)
|
||||
}
|
||||
|
||||
open header class Exception : Throwable
|
||||
|
||||
open header class IllegalArgumentException : RuntimeException {
|
||||
constructor()
|
||||
constructor(message: String)
|
||||
}
|
||||
|
||||
open header class IllegalStateException : RuntimeException {
|
||||
constructor(message: String)
|
||||
}
|
||||
|
||||
open header class IndexOutOfBoundsException : RuntimeException {
|
||||
constructor(message: String)
|
||||
}
|
||||
|
||||
open header class NoSuchElementException : RuntimeException {
|
||||
constructor()
|
||||
constructor(message: String)
|
||||
}
|
||||
|
||||
open header class RuntimeException : Exception {
|
||||
constructor()
|
||||
constructor(message: String)
|
||||
}
|
||||
|
||||
open header class UnsupportedOperationException : RuntimeException {
|
||||
constructor(message: String)
|
||||
}
|
||||
|
||||
|
||||
header interface Comparator<T> {
|
||||
fun compare(a: T, b: T): Int
|
||||
}
|
||||
|
||||
|
||||
// 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 header interface Serializable
|
||||
|
||||
// temporary
|
||||
internal header object Math {
|
||||
fun max(a: Int, b: Int): Int
|
||||
fun min(a: Int, b: Int): Int
|
||||
}
|
||||
|
||||
|
||||
// From concurrent.kt
|
||||
|
||||
@Target(PROPERTY, FIELD)
|
||||
header annotation class Volatile
|
||||
|
||||
inline header fun <R> synchronized(lock: Any, crossinline block: () -> R): R
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
package kotlin.sequences
|
||||
|
||||
internal header class ConstrainedOnceSequence<T> : Sequence<T> {
|
||||
constructor(sequence: Sequence<T>)
|
||||
|
||||
override fun iterator(): Iterator<T>
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package kotlin.text
|
||||
|
||||
header interface Appendable {
|
||||
fun append(c: Char): Appendable
|
||||
}
|
||||
|
||||
header class StringBuilder : Appendable, CharSequence {
|
||||
constructor()
|
||||
constructor(capacity: Int)
|
||||
constructor(seq: CharSequence)
|
||||
|
||||
override val length: Int
|
||||
override operator fun get(index: Int): Char
|
||||
override fun subSequence(startIndex: Int, endIndex: Int): CharSequence
|
||||
|
||||
fun reverse(): StringBuilder
|
||||
override fun append(c: Char): Appendable
|
||||
}
|
||||
|
||||
header class Regex {
|
||||
constructor(pattern: String)
|
||||
constructor(pattern: String, option: RegexOption)
|
||||
constructor(pattern: String, options: Set<RegexOption>)
|
||||
|
||||
fun matches(input: CharSequence): Boolean
|
||||
fun containsMatchIn(input: CharSequence): Boolean
|
||||
fun replace(input: CharSequence, replacement: String): String
|
||||
fun replace(input: CharSequence, transform: (MatchResult) -> CharSequence): String
|
||||
fun replaceFirst(input: CharSequence, replacement: String): String
|
||||
fun split(input: CharSequence, limit: Int): List<String>
|
||||
}
|
||||
|
||||
header class MatchGroup
|
||||
|
||||
header enum class RegexOption
|
||||
|
||||
public header interface MatchGroupCollection : Collection<MatchGroup?> {
|
||||
public operator fun get(index: Int): MatchGroup?
|
||||
}
|
||||
|
||||
public header interface MatchNamedGroupCollection : MatchGroupCollection {
|
||||
public operator fun get(name: String): MatchGroup?
|
||||
}
|
||||
|
||||
|
||||
public header interface MatchResult {
|
||||
public val range: IntRange
|
||||
public val value: String
|
||||
public val groups: MatchGroupCollection
|
||||
public val groupValues: List<String>
|
||||
//public val destructured: Destructured
|
||||
|
||||
public fun next(): MatchResult?
|
||||
|
||||
|
||||
}
|
||||
|
||||
// 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
|
||||
|
||||
// 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
|
||||
|
||||
// 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
|
||||
|
||||
header fun CharSequence.isBlank(): Boolean
|
||||
header fun CharSequence.regionMatches(thisOffset: Int, other: CharSequence, otherOffset: Int, length: Int, ignoreCase: Boolean): Boolean
|
||||
Reference in New Issue
Block a user