From 5987e8a47c49d057d3b1d632688499f35b19a146 Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Tue, 7 Feb 2017 17:37:32 +0300 Subject: [PATCH] Annotate findAnnotation and IllegalPropertyDelegateAccessException with SinceKotlin(1.1) --- core/reflection.jvm/src/kotlin/reflect/KAnnotatedElements.kt | 3 ++- .../src/kotlin/reflect/full/KAnnotatedElements.kt | 3 ++- core/reflection.jvm/src/kotlin/reflect/full/exceptions.kt | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/core/reflection.jvm/src/kotlin/reflect/KAnnotatedElements.kt b/core/reflection.jvm/src/kotlin/reflect/KAnnotatedElements.kt index 7f8ee9fbfae..70501e59d4f 100644 --- a/core/reflection.jvm/src/kotlin/reflect/KAnnotatedElements.kt +++ b/core/reflection.jvm/src/kotlin/reflect/KAnnotatedElements.kt @@ -23,6 +23,7 @@ package kotlin.reflect */ @kotlin.internal.LowPriorityInOverloadResolution @Deprecated("Use 'findAnnotation' from kotlin.reflect.full package", ReplaceWith("this.findAnnotation()", "kotlin.reflect.full.findAnnotation"), level = DeprecationLevel.WARNING) -@Suppress("UNCHECKED_CAST") +@SinceKotlin("1.1") inline fun KAnnotatedElement.findAnnotation(): T? = + @Suppress("UNCHECKED_CAST") annotations.firstOrNull { it is T } as T? diff --git a/core/reflection.jvm/src/kotlin/reflect/full/KAnnotatedElements.kt b/core/reflection.jvm/src/kotlin/reflect/full/KAnnotatedElements.kt index 0d940470835..2b869b7c66f 100644 --- a/core/reflection.jvm/src/kotlin/reflect/full/KAnnotatedElements.kt +++ b/core/reflection.jvm/src/kotlin/reflect/full/KAnnotatedElements.kt @@ -22,6 +22,7 @@ import kotlin.reflect.* /** * Returns an annotation of the given type on this element. */ -@Suppress("UNCHECKED_CAST") +@SinceKotlin("1.1") inline fun KAnnotatedElement.findAnnotation(): T? = + @Suppress("UNCHECKED_CAST") annotations.firstOrNull { it is T } as T? diff --git a/core/reflection.jvm/src/kotlin/reflect/full/exceptions.kt b/core/reflection.jvm/src/kotlin/reflect/full/exceptions.kt index d3dbe66c79b..6c0dc6c4eca 100644 --- a/core/reflection.jvm/src/kotlin/reflect/full/exceptions.kt +++ b/core/reflection.jvm/src/kotlin/reflect/full/exceptions.kt @@ -38,6 +38,7 @@ class IllegalCallableAccessException(cause: IllegalAccessException) : kotlin.ref * @see [kotlin.reflect.KProperty2.getDelegate] * @see [kotlin.reflect.jvm.isAccessible] */ +@SinceKotlin("1.1") class IllegalPropertyDelegateAccessException(cause: IllegalAccessException) : Exception( "Cannot obtain the delegate of a non-accessible property. Use \"isAccessible = true\" to make the property accessible", cause