From 50e7973fc08ff271754fc33709bd6e031903f145 Mon Sep 17 00:00:00 2001 From: Ilya Chernikov Date: Mon, 6 Mar 2017 10:00:16 +0100 Subject: [PATCH] Implement verification workaround for annotation-like class InvalidScriptResolverAnnotation fixes #KT-16621 --- .../kotlin/script/scriptAnnotationsPreprocessing.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/compiler/frontend/src/org/jetbrains/kotlin/script/scriptAnnotationsPreprocessing.kt b/compiler/frontend/src/org/jetbrains/kotlin/script/scriptAnnotationsPreprocessing.kt index f4213b36c77..bb9613e3246 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/script/scriptAnnotationsPreprocessing.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/script/scriptAnnotationsPreprocessing.kt @@ -55,4 +55,10 @@ internal fun constructAnnotation(psi: KtAnnotationEntry, targetClass: KClass>?, val error: Exception? = null) : Annotation +// NOTE: this class is used for error reporting. But in order to pass plugin verification, it should derive directly from java's Annotation +// and implement annotationType method (see #KT-16621 for details). +// TODO: instead of the workaround described above, consider using a sum-type for returning errors from constructAnnotation +@Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN") +class InvalidScriptResolverAnnotation(val name: String, val annParams: List>?, val error: Exception? = null) : Annotation, java.lang.annotation.Annotation { + override fun annotationType(): Class = InvalidScriptResolverAnnotation::class.java +}