diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/FunctionCodegen.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/FunctionCodegen.java index cb91fe62edf..06575263493 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/FunctionCodegen.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/FunctionCodegen.java @@ -25,6 +25,7 @@ import org.jetbrains.kotlin.codegen.state.KotlinTypeMapper; import org.jetbrains.kotlin.codegen.state.TypeMapperUtilsKt; import org.jetbrains.kotlin.config.JvmDefaultMode; import org.jetbrains.kotlin.config.LanguageFeature; +import org.jetbrains.kotlin.config.LanguageVersionSettings; import org.jetbrains.kotlin.descriptors.*; import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor; import org.jetbrains.kotlin.descriptors.impl.AnonymousFunctionDescriptor; @@ -73,6 +74,7 @@ import static org.jetbrains.kotlin.codegen.CodegenUtilKt.generateBridgeForMainFu import static org.jetbrains.kotlin.codegen.serialization.JvmSerializationBindings.METHOD_FOR_FUNCTION; import static org.jetbrains.kotlin.codegen.state.KotlinTypeMapper.isAccessor; import static org.jetbrains.kotlin.descriptors.CallableMemberDescriptor.Kind.DECLARATION; +import static org.jetbrains.kotlin.descriptors.CallableMemberDescriptor.Kind.DELEGATION; import static org.jetbrains.kotlin.descriptors.ModalityKt.isOverridable; import static org.jetbrains.kotlin.resolve.DescriptorToSourceUtils.getSourceFromDescriptor; import static org.jetbrains.kotlin.resolve.DescriptorUtils.*; @@ -1041,17 +1043,24 @@ public class FunctionCodegen { } @NotNull - public static String[] getThrownExceptions(@NotNull FunctionDescriptor function, @NotNull KotlinTypeMapper mapper) { - return ArrayUtil.toStringArray(CollectionsKt.map(getThrownExceptions(function), d -> mapper.mapClass(d).getInternalName())); + public static String[] getThrownExceptions(@NotNull FunctionDescriptor function, @NotNull KotlinTypeMapper typeMapper) { + return ArrayUtil.toStringArray(CollectionsKt.map( + getThrownExceptions(function, typeMapper.getLanguageVersionSettings()), + d -> typeMapper.mapClass(d).getInternalName() + )); } @NotNull - public static List getThrownExceptions(@NotNull FunctionDescriptor function) { - AnnotationDescriptor annotation = function.getAnnotations().findAnnotation(new FqName("kotlin.throws")); - if (annotation == null) { - annotation = function.getAnnotations().findAnnotation(new FqName("kotlin.jvm.Throws")); + public static List getThrownExceptions( + @NotNull FunctionDescriptor function, + @NotNull LanguageVersionSettings languageVersionSettings + ) { + if (function.getKind() == DELEGATION && + languageVersionSettings.supportsFeature(LanguageFeature.DoNotGenerateThrowsForDelegatedKotlinMembers)) { + return Collections.emptyList(); } + AnnotationDescriptor annotation = function.getAnnotations().findAnnotation(new FqName("kotlin.jvm.Throws")); if (annotation == null) return Collections.emptyList(); Collection> values = annotation.getAllValueArguments().values(); diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/KotlinTypeMapper.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/KotlinTypeMapper.kt index b490a70bd80..7acc29f806e 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/KotlinTypeMapper.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/KotlinTypeMapper.kt @@ -83,7 +83,7 @@ class KotlinTypeMapper @JvmOverloads constructor( val bindingContext: BindingContext, val classBuilderMode: ClassBuilderMode, private val moduleName: String, - private val languageVersionSettings: LanguageVersionSettings, + val languageVersionSettings: LanguageVersionSettings, private val incompatibleClassTracker: IncompatibleClassTracker = IncompatibleClassTracker.DoNothing, val jvmTarget: JvmTarget = JvmTarget.DEFAULT, private val isIrBackend: Boolean = false, diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/FunctionCodegen.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/FunctionCodegen.kt index 9902294567d..85691ba9130 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/FunctionCodegen.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/FunctionCodegen.kt @@ -187,21 +187,25 @@ open class FunctionCodegen( synchronizedFlag } - protected open fun createMethod(flags: Int, signature: JvmMethodGenericSignature): MethodVisitor { - // @Throws(vararg exceptionClasses: KClass) - val exceptions = irFunction.getAnnotation(FqName("kotlin.jvm.Throws"))?.getValueArgument(0)?.let { - (it as IrVararg).elements.map { exceptionClass -> - classCodegen.typeMapper.mapType((exceptionClass as IrClassReference).classType).internalName - }.toTypedArray() - } - - return classCodegen.visitor.newMethod( + protected open fun createMethod(flags: Int, signature: JvmMethodGenericSignature): MethodVisitor = + classCodegen.visitor.newMethod( irFunction.OtherOrigin, flags, signature.asmMethod.name, signature.asmMethod.descriptor, if (flags.and(Opcodes.ACC_SYNTHETIC) != 0) null else signature.genericsSignature, - exceptions + getThrownExceptions(irFunction)?.toTypedArray() ) + + private fun getThrownExceptions(function: IrFunction): List? { + if (state.languageVersionSettings.supportsFeature(LanguageFeature.DoNotGenerateThrowsForDelegatedKotlinMembers) && + function.origin == IrDeclarationOrigin.DELEGATED_MEMBER + ) return null + + // @Throws(vararg exceptionClasses: KClass) + val exceptionClasses = function.getAnnotation(FqName("kotlin.jvm.Throws"))?.getValueArgument(0) ?: return null + return (exceptionClasses as IrVararg).elements.map { exceptionClass -> + classCodegen.typeMapper.mapType((exceptionClass as IrClassReference).classType).internalName + } } private fun generateAnnotationDefaultValueIfNeeded(methodVisitor: MethodVisitor) { diff --git a/compiler/light-classes/src/org/jetbrains/kotlin/asJava/classes/ultraLightMethods.kt b/compiler/light-classes/src/org/jetbrains/kotlin/asJava/classes/ultraLightMethods.kt index f8dd2265000..69b5ad5ee97 100644 --- a/compiler/light-classes/src/org/jetbrains/kotlin/asJava/classes/ultraLightMethods.kt +++ b/compiler/light-classes/src/org/jetbrains/kotlin/asJava/classes/ultraLightMethods.kt @@ -17,6 +17,7 @@ import org.jetbrains.kotlin.asJava.builder.MemberIndex import org.jetbrains.kotlin.asJava.elements.KtLightAbstractAnnotation import org.jetbrains.kotlin.asJava.elements.KtLightMethodImpl import org.jetbrains.kotlin.codegen.FunctionCodegen +import org.jetbrains.kotlin.config.LanguageVersionSettingsImpl import org.jetbrains.kotlin.descriptors.ConstructorDescriptor import org.jetbrains.kotlin.descriptors.FunctionDescriptor import org.jetbrains.kotlin.load.java.BuiltinMethodsWithSpecialGenericSignature.getSpecialSignatureInfo @@ -56,7 +57,7 @@ internal abstract class KtUltraLightMethod( val builder = KtUltraLightThrowsReferenceListBuilder(parentMethod = this) if (methodDescriptor !== null) { - for (ex in FunctionCodegen.getThrownExceptions(methodDescriptor)) { + for (ex in FunctionCodegen.getThrownExceptions(methodDescriptor, LanguageVersionSettingsImpl.DEFAULT)) { val psiClassType = ex.defaultType.asPsiType(support, TypeMappingMode.DEFAULT, builder) as? PsiClassType psiClassType ?: continue builder.addReference(psiClassType) diff --git a/compiler/testData/codegen/box/throws/delegationAndThrows.kt b/compiler/testData/codegen/box/throws/delegationAndThrows.kt new file mode 100644 index 00000000000..59983781916 --- /dev/null +++ b/compiler/testData/codegen/box/throws/delegationAndThrows.kt @@ -0,0 +1,24 @@ +// !LANGUAGE: +DoNotGenerateThrowsForDelegatedKotlinMembers +// TARGET_BACKEND: JVM +// IGNORE_BACKEND_FIR: JVM_IR +// WITH_RUNTIME +// FILE: A.kt + +import java.io.IOException + +interface A { + @Throws(IOException::class) + fun foo() +} + +// FILE: B.kt + +class B(a: A) : A by a + +fun box(): String { + val method = B::class.java.declaredMethods.single { it.name == B::foo.name } + if (method.exceptionTypes.size != 0) + return "Fail: ${method.exceptionTypes.toList()}" + + return "OK" +} diff --git a/compiler/testData/codegen/box/throws/delegationAndThrows_1_3.kt b/compiler/testData/codegen/box/throws/delegationAndThrows_1_3.kt new file mode 100644 index 00000000000..aca94e5bbc1 --- /dev/null +++ b/compiler/testData/codegen/box/throws/delegationAndThrows_1_3.kt @@ -0,0 +1,24 @@ +// !LANGUAGE: -DoNotGenerateThrowsForDelegatedKotlinMembers +// TARGET_BACKEND: JVM +// IGNORE_BACKEND_FIR: JVM_IR +// WITH_RUNTIME +// FILE: A.kt + +import java.io.IOException + +interface A { + @Throws(IOException::class) + fun foo() +} + +// FILE: B.kt + +class B(a: A) : A by a + +fun box(): String { + val method = B::class.java.declaredMethods.single { it.name == B::foo.name } + if (method.exceptionTypes.size != 1) + return "Fail: ${method.exceptionTypes.toList()}" + + return "OK" +} diff --git a/compiler/testData/codegen/boxAgainstJava/throws/delegationAndThrows.kt b/compiler/testData/codegen/boxAgainstJava/throws/delegationAndThrows.kt new file mode 100644 index 00000000000..fff6cb67ef1 --- /dev/null +++ b/compiler/testData/codegen/boxAgainstJava/throws/delegationAndThrows.kt @@ -0,0 +1,21 @@ +// TARGET_BACKEND: JVM +// WITH_RUNTIME +// FILE: A.java + +import java.io.IOException; + +public interface A { + void foo() throws IOException; +} + +// FILE: B.kt + +class B(a: A) : A by a + +fun box(): String { + val method = B::class.java.declaredMethods.single { it.name == B::foo.name } + if (method.exceptionTypes.size != 0) + return "Fail: ${method.exceptionTypes.toList()}" + + return "OK" +} diff --git a/compiler/testData/compileKotlinAgainstKotlin/delegationAndAnnotations.kt b/compiler/testData/compileKotlinAgainstKotlin/delegationAndAnnotations.kt new file mode 100644 index 00000000000..0fe888bdeb5 --- /dev/null +++ b/compiler/testData/compileKotlinAgainstKotlin/delegationAndAnnotations.kt @@ -0,0 +1,28 @@ +// TARGET_BACKEND: JVM +// WITH_RUNTIME +// FILE: A.kt + +import java.io.IOException + +interface A { + @Throws(IOException::class) + @Anno + fun foo() +} + +annotation class Anno + +// FILE: B.kt + +class B(a: A) : A by a + +fun box(): String { + val method = B::class.java.declaredMethods.single { it.name == B::foo.name } + if (method.exceptionTypes.size != 0) + return "Fail throws: ${method.exceptionTypes.toList()}" + + if (method.declaredAnnotations.size != 1) + return "Fail annotations: ${method.declaredAnnotations.toList()}" + + return "OK" +} diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxAgainstJavaCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxAgainstJavaCodegenTestGenerated.java index 2fcfe6c5252..34882787877 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxAgainstJavaCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxAgainstJavaCodegenTestGenerated.java @@ -1034,6 +1034,24 @@ public class BlackBoxAgainstJavaCodegenTestGenerated extends AbstractBlackBoxAga } } + @TestMetadata("compiler/testData/codegen/boxAgainstJava/throws") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Throws extends AbstractBlackBoxAgainstJavaCodegenTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInThrows() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxAgainstJava/throws"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @TestMetadata("delegationAndThrows.kt") + public void testDelegationAndThrows() throws Exception { + runTest("compiler/testData/codegen/boxAgainstJava/throws/delegationAndThrows.kt"); + } + } + @TestMetadata("compiler/testData/codegen/boxAgainstJava/typealias") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index 2eaa72c16ce..1bcff920cfd 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -27658,6 +27658,29 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { } } + @TestMetadata("compiler/testData/codegen/box/throws") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Throws extends AbstractBlackBoxCodegenTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); + } + + public void testAllFilesPresentInThrows() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/throws"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + + @TestMetadata("delegationAndThrows.kt") + public void testDelegationAndThrows() throws Exception { + runTest("compiler/testData/codegen/box/throws/delegationAndThrows.kt"); + } + + @TestMetadata("delegationAndThrows_1_3.kt") + public void testDelegationAndThrows_1_3() throws Exception { + runTest("compiler/testData/codegen/box/throws/delegationAndThrows_1_3.kt"); + } + } + @TestMetadata("compiler/testData/codegen/box/toArray") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinTestGenerated.java index 04b22616153..17bb8b96850 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinTestGenerated.java @@ -123,6 +123,11 @@ public class CompileKotlinAgainstKotlinTestGenerated extends AbstractCompileKotl runTest("compiler/testData/compileKotlinAgainstKotlin/delegatedDefault.kt"); } + @TestMetadata("delegationAndAnnotations.kt") + public void testDelegationAndAnnotations() throws Exception { + runTest("compiler/testData/compileKotlinAgainstKotlin/delegationAndAnnotations.kt"); + } + @TestMetadata("doublyNestedClass.kt") public void testDoublyNestedClass() throws Exception { runTest("compiler/testData/compileKotlinAgainstKotlin/doublyNestedClass.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index c2d538be39f..e251925eb0d 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -26475,6 +26475,29 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes } } + @TestMetadata("compiler/testData/codegen/box/throws") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Throws extends AbstractLightAnalysisModeTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); + } + + public void testAllFilesPresentInThrows() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/throws"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + + @TestMetadata("delegationAndThrows.kt") + public void testDelegationAndThrows() throws Exception { + runTest("compiler/testData/codegen/box/throws/delegationAndThrows.kt"); + } + + @TestMetadata("delegationAndThrows_1_3.kt") + public void testDelegationAndThrows_1_3() throws Exception { + runTest("compiler/testData/codegen/box/throws/delegationAndThrows_1_3.kt"); + } + } + @TestMetadata("compiler/testData/codegen/box/toArray") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java index bcef67cca27..360afe6ba37 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java @@ -26157,6 +26157,29 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT } } + @TestMetadata("compiler/testData/codegen/box/throws") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Throws extends AbstractFirBlackBoxCodegenTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: "); + } + + public void testAllFilesPresentInThrows() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/throws"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @TestMetadata("delegationAndThrows.kt") + public void testDelegationAndThrows() throws Exception { + runTest("compiler/testData/codegen/box/throws/delegationAndThrows.kt"); + } + + @TestMetadata("delegationAndThrows_1_3.kt") + public void testDelegationAndThrows_1_3() throws Exception { + runTest("compiler/testData/codegen/box/throws/delegationAndThrows_1_3.kt"); + } + } + @TestMetadata("compiler/testData/codegen/box/toArray") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxAgainstJavaCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxAgainstJavaCodegenTestGenerated.java index 55cd634cf24..49fe75582c2 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxAgainstJavaCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxAgainstJavaCodegenTestGenerated.java @@ -1035,6 +1035,24 @@ public class IrBlackBoxAgainstJavaCodegenTestGenerated extends AbstractIrBlackBo } } + @TestMetadata("compiler/testData/codegen/boxAgainstJava/throws") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Throws extends AbstractIrBlackBoxAgainstJavaCodegenTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); + } + + public void testAllFilesPresentInThrows() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxAgainstJava/throws"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @TestMetadata("delegationAndThrows.kt") + public void testDelegationAndThrows() throws Exception { + runTest("compiler/testData/codegen/boxAgainstJava/throws/delegationAndThrows.kt"); + } + } + @TestMetadata("compiler/testData/codegen/boxAgainstJava/typealias") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index fa497313943..ab698cfe44f 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -26157,6 +26157,29 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes } } + @TestMetadata("compiler/testData/codegen/box/throws") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Throws extends AbstractIrBlackBoxCodegenTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); + } + + public void testAllFilesPresentInThrows() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/throws"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @TestMetadata("delegationAndThrows.kt") + public void testDelegationAndThrows() throws Exception { + runTest("compiler/testData/codegen/box/throws/delegationAndThrows.kt"); + } + + @TestMetadata("delegationAndThrows_1_3.kt") + public void testDelegationAndThrows_1_3() throws Exception { + runTest("compiler/testData/codegen/box/throws/delegationAndThrows_1_3.kt"); + } + } + @TestMetadata("compiler/testData/codegen/box/toArray") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstKotlinTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstKotlinTestGenerated.java index fa6ea40076b..812b5e072ed 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstKotlinTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstKotlinTestGenerated.java @@ -118,6 +118,11 @@ public class IrCompileKotlinAgainstKotlinTestGenerated extends AbstractIrCompile runTest("compiler/testData/compileKotlinAgainstKotlin/delegatedDefault.kt"); } + @TestMetadata("delegationAndAnnotations.kt") + public void testDelegationAndAnnotations() throws Exception { + runTest("compiler/testData/compileKotlinAgainstKotlin/delegationAndAnnotations.kt"); + } + @TestMetadata("doublyNestedClass.kt") public void testDoublyNestedClass() throws Exception { runTest("compiler/testData/compileKotlinAgainstKotlin/doublyNestedClass.kt"); diff --git a/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt b/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt index 96687916085..593bc11559a 100644 --- a/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt +++ b/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt @@ -124,6 +124,7 @@ enum class LanguageFeature( AllowContractsForNonOverridableMembers(KOTLIN_1_4), AllowReifiedGenericsInContracts(KOTLIN_1_4), ProperVisibilityForCompanionObjectInstanceField(KOTLIN_1_4, kind = BUG_FIX), + DoNotGenerateThrowsForDelegatedKotlinMembers(KOTLIN_1_4), // Temporarily disabled, see KT-27084/KT-22379 SoundSmartcastFromLoopConditionForLoopAssignedVariables(sinceVersion = null, kind = BUG_FIX), diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index e10f6c05ecf..2a3553d1f31 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -21318,6 +21318,19 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { } } + @TestMetadata("compiler/testData/codegen/box/throws") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Throws extends AbstractIrJsCodegenBoxTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath); + } + + public void testAllFilesPresentInThrows() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/throws"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); + } + } + @TestMetadata("compiler/testData/codegen/box/toArray") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index c9a82f680ca..d94246b0ec6 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -22453,6 +22453,19 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { } } + @TestMetadata("compiler/testData/codegen/box/throws") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Throws extends AbstractJsCodegenBoxTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath); + } + + public void testAllFilesPresentInThrows() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/throws"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); + } + } + @TestMetadata("compiler/testData/codegen/box/toArray") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class)