diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/deprecationUtil.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/deprecationUtil.kt index 5acf07353c1..076af2fd3ff 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/deprecationUtil.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/deprecationUtil.kt @@ -136,7 +136,7 @@ private fun deprecationByOverridden(root: CallableMemberDescriptor): Deprecation } private fun DeclarationDescriptor.getDeprecationByAnnotation(): DeprecatedByAnnotation? { - val ownAnnotation = getDeclaredDeprecatedAnnotation(AnnotationUseSiteTarget.getAssociatedUseSiteTarget(this)) + val ownAnnotation = getDeclaredDeprecatedAnnotation(AnnotationUseSiteTarget.getAssociatedUseSiteTarget(this), true) if (ownAnnotation != null) return DeprecatedByAnnotation(ownAnnotation, this) @@ -168,12 +168,16 @@ private fun DeclarationDescriptor.getDeprecationByAnnotation(): DeprecatedByAnno return null } +private fun DeclarationDescriptor.getDeclaredDeprecatedAnnotation(): AnnotationDescriptor? { + return annotations.findAnnotation(KotlinBuiltIns.FQ_NAMES.deprecated) ?: annotations.findAnnotation(JAVA_DEPRECATED) +} + private fun DeclarationDescriptor.getDeclaredDeprecatedAnnotation( - target: AnnotationUseSiteTarget? = null, - findAnnotationsWithoutTarget: Boolean = true + target: AnnotationUseSiteTarget?, + findAnnotationsWithoutTarget: Boolean ): AnnotationDescriptor? { if (findAnnotationsWithoutTarget) { - val annotations = annotations.findAnnotation(KotlinBuiltIns.FQ_NAMES.deprecated) ?: annotations.findAnnotation(JAVA_DEPRECATED) + val annotations = getDeclaredDeprecatedAnnotation() if (annotations != null) return annotations }