Add SinceKotlin("1.1") annotation to new reflection API

This commit is contained in:
Alexander Udalov
2016-10-12 13:13:52 +03:00
parent 8828e671f5
commit ed1490dbc4
15 changed files with 54 additions and 2 deletions
@@ -47,6 +47,7 @@ public interface KCallable<out R> : KAnnotatedElement {
/**
* The list of type parameters of this callable.
*/
@SinceKotlin("1.1")
public val typeParameters: List<KTypeParameter>
/**
@@ -66,20 +67,24 @@ public interface KCallable<out R> : KAnnotatedElement {
/**
* 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
}
@@ -67,31 +67,37 @@ public interface KClass<T : Any> : KDeclarationContainer, KAnnotatedElement, KCl
/**
* 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>
/**
* 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
/**
@@ -99,6 +105,7 @@ public interface KClass<T : Any> : KDeclarationContainer, KAnnotatedElement, KCl
* See the [Kotlin language documentation](https://kotlinlang.org/docs/reference/classes.html#sealed-classes)
* for more information.
*/
@SinceKotlin("1.1")
public val isSealed: Boolean
/**
@@ -106,6 +113,7 @@ public interface KClass<T : Any> : KDeclarationContainer, KAnnotatedElement, KCl
* See the [Kotlin language documentation](https://kotlinlang.org/docs/reference/data-classes.html)
* for more information.
*/
@SinceKotlin("1.1")
public val isData: Boolean
/**
@@ -113,6 +121,7 @@ public interface KClass<T : Any> : KDeclarationContainer, KAnnotatedElement, KCl
* 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
/**
@@ -120,6 +129,7 @@ public interface KClass<T : Any> : KDeclarationContainer, KAnnotatedElement, KCl
* 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
/**
@@ -18,7 +18,7 @@ package kotlin.reflect
/**
* A classifier is either a class, or a type parameter, or a type alias.
*
* TODO: improve doc
*/
// TODO: improve doc
@SinceKotlin("1.1")
public interface KClassifier
@@ -25,6 +25,7 @@ public interface KFunction<out R> : KCallable<R>, Function<R> {
* See the [Kotlin language documentation](https://kotlinlang.org/docs/reference/inline-functions.html)
* for more information.
*/
@SinceKotlin("1.1")
public val isInline: Boolean
/**
@@ -32,6 +33,7 @@ public interface KFunction<out R> : KCallable<R>, Function<R> {
* 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
/**
@@ -39,6 +41,7 @@ public interface KFunction<out R> : KCallable<R>, Function<R> {
* See the [Kotlin language documentation](https://kotlinlang.org/docs/reference/operator-overloading.html)
* for more information.
*/
@SinceKotlin("1.1")
public val isOperator: Boolean
/**
@@ -46,6 +49,7 @@ public interface KFunction<out R> : KCallable<R>, Function<R> {
* See the [Kotlin language documentation](https://kotlinlang.org/docs/reference/functions.html#infix-notation)
* for more information.
*/
@SinceKotlin("1.1")
public val isInfix: Boolean
/**
@@ -53,10 +57,12 @@ public interface KFunction<out R> : KCallable<R>, Function<R> {
* See the [Kotlin language documentation](https://kotlinlang.org/docs/reference/functions.html#tail-recursive-functions)
* for more information.
*/
@SinceKotlin("1.1")
public val isTailrec: Boolean
/**
* `true` if this is a suspending function.
*/
@SinceKotlin("1.1")
public val isSuspend: Boolean
}
@@ -75,6 +75,7 @@ public interface KParameter : KAnnotatedElement {
* 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
/**
@@ -82,6 +83,7 @@ public interface KParameter : KAnnotatedElement {
* See the [Kotlin language documentation](https://kotlinlang.org/docs/reference/inline-functions.html#noinline)
* for more information.
*/
@SinceKotlin("1.1")
public val isNoinline: Boolean
/**
@@ -89,10 +91,12 @@ public interface KParameter : KAnnotatedElement {
* See the [Kotlin language documentation](https://kotlinlang.org/docs/reference/inline-functions.html#non-local-returns)
* for more information.
*/
@SinceKotlin("1.1")
public val isCrossinline: Boolean
/**
* `true` if this parameter is `coroutine`.
*/
@SinceKotlin("1.1")
public val isCoroutine: Boolean
}
@@ -30,6 +30,7 @@ public interface KProperty<out R> : KCallable<R> {
* 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
/**
@@ -37,6 +38,7 @@ public interface KProperty<out R> : KCallable<R> {
* 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. */
@@ -27,6 +27,7 @@ public interface KType {
*
* 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?
/**
@@ -37,6 +38,7 @@ public interface KType {
* 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>
/**
@@ -68,6 +70,7 @@ public interface KType {
* See the [Kotlin language documentation](http://kotlinlang.org/docs/reference/generics.html#type-projections)
* for more information.
*/
@SinceKotlin("1.1")
public data class KTypeProjection private constructor(
/**
* The use-site variance specified in the projection, or `null` if this is a star projection.
@@ -21,6 +21,7 @@ package kotlin.reflect
* See the [Kotlin language documentation](http://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.
@@ -26,6 +26,7 @@ package kotlin.reflect
* @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.
@@ -26,6 +26,7 @@ package kotlin.reflect
* 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.