[FE 1.0] Fix diagnostic message rendering for OVERRIDE_DEPRECATION

This commit is contained in:
Dmitriy Novozhilov
2021-09-07 11:46:31 +03:00
committed by TeamCityServer
parent 9844671ded
commit 9f4abd8ff7
3 changed files with 3 additions and 3 deletions
@@ -394,7 +394,7 @@ public class DefaultErrorMessages {
(obj, renderingContext) -> obj.equals(VersionRequirement.Version.INFINITY) ? "" : " is only available since Kotlin " + obj.asString() + " and", (obj, renderingContext) -> obj.equals(VersionRequirement.Version.INFINITY) ? "" : " is only available since Kotlin " + obj.asString() + " and",
versionRequirementMessage); versionRequirementMessage);
MAP.put(OVERRIDE_DEPRECATION, "This declaration overrides deprecated member but not marked as deprecated itself. {0}Please add @Deprecated annotation or suppress", TO_STRING, TO_STRING, TO_STRING); MAP.put(OVERRIDE_DEPRECATION, "This declaration overrides deprecated member but not marked as deprecated itself. {0}Please add @Deprecated annotation or suppress", TO_STRING, EMPTY, EMPTY);
MAP.put(DEPRECATED_SINCE_KOTLIN_WITHOUT_DEPRECATED, "DeprecatedSinceKotlin annotation can be used only together with Deprecated annotation"); MAP.put(DEPRECATED_SINCE_KOTLIN_WITHOUT_DEPRECATED, "DeprecatedSinceKotlin annotation can be used only together with Deprecated annotation");
MAP.put(DEPRECATED_SINCE_KOTLIN_WITH_DEPRECATED_LEVEL, "DeprecatedSinceKotlin annotation can be used only with unspecified deprecation level of Deprecated annotation"); MAP.put(DEPRECATED_SINCE_KOTLIN_WITH_DEPRECATED_LEVEL, "DeprecatedSinceKotlin annotation can be used only with unspecified deprecation level of Deprecated annotation");
@@ -19,7 +19,7 @@ object DeprecationInheritanceChecker : DeclarationChecker {
val (deprecations, message) = if (context.languageVersionSettings.supportsFeature(StopPropagatingDeprecationThroughOverrides)) { val (deprecations, message) = if (context.languageVersionSettings.supportsFeature(StopPropagatingDeprecationThroughOverrides)) {
deprecationResolver.getHiddenDeprecationsFromOverriden(descriptor) to "" deprecationResolver.getHiddenDeprecationsFromOverriden(descriptor) to ""
} else { } else {
deprecationResolver.getDeprecations(descriptor) to "This deprecation won't be inherited in kotlin 1.7. " deprecationResolver.getDeprecations(descriptor) to "This deprecation won't be inherited in future releases. "
} }
context.trace.report(Errors.OVERRIDE_DEPRECATION.on(declaration, message, descriptor, deprecations)) context.trace.report(Errors.OVERRIDE_DEPRECATION.on(declaration, message, descriptor, deprecations))
} }
@@ -16,7 +16,7 @@ interface WithDeprecation {
} }
class A : J(), WithDeprecation { class A : J(), WithDeprecation {
override fun <!OVERRIDE_DEPRECATION!>foo<!>() {} override fun <!OVERRIDE_DEPRECATION("This deprecation won't be inherited in future releases. ")!>foo<!>() {}
} }
fun main() { fun main() {