From 59b29cf00da34bfaec0b190d20889fdf31accc86 Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Mon, 10 Oct 2016 14:23:41 +0300 Subject: [PATCH] Minor, extract isDeprecatedHidden for usage in codegen Also remove a hundred year old TODO --- .../backend/src/org/jetbrains/kotlin/codegen/AsmUtil.java | 5 ++--- .../src/org/jetbrains/kotlin/resolve/deprecationUtil.kt | 6 +++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/AsmUtil.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/AsmUtil.java index b0d39770156..1ad8eeb1282 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/AsmUtil.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/AsmUtil.java @@ -231,15 +231,14 @@ public class AsmUtil { int flags = getVisibilityAccessFlag(functionDescriptor); flags |= getVarargsFlag(functionDescriptor); flags |= getDeprecatedAccessFlag(functionDescriptor); - if (DeprecationUtilKt.isHiddenInResolution(functionDescriptor) + if (DeprecationUtilKt.isDeprecatedHidden(functionDescriptor) || functionDescriptor instanceof PropertyAccessorDescriptor - && DeprecationUtilKt.isHiddenInResolution(((PropertyAccessorDescriptor) functionDescriptor).getCorrespondingProperty())) { + && DeprecationUtilKt.isDeprecatedHidden(((PropertyAccessorDescriptor) functionDescriptor).getCorrespondingProperty())) { flags |= ACC_SYNTHETIC; } return flags; } - //TODO: move mapping logic to front-end java public static int getVisibilityAccessFlag(@NotNull MemberDescriptor descriptor) { Integer specialCase = specialCaseVisibility(descriptor); if (specialCase != null) { diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/deprecationUtil.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/deprecationUtil.kt index 624053b8860..8ab9eeeac99 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/deprecationUtil.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/deprecationUtil.kt @@ -183,11 +183,15 @@ enum class DeprecationLevelValue { WARNING, ERROR, HIDDEN } +fun DeclarationDescriptor.isDeprecatedHidden(): Boolean { + return getDeprecation()?.deprecationLevel == DeprecationLevelValue.HIDDEN +} + @JvmOverloads fun DeclarationDescriptor.isHiddenInResolution(isSuperCall: Boolean = false): Boolean { if (this is FunctionDescriptor) { if (isHiddenToOvercomeSignatureClash) return true if (isHiddenForResolutionEverywhereBesideSupercalls && !isSuperCall) return true } - return getDeprecation()?.deprecationLevel == DeprecationLevelValue.HIDDEN + return isDeprecatedHidden() }