diff --git a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java index 0f4a2dfd155..f007192b71b 100644 --- a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java @@ -16759,6 +16759,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/defaultArgsViaAnonymousObject.kt"); } + @TestMetadata("deprecatedDefaultMethod.kt") + public void testDeprecatedDefaultMethod() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/deprecatedDefaultMethod.kt"); + } + @TestMetadata("funInterface.kt") public void testFunInterface() throws Exception { runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/funInterface.kt"); @@ -16890,6 +16895,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/jvm8/defaults/compatibility/deprecatedAnnotation.kt"); } + @TestMetadata("deprecatedDefaultMethod.kt") + public void testDeprecatedDefaultMethod() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/compatibility/deprecatedDefaultMethod.kt"); + } + @TestMetadata("inheritedFunctionWithDefaultParameters.kt") public void testInheritedFunctionWithDefaultParameters() throws Exception { runTest("compiler/testData/codegen/box/jvm8/defaults/compatibility/inheritedFunctionWithDefaultParameters.kt"); diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmSymbols.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmSymbols.kt index 119d4cb00fb..2eac9f92bc5 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmSymbols.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmSymbols.kt @@ -209,7 +209,7 @@ class JvmSymbols( } private val javaLangDeprecatedWithDeprecatedFlag: IrClassSymbol = - createClass(FqName("java.lang.Deprecated")) { klass -> + createClass(FqName("java.lang.Deprecated"), classKind = ClassKind.ANNOTATION_CLASS) { klass -> klass.addConstructor { isPrimary = true } } diff --git a/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/deprecatedDefaultMethod.kt b/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/deprecatedDefaultMethod.kt new file mode 100644 index 00000000000..e79d895b5d4 --- /dev/null +++ b/compiler/testData/codegen/box/jvm8/defaults/allCompatibility/deprecatedDefaultMethod.kt @@ -0,0 +1,11 @@ +// !JVM_DEFAULT_MODE: all-compatibility +// TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 +// WITH_RUNTIME + +interface I { + @Deprecated("message") + fun result() = "OK" +} + +fun box(): String = object : I {}.result() diff --git a/compiler/testData/codegen/box/jvm8/defaults/compatibility/deprecatedDefaultMethod.kt b/compiler/testData/codegen/box/jvm8/defaults/compatibility/deprecatedDefaultMethod.kt new file mode 100644 index 00000000000..139018d21c1 --- /dev/null +++ b/compiler/testData/codegen/box/jvm8/defaults/compatibility/deprecatedDefaultMethod.kt @@ -0,0 +1,12 @@ +// !JVM_DEFAULT_MODE: compatibility +// TARGET_BACKEND: JVM +// JVM_TARGET: 1.8 +// WITH_RUNTIME + +interface I { + @Deprecated("message") + @JvmDefault + fun result() = "OK" +} + +fun box(): String = object : I {}.result() diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index e31f9d889cb..5f8fcb760a8 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -18159,6 +18159,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/defaultArgsViaAnonymousObject.kt"); } + @TestMetadata("deprecatedDefaultMethod.kt") + public void testDeprecatedDefaultMethod() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/deprecatedDefaultMethod.kt"); + } + @TestMetadata("funInterface.kt") public void testFunInterface() throws Exception { runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/funInterface.kt"); @@ -18290,6 +18295,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/jvm8/defaults/compatibility/deprecatedAnnotation.kt"); } + @TestMetadata("deprecatedDefaultMethod.kt") + public void testDeprecatedDefaultMethod() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/compatibility/deprecatedDefaultMethod.kt"); + } + @TestMetadata("inheritedFunctionWithDefaultParameters.kt") public void testInheritedFunctionWithDefaultParameters() throws Exception { runTest("compiler/testData/codegen/box/jvm8/defaults/compatibility/inheritedFunctionWithDefaultParameters.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index ff4606eb91c..1eda70c0aca 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -18159,6 +18159,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/defaultArgsViaAnonymousObject.kt"); } + @TestMetadata("deprecatedDefaultMethod.kt") + public void testDeprecatedDefaultMethod() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/deprecatedDefaultMethod.kt"); + } + @TestMetadata("funInterface.kt") public void testFunInterface() throws Exception { runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/funInterface.kt"); @@ -18290,6 +18295,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/jvm8/defaults/compatibility/deprecatedAnnotation.kt"); } + @TestMetadata("deprecatedDefaultMethod.kt") + public void testDeprecatedDefaultMethod() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/compatibility/deprecatedDefaultMethod.kt"); + } + @TestMetadata("inheritedFunctionWithDefaultParameters.kt") public void testInheritedFunctionWithDefaultParameters() throws Exception { runTest("compiler/testData/codegen/box/jvm8/defaults/compatibility/inheritedFunctionWithDefaultParameters.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index 0f7b800b4bf..75cf87608ae 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -16759,6 +16759,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/defaultArgsViaAnonymousObject.kt"); } + @TestMetadata("deprecatedDefaultMethod.kt") + public void testDeprecatedDefaultMethod() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/deprecatedDefaultMethod.kt"); + } + @TestMetadata("funInterface.kt") public void testFunInterface() throws Exception { runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/funInterface.kt"); @@ -16890,6 +16895,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/jvm8/defaults/compatibility/deprecatedAnnotation.kt"); } + @TestMetadata("deprecatedDefaultMethod.kt") + public void testDeprecatedDefaultMethod() throws Exception { + runTest("compiler/testData/codegen/box/jvm8/defaults/compatibility/deprecatedDefaultMethod.kt"); + } + @TestMetadata("inheritedFunctionWithDefaultParameters.kt") public void testInheritedFunctionWithDefaultParameters() throws Exception { runTest("compiler/testData/codegen/box/jvm8/defaults/compatibility/inheritedFunctionWithDefaultParameters.kt");