diff --git a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/DeprecatedOption.kt b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/GradleDeprecatedOption.kt similarity index 91% rename from compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/DeprecatedOption.kt rename to compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/GradleDeprecatedOption.kt index 51a0b8ad15f..fcbca65bff1 100644 --- a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/DeprecatedOption.kt +++ b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/GradleDeprecatedOption.kt @@ -6,7 +6,7 @@ package org.jetbrains.kotlin.cli.common.arguments @Retention(AnnotationRetention.RUNTIME) -annotation class DeprecatedOption( +annotation class GradleDeprecatedOption( val message: String = "This option has no effect and will be removed in a future release.", val removeAfter: String, val level: DeprecationLevel diff --git a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JVMCompilerArguments.kt b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JVMCompilerArguments.kt index 3263f0b5725..7cef376620e 100644 --- a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JVMCompilerArguments.kt +++ b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JVMCompilerArguments.kt @@ -27,12 +27,12 @@ class K2JVMCompilerArguments : CommonCompilerArguments() { ) var classpath: String? by NullableStringFreezableVar(null) - @DeprecatedOption(removeAfter = "1.5", level = DeprecationLevel.ERROR) + @GradleDeprecatedOption(removeAfter = "1.5", level = DeprecationLevel.ERROR) @GradleOption(DefaultValues.BooleanFalseDefault::class) @Argument(value = "-include-runtime", description = "Include Kotlin runtime into the resulting JAR") var includeRuntime: Boolean by FreezableVar(false) - @DeprecatedOption( + @GradleDeprecatedOption( message = "This option is not working well with Gradle caching and will be removed in the future.", removeAfter = "1.7", level = DeprecationLevel.WARNING @@ -49,7 +49,7 @@ class K2JVMCompilerArguments : CommonCompilerArguments() { @Argument(value = "-no-jdk", description = "Don't automatically include the Java runtime into the classpath") var noJdk: Boolean by FreezableVar(false) - @DeprecatedOption(removeAfter = "1.6", level = DeprecationLevel.ERROR) + @GradleDeprecatedOption(removeAfter = "1.6", level = DeprecationLevel.ERROR) @GradleOption(DefaultValues.BooleanTrueDefault::class) @Argument( value = "-no-stdlib", @@ -57,7 +57,7 @@ class K2JVMCompilerArguments : CommonCompilerArguments() { ) var noStdlib: Boolean by FreezableVar(false) - @DeprecatedOption(removeAfter = "1.5", level = DeprecationLevel.ERROR) + @GradleDeprecatedOption(removeAfter = "1.5", level = DeprecationLevel.ERROR) @GradleOption(DefaultValues.BooleanTrueDefault::class) @Argument(value = "-no-reflect", description = "Don't automatically include Kotlin reflection into the classpath") var noReflect: Boolean by FreezableVar(false) @@ -97,7 +97,7 @@ class K2JVMCompilerArguments : CommonCompilerArguments() { // Advanced options - @DeprecatedOption(removeAfter = "1.6", level = DeprecationLevel.HIDDEN) + @GradleDeprecatedOption(removeAfter = "1.6", level = DeprecationLevel.HIDDEN) @GradleOption(DefaultValues.BooleanFalseDefault::class) @Argument( value = "-Xuse-ir", diff --git a/generators/tests/org/jetbrains/kotlin/generators/arguments/GenerateGradleOptions.kt b/generators/tests/org/jetbrains/kotlin/generators/arguments/GenerateGradleOptions.kt index df6f82eac0f..399879fe168 100644 --- a/generators/tests/org/jetbrains/kotlin/generators/arguments/GenerateGradleOptions.kt +++ b/generators/tests/org/jetbrains/kotlin/generators/arguments/GenerateGradleOptions.kt @@ -183,7 +183,7 @@ fun main() { } private inline fun List>.filterToBeDeleted() = filter { prop -> - prop.findAnnotation() + prop.findAnnotation() ?.let { LanguageVersion.fromVersionString(it.removeAfter) } ?.let { it >= LanguageVersion.LATEST_STABLE } ?: true @@ -289,7 +289,7 @@ private fun Printer.generatePropertyDeclaration(property: KProperty1<*, *>, modi } private fun Printer.generateOptionDeprecation(property: KProperty1<*, *>) { - property.findAnnotation() + property.findAnnotation() ?.let { DeprecatedOptionAnnotator.generateOptionAnnotation(it) } ?.also { println(it) } } @@ -320,7 +320,7 @@ private fun generateMarkdown(properties: List>) { for (property in properties) { val name = property.name if (name == "includeRuntime") continue // This option has no effect in Gradle builds - val renderName = listOfNotNull("`$name`", property.findAnnotation()?.let { "__(Deprecated)__" }) + val renderName = listOfNotNull("`$name`", property.findAnnotation()?.let { "__(Deprecated)__" }) .joinToString(" ") val description = property.findAnnotation()!!.description val possibleValues = property.gradleValues.possibleValues @@ -363,7 +363,7 @@ private inline fun KAnnotatedElement.findAnnotation(): T? = annotations.filterIsInstance().firstOrNull() object DeprecatedOptionAnnotator { - fun generateOptionAnnotation(annotation: DeprecatedOption): String { + fun generateOptionAnnotation(annotation: GradleDeprecatedOption): String { val message = annotation.message.takeIf { it.isNotEmpty() }?.let { "message = \"$it\"" } val level = "level = DeprecationLevel.${annotation.level.name}" val arguments = listOfNotNull(message, level).joinToString()