[WASM] Initial runtime library
Add directory libraries/stdlib/wasm as a placeholder for WASM runtime library Copy built-ins from core/builtins Add ExcludeFromCodegen annotation for internal needs
This commit is contained in:
@@ -189,6 +189,17 @@ val generateReducedRuntimeKLib by eagerTask<NoDebugJavaExec> {
|
||||
)
|
||||
}
|
||||
|
||||
val generateWasmRuntimeKLib by task<NoDebugJavaExec> {
|
||||
dependsOn(reducedRuntimeSources)
|
||||
|
||||
buildKLib(sources = listOf("$rootDir/libraries/stdlib/wasm"),
|
||||
dependencies = emptyList(),
|
||||
outPath = "$buildDir/wasmRuntime/klib",
|
||||
commonSources = emptyList()
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
val kotlinTestCommonSources = listOf(
|
||||
"$rootDir/libraries/kotlin.test/annotations-common/src/main",
|
||||
"$rootDir/libraries/kotlin.test/common/src/main"
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* 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
|
||||
|
||||
import kotlin.annotation.AnnotationTarget.*
|
||||
|
||||
// Exclude declaration or file from lowerings and code generation
|
||||
@Target(FILE, CLASS, FUNCTION, PROPERTY)
|
||||
internal annotation class ExcludedFromCodegen
|
||||
@@ -0,0 +1,6 @@
|
||||
This directory is a modified copy of `core/builtins` adapted for current
|
||||
needs of WASM backend.
|
||||
|
||||
This is a temporary solution for a development convenience. Most of files
|
||||
from `core/builtins` will be reused once compiler implementation and
|
||||
stdlib become stable.
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* 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
|
||||
|
||||
/**
|
||||
* Base interface implicitly implemented by all annotation interfaces.
|
||||
* See [Kotlin language documentation](https://kotlinlang.org/docs/reference/annotations.html) for more information
|
||||
* on annotations.
|
||||
*/
|
||||
public interface Annotation
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
@file:Suppress(
|
||||
"NON_ABSTRACT_FUNCTION_WITH_NO_BODY",
|
||||
"MUST_BE_INITIALIZED_OR_BE_ABSTRACT",
|
||||
"EXTERNAL_TYPE_EXTENDS_NON_EXTERNAL_TYPE",
|
||||
"PRIMARY_CONSTRUCTOR_DELEGATION_CALL_EXPECTED",
|
||||
"WRONG_MODIFIER_TARGET"
|
||||
)
|
||||
|
||||
package kotlin
|
||||
|
||||
/**
|
||||
* The root of the Kotlin class hierarchy. Every Kotlin class has [Any] as a superclass.
|
||||
*/
|
||||
public open class Any {
|
||||
/**
|
||||
* Indicates whether some other object is "equal to" this one. Implementations must fulfil the following
|
||||
* requirements:
|
||||
*
|
||||
* * Reflexive: for any non-null value `x`, `x.equals(x)` should return true.
|
||||
* * Symmetric: for any non-null values `x` and `y`, `x.equals(y)` should return true if and only if `y.equals(x)` returns true.
|
||||
* * Transitive: for any non-null values `x`, `y`, and `z`, if `x.equals(y)` returns true and `y.equals(z)` returns true, then `x.equals(z)` should return true.
|
||||
* * Consistent: for any non-null values `x` and `y`, multiple invocations of `x.equals(y)` consistently return true or consistently return false, provided no information used in `equals` comparisons on the objects is modified.
|
||||
* * Never equal to null: for any non-null value `x`, `x.equals(null)` should return false.
|
||||
*
|
||||
* Read more about [equality](https://kotlinlang.org/docs/reference/equality.html) in Kotlin.
|
||||
*/
|
||||
public open operator fun equals(other: Any?): Boolean
|
||||
|
||||
/**
|
||||
* Returns a hash code value for the object. The general contract of `hashCode` is:
|
||||
*
|
||||
* * Whenever it is invoked on the same object more than once, the `hashCode` method must consistently return the same integer, provided no information used in `equals` comparisons on the object is modified.
|
||||
* * If two objects are equal according to the `equals()` method, then calling the `hashCode` method on each of the two objects must produce the same integer result.
|
||||
*/
|
||||
public open fun hashCode(): Int
|
||||
|
||||
/**
|
||||
* Returns a string representation of the object.
|
||||
*/
|
||||
public open fun toString(): String
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
@file:Suppress(
|
||||
"NON_ABSTRACT_FUNCTION_WITH_NO_BODY",
|
||||
"MUST_BE_INITIALIZED_OR_BE_ABSTRACT",
|
||||
"EXTERNAL_TYPE_EXTENDS_NON_EXTERNAL_TYPE",
|
||||
"PRIMARY_CONSTRUCTOR_DELEGATION_CALL_EXPECTED",
|
||||
"WRONG_MODIFIER_TARGET"
|
||||
)
|
||||
|
||||
package kotlin
|
||||
|
||||
/**
|
||||
* Represents an array (specifically, a Java array when targeting the JVM platform).
|
||||
* Array instances can be created using the [arrayOf], [arrayOfNulls] and [emptyArray]
|
||||
* standard library functions.
|
||||
* See [Kotlin language documentation](https://kotlinlang.org/docs/reference/basic-types.html#arrays)
|
||||
* for more information on arrays.
|
||||
*/
|
||||
public class Array<T> {
|
||||
/**
|
||||
* Creates a new array with the specified [size], where each element is calculated by calling the specified
|
||||
* [init] function.
|
||||
*
|
||||
* The function [init] is called for each array element sequentially starting from the first one.
|
||||
* It should return the value for an array element given its index.
|
||||
*/
|
||||
public inline constructor(size: Int, init: (Int) -> T)
|
||||
|
||||
/**
|
||||
* Returns the array element at the specified [index]. This method can be called using the
|
||||
* index operator.
|
||||
* ```
|
||||
* value = arr[index]
|
||||
* ```
|
||||
*
|
||||
* If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException] except in Kotlin/JS
|
||||
* where the behavior is unspecified.
|
||||
*/
|
||||
public operator fun get(index: Int): T
|
||||
|
||||
/**
|
||||
* Sets the array element at the specified [index] to the specified [value]. This method can
|
||||
* be called using the index operator.
|
||||
* ```
|
||||
* arr[index] = value
|
||||
* ```
|
||||
*
|
||||
* If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException] except in Kotlin/JS
|
||||
* where the behavior is unspecified.
|
||||
*/
|
||||
public operator fun set(index: Int, value: T): Unit
|
||||
|
||||
/**
|
||||
* Returns the number of elements in the array.
|
||||
*/
|
||||
public val size: Int
|
||||
|
||||
/**
|
||||
* Creates an iterator for iterating over the elements of the array.
|
||||
*/
|
||||
public operator fun iterator(): Iterator<T>
|
||||
}
|
||||
@@ -0,0 +1,313 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
// Auto-generated file. DO NOT EDIT!
|
||||
|
||||
@file:Suppress(
|
||||
"NON_ABSTRACT_FUNCTION_WITH_NO_BODY",
|
||||
"MUST_BE_INITIALIZED_OR_BE_ABSTRACT",
|
||||
"EXTERNAL_TYPE_EXTENDS_NON_EXTERNAL_TYPE",
|
||||
"PRIMARY_CONSTRUCTOR_DELEGATION_CALL_EXPECTED",
|
||||
"WRONG_MODIFIER_TARGET"
|
||||
)
|
||||
|
||||
package kotlin
|
||||
|
||||
/**
|
||||
* An array of bytes. When targeting the JVM, instances of this class are represented as `byte[]`.
|
||||
* @constructor Creates a new array of the specified [size], with all elements initialized to zero.
|
||||
*/
|
||||
public class ByteArray(size: Int) {
|
||||
/**
|
||||
* Creates a new array of the specified [size], where each element is calculated by calling the specified
|
||||
* [init] function.
|
||||
*
|
||||
* The function [init] is called for each array element sequentially starting from the first one.
|
||||
* It should return the value for an array element given its index.
|
||||
*/
|
||||
public inline constructor(size: Int, init: (Int) -> Byte)
|
||||
|
||||
/**
|
||||
* Returns the array element at the given [index]. This method can be called using the index operator.
|
||||
*
|
||||
* If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException] except in Kotlin/JS
|
||||
* where the behavior is unspecified.
|
||||
*/
|
||||
public operator fun get(index: Int): Byte
|
||||
|
||||
/**
|
||||
* Sets the element at the given [index] to the given [value]. This method can be called using the index operator.
|
||||
*
|
||||
* If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException] except in Kotlin/JS
|
||||
* where the behavior is unspecified.
|
||||
*/
|
||||
public operator fun set(index: Int, value: Byte): Unit
|
||||
|
||||
/** Returns the number of elements in the array. */
|
||||
public val size: Int
|
||||
|
||||
/** Creates an iterator over the elements of the array. */
|
||||
public operator fun iterator(): ByteIterator
|
||||
}
|
||||
|
||||
/**
|
||||
* An array of chars. When targeting the JVM, instances of this class are represented as `char[]`.
|
||||
* @constructor Creates a new array of the specified [size], with all elements initialized to null char (`\u0000').
|
||||
*/
|
||||
public class CharArray(size: Int) {
|
||||
/**
|
||||
* Creates a new array of the specified [size], where each element is calculated by calling the specified
|
||||
* [init] function.
|
||||
*
|
||||
* The function [init] is called for each array element sequentially starting from the first one.
|
||||
* It should return the value for an array element given its index.
|
||||
*/
|
||||
public inline constructor(size: Int, init: (Int) -> Char)
|
||||
|
||||
/**
|
||||
* Returns the array element at the given [index]. This method can be called using the index operator.
|
||||
*
|
||||
* If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException] except in Kotlin/JS
|
||||
* where the behavior is unspecified.
|
||||
*/
|
||||
public operator fun get(index: Int): Char
|
||||
|
||||
/**
|
||||
* Sets the element at the given [index] to the given [value]. This method can be called using the index operator.
|
||||
*
|
||||
* If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException] except in Kotlin/JS
|
||||
* where the behavior is unspecified.
|
||||
*/
|
||||
public operator fun set(index: Int, value: Char): Unit
|
||||
|
||||
/** Returns the number of elements in the array. */
|
||||
public val size: Int
|
||||
|
||||
/** Creates an iterator over the elements of the array. */
|
||||
public operator fun iterator(): CharIterator
|
||||
}
|
||||
|
||||
/**
|
||||
* An array of shorts. When targeting the JVM, instances of this class are represented as `short[]`.
|
||||
* @constructor Creates a new array of the specified [size], with all elements initialized to zero.
|
||||
*/
|
||||
public class ShortArray(size: Int) {
|
||||
/**
|
||||
* Creates a new array of the specified [size], where each element is calculated by calling the specified
|
||||
* [init] function.
|
||||
*
|
||||
* The function [init] is called for each array element sequentially starting from the first one.
|
||||
* It should return the value for an array element given its index.
|
||||
*/
|
||||
public inline constructor(size: Int, init: (Int) -> Short)
|
||||
|
||||
/**
|
||||
* Returns the array element at the given [index]. This method can be called using the index operator.
|
||||
*
|
||||
* If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException] except in Kotlin/JS
|
||||
* where the behavior is unspecified.
|
||||
*/
|
||||
public operator fun get(index: Int): Short
|
||||
|
||||
/**
|
||||
* Sets the element at the given [index] to the given [value]. This method can be called using the index operator.
|
||||
*
|
||||
* If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException] except in Kotlin/JS
|
||||
* where the behavior is unspecified.
|
||||
*/
|
||||
public operator fun set(index: Int, value: Short): Unit
|
||||
|
||||
/** Returns the number of elements in the array. */
|
||||
public val size: Int
|
||||
|
||||
/** Creates an iterator over the elements of the array. */
|
||||
public operator fun iterator(): ShortIterator
|
||||
}
|
||||
|
||||
/**
|
||||
* An array of ints. When targeting the JVM, instances of this class are represented as `int[]`.
|
||||
* @constructor Creates a new array of the specified [size], with all elements initialized to zero.
|
||||
*/
|
||||
public class IntArray(size: Int) {
|
||||
/**
|
||||
* Creates a new array of the specified [size], where each element is calculated by calling the specified
|
||||
* [init] function.
|
||||
*
|
||||
* The function [init] is called for each array element sequentially starting from the first one.
|
||||
* It should return the value for an array element given its index.
|
||||
*/
|
||||
public inline constructor(size: Int, init: (Int) -> Int)
|
||||
|
||||
/**
|
||||
* Returns the array element at the given [index]. This method can be called using the index operator.
|
||||
*
|
||||
* If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException] except in Kotlin/JS
|
||||
* where the behavior is unspecified.
|
||||
*/
|
||||
public operator fun get(index: Int): Int
|
||||
|
||||
/**
|
||||
* Sets the element at the given [index] to the given [value]. This method can be called using the index operator.
|
||||
*
|
||||
* If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException] except in Kotlin/JS
|
||||
* where the behavior is unspecified.
|
||||
*/
|
||||
public operator fun set(index: Int, value: Int): Unit
|
||||
|
||||
/** Returns the number of elements in the array. */
|
||||
public val size: Int
|
||||
|
||||
/** Creates an iterator over the elements of the array. */
|
||||
public operator fun iterator(): IntIterator
|
||||
}
|
||||
|
||||
/**
|
||||
* An array of longs. When targeting the JVM, instances of this class are represented as `long[]`.
|
||||
* @constructor Creates a new array of the specified [size], with all elements initialized to zero.
|
||||
*/
|
||||
public class LongArray(size: Int) {
|
||||
/**
|
||||
* Creates a new array of the specified [size], where each element is calculated by calling the specified
|
||||
* [init] function.
|
||||
*
|
||||
* The function [init] is called for each array element sequentially starting from the first one.
|
||||
* It should return the value for an array element given its index.
|
||||
*/
|
||||
public inline constructor(size: Int, init: (Int) -> Long)
|
||||
|
||||
/**
|
||||
* Returns the array element at the given [index]. This method can be called using the index operator.
|
||||
*
|
||||
* If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException] except in Kotlin/JS
|
||||
* where the behavior is unspecified.
|
||||
*/
|
||||
public operator fun get(index: Int): Long
|
||||
|
||||
/**
|
||||
* Sets the element at the given [index] to the given [value]. This method can be called using the index operator.
|
||||
*
|
||||
* If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException] except in Kotlin/JS
|
||||
* where the behavior is unspecified.
|
||||
*/
|
||||
public operator fun set(index: Int, value: Long): Unit
|
||||
|
||||
/** Returns the number of elements in the array. */
|
||||
public val size: Int
|
||||
|
||||
/** Creates an iterator over the elements of the array. */
|
||||
public operator fun iterator(): LongIterator
|
||||
}
|
||||
|
||||
/**
|
||||
* An array of floats. When targeting the JVM, instances of this class are represented as `float[]`.
|
||||
* @constructor Creates a new array of the specified [size], with all elements initialized to zero.
|
||||
*/
|
||||
public class FloatArray(size: Int) {
|
||||
/**
|
||||
* Creates a new array of the specified [size], where each element is calculated by calling the specified
|
||||
* [init] function.
|
||||
*
|
||||
* The function [init] is called for each array element sequentially starting from the first one.
|
||||
* It should return the value for an array element given its index.
|
||||
*/
|
||||
public inline constructor(size: Int, init: (Int) -> Float)
|
||||
|
||||
/**
|
||||
* Returns the array element at the given [index]. This method can be called using the index operator.
|
||||
*
|
||||
* If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException] except in Kotlin/JS
|
||||
* where the behavior is unspecified.
|
||||
*/
|
||||
public operator fun get(index: Int): Float
|
||||
|
||||
/**
|
||||
* Sets the element at the given [index] to the given [value]. This method can be called using the index operator.
|
||||
*
|
||||
* If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException] except in Kotlin/JS
|
||||
* where the behavior is unspecified.
|
||||
*/
|
||||
public operator fun set(index: Int, value: Float): Unit
|
||||
|
||||
/** Returns the number of elements in the array. */
|
||||
public val size: Int
|
||||
|
||||
/** Creates an iterator over the elements of the array. */
|
||||
public operator fun iterator(): FloatIterator
|
||||
}
|
||||
|
||||
/**
|
||||
* An array of doubles. When targeting the JVM, instances of this class are represented as `double[]`.
|
||||
* @constructor Creates a new array of the specified [size], with all elements initialized to zero.
|
||||
*/
|
||||
public class DoubleArray(size: Int) {
|
||||
/**
|
||||
* Creates a new array of the specified [size], where each element is calculated by calling the specified
|
||||
* [init] function.
|
||||
*
|
||||
* The function [init] is called for each array element sequentially starting from the first one.
|
||||
* It should return the value for an array element given its index.
|
||||
*/
|
||||
public inline constructor(size: Int, init: (Int) -> Double)
|
||||
|
||||
/**
|
||||
* Returns the array element at the given [index]. This method can be called using the index operator.
|
||||
*
|
||||
* If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException] except in Kotlin/JS
|
||||
* where the behavior is unspecified.
|
||||
*/
|
||||
public operator fun get(index: Int): Double
|
||||
|
||||
/**
|
||||
* Sets the element at the given [index] to the given [value]. This method can be called using the index operator.
|
||||
*
|
||||
* If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException] except in Kotlin/JS
|
||||
* where the behavior is unspecified.
|
||||
*/
|
||||
public operator fun set(index: Int, value: Double): Unit
|
||||
|
||||
/** Returns the number of elements in the array. */
|
||||
public val size: Int
|
||||
|
||||
/** Creates an iterator over the elements of the array. */
|
||||
public operator fun iterator(): DoubleIterator
|
||||
}
|
||||
|
||||
/**
|
||||
* An array of booleans. When targeting the JVM, instances of this class are represented as `boolean[]`.
|
||||
* @constructor Creates a new array of the specified [size], with all elements initialized to `false`.
|
||||
*/
|
||||
public class BooleanArray(size: Int) {
|
||||
/**
|
||||
* Creates a new array of the specified [size], where each element is calculated by calling the specified
|
||||
* [init] function.
|
||||
*
|
||||
* The function [init] is called for each array element sequentially starting from the first one.
|
||||
* It should return the value for an array element given its index.
|
||||
*/
|
||||
public inline constructor(size: Int, init: (Int) -> Boolean)
|
||||
|
||||
/**
|
||||
* Returns the array element at the given [index]. This method can be called using the index operator.
|
||||
*
|
||||
* If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException] except in Kotlin/JS
|
||||
* where the behavior is unspecified.
|
||||
*/
|
||||
public operator fun get(index: Int): Boolean
|
||||
|
||||
/**
|
||||
* Sets the element at the given [index] to the given [value]. This method can be called using the index operator.
|
||||
*
|
||||
* If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException] except in Kotlin/JS
|
||||
* where the behavior is unspecified.
|
||||
*/
|
||||
public operator fun set(index: Int, value: Boolean): Unit
|
||||
|
||||
/** Returns the number of elements in the array. */
|
||||
public val size: Int
|
||||
|
||||
/** Creates an iterator over the elements of the array. */
|
||||
public operator fun iterator(): BooleanIterator
|
||||
}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
@file:Suppress(
|
||||
"NON_ABSTRACT_FUNCTION_WITH_NO_BODY",
|
||||
"MUST_BE_INITIALIZED_OR_BE_ABSTRACT",
|
||||
"EXTERNAL_TYPE_EXTENDS_NON_EXTERNAL_TYPE",
|
||||
"PRIMARY_CONSTRUCTOR_DELEGATION_CALL_EXPECTED",
|
||||
"WRONG_MODIFIER_TARGET"
|
||||
)
|
||||
|
||||
package kotlin
|
||||
|
||||
/**
|
||||
* Represents a value which is either `true` or `false`. On the JVM, non-nullable values of this type are
|
||||
* represented as values of the primitive type `boolean`.
|
||||
*/
|
||||
public class Boolean private constructor() : Comparable<Boolean> {
|
||||
/**
|
||||
* Returns the inverse of this boolean.
|
||||
*/
|
||||
public operator fun not(): Boolean
|
||||
|
||||
/**
|
||||
* Performs a logical `and` operation between this Boolean and the [other] one. Unlike the `&&` operator,
|
||||
* this function does not perform short-circuit evaluation. Both `this` and [other] will always be evaluated.
|
||||
*/
|
||||
public infix fun and(other: Boolean): Boolean
|
||||
|
||||
/**
|
||||
* Performs a logical `or` operation between this Boolean and the [other] one. Unlike the `||` operator,
|
||||
* this function does not perform short-circuit evaluation. Both `this` and [other] will always be evaluated.
|
||||
*/
|
||||
public infix fun or(other: Boolean): Boolean
|
||||
|
||||
/**
|
||||
* Performs a logical `xor` operation between this Boolean and the [other] one.
|
||||
*/
|
||||
public infix fun xor(other: Boolean): Boolean
|
||||
|
||||
public override fun compareTo(other: Boolean): Int
|
||||
|
||||
@SinceKotlin("1.3")
|
||||
companion object {}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
@file:Suppress(
|
||||
"NON_ABSTRACT_FUNCTION_WITH_NO_BODY",
|
||||
"MUST_BE_INITIALIZED_OR_BE_ABSTRACT",
|
||||
"EXTERNAL_TYPE_EXTENDS_NON_EXTERNAL_TYPE",
|
||||
"PRIMARY_CONSTRUCTOR_DELEGATION_CALL_EXPECTED",
|
||||
"WRONG_MODIFIER_TARGET"
|
||||
)
|
||||
|
||||
package kotlin
|
||||
|
||||
/**
|
||||
* Represents a 16-bit Unicode character.
|
||||
*
|
||||
* On the JVM, non-nullable values of this type are represented as values of the primitive type `char`.
|
||||
*/
|
||||
public class Char private constructor() : Comparable<Char> {
|
||||
/**
|
||||
* Compares this value with the specified value for order.
|
||||
*
|
||||
* Returns zero if this value is equal to the specified other value, a negative number if it's less than other,
|
||||
* or a positive number if it's greater than other.
|
||||
*/
|
||||
public override fun compareTo(other: Char): Int
|
||||
|
||||
/** Adds the other Int value to this value resulting a Char. */
|
||||
public operator fun plus(other: Int): Char
|
||||
|
||||
/** Subtracts the other Char value from this value resulting an Int. */
|
||||
public operator fun minus(other: Char): Int
|
||||
/** Subtracts the other Int value from this value resulting a Char. */
|
||||
public operator fun minus(other: Int): Char
|
||||
|
||||
/** Increments this value. */
|
||||
public operator fun inc(): Char
|
||||
/** Decrements this value. */
|
||||
public operator fun dec(): Char
|
||||
|
||||
// /** Creates a range from this value to the specified [other] value. */
|
||||
// public operator fun rangeTo(other: Char): CharRange
|
||||
|
||||
/** Returns the value of this character as a `Byte`. */
|
||||
public fun toByte(): Byte
|
||||
/** Returns the value of this character as a `Char`. */
|
||||
public fun toChar(): Char
|
||||
/** Returns the value of this character as a `Short`. */
|
||||
public fun toShort(): Short
|
||||
/** Returns the value of this character as a `Int`. */
|
||||
public fun toInt(): Int
|
||||
/** Returns the value of this character as a `Long`. */
|
||||
public fun toLong(): Long
|
||||
/** Returns the value of this character as a `Float`. */
|
||||
public fun toFloat(): Float
|
||||
/** Returns the value of this character as a `Double`. */
|
||||
public fun toDouble(): Double
|
||||
|
||||
companion object {
|
||||
/**
|
||||
* The minimum value of a character code unit.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
public const val MIN_VALUE: Char = '\u0000'
|
||||
|
||||
/**
|
||||
* The maximum value of a character code unit.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
public const val MAX_VALUE: Char = '\uFFFF'
|
||||
|
||||
/**
|
||||
* The minimum value of a Unicode high-surrogate code unit.
|
||||
*/
|
||||
public const val MIN_HIGH_SURROGATE: Char = '\uD800'
|
||||
|
||||
/**
|
||||
* The maximum value of a Unicode high-surrogate code unit.
|
||||
*/
|
||||
public const val MAX_HIGH_SURROGATE: Char = '\uDBFF'
|
||||
|
||||
/**
|
||||
* The minimum value of a Unicode low-surrogate code unit.
|
||||
*/
|
||||
public const val MIN_LOW_SURROGATE: Char = '\uDC00'
|
||||
|
||||
/**
|
||||
* The maximum value of a Unicode low-surrogate code unit.
|
||||
*/
|
||||
public const val MAX_LOW_SURROGATE: Char = '\uDFFF'
|
||||
|
||||
/**
|
||||
* The minimum value of a Unicode surrogate code unit.
|
||||
*/
|
||||
public const val MIN_SURROGATE: Char = MIN_HIGH_SURROGATE
|
||||
|
||||
/**
|
||||
* The maximum value of a Unicode surrogate code unit.
|
||||
*/
|
||||
public const val MAX_SURROGATE: Char = MAX_LOW_SURROGATE
|
||||
|
||||
/**
|
||||
* The number of bytes used to represent a Char in a binary form.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
public const val SIZE_BYTES: Int = 2
|
||||
|
||||
/**
|
||||
* The number of bits used to represent a Char in a binary form.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
public const val SIZE_BITS: Int = 16
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package kotlin
|
||||
|
||||
/**
|
||||
* Represents a readable sequence of [Char] values.
|
||||
*/
|
||||
public interface CharSequence {
|
||||
/**
|
||||
* Returns the length of this character sequence.
|
||||
*/
|
||||
public val length: Int
|
||||
|
||||
/**
|
||||
* Returns the character at the specified [index] in this character sequence.
|
||||
*
|
||||
* @throws [IndexOutOfBoundsException] if the [index] is out of bounds of this character sequence.
|
||||
*
|
||||
* Note that the [String] implementation of this interface in Kotlin/JS has unspecified behavior
|
||||
* if the [index] is out of its bounds.
|
||||
*/
|
||||
public operator fun get(index: Int): Char
|
||||
|
||||
/**
|
||||
* Returns a new character sequence that is a subsequence of this character sequence,
|
||||
* starting at the specified [startIndex] and ending right before the specified [endIndex].
|
||||
*
|
||||
* @param startIndex the start index (inclusive).
|
||||
* @param endIndex the end index (exclusive).
|
||||
*/
|
||||
public fun subSequence(startIndex: Int, endIndex: Int): CharSequence
|
||||
}
|
||||
@@ -0,0 +1,449 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package kotlin.collections
|
||||
|
||||
import kotlin.internal.PlatformDependent
|
||||
|
||||
/**
|
||||
* Classes that inherit from this interface can be represented as a sequence of elements that can
|
||||
* be iterated over.
|
||||
* @param T the type of element being iterated over. The iterator is covariant on its element type.
|
||||
*/
|
||||
public interface Iterable<out T> {
|
||||
/**
|
||||
* Returns an iterator over the elements of this object.
|
||||
*/
|
||||
public operator fun iterator(): Iterator<T>
|
||||
}
|
||||
|
||||
/**
|
||||
* Classes that inherit from this interface can be represented as a sequence of elements that can
|
||||
* be iterated over and that supports removing elements during iteration.
|
||||
* @param T the type of element being iterated over. The mutable iterator is invariant on its element type.
|
||||
*/
|
||||
public interface MutableIterable<out T> : Iterable<T> {
|
||||
/**
|
||||
* Returns an iterator over the elements of this sequence that supports removing elements during iteration.
|
||||
*/
|
||||
override fun iterator(): MutableIterator<T>
|
||||
}
|
||||
|
||||
/**
|
||||
* A generic collection of elements. Methods in this interface support only read-only access to the collection;
|
||||
* read/write access is supported through the [MutableCollection] interface.
|
||||
* @param E the type of elements contained in the collection. The collection is covariant on its element type.
|
||||
*/
|
||||
public interface Collection<out E> : Iterable<E> {
|
||||
// Query Operations
|
||||
/**
|
||||
* Returns the size of the collection.
|
||||
*/
|
||||
public val size: Int
|
||||
|
||||
/**
|
||||
* Returns `true` if the collection is empty (contains no elements), `false` otherwise.
|
||||
*/
|
||||
public fun isEmpty(): Boolean
|
||||
|
||||
/**
|
||||
* Checks if the specified element is contained in this collection.
|
||||
*/
|
||||
public operator fun contains(element: @UnsafeVariance E): Boolean
|
||||
|
||||
override fun iterator(): Iterator<E>
|
||||
|
||||
// Bulk Operations
|
||||
/**
|
||||
* Checks if all elements in the specified collection are contained in this collection.
|
||||
*/
|
||||
public fun containsAll(elements: Collection<@UnsafeVariance E>): Boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* A generic collection of elements that supports adding and removing elements.
|
||||
*
|
||||
* @param E the type of elements contained in the collection. The mutable collection is invariant on its element type.
|
||||
*/
|
||||
public interface MutableCollection<E> : Collection<E>, MutableIterable<E> {
|
||||
// Query Operations
|
||||
override fun iterator(): MutableIterator<E>
|
||||
|
||||
// Modification Operations
|
||||
/**
|
||||
* Adds the specified element to the collection.
|
||||
*
|
||||
* @return `true` if the element has been added, `false` if the collection does not support duplicates
|
||||
* and the element is already contained in the collection.
|
||||
*/
|
||||
public fun add(element: E): Boolean
|
||||
|
||||
/**
|
||||
* Removes a single instance of the specified element from this
|
||||
* collection, if it is present.
|
||||
*
|
||||
* @return `true` if the element has been successfully removed; `false` if it was not present in the collection.
|
||||
*/
|
||||
public fun remove(element: E): Boolean
|
||||
|
||||
// Bulk Modification Operations
|
||||
/**
|
||||
* Adds all of the elements of the specified collection to this collection.
|
||||
*
|
||||
* @return `true` if any of the specified elements was added to the collection, `false` if the collection was not modified.
|
||||
*/
|
||||
public fun addAll(elements: Collection<E>): Boolean
|
||||
|
||||
/**
|
||||
* Removes all of this collection's elements that are also contained in the specified collection.
|
||||
*
|
||||
* @return `true` if any of the specified elements was removed from the collection, `false` if the collection was not modified.
|
||||
*/
|
||||
public fun removeAll(elements: Collection<E>): Boolean
|
||||
|
||||
/**
|
||||
* Retains only the elements in this collection that are contained in the specified collection.
|
||||
*
|
||||
* @return `true` if any element was removed from the collection, `false` if the collection was not modified.
|
||||
*/
|
||||
public fun retainAll(elements: Collection<E>): Boolean
|
||||
|
||||
/**
|
||||
* Removes all elements from this collection.
|
||||
*/
|
||||
public fun clear(): Unit
|
||||
}
|
||||
|
||||
/**
|
||||
* A generic ordered collection of elements. Methods in this interface support only read-only access to the list;
|
||||
* read/write access is supported through the [MutableList] interface.
|
||||
* @param E the type of elements contained in the list. The list is covariant on its element type.
|
||||
*/
|
||||
public interface List<out E> : Collection<E> {
|
||||
// Query Operations
|
||||
|
||||
override val size: Int
|
||||
override fun isEmpty(): Boolean
|
||||
override fun contains(element: @UnsafeVariance E): Boolean
|
||||
override fun iterator(): Iterator<E>
|
||||
|
||||
// Bulk Operations
|
||||
override fun containsAll(elements: Collection<@UnsafeVariance E>): Boolean
|
||||
|
||||
// Positional Access Operations
|
||||
/**
|
||||
* Returns the element at the specified index in the list.
|
||||
*/
|
||||
public operator fun get(index: Int): E
|
||||
|
||||
// Search Operations
|
||||
/**
|
||||
* Returns the index of the first occurrence of the specified element in the list, or -1 if the specified
|
||||
* element is not contained in the list.
|
||||
*/
|
||||
public fun indexOf(element: @UnsafeVariance E): Int
|
||||
|
||||
/**
|
||||
* Returns the index of the last occurrence of the specified element in the list, or -1 if the specified
|
||||
* element is not contained in the list.
|
||||
*/
|
||||
public fun lastIndexOf(element: @UnsafeVariance E): Int
|
||||
|
||||
// List Iterators
|
||||
/**
|
||||
* Returns a list iterator over the elements in this list (in proper sequence).
|
||||
*/
|
||||
public fun listIterator(): ListIterator<E>
|
||||
|
||||
/**
|
||||
* Returns a list iterator over the elements in this list (in proper sequence), starting at the specified [index].
|
||||
*/
|
||||
public fun listIterator(index: Int): ListIterator<E>
|
||||
|
||||
// View
|
||||
/**
|
||||
* Returns a view of the portion of this list between the specified [fromIndex] (inclusive) and [toIndex] (exclusive).
|
||||
* The returned list is backed by this list, so non-structural changes in the returned list are reflected in this list, and vice-versa.
|
||||
*
|
||||
* Structural changes in the base list make the behavior of the view undefined.
|
||||
*/
|
||||
public fun subList(fromIndex: Int, toIndex: Int): List<E>
|
||||
}
|
||||
|
||||
/**
|
||||
* A generic ordered collection of elements that supports adding and removing elements.
|
||||
* @param E the type of elements contained in the list. The mutable list is invariant on its element type.
|
||||
*/
|
||||
public interface MutableList<E> : List<E>, MutableCollection<E> {
|
||||
// Modification Operations
|
||||
/**
|
||||
* Adds the specified element to the end of this list.
|
||||
*
|
||||
* @return `true` because the list is always modified as the result of this operation.
|
||||
*/
|
||||
override fun add(element: E): Boolean
|
||||
|
||||
override fun remove(element: E): Boolean
|
||||
|
||||
// Bulk Modification Operations
|
||||
/**
|
||||
* Adds all of the elements of the specified collection to the end of this list.
|
||||
*
|
||||
* The elements are appended in the order they appear in the [elements] collection.
|
||||
*
|
||||
* @return `true` if the list was changed as the result of the operation.
|
||||
*/
|
||||
override fun addAll(elements: Collection<E>): Boolean
|
||||
|
||||
/**
|
||||
* Inserts all of the elements of the specified collection [elements] into this list at the specified [index].
|
||||
*
|
||||
* @return `true` if the list was changed as the result of the operation.
|
||||
*/
|
||||
public 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(): Unit
|
||||
|
||||
// Positional Access Operations
|
||||
/**
|
||||
* Replaces the element at the specified position in this list with the specified element.
|
||||
*
|
||||
* @return the element previously at the specified position.
|
||||
*/
|
||||
public operator fun set(index: Int, element: E): E
|
||||
|
||||
/**
|
||||
* Inserts an element into the list at the specified [index].
|
||||
*/
|
||||
public fun add(index: Int, element: E): Unit
|
||||
|
||||
/**
|
||||
* Removes an element at the specified [index] from the list.
|
||||
*
|
||||
* @return the element that has been removed.
|
||||
*/
|
||||
public fun removeAt(index: Int): E
|
||||
|
||||
// List Iterators
|
||||
override fun listIterator(): MutableListIterator<E>
|
||||
|
||||
override fun listIterator(index: Int): MutableListIterator<E>
|
||||
|
||||
// View
|
||||
override fun subList(fromIndex: Int, toIndex: Int): MutableList<E>
|
||||
}
|
||||
|
||||
/**
|
||||
* A generic unordered collection of elements that does not support duplicate elements.
|
||||
* Methods in this interface support only read-only access to the set;
|
||||
* read/write access is supported through the [MutableSet] interface.
|
||||
* @param E the type of elements contained in the set. The set is covariant on its element type.
|
||||
*/
|
||||
public interface Set<out E> : Collection<E> {
|
||||
// Query Operations
|
||||
|
||||
override val size: Int
|
||||
override fun isEmpty(): Boolean
|
||||
override fun contains(element: @UnsafeVariance E): Boolean
|
||||
override fun iterator(): Iterator<E>
|
||||
|
||||
// Bulk Operations
|
||||
override fun containsAll(elements: Collection<@UnsafeVariance E>): Boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* A generic unordered collection of elements that does not support duplicate elements, and supports
|
||||
* adding and removing elements.
|
||||
* @param E the type of elements contained in the set. The mutable set is invariant on its element type.
|
||||
*/
|
||||
public interface MutableSet<E> : Set<E>, MutableCollection<E> {
|
||||
// Query Operations
|
||||
override fun iterator(): MutableIterator<E>
|
||||
|
||||
// Modification Operations
|
||||
|
||||
/**
|
||||
* Adds the specified element to the set.
|
||||
*
|
||||
* @return `true` if the element has been added, `false` if the element is already contained in the set.
|
||||
*/
|
||||
override fun add(element: E): Boolean
|
||||
|
||||
override fun remove(element: E): Boolean
|
||||
|
||||
// Bulk Modification Operations
|
||||
|
||||
override fun addAll(elements: Collection<E>): Boolean
|
||||
override fun removeAll(elements: Collection<E>): Boolean
|
||||
override fun retainAll(elements: Collection<E>): Boolean
|
||||
override fun clear(): Unit
|
||||
}
|
||||
|
||||
/**
|
||||
* A collection that holds pairs of objects (keys and values) and supports efficiently retrieving
|
||||
* the value corresponding to each key. Map keys are unique; the map holds only one value for each key.
|
||||
* Methods in this interface support only read-only access to the map; read-write access is supported through
|
||||
* the [MutableMap] interface.
|
||||
* @param K the type of map keys. The map is invariant on its key type, as it
|
||||
* can accept key as a parameter (of [containsKey] for example) and return it in [keys] set.
|
||||
* @param V the type of map values. The map is covariant on its value type.
|
||||
*/
|
||||
public interface Map<K, out V> {
|
||||
// Query Operations
|
||||
/**
|
||||
* Returns the number of key/value pairs in the map.
|
||||
*/
|
||||
public val size: Int
|
||||
|
||||
/**
|
||||
* Returns `true` if the map is empty (contains no elements), `false` otherwise.
|
||||
*/
|
||||
public fun isEmpty(): Boolean
|
||||
|
||||
/**
|
||||
* Returns `true` if the map contains the specified [key].
|
||||
*/
|
||||
public fun containsKey(key: K): Boolean
|
||||
|
||||
/**
|
||||
* Returns `true` if the map maps one or more keys to the specified [value].
|
||||
*/
|
||||
public fun containsValue(value: @UnsafeVariance V): Boolean
|
||||
|
||||
/**
|
||||
* Returns the value corresponding to the given [key], or `null` if such a key is not present in the map.
|
||||
*/
|
||||
public operator fun get(key: K): V?
|
||||
|
||||
/**
|
||||
* Returns the value corresponding to the given [key], or [defaultValue] if such a key is not present in the map.
|
||||
*
|
||||
* @since JDK 1.8
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
@PlatformDependent
|
||||
public fun getOrDefault(key: K, defaultValue: @UnsafeVariance V): V {
|
||||
// See default implementation in JDK sources
|
||||
return null as V
|
||||
}
|
||||
|
||||
// Views
|
||||
/**
|
||||
* Returns a read-only [Set] of all keys in this map.
|
||||
*/
|
||||
public val keys: Set<K>
|
||||
|
||||
/**
|
||||
* Returns a read-only [Collection] of all values in this map. Note that this collection may contain duplicate values.
|
||||
*/
|
||||
public val values: Collection<V>
|
||||
|
||||
/**
|
||||
* Returns a read-only [Set] of all key/value pairs in this map.
|
||||
*/
|
||||
public val entries: Set<Map.Entry<K, V>>
|
||||
|
||||
/**
|
||||
* Represents a key/value pair held by a [Map].
|
||||
*/
|
||||
public interface Entry<out K, out V> {
|
||||
/**
|
||||
* Returns the key of this key/value pair.
|
||||
*/
|
||||
public val key: K
|
||||
|
||||
/**
|
||||
* Returns the value of this key/value pair.
|
||||
*/
|
||||
public val value: V
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A modifiable collection that holds pairs of objects (keys and values) and supports efficiently retrieving
|
||||
* the value corresponding to each key. Map keys are unique; the map holds only one value for each key.
|
||||
* @param K the type of map keys. The map is invariant on its key type.
|
||||
* @param V the type of map values. The mutable map is invariant on its value type.
|
||||
*/
|
||||
public interface MutableMap<K, V> : Map<K, V> {
|
||||
// Modification Operations
|
||||
/**
|
||||
* Associates the specified [value] with the specified [key] in the map.
|
||||
*
|
||||
* @return the previous value associated with the key, or `null` if the key was not present in the map.
|
||||
*/
|
||||
public fun put(key: K, value: V): V?
|
||||
|
||||
/**
|
||||
* Removes the specified key and its corresponding value from this map.
|
||||
*
|
||||
* @return the previous value associated with the key, or `null` if the key was not present in the map.
|
||||
*/
|
||||
public fun remove(key: K): V?
|
||||
|
||||
/**
|
||||
* Removes the entry for the specified key only if it is mapped to the specified value.
|
||||
*
|
||||
* @return true if entry was removed
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
@PlatformDependent
|
||||
public fun remove(key: K, value: V): Boolean {
|
||||
// See default implementation in JDK sources
|
||||
return true
|
||||
}
|
||||
|
||||
// Bulk Modification Operations
|
||||
/**
|
||||
* Updates this map with key/value pairs from the specified map [from].
|
||||
*/
|
||||
public fun putAll(from: Map<out K, V>): Unit
|
||||
|
||||
/**
|
||||
* Removes all elements from this map.
|
||||
*/
|
||||
public fun clear(): Unit
|
||||
|
||||
// Views
|
||||
/**
|
||||
* Returns a [MutableSet] of all keys in this map.
|
||||
*/
|
||||
override val keys: MutableSet<K>
|
||||
|
||||
/**
|
||||
* Returns a [MutableCollection] of all values in this map. Note that this collection may contain duplicate values.
|
||||
*/
|
||||
override val values: MutableCollection<V>
|
||||
|
||||
/**
|
||||
* Returns a [MutableSet] of all key/value pairs in this map.
|
||||
*/
|
||||
override val entries: MutableSet<MutableMap.MutableEntry<K, V>>
|
||||
|
||||
/**
|
||||
* Represents a key/value pair held by a [MutableMap].
|
||||
*/
|
||||
public interface MutableEntry<K, V> : Map.Entry<K, V> {
|
||||
/**
|
||||
* Changes the value associated with the key of this entry.
|
||||
*
|
||||
* @return the previous value corresponding to the key.
|
||||
*/
|
||||
public fun setValue(newValue: V): V
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package kotlin
|
||||
|
||||
/**
|
||||
* Classes which inherit from this interface have a defined total ordering between their instances.
|
||||
*/
|
||||
public interface Comparable<in T> {
|
||||
/**
|
||||
* Compares this object with the specified object for order. Returns zero if this object is equal
|
||||
* to the specified [other] object, a negative number if it's less than [other], or a positive number
|
||||
* if it's greater than [other].
|
||||
*/
|
||||
public operator fun compareTo(other: T): Int
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
@file:Suppress(
|
||||
"NON_ABSTRACT_FUNCTION_WITH_NO_BODY",
|
||||
"MUST_BE_INITIALIZED_OR_BE_ABSTRACT",
|
||||
"EXTERNAL_TYPE_EXTENDS_NON_EXTERNAL_TYPE",
|
||||
"PRIMARY_CONSTRUCTOR_DELEGATION_CALL_EXPECTED",
|
||||
"WRONG_MODIFIER_TARGET"
|
||||
)
|
||||
|
||||
package kotlin
|
||||
|
||||
/**
|
||||
* The common base class of all enum classes.
|
||||
* See the [Kotlin language documentation](https://kotlinlang.org/docs/reference/enum-classes.html) for more
|
||||
* information on enum classes.
|
||||
*/
|
||||
public abstract class Enum<E : Enum<E>>(name: String, ordinal: Int): Comparable<E> {
|
||||
companion object {}
|
||||
|
||||
/**
|
||||
* Returns the name of this enum constant, exactly as declared in its enum declaration.
|
||||
*/
|
||||
public final val name: String
|
||||
|
||||
/**
|
||||
* Returns the ordinal of this enumeration constant (its position in its enum declaration, where the initial constant
|
||||
* is assigned an ordinal of zero).
|
||||
*/
|
||||
public final val ordinal: Int
|
||||
|
||||
public override final fun compareTo(other: E): Int
|
||||
|
||||
/**
|
||||
* Throws an exception since enum constants cannot be cloned.
|
||||
* This method prevents enum classes from inheriting from `Cloneable`.
|
||||
*/
|
||||
protected final fun clone(): Any
|
||||
|
||||
public override final fun equals(other: Any?): Boolean
|
||||
public override final fun hashCode(): Int
|
||||
public override fun toString(): String
|
||||
|
||||
/**
|
||||
* Returns an array containing the constants of this enum type, in the order they're declared.
|
||||
* This method may be used to iterate over the constants.
|
||||
* @values
|
||||
*/
|
||||
|
||||
/**
|
||||
* Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
|
||||
* @throws IllegalArgumentException if this enum type has no constant with the specified name
|
||||
* @valueOf
|
||||
*/
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package kotlin.collections
|
||||
|
||||
/**
|
||||
* An iterator over a collection or another entity that can be represented as a sequence of elements.
|
||||
* Allows to sequentially access the elements.
|
||||
*/
|
||||
public interface Iterator<out T> {
|
||||
/**
|
||||
* Returns the next element in the iteration.
|
||||
*/
|
||||
public operator fun next(): T
|
||||
|
||||
/**
|
||||
* Returns `true` if the iteration has more elements.
|
||||
*/
|
||||
public operator fun hasNext(): Boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* An iterator over a mutable collection. Provides the ability to remove elements while iterating.
|
||||
* @see MutableCollection.iterator
|
||||
*/
|
||||
public interface MutableIterator<out T> : Iterator<T> {
|
||||
/**
|
||||
* Removes from the underlying collection the last element returned by this iterator.
|
||||
*/
|
||||
public fun remove(): Unit
|
||||
}
|
||||
|
||||
/**
|
||||
* An iterator over a collection that supports indexed access.
|
||||
* @see List.listIterator
|
||||
*/
|
||||
public interface ListIterator<out T> : Iterator<T> {
|
||||
// Query Operations
|
||||
override fun next(): T
|
||||
override fun hasNext(): Boolean
|
||||
|
||||
/**
|
||||
* Returns `true` if there are elements in the iteration before the current element.
|
||||
*/
|
||||
public fun hasPrevious(): Boolean
|
||||
|
||||
/**
|
||||
* Returns the previous element in the iteration and moves the cursor position backwards.
|
||||
*/
|
||||
public fun previous(): T
|
||||
|
||||
/**
|
||||
* Returns the index of the element that would be returned by a subsequent call to [next].
|
||||
*/
|
||||
public fun nextIndex(): Int
|
||||
|
||||
/**
|
||||
* Returns the index of the element that would be returned by a subsequent call to [previous].
|
||||
*/
|
||||
public fun previousIndex(): Int
|
||||
}
|
||||
|
||||
/**
|
||||
* An iterator over a mutable collection that supports indexed access. Provides the ability
|
||||
* to add, modify and remove elements while iterating.
|
||||
*/
|
||||
public interface MutableListIterator<T> : ListIterator<T>, MutableIterator<T> {
|
||||
// Query Operations
|
||||
override fun next(): T
|
||||
override fun hasNext(): Boolean
|
||||
|
||||
// Modification Operations
|
||||
override fun remove(): Unit
|
||||
|
||||
/**
|
||||
* Replaces the last element returned by [next] or [previous] with the specified element [element].
|
||||
*/
|
||||
public fun set(element: T): Unit
|
||||
|
||||
/**
|
||||
* Adds the specified element [element] into the underlying collection immediately before the element that would be
|
||||
* returned by [next], if any, and after the element that would be returned by [previous], if any.
|
||||
* (If the collection contains no elements, the new element becomes the sole element in the collection.)
|
||||
* The new element is inserted before the implicit cursor: a subsequent call to [next] would be unaffected,
|
||||
* and a subsequent call to [previous] would return the new element. (This call increases by one the value \
|
||||
* that would be returned by a call to [nextIndex] or [previousIndex].)
|
||||
*/
|
||||
public fun add(element: T): Unit
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
@file:Suppress(
|
||||
"NON_MEMBER_FUNCTION_NO_BODY",
|
||||
"REIFIED_TYPE_PARAMETER_NO_INLINE"
|
||||
)
|
||||
@file:ExcludedFromCodegen
|
||||
|
||||
package kotlin
|
||||
|
||||
import kotlin.internal.PureReifiable
|
||||
|
||||
/**
|
||||
* Returns a string representation of the object. Can be called with a null receiver, in which case
|
||||
* it returns the string "null".
|
||||
*/
|
||||
public fun Any?.toString(): String
|
||||
|
||||
/**
|
||||
* Concatenates this string with the string representation of the given [other] object. If either the receiver
|
||||
* or the [other] object are null, they are represented as the string "null".
|
||||
*/
|
||||
public operator fun String?.plus(other: Any?): String
|
||||
|
||||
/**
|
||||
* Returns an array of objects of the given type with the given [size], initialized with null values.
|
||||
*/
|
||||
public fun <reified @PureReifiable T> arrayOfNulls(size: Int): Array<T?>
|
||||
|
||||
/**
|
||||
* Returns an array containing the specified elements.
|
||||
*/
|
||||
public inline fun <reified @PureReifiable T> arrayOf(vararg elements: T): Array<T>
|
||||
|
||||
/**
|
||||
* Returns an array containing the specified [Double] numbers.
|
||||
*/
|
||||
public fun doubleArrayOf(vararg elements: Double): DoubleArray
|
||||
|
||||
/**
|
||||
* Returns an array containing the specified [Float] numbers.
|
||||
*/
|
||||
public fun floatArrayOf(vararg elements: Float): FloatArray
|
||||
|
||||
/**
|
||||
* Returns an array containing the specified [Long] numbers.
|
||||
*/
|
||||
public fun longArrayOf(vararg elements: Long): LongArray
|
||||
|
||||
/**
|
||||
* Returns an array containing the specified [Int] numbers.
|
||||
*/
|
||||
public fun intArrayOf(vararg elements: Int): IntArray
|
||||
|
||||
/**
|
||||
* Returns an array containing the specified characters.
|
||||
*/
|
||||
public fun charArrayOf(vararg elements: Char): CharArray
|
||||
|
||||
/**
|
||||
* Returns an array containing the specified [Short] numbers.
|
||||
*/
|
||||
public fun shortArrayOf(vararg elements: Short): ShortArray
|
||||
|
||||
/**
|
||||
* Returns an array containing the specified [Byte] numbers.
|
||||
*/
|
||||
public fun byteArrayOf(vararg elements: Byte): ByteArray
|
||||
|
||||
/**
|
||||
* Returns an array containing the specified boolean values.
|
||||
*/
|
||||
public fun booleanArrayOf(vararg elements: Boolean): BooleanArray
|
||||
|
||||
/**
|
||||
* Returns an array containing enum T entries.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public inline fun <reified T : Enum<T>> enumValues(): Array<T>
|
||||
|
||||
/**
|
||||
* Returns an enum entry with specified name.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public inline fun <reified T : Enum<T>> enumValueOf(name: String): T
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package kotlin
|
||||
|
||||
/**
|
||||
* Nothing has no instances. You can use Nothing to represent "a value that never exists": for example,
|
||||
* if a function has the return type of Nothing, it means that it never returns (always throws an exception).
|
||||
*/
|
||||
public class Nothing private constructor()
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package kotlin
|
||||
|
||||
/**
|
||||
* Superclass for all platform classes representing numeric values.
|
||||
*/
|
||||
public abstract class Number {
|
||||
/**
|
||||
* Returns the value of this number as a [Double], which may involve rounding.
|
||||
*/
|
||||
public abstract fun toDouble(): Double
|
||||
|
||||
/**
|
||||
* Returns the value of this number as a [Float], which may involve rounding.
|
||||
*/
|
||||
public abstract fun toFloat(): Float
|
||||
|
||||
/**
|
||||
* Returns the value of this number as a [Long], which may involve rounding or truncation.
|
||||
*/
|
||||
public abstract fun toLong(): Long
|
||||
|
||||
/**
|
||||
* Returns the value of this number as an [Int], which may involve rounding or truncation.
|
||||
*/
|
||||
public abstract fun toInt(): Int
|
||||
|
||||
/**
|
||||
* Returns the [Char] with the numeric value equal to this number, truncated to 16 bits if appropriate.
|
||||
*/
|
||||
public abstract fun toChar(): Char
|
||||
|
||||
/**
|
||||
* Returns the value of this number as a [Short], which may involve rounding or truncation.
|
||||
*/
|
||||
public abstract fun toShort(): Short
|
||||
|
||||
/**
|
||||
* Returns the value of this number as a [Byte], which may involve rounding or truncation.
|
||||
*/
|
||||
public abstract fun toByte(): Byte
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
@file:Suppress(
|
||||
"NON_ABSTRACT_FUNCTION_WITH_NO_BODY",
|
||||
"MUST_BE_INITIALIZED_OR_BE_ABSTRACT",
|
||||
"EXTERNAL_TYPE_EXTENDS_NON_EXTERNAL_TYPE",
|
||||
"PRIMARY_CONSTRUCTOR_DELEGATION_CALL_EXPECTED",
|
||||
"WRONG_MODIFIER_TARGET"
|
||||
)
|
||||
|
||||
package kotlin
|
||||
|
||||
/**
|
||||
* The `String` class represents character strings. All string literals in Kotlin programs, such as `"abc"`, are
|
||||
* implemented as instances of this class.
|
||||
*/
|
||||
public class String : Comparable<String>, CharSequence {
|
||||
companion object {}
|
||||
|
||||
/**
|
||||
* Returns a string obtained by concatenating this string with the string representation of the given [other] object.
|
||||
*/
|
||||
public operator fun plus(other: Any?): String
|
||||
|
||||
public override val length: Int
|
||||
|
||||
/**
|
||||
* Returns the character of this string at the specified [index].
|
||||
*
|
||||
* If the [index] is out of bounds of this string, throws an [IndexOutOfBoundsException] except in Kotlin/JS
|
||||
* where the behavior is unspecified.
|
||||
*/
|
||||
public override fun get(index: Int): Char
|
||||
|
||||
public override fun subSequence(startIndex: Int, endIndex: Int): CharSequence
|
||||
|
||||
public override fun compareTo(other: String): Int
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
@file:Suppress(
|
||||
"NON_ABSTRACT_FUNCTION_WITH_NO_BODY",
|
||||
"MUST_BE_INITIALIZED_OR_BE_ABSTRACT",
|
||||
"EXTERNAL_TYPE_EXTENDS_NON_EXTERNAL_TYPE",
|
||||
"PRIMARY_CONSTRUCTOR_DELEGATION_CALL_EXPECTED",
|
||||
"WRONG_MODIFIER_TARGET"
|
||||
)
|
||||
|
||||
package kotlin
|
||||
|
||||
/**
|
||||
* The base class for all errors and exceptions. Only instances of this class can be thrown or caught.
|
||||
*
|
||||
* @param message the detail message string.
|
||||
* @param cause the cause of this throwable.
|
||||
*/
|
||||
public open class Throwable(open val message: String?, open val cause: Throwable?) {
|
||||
constructor(message: String?) : this(message, null)
|
||||
|
||||
constructor(cause: Throwable?) : this(cause?.toString(), cause)
|
||||
|
||||
constructor() : this(null, null)
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* 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
|
||||
|
||||
import kotlin.annotation.AnnotationRetention.BINARY
|
||||
import kotlin.annotation.AnnotationRetention.SOURCE
|
||||
import kotlin.annotation.AnnotationTarget.*
|
||||
|
||||
/**
|
||||
* Marks the annotated declaration as deprecated.
|
||||
*
|
||||
* A deprecated API element is not recommended to use, typically because it's being phased out or a better alternative exists.
|
||||
*
|
||||
* To help removing deprecated API gradually, the property [level] could be used.
|
||||
* Usually a gradual phase-out goes through the "warning", then "error", then "hidden" or "removed" stages:
|
||||
* - First and by default, [DeprecationLevel.WARNING] is used to notify API consumers, but not to break their compilation or runtime usages.
|
||||
* - Then, some time later the deprecation level is raised to [DeprecationLevel.ERROR], so that no new Kotlin code can be compiled
|
||||
* using the deprecated API.
|
||||
* - Finally, the API is either removed entirely, or hidden ([DeprecationLevel.HIDDEN]) from code,
|
||||
* so its usages look like unresolved references, while the API remains in the compiled code
|
||||
* preserving binary compatibility with previously compiled code.
|
||||
*
|
||||
* @property message The message explaining the deprecation and recommending an alternative API to use.
|
||||
* @property replaceWith If present, specifies a code fragment which should be used as a replacement for
|
||||
* the deprecated API usage.
|
||||
* @property level Specifies how the deprecated element usages are reported in code.
|
||||
* See the [DeprecationLevel] enum for the possible values.
|
||||
*/
|
||||
@Target(CLASS, FUNCTION, PROPERTY, ANNOTATION_CLASS, CONSTRUCTOR, PROPERTY_SETTER, PROPERTY_GETTER, TYPEALIAS)
|
||||
@MustBeDocumented
|
||||
public annotation class Deprecated(
|
||||
val message: String,
|
||||
val replaceWith: ReplaceWith = ReplaceWith(""),
|
||||
val level: DeprecationLevel = DeprecationLevel.WARNING
|
||||
)
|
||||
|
||||
/**
|
||||
* Specifies a code fragment that can be used to replace a deprecated function, property or class. Tools such
|
||||
* as IDEs can automatically apply the replacements specified through this annotation.
|
||||
*
|
||||
* @property expression the replacement expression. The replacement expression is interpreted in the context
|
||||
* of the symbol being used, and can reference members of enclosing classes etc.
|
||||
* For function calls, the replacement expression may contain argument names of the deprecated function,
|
||||
* which will be substituted with actual parameters used in the call being updated. The imports used in the file
|
||||
* containing the deprecated function or property are NOT accessible; if the replacement expression refers
|
||||
* on any of those imports, they need to be specified explicitly in the [imports] parameter.
|
||||
* @property imports the qualified names that need to be imported in order for the references in the
|
||||
* replacement expression to be resolved correctly.
|
||||
*/
|
||||
@Target()
|
||||
@Retention(BINARY)
|
||||
@MustBeDocumented
|
||||
public annotation class ReplaceWith(val expression: String, vararg val imports: String)
|
||||
|
||||
/**
|
||||
* Possible levels of a deprecation. The level specifies how the deprecated element usages are reported in code.
|
||||
*
|
||||
* @see Deprecated
|
||||
*/
|
||||
public enum class DeprecationLevel {
|
||||
/** Usage of the deprecated element will be reported as a warning. */
|
||||
WARNING,
|
||||
/** Usage of the deprecated element will be reported as an error. */
|
||||
ERROR,
|
||||
/** Deprecated element will not be accessible from code. */
|
||||
HIDDEN
|
||||
}
|
||||
|
||||
/**
|
||||
* Signifies that the annotated functional type represents an extension function.
|
||||
*/
|
||||
@Target(TYPE)
|
||||
@MustBeDocumented
|
||||
public annotation class ExtensionFunctionType
|
||||
|
||||
/**
|
||||
* Annotates type arguments of functional type and holds corresponding parameter name specified by the user in type declaration (if any).
|
||||
*/
|
||||
@Target(TYPE)
|
||||
@MustBeDocumented
|
||||
@SinceKotlin("1.1")
|
||||
public annotation class ParameterName(val name: String)
|
||||
|
||||
/**
|
||||
* Suppresses the given compilation warnings in the annotated element.
|
||||
* @property names names of the compiler diagnostics to suppress.
|
||||
*/
|
||||
@Target(CLASS, ANNOTATION_CLASS, PROPERTY, FIELD, LOCAL_VARIABLE, VALUE_PARAMETER,
|
||||
CONSTRUCTOR, FUNCTION, PROPERTY_GETTER, PROPERTY_SETTER, TYPE, EXPRESSION, FILE, TYPEALIAS)
|
||||
@Retention(SOURCE)
|
||||
public annotation class Suppress(vararg val names: String)
|
||||
|
||||
/**
|
||||
* Suppresses errors about variance conflict
|
||||
*/
|
||||
@Target(TYPE)
|
||||
@Retention(SOURCE)
|
||||
@MustBeDocumented
|
||||
public annotation class UnsafeVariance
|
||||
|
||||
/**
|
||||
* Specifies the first version of Kotlin where a declaration has appeared.
|
||||
* Using the declaration and specifying an older API version (via the `-api-version` command line option) will result in an error.
|
||||
*
|
||||
* @property version the version in the following formats: `<major>.<minor>` or `<major>.<minor>.<patch>`, where major, minor and patch
|
||||
* are non-negative integer numbers without leading zeros.
|
||||
*/
|
||||
@Target(CLASS, PROPERTY, FIELD, CONSTRUCTOR, FUNCTION, PROPERTY_GETTER, PROPERTY_SETTER, TYPEALIAS)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
@MustBeDocumented
|
||||
public annotation class SinceKotlin(val version: String)
|
||||
|
||||
/**
|
||||
* When applied to annotation class X specifies that X defines a DSL language
|
||||
*
|
||||
* The general rule:
|
||||
* - an implicit receiver may *belong to a DSL @X* if marked with a corresponding DSL marker annotation
|
||||
* - two implicit receivers of the same DSL are not accessible in the same scope
|
||||
* - the closest one wins
|
||||
* - other available receivers are resolved as usual, but if the resulting resolved call binds to such a receiver, it's a compilation error
|
||||
*
|
||||
* Marking rules: an implicit receiver is considered marked with @Ann if
|
||||
* - its type is marked, or
|
||||
* - its type's classifier is marked
|
||||
* - or any of its superclasses/superinterfaces
|
||||
*/
|
||||
@Target(ANNOTATION_CLASS)
|
||||
@Retention(BINARY)
|
||||
@MustBeDocumented
|
||||
@SinceKotlin("1.1")
|
||||
public annotation class DslMarker
|
||||
|
||||
|
||||
/**
|
||||
* When applied to a class or a member with internal visibility allows to use it from public inline functions and
|
||||
* makes it effectively public.
|
||||
*
|
||||
* Public inline functions cannot use non-public API, since if they are inlined, those non-public API references
|
||||
* would violate access restrictions at a call site (https://kotlinlang.org/docs/reference/inline-functions.html#public-inline-restrictions).
|
||||
*
|
||||
* To overcome this restriction an `internal` declaration can be annotated with the `@PublishedApi` annotation:
|
||||
* - this allows to call that declaration from public inline functions;
|
||||
* - the declaration becomes effectively public, and this should be considered with respect to binary compatibility maintaining.
|
||||
*/
|
||||
@Target(AnnotationTarget.CLASS, AnnotationTarget.CONSTRUCTOR, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
@MustBeDocumented
|
||||
@SinceKotlin("1.1")
|
||||
public annotation class PublishedApi
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package kotlin
|
||||
|
||||
/**
|
||||
* Represents a value of a functional type, such as a lambda, an anonymous function or a function reference.
|
||||
*
|
||||
* @param R return type of the function.
|
||||
*/
|
||||
public interface Function<out R>
|
||||
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
// Auto-generated file. DO NOT EDIT!
|
||||
|
||||
package kotlin.collections
|
||||
|
||||
/** An iterator over a sequence of values of type `Byte`. */
|
||||
public abstract class ByteIterator : Iterator<Byte> {
|
||||
override final fun next() = nextByte()
|
||||
|
||||
/** Returns the next value in the sequence without boxing. */
|
||||
public abstract fun nextByte(): Byte
|
||||
}
|
||||
|
||||
/** An iterator over a sequence of values of type `Char`. */
|
||||
public abstract class CharIterator : Iterator<Char> {
|
||||
override final fun next() = nextChar()
|
||||
|
||||
/** Returns the next value in the sequence without boxing. */
|
||||
public abstract fun nextChar(): Char
|
||||
}
|
||||
|
||||
/** An iterator over a sequence of values of type `Short`. */
|
||||
public abstract class ShortIterator : Iterator<Short> {
|
||||
override final fun next() = nextShort()
|
||||
|
||||
/** Returns the next value in the sequence without boxing. */
|
||||
public abstract fun nextShort(): Short
|
||||
}
|
||||
|
||||
/** An iterator over a sequence of values of type `Int`. */
|
||||
public abstract class IntIterator : Iterator<Int> {
|
||||
override final fun next() = nextInt()
|
||||
|
||||
/** Returns the next value in the sequence without boxing. */
|
||||
public abstract fun nextInt(): Int
|
||||
}
|
||||
|
||||
/** An iterator over a sequence of values of type `Long`. */
|
||||
public abstract class LongIterator : Iterator<Long> {
|
||||
override final fun next() = nextLong()
|
||||
|
||||
/** Returns the next value in the sequence without boxing. */
|
||||
public abstract fun nextLong(): Long
|
||||
}
|
||||
|
||||
/** An iterator over a sequence of values of type `Float`. */
|
||||
public abstract class FloatIterator : Iterator<Float> {
|
||||
override final fun next() = nextFloat()
|
||||
|
||||
/** Returns the next value in the sequence without boxing. */
|
||||
public abstract fun nextFloat(): Float
|
||||
}
|
||||
|
||||
/** An iterator over a sequence of values of type `Double`. */
|
||||
public abstract class DoubleIterator : Iterator<Double> {
|
||||
override final fun next() = nextDouble()
|
||||
|
||||
/** Returns the next value in the sequence without boxing. */
|
||||
public abstract fun nextDouble(): Double
|
||||
}
|
||||
|
||||
/** An iterator over a sequence of values of type `Boolean`. */
|
||||
public abstract class BooleanIterator : Iterator<Boolean> {
|
||||
override final fun next() = nextBoolean()
|
||||
|
||||
/** Returns the next value in the sequence without boxing. */
|
||||
public abstract fun nextBoolean(): Boolean
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package kotlin
|
||||
|
||||
/**
|
||||
* The type with only one value: the `Unit` object. This type corresponds to the `void` type in Java.
|
||||
*/
|
||||
public object Unit {
|
||||
override fun toString() = "kotlin.Unit"
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package kotlin.annotation
|
||||
|
||||
import kotlin.annotation.AnnotationTarget.*
|
||||
|
||||
/**
|
||||
* Contains the list of code elements which are the possible annotation targets
|
||||
*/
|
||||
public enum class AnnotationTarget {
|
||||
/** Class, interface or object, annotation class is also included */
|
||||
CLASS,
|
||||
/** Annotation class only */
|
||||
ANNOTATION_CLASS,
|
||||
/** Generic type parameter (unsupported yet) */
|
||||
TYPE_PARAMETER,
|
||||
/** Property */
|
||||
PROPERTY,
|
||||
/** Field, including property's backing field */
|
||||
FIELD,
|
||||
/** Local variable */
|
||||
LOCAL_VARIABLE,
|
||||
/** Value parameter of a function or a constructor */
|
||||
VALUE_PARAMETER,
|
||||
/** Constructor only (primary or secondary) */
|
||||
CONSTRUCTOR,
|
||||
/** Function (constructors are not included) */
|
||||
FUNCTION,
|
||||
/** Property getter only */
|
||||
PROPERTY_GETTER,
|
||||
/** Property setter only */
|
||||
PROPERTY_SETTER,
|
||||
/** Type usage */
|
||||
TYPE,
|
||||
/** Any expression */
|
||||
EXPRESSION,
|
||||
/** File */
|
||||
FILE,
|
||||
/** Type alias */
|
||||
@SinceKotlin("1.1")
|
||||
TYPEALIAS
|
||||
}
|
||||
|
||||
/**
|
||||
* Contains the list of possible annotation's retentions.
|
||||
*
|
||||
* Determines how an annotation is stored in binary output.
|
||||
*/
|
||||
public enum class AnnotationRetention {
|
||||
/** Annotation isn't stored in binary output */
|
||||
SOURCE,
|
||||
/** Annotation is stored in binary output, but invisible for reflection */
|
||||
BINARY,
|
||||
/** Annotation is stored in binary output and visible for reflection (default retention) */
|
||||
RUNTIME
|
||||
}
|
||||
|
||||
/**
|
||||
* This meta-annotation indicates the kinds of code elements which are possible targets of an annotation.
|
||||
*
|
||||
* If the target meta-annotation is not present on an annotation declaration, the annotation is applicable to the following elements:
|
||||
* [CLASS], [PROPERTY], [FIELD], [LOCAL_VARIABLE], [VALUE_PARAMETER], [CONSTRUCTOR], [FUNCTION], [PROPERTY_GETTER], [PROPERTY_SETTER].
|
||||
*
|
||||
* @property allowedTargets list of allowed annotation targets
|
||||
*/
|
||||
@Target(AnnotationTarget.ANNOTATION_CLASS)
|
||||
@MustBeDocumented
|
||||
public annotation class Target(vararg val allowedTargets: AnnotationTarget)
|
||||
|
||||
/**
|
||||
* This meta-annotation determines whether an annotation is stored in binary output and visible for reflection. By default, both are true.
|
||||
*
|
||||
* @property value necessary annotation retention (RUNTIME, BINARY or SOURCE)
|
||||
*/
|
||||
@Target(AnnotationTarget.ANNOTATION_CLASS)
|
||||
public annotation class Retention(val value: AnnotationRetention = AnnotationRetention.RUNTIME)
|
||||
|
||||
/**
|
||||
* This meta-annotation determines that an annotation is applicable twice or more on a single code element
|
||||
*/
|
||||
@Target(AnnotationTarget.ANNOTATION_CLASS)
|
||||
public annotation class Repeatable
|
||||
|
||||
/**
|
||||
* This meta-annotation determines that an annotation is a part of public API and therefore should be included in the generated
|
||||
* documentation for the element to which the annotation is applied.
|
||||
*/
|
||||
@Target(AnnotationTarget.ANNOTATION_CLASS)
|
||||
public annotation class MustBeDocumented
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright 2010-2016 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.
|
||||
*/
|
||||
|
||||
package kotlin.internal
|
||||
|
||||
/**
|
||||
* Specifies that the corresponding type parameter is not used for unsafe operations such as casts or 'is' checks
|
||||
* That means it's completely safe to use generic types as argument for such parameter.
|
||||
*/
|
||||
@Target(AnnotationTarget.TYPE_PARAMETER)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
internal annotation class PureReifiable
|
||||
|
||||
/**
|
||||
* Specifies that the corresponding built-in method exists depending on platform.
|
||||
* Current implementation for JVM looks whether method with same JVM descriptor exists in the module JDK.
|
||||
* For example MutableMap.remove(K, V) available only if corresponding
|
||||
* method 'java/util/Map.remove(Ljava/lang/Object;Ljava/lang/Object;)Z' is defined in JDK (i.e. for major versions >= 8)
|
||||
*/
|
||||
@Target(AnnotationTarget.FUNCTION)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
internal annotation class PlatformDependent
|
||||
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* 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.reflect
|
||||
|
||||
/**
|
||||
* Represents an annotated element and allows to obtain its annotations.
|
||||
* See the [Kotlin language documentation](https://kotlinlang.org/docs/reference/annotations.html)
|
||||
* for more information.
|
||||
*/
|
||||
public interface KAnnotatedElement {
|
||||
/**
|
||||
* Annotations which are present on this element.
|
||||
*/
|
||||
public val annotations: List<Annotation>
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* 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.reflect
|
||||
|
||||
/**
|
||||
* Represents a callable entity, such as a function or a property.
|
||||
*
|
||||
* @param R return type of the callable.
|
||||
*/
|
||||
public interface KCallable<out R> : KAnnotatedElement {
|
||||
/**
|
||||
* The name of this callable as it was declared in the source code.
|
||||
* If the callable has no name, a special invented name is created.
|
||||
* Nameless callables include:
|
||||
* - constructors have the name "<init>",
|
||||
* - property accessors: the getter for a property named "foo" will have the name "<get-foo>",
|
||||
* the setter, similarly, will have the name "<set-foo>".
|
||||
*/
|
||||
public val name: String
|
||||
|
||||
/**
|
||||
* Parameters required to make a call to this callable.
|
||||
* If this callable requires a `this` instance or an extension receiver parameter,
|
||||
* they come first in the list in that order.
|
||||
*/
|
||||
public val parameters: List<KParameter>
|
||||
|
||||
/**
|
||||
* The type of values returned by this callable.
|
||||
*/
|
||||
public val returnType: KType
|
||||
|
||||
/**
|
||||
* The list of type parameters of this callable.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public val typeParameters: List<KTypeParameter>
|
||||
|
||||
/**
|
||||
* Calls this callable with the specified list of arguments and returns the result.
|
||||
* Throws an exception if the number of specified arguments is not equal to the size of [parameters],
|
||||
* or if their types do not match the types of the parameters.
|
||||
*/
|
||||
public fun call(vararg args: Any?): R
|
||||
|
||||
/**
|
||||
* Calls this callable with the specified mapping of parameters to arguments and returns the result.
|
||||
* If a parameter is not found in the mapping and is not optional (as per [KParameter.isOptional]),
|
||||
* or its type does not match the type of the provided value, an exception is thrown.
|
||||
*/
|
||||
public fun callBy(args: Map<KParameter, Any?>): R
|
||||
|
||||
/**
|
||||
* Visibility of this callable, or `null` if its visibility cannot be represented in Kotlin.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public val visibility: KVisibility?
|
||||
|
||||
/**
|
||||
* `true` if this callable is `final`.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public val isFinal: Boolean
|
||||
|
||||
/**
|
||||
* `true` if this callable is `open`.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public val isOpen: Boolean
|
||||
|
||||
/**
|
||||
* `true` if this callable is `abstract`.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public val isAbstract: Boolean
|
||||
|
||||
/**
|
||||
* `true` if this is a suspending function.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
public val isSuspend: Boolean
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* 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.reflect
|
||||
|
||||
/**
|
||||
* Represents a class and provides introspection capabilities.
|
||||
* Instances of this class are obtainable by the `::class` syntax.
|
||||
* See the [Kotlin language documentation](https://kotlinlang.org/docs/reference/reflection.html#class-references)
|
||||
* for more information.
|
||||
*
|
||||
* @param T the type of the class.
|
||||
*/
|
||||
public interface KClass<T : Any> : KDeclarationContainer, KAnnotatedElement, KClassifier {
|
||||
/**
|
||||
* The simple name of the class as it was declared in the source code,
|
||||
* or `null` if the class has no name (if, for example, it is an anonymous object literal).
|
||||
*/
|
||||
public val simpleName: String?
|
||||
|
||||
/**
|
||||
* The fully qualified dot-separated name of the class,
|
||||
* or `null` if the class is local or it is an anonymous object literal.
|
||||
*/
|
||||
public val qualifiedName: String?
|
||||
|
||||
/**
|
||||
* All functions and properties accessible in this class, including those declared in this class
|
||||
* and all of its superclasses. Does not include constructors.
|
||||
*/
|
||||
override val members: Collection<KCallable<*>>
|
||||
|
||||
/**
|
||||
* All constructors declared in this class.
|
||||
*/
|
||||
public val constructors: Collection<KFunction<T>>
|
||||
|
||||
/**
|
||||
* All classes declared inside this class. This includes both inner and static nested classes.
|
||||
*/
|
||||
public val nestedClasses: Collection<KClass<*>>
|
||||
|
||||
/**
|
||||
* The instance of the object declaration, or `null` if this class is not an object declaration.
|
||||
*/
|
||||
public val objectInstance: T?
|
||||
|
||||
/**
|
||||
* Returns `true` if [value] is an instance of this class on a given platform.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public fun isInstance(value: Any?): Boolean
|
||||
|
||||
/**
|
||||
* The list of type parameters of this class. This list does *not* include type parameters of outer classes.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public val typeParameters: List<KTypeParameter>
|
||||
|
||||
/**
|
||||
* The list of immediate supertypes of this class, in the order they are listed in the source code.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public val supertypes: List<KType>
|
||||
|
||||
/**
|
||||
* The list of the immediate subclasses if this class is a sealed class, or an empty list otherwise.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
public val sealedSubclasses: List<KClass<out T>>
|
||||
|
||||
/**
|
||||
* Visibility of this class, or `null` if its visibility cannot be represented in Kotlin.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public val visibility: KVisibility?
|
||||
|
||||
/**
|
||||
* `true` if this class is `final`.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public val isFinal: Boolean
|
||||
|
||||
/**
|
||||
* `true` if this class is `open`.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public val isOpen: Boolean
|
||||
|
||||
/**
|
||||
* `true` if this class is `abstract`.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public val isAbstract: Boolean
|
||||
|
||||
/**
|
||||
* `true` if this class is `sealed`.
|
||||
* See the [Kotlin language documentation](https://kotlinlang.org/docs/reference/sealed-classes.html)
|
||||
* for more information.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public val isSealed: Boolean
|
||||
|
||||
/**
|
||||
* `true` if this class is a data class.
|
||||
* See the [Kotlin language documentation](https://kotlinlang.org/docs/reference/data-classes.html)
|
||||
* for more information.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public val isData: Boolean
|
||||
|
||||
/**
|
||||
* `true` if this class is an inner class.
|
||||
* See the [Kotlin language documentation](https://kotlinlang.org/docs/reference/nested-classes.html#inner-classes)
|
||||
* for more information.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public val isInner: Boolean
|
||||
|
||||
/**
|
||||
* `true` if this class is a companion object.
|
||||
* See the [Kotlin language documentation](https://kotlinlang.org/docs/reference/object-declarations.html#companion-objects)
|
||||
* for more information.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public val isCompanion: Boolean
|
||||
|
||||
/**
|
||||
* Returns `true` if this [KClass] instance represents the same Kotlin class as the class represented by [other].
|
||||
* On JVM this means that all of the following conditions are satisfied:
|
||||
*
|
||||
* 1. [other] has the same (fully qualified) Kotlin class name as this instance.
|
||||
* 2. [other]'s backing [Class] object is loaded with the same class loader as the [Class] object of this instance.
|
||||
* 3. If the classes represent [Array], then [Class] objects of their element types are equal.
|
||||
*
|
||||
* For example, on JVM, [KClass] instances for a primitive type (`int`) and the corresponding wrapper type (`java.lang.Integer`)
|
||||
* are considered equal, because they have the same fully qualified name "kotlin.Int".
|
||||
*/
|
||||
override fun equals(other: Any?): Boolean
|
||||
|
||||
override fun hashCode(): Int
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright 2010-2016 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.
|
||||
*/
|
||||
|
||||
package kotlin.reflect
|
||||
|
||||
/**
|
||||
* A classifier is either a class or a type parameter.
|
||||
*
|
||||
* @see [KClass]
|
||||
* @see [KTypeParameter]
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public interface KClassifier
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package kotlin.reflect
|
||||
|
||||
/**
|
||||
* Represents an entity which may contain declarations of any other entities,
|
||||
* such as a class or a package.
|
||||
*/
|
||||
public interface KDeclarationContainer {
|
||||
/**
|
||||
* All functions and properties accessible in this container.
|
||||
*/
|
||||
public val members: Collection<KCallable<*>>
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* 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.reflect
|
||||
|
||||
/**
|
||||
* Represents a function with introspection capabilities.
|
||||
*/
|
||||
public interface KFunction<out R> : KCallable<R>, Function<R> {
|
||||
/**
|
||||
* `true` if this function is `inline`.
|
||||
* See the [Kotlin language documentation](https://kotlinlang.org/docs/reference/inline-functions.html)
|
||||
* for more information.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public val isInline: Boolean
|
||||
|
||||
/**
|
||||
* `true` if this function is `external`.
|
||||
* See the [Kotlin language documentation](https://kotlinlang.org/docs/reference/java-interop.html#using-jni-with-kotlin)
|
||||
* for more information.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public val isExternal: Boolean
|
||||
|
||||
/**
|
||||
* `true` if this function is `operator`.
|
||||
* See the [Kotlin language documentation](https://kotlinlang.org/docs/reference/operator-overloading.html)
|
||||
* for more information.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public val isOperator: Boolean
|
||||
|
||||
/**
|
||||
* `true` if this function is `infix`.
|
||||
* See the [Kotlin language documentation](https://kotlinlang.org/docs/reference/functions.html#infix-notation)
|
||||
* for more information.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public val isInfix: Boolean
|
||||
|
||||
/**
|
||||
* `true` if this is a suspending function.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public override val isSuspend: Boolean
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package kotlin.reflect
|
||||
|
||||
/**
|
||||
* Represents a parameter passed to a function or a property getter/setter,
|
||||
* including `this` and extension receiver parameters.
|
||||
*/
|
||||
public interface KParameter : KAnnotatedElement {
|
||||
/**
|
||||
* 0-based index of this parameter in the parameter list of its containing callable.
|
||||
*/
|
||||
public val index: Int
|
||||
|
||||
/**
|
||||
* Name of this parameter as it was declared in the source code,
|
||||
* or `null` if the parameter has no name or its name is not available at runtime.
|
||||
* Examples of nameless parameters include `this` instance for member functions,
|
||||
* extension receiver for extension functions or properties, parameters of Java methods
|
||||
* compiled without the debug information, and others.
|
||||
*/
|
||||
public val name: String?
|
||||
|
||||
/**
|
||||
* Type of this parameter. For a `vararg` parameter, this is the type of the corresponding array,
|
||||
* not the individual element.
|
||||
*/
|
||||
public val type: KType
|
||||
|
||||
/**
|
||||
* Kind of this parameter.
|
||||
*/
|
||||
public val kind: Kind
|
||||
|
||||
/**
|
||||
* Kind represents a particular position of the parameter declaration in the source code,
|
||||
* such as an instance, an extension receiver parameter or a value parameter.
|
||||
*/
|
||||
public enum class Kind {
|
||||
/** Instance required to make a call to the member, or an outer class instance for an inner class constructor. */
|
||||
INSTANCE,
|
||||
|
||||
/** Extension receiver of an extension function or property. */
|
||||
EXTENSION_RECEIVER,
|
||||
|
||||
/** Ordinary named value parameter. */
|
||||
VALUE,
|
||||
}
|
||||
|
||||
/**
|
||||
* `true` if this parameter is optional and can be omitted when making a call via [KCallable.callBy], or `false` otherwise.
|
||||
*
|
||||
* A parameter is optional in any of the two cases:
|
||||
* 1. The default value is provided at the declaration of this parameter.
|
||||
* 2. The parameter is declared in a member function and one of the corresponding parameters in the super functions is optional.
|
||||
*/
|
||||
public val isOptional: Boolean
|
||||
|
||||
/**
|
||||
* `true` if this parameter is `vararg`.
|
||||
* See the [Kotlin language documentation](https://kotlinlang.org/docs/reference/functions.html#variable-number-of-arguments-varargs)
|
||||
* for more information.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public val isVararg: Boolean
|
||||
}
|
||||
@@ -0,0 +1,258 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
@file:Suppress("IMPLEMENTING_FUNCTION_INTERFACE")
|
||||
package kotlin.reflect
|
||||
|
||||
/**
|
||||
* Represents a property, such as a named `val` or `var` declaration.
|
||||
* Instances of this class are obtainable by the `::` operator.
|
||||
*
|
||||
* See the [Kotlin language documentation](https://kotlinlang.org/docs/reference/reflection.html)
|
||||
* for more information.
|
||||
*
|
||||
* @param R the type of the property.
|
||||
*/
|
||||
public interface KProperty<out R> : KCallable<R> {
|
||||
/**
|
||||
* `true` if this property is `lateinit`.
|
||||
* See the [Kotlin language documentation](https://kotlinlang.org/docs/reference/properties.html#late-initialized-properties)
|
||||
* for more information.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public val isLateinit: Boolean
|
||||
|
||||
/**
|
||||
* `true` if this property is `const`.
|
||||
* See the [Kotlin language documentation](https://kotlinlang.org/docs/reference/properties.html#compile-time-constants)
|
||||
* for more information.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public val isConst: Boolean
|
||||
|
||||
/** The getter of this property, used to obtain the value of the property. */
|
||||
public val getter: Getter<R>
|
||||
|
||||
/**
|
||||
* Represents a property accessor, which is a `get` or `set` method declared alongside the property.
|
||||
* See the [Kotlin language documentation](https://kotlinlang.org/docs/reference/properties.html#getters-and-setters)
|
||||
* for more information.
|
||||
*
|
||||
* @param R the type of the property, which it is an accessor of.
|
||||
*/
|
||||
public interface Accessor<out R> {
|
||||
/** The property which this accessor is originated from. */
|
||||
public val property: KProperty<R>
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter of the property is a `get` method declared alongside the property.
|
||||
*/
|
||||
public interface Getter<out R> : Accessor<R>, KFunction<R>
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a property declared as a `var`.
|
||||
*/
|
||||
public interface KMutableProperty<R> : KProperty<R> {
|
||||
/** The setter of this mutable property, used to change the value of the property. */
|
||||
public val setter: Setter<R>
|
||||
|
||||
/**
|
||||
* Setter of the property is a `set` method declared alongside the property.
|
||||
*/
|
||||
public interface Setter<R> : KProperty.Accessor<R>, KFunction<Unit>
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Represents a property without any kind of receiver.
|
||||
* Such property is either originally declared in a receiverless context such as a package,
|
||||
* or has the receiver bound to it.
|
||||
*/
|
||||
public interface KProperty0<out R> : KProperty<R>, () -> R {
|
||||
/**
|
||||
* Returns the current value of the property.
|
||||
*/
|
||||
public fun get(): R
|
||||
|
||||
/**
|
||||
* Returns the value of the delegate if this is a delegated property, or `null` if this property is not delegated.
|
||||
* See the [Kotlin language documentation](https://kotlinlang.org/docs/reference/delegated-properties.html)
|
||||
* for more information.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public fun getDelegate(): Any?
|
||||
|
||||
override val getter: Getter<R>
|
||||
|
||||
/**
|
||||
* Getter of the property is a `get` method declared alongside the property.
|
||||
*
|
||||
* Can be used as a function that takes 0 arguments and returns the value of the property type [R].
|
||||
*/
|
||||
public interface Getter<out R> : KProperty.Getter<R>, () -> R
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a `var`-property without any kind of receiver.
|
||||
*/
|
||||
public interface KMutableProperty0<R> : KProperty0<R>, KMutableProperty<R> {
|
||||
/**
|
||||
* Modifies the value of the property.
|
||||
*
|
||||
* @param value the new value to be assigned to this property.
|
||||
*/
|
||||
public fun set(value: R)
|
||||
|
||||
override val setter: Setter<R>
|
||||
|
||||
/**
|
||||
* Setter of the property is a `set` method declared alongside the property.
|
||||
*
|
||||
* Can be used as a function that takes new property value as an argument and returns [Unit].
|
||||
*/
|
||||
public interface Setter<R> : KMutableProperty.Setter<R>, (R) -> Unit
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Represents a property, operations on which take one receiver as a parameter.
|
||||
*
|
||||
* @param T the type of the receiver which should be used to obtain the value of the property.
|
||||
* @param R the type of the property.
|
||||
*/
|
||||
public interface KProperty1<T, out R> : KProperty<R>, (T) -> R {
|
||||
/**
|
||||
* Returns the current value of the property.
|
||||
*
|
||||
* @param receiver the receiver which is used to obtain the value of the property.
|
||||
* For example, it should be a class instance if this is a member property of that class,
|
||||
* or an extension receiver if this is a top level extension property.
|
||||
*/
|
||||
public fun get(receiver: T): R
|
||||
|
||||
/**
|
||||
* Returns the value of the delegate if this is a delegated property, or `null` if this property is not delegated.
|
||||
* See the [Kotlin language documentation](https://kotlinlang.org/docs/reference/delegated-properties.html)
|
||||
* for more information.
|
||||
*
|
||||
* Note that for a top level **extension** property, the delegate is the same for all extension receivers,
|
||||
* so the [receiver] instance passed in is not going to make any difference, it must only be a value of [T].
|
||||
*
|
||||
* @param receiver the receiver which is used to obtain the value of the property delegate.
|
||||
* For example, it should be a class instance if this is a member property of that class,
|
||||
* or an extension receiver if this is a top level extension property.
|
||||
*
|
||||
* @see [kotlin.reflect.full.getExtensionDelegate] // [KProperty1.getExtensionDelegate]
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public fun getDelegate(receiver: T): Any?
|
||||
|
||||
override val getter: Getter<T, R>
|
||||
|
||||
/**
|
||||
* Getter of the property is a `get` method declared alongside the property.
|
||||
*
|
||||
* Can be used as a function that takes an argument of type [T] (the receiver) and returns the value of the property type [R].
|
||||
*/
|
||||
public interface Getter<T, out R> : KProperty.Getter<R>, (T) -> R
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a `var`-property, operations on which take one receiver as a parameter.
|
||||
*/
|
||||
public interface KMutableProperty1<T, R> : KProperty1<T, R>, KMutableProperty<R> {
|
||||
/**
|
||||
* Modifies the value of the property.
|
||||
*
|
||||
* @param receiver the receiver which is used to modify the value of the property.
|
||||
* For example, it should be a class instance if this is a member property of that class,
|
||||
* or an extension receiver if this is a top level extension property.
|
||||
* @param value the new value to be assigned to this property.
|
||||
*/
|
||||
public fun set(receiver: T, value: R)
|
||||
|
||||
override val setter: Setter<T, R>
|
||||
|
||||
/**
|
||||
* Setter of the property is a `set` method declared alongside the property.
|
||||
*
|
||||
* Can be used as a function that takes the receiver and the new property value as arguments and returns [Unit].
|
||||
*/
|
||||
public interface Setter<T, R> : KMutableProperty.Setter<R>, (T, R) -> Unit
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Represents a property, operations on which take two receivers as parameters,
|
||||
* such as an extension property declared in a class.
|
||||
*
|
||||
* @param D the type of the first receiver. In case of the extension property in a class this is
|
||||
* the type of the declaring class of the property, or any subclass of that class.
|
||||
* @param E the type of the second receiver. In case of the extension property in a class this is
|
||||
* the type of the extension receiver.
|
||||
* @param R the type of the property.
|
||||
*/
|
||||
public interface KProperty2<D, E, out R> : KProperty<R>, (D, E) -> R {
|
||||
/**
|
||||
* Returns the current value of the property. In case of the extension property in a class,
|
||||
* the instance of the class should be passed first and the instance of the extension receiver second.
|
||||
*
|
||||
* @param receiver1 the instance of the first receiver.
|
||||
* @param receiver2 the instance of the second receiver.
|
||||
*/
|
||||
public fun get(receiver1: D, receiver2: E): R
|
||||
|
||||
/**
|
||||
* Returns the value of the delegate if this is a delegated property, or `null` if this property is not delegated.
|
||||
* See the [Kotlin language documentation](https://kotlinlang.org/docs/reference/delegated-properties.html)
|
||||
* for more information.
|
||||
*
|
||||
* In case of the extension property in a class, the instance of the class should be passed first
|
||||
* and the instance of the extension receiver second.
|
||||
*
|
||||
* @param receiver1 the instance of the first receiver.
|
||||
* @param receiver2 the instance of the second receiver.
|
||||
*
|
||||
* @see [kotlin.reflect.full.getExtensionDelegate] // [KProperty2.getExtensionDelegate]
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public fun getDelegate(receiver1: D, receiver2: E): Any?
|
||||
|
||||
override val getter: Getter<D, E, R>
|
||||
|
||||
/**
|
||||
* Getter of the property is a `get` method declared alongside the property.
|
||||
*
|
||||
* Can be used as a function that takes an argument of type [D] (the first receiver), an argument of type [E] (the second receiver)
|
||||
* and returns the value of the property type [R].
|
||||
*/
|
||||
public interface Getter<D, E, out R> : KProperty.Getter<R>, (D, E) -> R
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a `var`-property, operations on which take two receivers as parameters.
|
||||
*/
|
||||
public interface KMutableProperty2<D, E, R> : KProperty2<D, E, R>, KMutableProperty<R> {
|
||||
/**
|
||||
* Modifies the value of the property.
|
||||
*
|
||||
* @param receiver1 the instance of the first receiver.
|
||||
* @param receiver2 the instance of the second receiver.
|
||||
* @param value the new value to be assigned to this property.
|
||||
*/
|
||||
public fun set(receiver1: D, receiver2: E, value: R)
|
||||
|
||||
override val setter: Setter<D, E, R>
|
||||
|
||||
/**
|
||||
* Setter of the property is a `set` method declared alongside the property.
|
||||
*
|
||||
* Can be used as a function that takes an argument of type [D] (the first receiver), an argument of type [E] (the second receiver),
|
||||
* and the new property value and returns [Unit].
|
||||
*/
|
||||
public interface Setter<D, E, R> : KMutableProperty.Setter<R>, (D, E, R) -> Unit
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* 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.reflect
|
||||
|
||||
/**
|
||||
* Represents a type. Type is usually either a class with optional type arguments,
|
||||
* or a type parameter of some declaration, plus nullability.
|
||||
*/
|
||||
public interface KType : KAnnotatedElement {
|
||||
/**
|
||||
* The declaration of the classifier used in this type.
|
||||
* For example, in the type `List<String>` the classifier would be the [KClass] instance for [List].
|
||||
*
|
||||
* Returns `null` if this type is not denotable in Kotlin, for example if it is an intersection type.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public val classifier: KClassifier?
|
||||
|
||||
/**
|
||||
* Type arguments passed for the parameters of the classifier in this type.
|
||||
* For example, in the type `Array<out Number>` the only type argument is `out Number`.
|
||||
*
|
||||
* In case this type is based on an inner class, the returned list contains the type arguments provided for the innermost class first,
|
||||
* then its outer class, and so on.
|
||||
* For example, in the type `Outer<A, B>.Inner<C, D>` the returned list is `[C, D, A, B]`.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public val arguments: List<KTypeProjection>
|
||||
|
||||
/**
|
||||
* `true` if this type was marked nullable in the source code.
|
||||
*
|
||||
* For Kotlin types, it means that `null` value is allowed to be represented by this type.
|
||||
* In practice it means that the type was declared with a question mark at the end.
|
||||
* For non-Kotlin types, it means the type or the symbol which was declared with this type
|
||||
* is annotated with a runtime-retained nullability annotation such as [javax.annotation.Nullable].
|
||||
*
|
||||
* Note that even if [isMarkedNullable] is false, values of the type can still be `null`.
|
||||
* This may happen if it is a type of the type parameter with a nullable upper bound:
|
||||
*
|
||||
* ```
|
||||
* fun <T> foo(t: T) {
|
||||
* // isMarkedNullable == false for t's type, but t can be null here when T = "Any?"
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
public val isMarkedNullable: Boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a type projection. Type projection is usually the argument to another type in a type usage.
|
||||
* For example, in the type `Array<out Number>`, `out Number` is the covariant projection of the type represented by the class `Number`.
|
||||
*
|
||||
* Type projection is either the star projection, or an entity consisting of a specific type plus optional variance.
|
||||
*
|
||||
* See the [Kotlin language documentation](https://kotlinlang.org/docs/reference/generics.html#type-projections)
|
||||
* for more information.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public data class KTypeProjection constructor(
|
||||
/**
|
||||
* The use-site variance specified in the projection, or `null` if this is a star projection.
|
||||
*/
|
||||
public val variance: KVariance?,
|
||||
/**
|
||||
* The type specified in the projection, or `null` if this is a star projection.
|
||||
*/
|
||||
public val type: KType?
|
||||
) {
|
||||
public companion object {
|
||||
/**
|
||||
* Star projection, denoted by the `*` character.
|
||||
* For example, in the type `KClass<*>`, `*` is the star projection.
|
||||
* See the [Kotlin language documentation](https://kotlinlang.org/docs/reference/generics.html#star-projections)
|
||||
* for more information.
|
||||
*/
|
||||
public val STAR: KTypeProjection = KTypeProjection(null, null)
|
||||
|
||||
/**
|
||||
* Creates an invariant projection of a given type. Invariant projection is just the type itself,
|
||||
* without any use-site variance modifiers applied to it.
|
||||
* For example, in the type `Set<String>`, `String` is an invariant projection of the type represented by the class `String`.
|
||||
*/
|
||||
public fun invariant(type: KType): KTypeProjection =
|
||||
KTypeProjection(KVariance.INVARIANT, type)
|
||||
|
||||
/**
|
||||
* Creates a contravariant projection of a given type, denoted by the `in` modifier applied to a type.
|
||||
* For example, in the type `MutableList<in Number>`, `in Number` is a contravariant projection of the type of class `Number`.
|
||||
*/
|
||||
public fun contravariant(type: KType): KTypeProjection =
|
||||
KTypeProjection(KVariance.IN, type)
|
||||
|
||||
/**
|
||||
* Creates a covariant projection of a given type, denoted by the `out` modifier applied to a type.
|
||||
* For example, in the type `Array<out Number>`, `out Number` is a covariant projection of the type of class `Number`.
|
||||
*/
|
||||
public fun covariant(type: KType): KTypeProjection =
|
||||
KTypeProjection(KVariance.OUT, type)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* 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.reflect
|
||||
|
||||
/**
|
||||
* Represents a declaration of a type parameter of a class or a callable.
|
||||
* See the [Kotlin language documentation](https://kotlinlang.org/docs/reference/generics.html#generics)
|
||||
* for more information.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public interface KTypeParameter : KClassifier {
|
||||
/**
|
||||
* The name of this type parameter as it was declared in the source code.
|
||||
*/
|
||||
public val name: String
|
||||
|
||||
/**
|
||||
* Upper bounds, or generic constraints imposed on this type parameter.
|
||||
* See the [Kotlin language documentation](https://kotlinlang.org/docs/reference/generics.html#upper-bounds)
|
||||
* for more information.
|
||||
*/
|
||||
public val upperBounds: List<KType>
|
||||
|
||||
/**
|
||||
* Declaration-site variance of this type parameter.
|
||||
* See the [Kotlin language documentation](https://kotlinlang.org/docs/reference/generics.html#declaration-site-variance)
|
||||
* for more information.
|
||||
*/
|
||||
public val variance: KVariance
|
||||
|
||||
/**
|
||||
* `true` if this type parameter is `reified`.
|
||||
* See the [Kotlin language documentation](https://kotlinlang.org/docs/reference/inline-functions.html#reified-type-parameters)
|
||||
* for more information.
|
||||
*/
|
||||
public val isReified: Boolean
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright 2010-2016 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.
|
||||
*/
|
||||
|
||||
package kotlin.reflect
|
||||
|
||||
/**
|
||||
* Represents variance applied to a type parameter on the declaration site (*declaration-site variance*),
|
||||
* or to a type in a projection (*use-site variance*).
|
||||
*
|
||||
* See the [Kotlin language documentation](https://kotlinlang.org/docs/reference/generics.html#variance)
|
||||
* for more information.
|
||||
*
|
||||
* @see [KTypeParameter.variance]
|
||||
* @see [KTypeProjection]
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
enum class KVariance {
|
||||
/**
|
||||
* The affected type parameter or type is *invariant*, which means it has no variance applied to it.
|
||||
*/
|
||||
INVARIANT,
|
||||
|
||||
/**
|
||||
* The affected type parameter or type is *contravariant*. Denoted by the `in` modifier in the source code.
|
||||
*/
|
||||
IN,
|
||||
|
||||
/**
|
||||
* The affected type parameter or type is *covariant*. Denoted by the `out` modifier in the source code.
|
||||
*/
|
||||
OUT,
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright 2010-2016 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.
|
||||
*/
|
||||
|
||||
package kotlin.reflect
|
||||
|
||||
/**
|
||||
* Visibility is an aspect of a Kotlin declaration regulating where that declaration is accessible in the source code.
|
||||
* Visibility can be changed with one of the following modifiers: `public`, `protected`, `internal`, `private`.
|
||||
*
|
||||
* Note that some Java visibilities such as package-private and protected (which also gives access to items from the same package)
|
||||
* cannot be represented in Kotlin, so there's no [KVisibility] value corresponding to them.
|
||||
*
|
||||
* See the [Kotlin language documentation](https://kotlinlang.org/docs/reference/visibility-modifiers.html)
|
||||
* for more information.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
enum class KVisibility {
|
||||
/**
|
||||
* Visibility of declarations marked with the `public` modifier, or with no modifier at all.
|
||||
*/
|
||||
PUBLIC,
|
||||
|
||||
/**
|
||||
* Visibility of declarations marked with the `protected` modifier.
|
||||
*/
|
||||
PROTECTED,
|
||||
|
||||
/**
|
||||
* Visibility of declarations marked with the `internal` modifier.
|
||||
*/
|
||||
INTERNAL,
|
||||
|
||||
/**
|
||||
* Visibility of declarations marked with the `private` modifier.
|
||||
*/
|
||||
PRIVATE,
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
@file:ExcludedFromCodegen
|
||||
|
||||
package kotlin.ranges
|
||||
|
||||
// Stubs for unimplemented classes used by CommonBackendContext
|
||||
|
||||
class CharProgression
|
||||
class IntProgression
|
||||
class LongProgression
|
||||
Reference in New Issue
Block a user