From c5fc55b84cb399c2127791c8718a6a6bbde0e90b Mon Sep 17 00:00:00 2001 From: Igor Yakovlev Date: Tue, 24 Sep 2019 17:20:32 +0300 Subject: [PATCH] Fix exception when Enum.valueOf got an invalid argument value #Fixed KT-30515 --- .../src/org/jetbrains/kotlin/resolve/DescriptorUtils.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/descriptors/src/org/jetbrains/kotlin/resolve/DescriptorUtils.kt b/core/descriptors/src/org/jetbrains/kotlin/resolve/DescriptorUtils.kt index 224f42c49b3..a643dc997a5 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/resolve/DescriptorUtils.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/resolve/DescriptorUtils.kt @@ -209,7 +209,9 @@ fun Annotated.getAnnotationRetention(): KotlinRetention? { val retentionArgumentValue = annotations.findAnnotation(KotlinBuiltIns.FQ_NAMES.retention)?.allValueArguments?.get(RETENTION_PARAMETER_NAME) as? EnumValue ?: return null - return KotlinRetention.valueOf(retentionArgumentValue.enumEntryName.asString()) + + val retentionArgumentValueName = retentionArgumentValue.enumEntryName.asString() + return KotlinRetention.values().firstOrNull { it.name == retentionArgumentValueName } } val Annotated.nonSourceAnnotations: List