From d16b5c8bd8a0fdae616c8fed3acaeb24fab76027 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Thu, 25 Nov 2021 15:15:43 +0300 Subject: [PATCH] FE: make error message more precise #KT-49598 Fixed --- .../kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java | 2 +- compiler/testData/cli/jvm/jvmRecordWrongTarget.out | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 ea774573eae..b720474a0ee 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 @@ -186,7 +186,7 @@ public class DefaultErrorMessagesJvm implements DefaultErrorMessages.Extension { MAP.put(DELEGATION_BY_IN_JVM_RECORD, "Delegation is not allowed for @JvmRecord classes"); MAP.put(NON_DATA_CLASS_JVM_RECORD, "Only data classes are allowed to be marked as @JvmRecord"); MAP.put(ILLEGAL_JAVA_LANG_RECORD_SUPERTYPE, "Classes cannot have explicit 'java.lang.Record' supertype"); - MAP.put(JVM_RECORDS_ILLEGAL_BYTECODE_TARGET, "Using @JvmRecord is only allowed with -jvm-target 15 and -Xjvm-enable-preview flag enabled"); + MAP.put(JVM_RECORDS_ILLEGAL_BYTECODE_TARGET, "Using @JvmRecord is only allowed with -jvm-target 16 or later (or -jvm-target 15 with the -Xjvm-enable-preview flag enabled)"); String MESSAGE_FOR_CONCURRENT_HASH_MAP_CONTAINS = "Method 'contains' from ConcurrentHashMap may have unexpected semantics: it calls 'containsValue' instead of 'containsKey'. " + diff --git a/compiler/testData/cli/jvm/jvmRecordWrongTarget.out b/compiler/testData/cli/jvm/jvmRecordWrongTarget.out index 99fcd0eba3a..456f06df2b2 100644 --- a/compiler/testData/cli/jvm/jvmRecordWrongTarget.out +++ b/compiler/testData/cli/jvm/jvmRecordWrongTarget.out @@ -7,7 +7,7 @@ This mode is not recommended for production use, as no stability/compatibility guarantees are given on compiler or generated code. Use it at your own risk! -compiler/testData/cli/jvm/jvmRecord.kt:1:1: error: using @JvmRecord is only allowed with -jvm-target 15 and -Xjvm-enable-preview flag enabled +compiler/testData/cli/jvm/jvmRecord.kt:1:1: error: using @JvmRecord is only allowed with -jvm-target 16 or later (or -jvm-target 15 with the -Xjvm-enable-preview flag enabled) @JvmRecord ^ COMPILATION_ERROR