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 5547dd9a048..619719288b4 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 @@ -289,7 +289,6 @@ class K2JVMCompilerArguments : CommonCompilerArguments() { Note that if interface delegation is used, all interface methods are delegated. The only exception are methods annotated with the deprecated @JvmDefault annotation. -Xjvm-default=disable Do not generate JVM default methods and prohibit @JvmDefault annotation usage. - The following modes are DEPRECATED: -Xjvm-default=enable Allow usages of @JvmDefault; only generate the default method for annotated method in the interface (annotating an existing method can break binary compatibility) @@ -363,12 +362,6 @@ class K2JVMCompilerArguments : CommonCompilerArguments() { result[AnalysisFlags.ignoreDataFlowInAssert] = JVMAssertionsMode.fromString(assertionsMode) != JVMAssertionsMode.LEGACY JvmDefaultMode.fromStringOrNull(jvmDefault)?.let { result[JvmAnalysisFlags.jvmDefaultMode] = it - if (it == JvmDefaultMode.ENABLE || it == JvmDefaultMode.ENABLE_WITH_DEFAULT_IMPLS) { - collector.report( - CompilerMessageSeverity.WARNING, - "'-Xjvm-default=$jvmDefault' mode is deprecated. Please considering to switch to new modes: 'all' and 'all-compatibility'" - ) - } } ?: collector.report( CompilerMessageSeverity.ERROR, "Unknown @JvmDefault mode: $jvmDefault, " + diff --git a/compiler/testData/cli/jvm/extraHelp.out b/compiler/testData/cli/jvm/extraHelp.out index 18a5e2171b5..6640cf273ab 100644 --- a/compiler/testData/cli/jvm/extraHelp.out +++ b/compiler/testData/cli/jvm/extraHelp.out @@ -57,7 +57,6 @@ where advanced options include: Note that if interface delegation is used, all interface methods are delegated. The only exception are methods annotated with the deprecated @JvmDefault annotation. -Xjvm-default=disable Do not generate JVM default methods and prohibit @JvmDefault annotation usage. - The following modes are DEPRECATED: -Xjvm-default=enable Allow usages of @JvmDefault; only generate the default method for annotated method in the interface (annotating an existing method can break binary compatibility) diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/generic.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/generic.kt index df3ea58ec10..97f2b30d9b5 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/generic.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/generic.kt @@ -2,7 +2,7 @@ // !JVM_DEFAULT_MODE: enable interface A { - @JvmDefault + @JvmDefault fun test(p: T) { } } diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/javaOverride.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/javaOverride.kt index 9a87a0a26a0..b7204e24613 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/javaOverride.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/javaOverride.kt @@ -13,7 +13,7 @@ public interface JavaInterface { // FILE: 1.kt interface KotlinInterface : JavaInterface { - @JvmDefault + @JvmDefault override fun test() {} override fun testForNonDefault() {} @@ -22,7 +22,7 @@ interface KotlinInterface : JavaInterface { } interface KotlinInterface2 : JavaInterface, KotlinInterface { - @JvmDefault + @JvmDefault override fun test() {} override fun testForNonDefault() {} @@ -37,7 +37,7 @@ interface KotlinInterfaceForIndirect : JavaInterface { interface KotlinInterfaceIndirectInheritance : KotlinInterfaceForIndirect { - @JvmDefault + @JvmDefault override fun test() {} override fun testForNonDefault() {} @@ -63,7 +63,7 @@ interface KotlinInterfaceX { } interface KotlinInterfaceManySuper: JavaInterface, KotlinInterfaceX { - @JvmDefault + @JvmDefault override fun test() {} override fun testForNonDefault() {} diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/jvmDefaultInInheritance.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/jvmDefaultInInheritance.kt index 3139cf76563..e89e2deb868 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/jvmDefaultInInheritance.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/jvmDefaultInInheritance.kt @@ -1,7 +1,7 @@ // !JVM_TARGET: 1.8 interface A { - @JvmDefault + @JvmDefault fun test() { } } @@ -28,7 +28,7 @@ class Bar2 : Foo(), A class Bar3 : Foo(), B open class BarWithJvmDefault : B { - @JvmDefault + @JvmDefault override fun test() { } } diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/jvmDefaults.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/jvmDefaults.kt index 22820b64cd5..f7cb28811be 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/jvmDefaults.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/jvmDefaults.kt @@ -2,12 +2,12 @@ // !JVM_TARGET: 1.8 public interface KInterface { - @JvmDefault + @JvmDefault fun test(): String { return "OK"; } - @JvmDefault + @JvmDefault val property: String get() = "OK" @@ -23,7 +23,7 @@ public interface KInterface { // FILE: 1.kt interface KotlinInterface : KInterface { - @JvmDefault + @JvmDefault fun fooo() { super.test() super.property @@ -42,7 +42,7 @@ interface KotlinInterface : KInterface { } } - @JvmDefault + @JvmDefault val propertyy: String get() { super.test() @@ -105,7 +105,7 @@ interface KotlinInterface : KInterface { } interface KotlinInterfaceIndirectInheritance : KotlinInterface { - @JvmDefault + @JvmDefault fun foooo() { super.test() super.property @@ -124,7 +124,7 @@ interface KotlinInterfaceIndirectInheritance : KotlinInterface { } } - @JvmDefault + @JvmDefault val propertyyy: String get() { super.test() diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/jvmDefaultsWithJava.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/jvmDefaultsWithJava.kt index 8517f8efd38..b15d257c398 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/jvmDefaultsWithJava.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/jvmDefaultsWithJava.kt @@ -15,7 +15,7 @@ public interface JavaInterface { // FILE: 1.kt interface KotlinInterface : JavaInterface { - @JvmDefault + @JvmDefault fun fooo() { super.test() @@ -26,7 +26,7 @@ interface KotlinInterface : JavaInterface { } } - @JvmDefault + @JvmDefault val propertyy: String get() { super.test() @@ -39,14 +39,14 @@ interface KotlinInterface : JavaInterface { return "" } - @JvmDefault + @JvmDefault override fun testOverride(): String { return "OK"; } } interface KotlinInterfaceIndirectInheritance : KotlinInterface { - @JvmDefault + @JvmDefault fun foooo() { super.test() @@ -57,7 +57,7 @@ interface KotlinInterfaceIndirectInheritance : KotlinInterface { } } - @JvmDefault + @JvmDefault val propertyyy: String get() { super.test() diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/noJvmDefaultFlag.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/noJvmDefaultFlag.kt index 70470e51d59..46fb4e1005e 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/noJvmDefaultFlag.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/noJvmDefaultFlag.kt @@ -2,27 +2,27 @@ interface B { - @JvmDefault + @JvmDefault fun test() {} - @JvmDefault + @JvmDefault abstract fun test2(s: String = "") - @JvmDefault + @JvmDefault abstract fun test3() - @JvmDefault + @JvmDefault abstract val prop: String - @JvmDefault + @JvmDefault abstract val prop2: String - @JvmDefault + @JvmDefault val prop3: String get() = "" - @JvmDefault + @JvmDefault var prop4: String get() = "" set(value) {} diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/notInterface.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/notInterface.kt index 800433dea87..7378e4a6338 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/notInterface.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/notInterface.kt @@ -2,21 +2,21 @@ abstract class A { - @JvmDefault + @JvmDefault fun test() {} - @JvmDefault + @JvmDefault abstract fun test2(s: String = "") - @JvmDefault + @JvmDefault abstract fun test3() } object B { - @JvmDefault + @JvmDefault fun test() {} - @JvmDefault + @JvmDefault fun test2(s: String = "") {} } diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/propertyAccessor.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/propertyAccessor.kt index 247dd15cce9..ae9bf7ef203 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/propertyAccessor.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/propertyAccessor.kt @@ -3,12 +3,12 @@ interface B { - @JvmDefault + @JvmDefault val prop1: String - @JvmDefault get() = "" + @JvmDefault get() = "" var prop2: String - @JvmDefault get() = "" - @JvmDefault set(value) {} + @JvmDefault get() = "" + @JvmDefault set(value) {} } diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/simpleOverride.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/simpleOverride.kt index 9ac34d7ac9b..e6f26e0eec0 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/simpleOverride.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/simpleOverride.kt @@ -2,7 +2,7 @@ // !JVM_DEFAULT_MODE: enable interface A { - @JvmDefault + @JvmDefault fun test() {} } diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/simplePropertyOverride.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/simplePropertyOverride.kt index 5232315c24e..202e083d645 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/simplePropertyOverride.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/simplePropertyOverride.kt @@ -2,7 +2,7 @@ // !JVM_DEFAULT_MODE: enable interface A { - @JvmDefault + @JvmDefault val test: String get() = "OK" } diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/superCall.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/superCall.kt index 32ffdc7e5ea..28b7b07b3fb 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/superCall.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/superCall.kt @@ -1,7 +1,7 @@ // !JVM_TARGET: 1.8 // FILE: 1.kt interface A { - @JvmDefault + @JvmDefault fun test() { } } @@ -12,7 +12,7 @@ interface B : A { } interface C : B { - @JvmDefault + @JvmDefault override fun test() { super.test() } diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/superCallAmbiguity.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/superCallAmbiguity.kt index 5d0e9f1393f..a4c01edb548 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/superCallAmbiguity.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/superCallAmbiguity.kt @@ -1,6 +1,6 @@ // !JVM_TARGET: 1.8 interface A { - @JvmDefault + @JvmDefault fun test() { } } @@ -16,7 +16,7 @@ interface B{ interface C : A, B { - @JvmDefault + @JvmDefault override fun test() { super.test() super.test() @@ -24,7 +24,7 @@ interface C : A, B { } interface D : B, A { - @JvmDefault + @JvmDefault override fun test() { super.test() super.test() diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/superCallAmbiguity2.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/superCallAmbiguity2.kt index 4a5bfe788af..88da42e2aed 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/superCallAmbiguity2.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/superCallAmbiguity2.kt @@ -1,6 +1,6 @@ // !JVM_TARGET: 1.8 interface A { - @JvmDefault + @JvmDefault fun test() } diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/superCallAmbiguity3.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/superCallAmbiguity3.kt index 691f8288efc..774d347ef4b 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/superCallAmbiguity3.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/superCallAmbiguity3.kt @@ -1,6 +1,6 @@ // !JVM_TARGET: 1.8 interface A { - @JvmDefault + @JvmDefault fun test() { } diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/target6.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/target6.kt index e73f23b6fd5..77391b331c3 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/target6.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/target6.kt @@ -2,27 +2,27 @@ interface B { - @JvmDefault + @JvmDefault fun test() {} - @JvmDefault + @JvmDefault abstract fun test2(s: String = "") - @JvmDefault + @JvmDefault abstract fun test3() - @JvmDefault + @JvmDefault abstract val prop: String - @JvmDefault + @JvmDefault abstract val prop2: String - @JvmDefault + @JvmDefault val prop3: String get() = "" - @JvmDefault + @JvmDefault var prop4: String get() = "" set(value) {} diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/target8.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/target8.kt index 1421e03ba21..cb0b02d8244 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/target8.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/target8.kt @@ -3,27 +3,27 @@ interface B { - @JvmDefault + @JvmDefault fun test() {} - @JvmDefault + @JvmDefault abstract fun test2(s: String = "") - @JvmDefault + @JvmDefault abstract fun test3() - @JvmDefault + @JvmDefault abstract val prop: String - @JvmDefault + @JvmDefault abstract val prop2: String - @JvmDefault + @JvmDefault val prop3: String get() = "" - @JvmDefault + @JvmDefault var prop4: String get() = "" set(value) {} diff --git a/libraries/stdlib/jvm/src/kotlin/jvm/JvmDefault.kt b/libraries/stdlib/jvm/src/kotlin/jvm/JvmDefault.kt index 4f6de68e950..68d438428e6 100644 --- a/libraries/stdlib/jvm/src/kotlin/jvm/JvmDefault.kt +++ b/libraries/stdlib/jvm/src/kotlin/jvm/JvmDefault.kt @@ -27,16 +27,8 @@ import kotlin.internal.RequireKotlinVersionKind * Generation of default methods is only possible with JVM target bytecode version 1.8 (`-jvm-target 1.8`) or higher. * * @[JvmDefault] methods are excluded from interface delegation. - * - * # - * This annotation is **deprecated** in favor of new compiler arguments `-Xjvm-default=all-compatibility` and `-Xjvm-default=all`. - * The new arguments allow all interface methods with bodies to be generated as JVM default methods on JVM target 1.8+. - * Please refer to the [official documentation](https://kotlinlang.org/docs/reference/java-to-kotlin-interop.html#default-methods-in-interfaces) - * for more information. - * */ @SinceKotlin("1.2") @RequireKotlin("1.2.40", versionKind = RequireKotlinVersionKind.COMPILER_VERSION) @Target(AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY) -@Deprecated("Switch to new -Xjvm-default options: `all` or `all-compatibility`") annotation class JvmDefault