From afc149d4607f2bb38326bb3de92d31fb0b6ba189 Mon Sep 17 00:00:00 2001 From: Mikhael Bogdanov Date: Sat, 30 Oct 2021 15:00:15 +0200 Subject: [PATCH] JvmDefault. Allow non default inheritance with special flag #KT-47000 --- .../arguments/K2JVMCompilerArguments.kt | 4 ++ .../kotlin/config/JvmAnalysisFlags.kt | 3 + .../FirBlackBoxCodegenTestGenerated.java | 34 +++++++++++ .../resolve/jvm/checkers/JvmDefaultChecker.kt | 15 +++-- .../LanguageVersionSettingsBuilder.kt | 1 + .../directives/LanguageSettingsDirectives.kt | 4 ++ compiler/testData/cli/jvm/extraHelp.out | 2 + .../defaults/nonDefaultInheritance/simple.kt | 57 +++++++++++++++++++ .../defaults/nonDefaultInheritance/simple2.kt | 39 +++++++++++++ .../nonDefaultInheritance/specialization.kt | 32 +++++++++++ .../nonDefaultInheritance/specialization.txt | 46 +++++++++++++++ .../nonDefaultInheritance/superCall.kt | 26 +++++++++ .../nonDefaultInheritance/superCall.txt | 25 ++++++++ .../library/a.kt | 5 ++ .../output.txt | 7 +++ .../source.kt | 7 +++ .../codegen/BlackBoxCodegenTestGenerated.java | 34 +++++++++++ .../IrBlackBoxCodegenTestGenerated.java | 34 +++++++++++ .../LightAnalysisModeTestGenerated.java | 33 +++++++++++ .../CompileKotlinAgainstCustomBinariesTest.kt | 10 ++++ .../IrJsCodegenBoxES6TestGenerated.java | 13 +++++ .../IrJsCodegenBoxTestGenerated.java | 13 +++++ .../IrCodegenBoxWasmTestGenerated.java | 13 +++++ .../js/testNew/JsCodegenBoxTestGenerated.java | 10 ++++ 24 files changed, 461 insertions(+), 6 deletions(-) create mode 100644 compiler/testData/codegen/box/jvm8/defaults/nonDefaultInheritance/simple.kt create mode 100644 compiler/testData/codegen/box/jvm8/defaults/nonDefaultInheritance/simple2.kt create mode 100644 compiler/testData/codegen/box/jvm8/defaults/nonDefaultInheritance/specialization.kt create mode 100644 compiler/testData/codegen/box/jvm8/defaults/nonDefaultInheritance/specialization.txt create mode 100644 compiler/testData/codegen/box/jvm8/defaults/nonDefaultInheritance/superCall.kt create mode 100644 compiler/testData/codegen/box/jvm8/defaults/nonDefaultInheritance/superCall.txt create mode 100644 compiler/testData/compileKotlinAgainstCustomBinaries/jvmDefaultNonDefaultInheritanceSuperCall/library/a.kt create mode 100644 compiler/testData/compileKotlinAgainstCustomBinaries/jvmDefaultNonDefaultInheritanceSuperCall/output.txt create mode 100644 compiler/testData/compileKotlinAgainstCustomBinaries/jvmDefaultNonDefaultInheritanceSuperCall/source.kt 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 b3332977bae86..77174e065f07a 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 @@ -337,6 +337,9 @@ class K2JVMCompilerArguments : CommonCompilerArguments() { ) var jvmDefault: String by FreezableVar(JvmDefaultMode.DEFAULT.description) + @Argument(value = "-Xjvm-default-allow-non-default-inheritance", description = "Allow inheritance from 'all*' modes for 'disable' one") + var jvmDefaultAllowDisableAgainstAll: Boolean by FreezableVar(false) + @Argument( value = "-Xdefault-script-extension", valueDescription = "