From afe8773e41b97c6e8088a17a26fab612c0dab148 Mon Sep 17 00:00:00 2001 From: "Pavel V. Talanov" Date: Wed, 4 Mar 2015 14:55:21 +0300 Subject: [PATCH] Minor: rename OVERRIDE_CANNOT_BE_STATIC and improve message --- .../kotlin/load/kotlin/KotlinJvmCheckerProvider.kt | 2 +- .../resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java | 2 +- .../jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java | 2 +- .../testsWithStdLib/annotations/platformStatic/property.kt | 6 ++++-- .../testsWithStdLib/annotations/platformStatic/property.txt | 1 + 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/load/kotlin/KotlinJvmCheckerProvider.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/load/kotlin/KotlinJvmCheckerProvider.kt index b717cbe7078..c0e65bf406a 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/load/kotlin/KotlinJvmCheckerProvider.kt +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/load/kotlin/KotlinJvmCheckerProvider.kt @@ -112,7 +112,7 @@ public class PlatformStaticAnnotationChecker : AnnotationChecker { } if (insideObject && descriptor is MemberDescriptor && descriptor.getModality().isOverridable()) { - diagnosticHolder.report(ErrorsJvm.OVERRIDE_CANNOT_BE_STATIC.on(declaration)); + diagnosticHolder.report(ErrorsJvm.OPEN_CANNOT_BE_STATIC.on(declaration)); } } } diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java index 23bcb257a4a..b0962188e7a 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java @@ -46,7 +46,7 @@ public class DefaultErrorMessagesJvm implements DefaultErrorMessages.Extension { MAP.put(ErrorsJvm.CONFLICTING_JVM_DECLARATIONS, "Platform declaration clash: {0}", CONFLICTING_JVM_DECLARATIONS_DATA); MAP.put(ErrorsJvm.ACCIDENTAL_OVERRIDE, "Accidental override: {0}", CONFLICTING_JVM_DECLARATIONS_DATA); MAP.put(ErrorsJvm.PLATFORM_STATIC_NOT_IN_OBJECT, "Only functions in named objects and default objects of classes can be annotated with 'platformStatic'"); - MAP.put(ErrorsJvm.OVERRIDE_CANNOT_BE_STATIC, "Override cannot be 'platformStatic' in object"); + MAP.put(ErrorsJvm.OPEN_CANNOT_BE_STATIC, "Open member cannot be 'platformStatic' in object"); MAP.put(ErrorsJvm.PLATFORM_STATIC_ILLEGAL_USAGE, "This declaration does not support ''platformStatic''", DescriptorRenderer.SHORT_NAMES_IN_TYPES); MAP.put(ErrorsJvm.NATIVE_DECLARATION_CANNOT_BE_ABSTRACT, "Native declaration can not be abstract"); MAP.put(ErrorsJvm.NATIVE_DECLARATION_CANNOT_HAVE_BODY, "Native declaration can not have a body"); diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java index 4f7a82b32a3..a38fc90dff3 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java @@ -37,7 +37,7 @@ public interface ErrorsJvm { DiagnosticFactory1 ACCIDENTAL_OVERRIDE = DiagnosticFactory1.create(ERROR, DECLARATION_SIGNATURE_OR_DEFAULT); - DiagnosticFactory0 OVERRIDE_CANNOT_BE_STATIC = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE); + DiagnosticFactory0 OPEN_CANNOT_BE_STATIC = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE); DiagnosticFactory0 PLATFORM_STATIC_NOT_IN_OBJECT = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE); DiagnosticFactory1 PLATFORM_STATIC_ILLEGAL_USAGE = DiagnosticFactory1.create(ERROR, DECLARATION_SIGNATURE); diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/platformStatic/property.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/platformStatic/property.kt index 20053f5dbf5..8813a3a485f 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/platformStatic/property.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/platformStatic/property.kt @@ -29,10 +29,12 @@ class A { [platformStatic] val z = 1; - [platformStatic] override val base1: Int = 0 + [platformStatic] override val base1: Int = 0 + + platformStatic open fun f() {} override val base2: Int = 0 - [platformStatic] get + [platformStatic] get } var p:Int = 1 diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/platformStatic/property.txt b/compiler/testData/diagnostics/testsWithStdLib/annotations/platformStatic/property.txt index 42016d0044b..6148aad1b49 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/platformStatic/property.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/platformStatic/property.txt @@ -15,6 +15,7 @@ internal final class A { internal final var p: kotlin.Int kotlin.platform.platformStatic() internal final val z: kotlin.Int = 1 public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + kotlin.platform.platformStatic() internal open fun f(): kotlin.Unit public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String }