From ccf78b6fa45b9f7c5d4605658ca900d5611a0a72 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Thu, 3 Sep 2015 16:11:11 +0300 Subject: [PATCH] Drop support of annotation(retention, repeatable, mustBeDocumented) format --- .../kotlin/resolve/DescriptorUtils.kt | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/core/descriptors/src/org/jetbrains/kotlin/resolve/DescriptorUtils.kt b/core/descriptors/src/org/jetbrains/kotlin/resolve/DescriptorUtils.kt index 83f77a1a8c2..e99060c91a4 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/resolve/DescriptorUtils.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/resolve/DescriptorUtils.kt @@ -173,30 +173,16 @@ public fun ValueParameterDescriptor.hasDefaultValue(): Boolean { return handler.result() } -private fun Annotated.isAnnotationPropertyTrue(name: String, defaultValue: Boolean = false): Boolean { - val annotationEntryDescriptor = annotations.findAnnotation(KotlinBuiltIns.FQ_NAMES.annotation) ?: return defaultValue - val repeatableArgumentValue = annotationEntryDescriptor.allValueArguments.entrySet().firstOrNull { - name == it.key.name.asString() - }?.getValue() as? BooleanValue ?: return defaultValue - return repeatableArgumentValue.value -} - public fun Annotated.isRepeatableAnnotation(): Boolean = annotations.findAnnotation(KotlinBuiltIns.FQ_NAMES.repeatable) != null - // deprecated - || isAnnotationPropertyTrue("repeatable") public fun Annotated.isDocumentedAnnotation(): Boolean = annotations.findAnnotation(KotlinBuiltIns.FQ_NAMES.mustBeDocumented) != null - // deprecated - || isAnnotationPropertyTrue("mustBeDocumented") public fun Annotated.getAnnotationRetention(): KotlinRetention? { - val annotationEntryDescriptor = annotations.findAnnotation(KotlinBuiltIns.FQ_NAMES.retention) ?: - // deprecated - annotations.findAnnotation(KotlinBuiltIns.FQ_NAMES.annotation) ?: return null + val annotationEntryDescriptor = annotations.findAnnotation(KotlinBuiltIns.FQ_NAMES.retention) ?: return null val retentionArgumentValue = annotationEntryDescriptor.allValueArguments.entrySet().firstOrNull { - it.key.name.asString() in setOf("value", "retention") + it.key.name.asString() == "value" }?.getValue() as? EnumValue ?: return null return KotlinRetention.valueOf(retentionArgumentValue.value.name.asString()) }