From e74a3eb0e9e739cd7cb245560346d80ad97e08c1 Mon Sep 17 00:00:00 2001 From: Ilya Gorbunov Date: Sun, 10 Apr 2022 21:52:53 +0300 Subject: [PATCH] Promote findAnnotations to Stable #KT-51470 --- .../src/kotlin/reflect/full/KAnnotatedElements.kt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/core/reflection.jvm/src/kotlin/reflect/full/KAnnotatedElements.kt b/core/reflection.jvm/src/kotlin/reflect/full/KAnnotatedElements.kt index 38107bcbe1e..86f78adc2be 100644 --- a/core/reflection.jvm/src/kotlin/reflect/full/KAnnotatedElements.kt +++ b/core/reflection.jvm/src/kotlin/reflect/full/KAnnotatedElements.kt @@ -36,8 +36,9 @@ inline fun KAnnotatedElement.hasAnnotation(): Boolean = * in Java reflection ([java.lang.reflect.AnnotatedElement.getAnnotationsByType]). This is supported both for Kotlin-repeatable * ([kotlin.annotation.Repeatable]) and Java-repeatable ([java.lang.annotation.Repeatable]) annotation classes. */ -@SinceKotlin("1.5") -@ExperimentalStdlibApi +@SinceKotlin("1.7") +@Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") +@WasExperimental(ExperimentalStdlibApi::class) inline fun KAnnotatedElement.findAnnotations(): List = findAnnotations(T::class) @@ -49,9 +50,9 @@ inline fun KAnnotatedElement.findAnnotations(): List * in Java reflection ([java.lang.reflect.AnnotatedElement.getAnnotationsByType]). This is supported both for Kotlin-repeatable * ([kotlin.annotation.Repeatable]) and Java-repeatable ([java.lang.annotation.Repeatable]) annotation classes. */ -@Suppress("UNCHECKED_CAST") -@SinceKotlin("1.5") -@ExperimentalStdlibApi +@SinceKotlin("1.7") +@Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") +@WasExperimental(ExperimentalStdlibApi::class) fun KAnnotatedElement.findAnnotations(klass: KClass): List { val filtered = annotations.filterIsInstance(klass.java) if (filtered.isNotEmpty()) return filtered @@ -62,6 +63,7 @@ fun KAnnotatedElement.findAnnotations(klass: KClass): List).asList() } }