From e7f8486078497daf67d9c7d78c1a80b85838f536 Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Mon, 14 Dec 2020 17:33:53 +0300 Subject: [PATCH] [TEST] Migrate AbstractDiagnosticsTestWithJvmBackend to new test runners --- ...gnosticsTestWithJvmIrBackendGenerated.java | 201 +++++++++++------- ...nosticsTestWithOldJvmBackendGenerated.java | 199 ++++++++++------- .../handlers/JvmBackendDiagnosticsHandler.kt | 35 +++ .../test/directives/DiagnosticsDirectives.kt | 9 + .../handlers/ClassicDiagnosticReporter.kt | 150 +++++++++++++ .../handlers/ClassicDiagnosticsHandler.kt | 140 +----------- .../generators/GenerateNewCompilerTests.kt | 9 + .../test/runners/AbstractDiagnosticTest.kt | 3 + .../AbstractDiagnosticsTestWithJvmBackend.kt | 84 ++++++++ .../AbstractDiagnosticsTestWithJvmBackend.kt | 53 ----- .../generators/tests/GenerateCompilerTests.kt | 8 - 11 files changed, 546 insertions(+), 345 deletions(-) rename compiler/{tests-gen/org/jetbrains/kotlin/checkers => tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners}/DiagnosticsTestWithJvmIrBackendGenerated.java (88%) rename compiler/{tests-gen/org/jetbrains/kotlin/checkers => tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners}/DiagnosticsTestWithOldJvmBackendGenerated.java (88%) create mode 100644 compiler/tests-common-new/tests/org/jetbrains/kotlin/test/backend/handlers/JvmBackendDiagnosticsHandler.kt create mode 100644 compiler/tests-common-new/tests/org/jetbrains/kotlin/test/frontend/classic/handlers/ClassicDiagnosticReporter.kt create mode 100644 compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/AbstractDiagnosticsTestWithJvmBackend.kt delete mode 100644 compiler/tests-common/tests/org/jetbrains/kotlin/checkers/AbstractDiagnosticsTestWithJvmBackend.kt diff --git a/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestWithJvmIrBackendGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticsTestWithJvmIrBackendGenerated.java similarity index 88% rename from compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestWithJvmIrBackendGenerated.java rename to compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticsTestWithJvmIrBackendGenerated.java index e830e031ba1..34721d6790f 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestWithJvmIrBackendGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticsTestWithJvmIrBackendGenerated.java @@ -3,581 +3,631 @@ * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ -package org.jetbrains.kotlin.checkers; +package org.jetbrains.kotlin.test.runners; import com.intellij.testFramework.TestDataPath; -import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; -import org.jetbrains.kotlin.test.KotlinTestUtils; import org.jetbrains.kotlin.test.util.KtTestUtil; import org.jetbrains.kotlin.test.TargetBackend; import org.jetbrains.kotlin.test.TestMetadata; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; import java.io.File; import java.util.regex.Pattern; -/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ +/** This class is generated by {@link GenerateNewCompilerTests.kt}. DO NOT MODIFY MANUALLY */ @SuppressWarnings("all") @TestMetadata("compiler/testData/diagnostics/testsWithJvmBackend") @TestDataPath("$PROJECT_ROOT") -@RunWith(JUnit3RunnerWithInners.class) public class DiagnosticsTestWithJvmIrBackendGenerated extends AbstractDiagnosticsTestWithJvmIrBackend { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); - } - + @Test public void testAllFilesPresentInTestsWithJvmBackend() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithJvmBackend"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } + @Test @TestMetadata("indirectInlineCycle_ir.kt") public void testIndirectInlineCycle_ir() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/indirectInlineCycle_ir.kt"); } + @Test @TestMetadata("inlineCycle_ir.kt") public void testInlineCycle_ir() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/inlineCycle_ir.kt"); } + @Test @TestMetadata("multipleBigArityFunsImplemented_ir.kt") public void testMultipleBigArityFunsImplemented_ir() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/multipleBigArityFunsImplemented_ir.kt"); } + @Test @TestMetadata("suspendInlineCycle_ir.kt") public void testSuspendInlineCycle_ir() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/suspendInlineCycle_ir.kt"); } + @Nested @TestMetadata("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature") @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class DuplicateJvmSignature extends AbstractDiagnosticsTestWithJvmIrBackend { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); - } - + public class DuplicateJvmSignature extends AbstractDiagnosticsTestWithJvmIrBackend { + @Test public void testAllFilesPresentInDuplicateJvmSignature() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } + @Test @TestMetadata("caseInProperties.kt") public void testCaseInProperties() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/caseInProperties.kt"); } + @Test @TestMetadata("changingNullabilityOfOrdinaryClassIsBinaryCompatibleChange.kt") public void testChangingNullabilityOfOrdinaryClassIsBinaryCompatibleChange() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/changingNullabilityOfOrdinaryClassIsBinaryCompatibleChange.kt"); } + @Test @TestMetadata("vararg.kt") public void testVararg() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/vararg.kt"); } + @Nested @TestMetadata("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/accidentalOverrides") @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class AccidentalOverrides extends AbstractDiagnosticsTestWithJvmIrBackend { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); - } - + public class AccidentalOverrides extends AbstractDiagnosticsTestWithJvmIrBackend { + @Test @TestMetadata("accidentalOverrideFromGrandparent.kt") public void testAccidentalOverrideFromGrandparent() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/accidentalOverrides/accidentalOverrideFromGrandparent.kt"); } + @Test public void testAllFilesPresentInAccidentalOverrides() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/accidentalOverrides"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } + @Test @TestMetadata("classFunctionOverriddenByProperty.kt") public void testClassFunctionOverriddenByProperty() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/accidentalOverrides/classFunctionOverriddenByProperty.kt"); } + @Test @TestMetadata("classFunctionOverriddenByPropertyInConstructor.kt") public void testClassFunctionOverriddenByPropertyInConstructor() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/accidentalOverrides/classFunctionOverriddenByPropertyInConstructor.kt"); } + @Test @TestMetadata("classFunctionOverriddenByPropertyNoGetter.kt") public void testClassFunctionOverriddenByPropertyNoGetter() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/accidentalOverrides/classFunctionOverriddenByPropertyNoGetter.kt"); } + @Test @TestMetadata("classPropertyOverriddenByFunction.kt") public void testClassPropertyOverriddenByFunction() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/accidentalOverrides/classPropertyOverriddenByFunction.kt"); } + @Test @TestMetadata("defaultFunction_ir.kt") public void testDefaultFunction_ir() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/accidentalOverrides/defaultFunction_ir.kt"); } + @Test @TestMetadata("delegatedFunctionOverriddenByProperty_ir.kt") public void testDelegatedFunctionOverriddenByProperty_ir() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/accidentalOverrides/delegatedFunctionOverriddenByProperty_ir.kt"); } + @Test @TestMetadata("genericClassFunction.kt") public void testGenericClassFunction() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/accidentalOverrides/genericClassFunction.kt"); } + @Test @TestMetadata("overridesNothing_ir.kt") public void testOverridesNothing_ir() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/accidentalOverrides/overridesNothing_ir.kt"); } + @Test @TestMetadata("overridesNothing_old.kt") public void testOverridesNothing_old() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/accidentalOverrides/overridesNothing_old.kt"); } + @Test @TestMetadata("privateClassFunctionOverriddenByProperty.kt") public void testPrivateClassFunctionOverriddenByProperty() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/accidentalOverrides/privateClassFunctionOverriddenByProperty.kt"); } + @Test @TestMetadata("traitFunctionOverriddenByPropertyNoImpl.kt") public void testTraitFunctionOverriddenByPropertyNoImpl() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/accidentalOverrides/traitFunctionOverriddenByPropertyNoImpl.kt"); } + @Test @TestMetadata("traitFunctionOverriddenByProperty_ir.kt") public void testTraitFunctionOverriddenByProperty_ir() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/accidentalOverrides/traitFunctionOverriddenByProperty_ir.kt"); } + @Test @TestMetadata("traitPropertyOverriddenByFunctionNoImpl.kt") public void testTraitPropertyOverriddenByFunctionNoImpl() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/accidentalOverrides/traitPropertyOverriddenByFunctionNoImpl.kt"); } + @Test @TestMetadata("traitPropertyOverriddenByFunction_ir.kt") public void testTraitPropertyOverriddenByFunction_ir() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/accidentalOverrides/traitPropertyOverriddenByFunction_ir.kt"); } } + @Nested @TestMetadata("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/bridges") @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class Bridges extends AbstractDiagnosticsTestWithJvmIrBackend { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); - } - + public class Bridges extends AbstractDiagnosticsTestWithJvmIrBackend { + @Test public void testAllFilesPresentInBridges() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/bridges"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } + @Test @TestMetadata("class_ir.kt") public void testClass_ir() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/bridges/class_ir.kt"); } + @Test @TestMetadata("fakeOverrideTrait_ir.kt") public void testFakeOverrideTrait_ir() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/bridges/fakeOverrideTrait_ir.kt"); } + @Test @TestMetadata("trait_ir.kt") public void testTrait_ir() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/bridges/trait_ir.kt"); } } + @Nested @TestMetadata("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/erasure") @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class Erasure extends AbstractDiagnosticsTestWithJvmIrBackend { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); - } - + public class Erasure extends AbstractDiagnosticsTestWithJvmIrBackend { + @Test public void testAllFilesPresentInErasure() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/erasure"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } + @Test @TestMetadata("clashFromInterfaceAndSuperClass_ir.kt") public void testClashFromInterfaceAndSuperClass_ir() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/erasure/clashFromInterfaceAndSuperClass_ir.kt"); } + @Test @TestMetadata("collections.kt") public void testCollections() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/erasure/collections.kt"); } + @Test @TestMetadata("delegateToTwoTraits.kt") public void testDelegateToTwoTraits() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/erasure/delegateToTwoTraits.kt"); } + @Test @TestMetadata("delegationAndOwnMethod.kt") public void testDelegationAndOwnMethod() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/erasure/delegationAndOwnMethod.kt"); } + @Test @TestMetadata("delegationToTraitImplAndOwnMethod.kt") public void testDelegationToTraitImplAndOwnMethod() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/erasure/delegationToTraitImplAndOwnMethod.kt"); } + @Test @TestMetadata("extensionProperties.kt") public void testExtensionProperties() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/erasure/extensionProperties.kt"); } + @Test @TestMetadata("genericType.kt") public void testGenericType() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/erasure/genericType.kt"); } + @Test @TestMetadata("inheritFromTwoTraits_ir.kt") public void testInheritFromTwoTraits_ir() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/erasure/inheritFromTwoTraits_ir.kt"); } + @Test @TestMetadata("kotlinAndJavaCollections.kt") public void testKotlinAndJavaCollections() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/erasure/kotlinAndJavaCollections.kt"); } + @Test @TestMetadata("nullableType.kt") public void testNullableType() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/erasure/nullableType.kt"); } + @Test @TestMetadata("superTraitAndDelegationToTraitImpl_ir.kt") public void testSuperTraitAndDelegationToTraitImpl_ir() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/erasure/superTraitAndDelegationToTraitImpl_ir.kt"); } + @Test @TestMetadata("twoTraitsAndOwnFunction_ir.kt") public void testTwoTraitsAndOwnFunction_ir() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/erasure/twoTraitsAndOwnFunction_ir.kt"); } + @Test @TestMetadata("typeMappedToJava.kt") public void testTypeMappedToJava() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/erasure/typeMappedToJava.kt"); } + @Test @TestMetadata("typeParameter.kt") public void testTypeParameter() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/erasure/typeParameter.kt"); } + @Test @TestMetadata("typeParameterWithBound.kt") public void testTypeParameterWithBound() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/erasure/typeParameterWithBound.kt"); } + @Test @TestMetadata("typeParameterWithTwoBounds.kt") public void testTypeParameterWithTwoBounds() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/erasure/typeParameterWithTwoBounds.kt"); } + @Test @TestMetadata("typeParameterWithTwoBoundsInWhere.kt") public void testTypeParameterWithTwoBoundsInWhere() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/erasure/typeParameterWithTwoBoundsInWhere.kt"); } } + @Nested @TestMetadata("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/finalMembersFromBuiltIns") @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class FinalMembersFromBuiltIns extends AbstractDiagnosticsTestWithJvmIrBackend { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); - } - + public class FinalMembersFromBuiltIns extends AbstractDiagnosticsTestWithJvmIrBackend { + @Test public void testAllFilesPresentInFinalMembersFromBuiltIns() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/finalMembersFromBuiltIns"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } + @Test @TestMetadata("enumMembers.kt") public void testEnumMembers() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/finalMembersFromBuiltIns/enumMembers.kt"); } + @Test @TestMetadata("waitNotifyGetClass_ir.kt") public void testWaitNotifyGetClass_ir() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/finalMembersFromBuiltIns/waitNotifyGetClass_ir.kt"); } } + @Nested @TestMetadata("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/functionAndProperty") @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class FunctionAndProperty extends AbstractDiagnosticsTestWithJvmIrBackend { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); - } - + public class FunctionAndProperty extends AbstractDiagnosticsTestWithJvmIrBackend { + @Test public void testAllFilesPresentInFunctionAndProperty() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/functionAndProperty"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } + @Test @TestMetadata("class.kt") public void testClass() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/functionAndProperty/class.kt"); } + @Test @TestMetadata("classObject.kt") public void testClassObject() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/functionAndProperty/classObject.kt"); } + @Test @TestMetadata("classPropertyInConstructor.kt") public void testClassPropertyInConstructor() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/functionAndProperty/classPropertyInConstructor.kt"); } + @Test @TestMetadata("extensionFunctionAndNormalFunction.kt") public void testExtensionFunctionAndNormalFunction() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/functionAndProperty/extensionFunctionAndNormalFunction.kt"); } + @Test @TestMetadata("extensionPropertyAndFunction.kt") public void testExtensionPropertyAndFunction() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/functionAndProperty/extensionPropertyAndFunction.kt"); } + @Test @TestMetadata("functionAndSetter.kt") public void testFunctionAndSetter() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/functionAndProperty/functionAndSetter.kt"); } + @Test @TestMetadata("functionAndVar.kt") public void testFunctionAndVar() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/functionAndProperty/functionAndVar.kt"); } + @Test @TestMetadata("localClass.kt") public void testLocalClass() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/functionAndProperty/localClass.kt"); } + @Test @TestMetadata("localClassInClass.kt") public void testLocalClassInClass() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/functionAndProperty/localClassInClass.kt"); } + @Test @TestMetadata("nestedClass.kt") public void testNestedClass() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/functionAndProperty/nestedClass.kt"); } + @Test @TestMetadata("object.kt") public void testObject() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/functionAndProperty/object.kt"); } + @Test @TestMetadata("objectExpression.kt") public void testObjectExpression() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/functionAndProperty/objectExpression.kt"); } + @Test @TestMetadata("objectExpressionInConstructor.kt") public void testObjectExpressionInConstructor() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/functionAndProperty/objectExpressionInConstructor.kt"); } + @Test @TestMetadata("privateClassPropertyNoClash.kt") public void testPrivateClassPropertyNoClash() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/functionAndProperty/privateClassPropertyNoClash.kt"); } + @Test @TestMetadata("topLevel.kt") public void testTopLevel() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/functionAndProperty/topLevel.kt"); } + @Test @TestMetadata("topLevelDifferentFiles.kt") public void testTopLevelDifferentFiles() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/functionAndProperty/topLevelDifferentFiles.kt"); } + @Test @TestMetadata("topLevelGetter.kt") public void testTopLevelGetter() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/functionAndProperty/topLevelGetter.kt"); } + @Test @TestMetadata("trait_ir.kt") public void testTrait_ir() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/functionAndProperty/trait_ir.kt"); } } + @Nested @TestMetadata("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/specialNames") @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class SpecialNames extends AbstractDiagnosticsTestWithJvmIrBackend { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); - } - + public class SpecialNames extends AbstractDiagnosticsTestWithJvmIrBackend { + @Test public void testAllFilesPresentInSpecialNames() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/specialNames"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } + @Test @TestMetadata("classObjectCopiedField.kt") public void testClassObjectCopiedField() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/specialNames/classObjectCopiedField.kt"); } + @Test @TestMetadata("classObjectCopiedFieldObject_ir.kt") public void testClassObjectCopiedFieldObject_ir() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/specialNames/classObjectCopiedFieldObject_ir.kt"); } + @Test @TestMetadata("classObject_ir.kt") public void testClassObject_ir() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/specialNames/classObject_ir.kt"); } + @Test @TestMetadata("dataClassCopy.kt") public void testDataClassCopy() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/specialNames/dataClassCopy.kt"); } + @Test @TestMetadata("defaults_ir.kt") public void testDefaults_ir() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/specialNames/defaults_ir.kt"); } + @Test @TestMetadata("delegationBy_ir.kt") public void testDelegationBy_ir() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/specialNames/delegationBy_ir.kt"); } + @Test @TestMetadata("enum.kt") public void testEnum() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/specialNames/enum.kt"); } + @Test @TestMetadata("innerClassField_ir.kt") public void testInnerClassField_ir() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/specialNames/innerClassField_ir.kt"); } + @Test @TestMetadata("instance_ir.kt") public void testInstance_ir() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/specialNames/instance_ir.kt"); } + @Test @TestMetadata("propertyMetadataCache_ir.kt") public void testPropertyMetadataCache_ir() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/specialNames/propertyMetadataCache_ir.kt"); } } + @Nested @TestMetadata("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/statics") @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class Statics extends AbstractDiagnosticsTestWithJvmIrBackend { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); - } - + public class Statics extends AbstractDiagnosticsTestWithJvmIrBackend { + @Test public void testAllFilesPresentInStatics() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/statics"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } + @Test @TestMetadata("jkjk.kt") public void testJkjk() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/statics/jkjk.kt"); } + @Test @TestMetadata("kotlinClassExtendsJavaClass.kt") public void testKotlinClassExtendsJavaClass() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/statics/kotlinClassExtendsJavaClass.kt"); } + @Test @TestMetadata("kotlinClassExtendsJavaClassExtendsJavaClass.kt") public void testKotlinClassExtendsJavaClassExtendsJavaClass() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/statics/kotlinClassExtendsJavaClassExtendsJavaClass.kt"); } + @Test @TestMetadata("kotlinClassImplementsJavaInterface.kt") public void testKotlinClassImplementsJavaInterface() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/statics/kotlinClassImplementsJavaInterface.kt"); } + @Test @TestMetadata("kotlinClassImplementsJavaInterfaceExtendsJavaInteface.kt") public void testKotlinClassImplementsJavaInterfaceExtendsJavaInteface() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/statics/kotlinClassImplementsJavaInterfaceExtendsJavaInteface.kt"); } + @Test @TestMetadata("kotlinMembersVsJavaNonVisibleStatics.kt") public void testKotlinMembersVsJavaNonVisibleStatics() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/statics/kotlinMembersVsJavaNonVisibleStatics.kt"); } } + @Nested @TestMetadata("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/synthesized") @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class Synthesized extends AbstractDiagnosticsTestWithJvmIrBackend { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); - } - + public class Synthesized extends AbstractDiagnosticsTestWithJvmIrBackend { + @Test public void testAllFilesPresentInSynthesized() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/synthesized"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } + @Test @TestMetadata("enumValuesValueOf.kt") public void testEnumValuesValueOf() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/synthesized/enumValuesValueOf.kt"); } } + @Nested @TestMetadata("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/traitImpl") @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class TraitImpl extends AbstractDiagnosticsTestWithJvmIrBackend { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); - } - + public class TraitImpl extends AbstractDiagnosticsTestWithJvmIrBackend { + @Test public void testAllFilesPresentInTraitImpl() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/traitImpl"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } + @Test @TestMetadata("defaultVsNonDefault_ir.kt") public void testDefaultVsNonDefault_ir() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/traitImpl/defaultVsNonDefault_ir.kt"); } + @Test @TestMetadata("kt43611.kt") public void testKt43611() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/traitImpl/kt43611.kt"); } + @Test @TestMetadata("oneTrait_ir.kt") public void testOneTrait_ir() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/traitImpl/oneTrait_ir.kt"); } + @Test @TestMetadata("traitFunctionOverriddenByPropertyInTrait_ir.kt") public void testTraitFunctionOverriddenByPropertyInTrait_ir() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/traitImpl/traitFunctionOverriddenByPropertyInTrait_ir.kt"); } + @Test @TestMetadata("traitPropertyOverriddenByFunctionInTrait_ir.kt") public void testTraitPropertyOverriddenByFunctionInTrait_ir() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/traitImpl/traitPropertyOverriddenByFunctionInTrait_ir.kt"); } + @Test @TestMetadata("twoTraits_ir.kt") public void testTwoTraits_ir() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/traitImpl/twoTraits_ir.kt"); @@ -585,23 +635,22 @@ public class DiagnosticsTestWithJvmIrBackendGenerated extends AbstractDiagnostic } } + @Nested @TestMetadata("compiler/testData/diagnostics/testsWithJvmBackend/valueClasses") @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class ValueClasses extends AbstractDiagnosticsTestWithJvmIrBackend { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); - } - + public class ValueClasses extends AbstractDiagnosticsTestWithJvmIrBackend { + @Test public void testAllFilesPresentInValueClasses() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithJvmBackend/valueClasses"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } + @Test @TestMetadata("cloneable.kt") public void testCloneable() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/valueClasses/cloneable.kt"); } + @Test @TestMetadata("cloneable.fir.kt") public void testCloneable_fir() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/valueClasses/cloneable.fir.kt"); diff --git a/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestWithOldJvmBackendGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticsTestWithOldJvmBackendGenerated.java similarity index 88% rename from compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestWithOldJvmBackendGenerated.java rename to compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticsTestWithOldJvmBackendGenerated.java index cfd13fb6f8f..88ab881fcb9 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/checkers/DiagnosticsTestWithOldJvmBackendGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticsTestWithOldJvmBackendGenerated.java @@ -3,571 +3,619 @@ * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ -package org.jetbrains.kotlin.checkers; +package org.jetbrains.kotlin.test.runners; import com.intellij.testFramework.TestDataPath; -import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; -import org.jetbrains.kotlin.test.KotlinTestUtils; import org.jetbrains.kotlin.test.util.KtTestUtil; import org.jetbrains.kotlin.test.TargetBackend; import org.jetbrains.kotlin.test.TestMetadata; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; import java.io.File; import java.util.regex.Pattern; -/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ +/** This class is generated by {@link GenerateNewCompilerTests.kt}. DO NOT MODIFY MANUALLY */ @SuppressWarnings("all") @TestMetadata("compiler/testData/diagnostics/testsWithJvmBackend") @TestDataPath("$PROJECT_ROOT") -@RunWith(JUnit3RunnerWithInners.class) public class DiagnosticsTestWithOldJvmBackendGenerated extends AbstractDiagnosticsTestWithOldJvmBackend { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_OLD, testDataFilePath); - } - + @Test public void testAllFilesPresentInTestsWithJvmBackend() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithJvmBackend"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_OLD, true); } + @Test @TestMetadata("indirectInlineCycle.kt") public void testIndirectInlineCycle() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/indirectInlineCycle.kt"); } + @Test @TestMetadata("inlineCycle.kt") public void testInlineCycle() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/inlineCycle.kt"); } + @Test @TestMetadata("multipleBigArityFunsImplemented.kt") public void testMultipleBigArityFunsImplemented() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/multipleBigArityFunsImplemented.kt"); } + @Test @TestMetadata("suspendInlineCycle.kt") public void testSuspendInlineCycle() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/suspendInlineCycle.kt"); } + @Nested @TestMetadata("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature") @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class DuplicateJvmSignature extends AbstractDiagnosticsTestWithOldJvmBackend { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_OLD, testDataFilePath); - } - + public class DuplicateJvmSignature extends AbstractDiagnosticsTestWithOldJvmBackend { + @Test public void testAllFilesPresentInDuplicateJvmSignature() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_OLD, true); } + @Test @TestMetadata("caseInProperties.kt") public void testCaseInProperties() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/caseInProperties.kt"); } + @Test @TestMetadata("changingNullabilityOfOrdinaryClassIsBinaryCompatibleChange.kt") public void testChangingNullabilityOfOrdinaryClassIsBinaryCompatibleChange() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/changingNullabilityOfOrdinaryClassIsBinaryCompatibleChange.kt"); } + @Test @TestMetadata("vararg.kt") public void testVararg() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/vararg.kt"); } + @Nested @TestMetadata("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/accidentalOverrides") @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class AccidentalOverrides extends AbstractDiagnosticsTestWithOldJvmBackend { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_OLD, testDataFilePath); - } - + public class AccidentalOverrides extends AbstractDiagnosticsTestWithOldJvmBackend { + @Test @TestMetadata("accidentalOverrideFromGrandparent.kt") public void testAccidentalOverrideFromGrandparent() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/accidentalOverrides/accidentalOverrideFromGrandparent.kt"); } + @Test public void testAllFilesPresentInAccidentalOverrides() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/accidentalOverrides"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_OLD, true); } + @Test @TestMetadata("classFunctionOverriddenByProperty.kt") public void testClassFunctionOverriddenByProperty() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/accidentalOverrides/classFunctionOverriddenByProperty.kt"); } + @Test @TestMetadata("classFunctionOverriddenByPropertyInConstructor.kt") public void testClassFunctionOverriddenByPropertyInConstructor() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/accidentalOverrides/classFunctionOverriddenByPropertyInConstructor.kt"); } + @Test @TestMetadata("classFunctionOverriddenByPropertyNoGetter.kt") public void testClassFunctionOverriddenByPropertyNoGetter() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/accidentalOverrides/classFunctionOverriddenByPropertyNoGetter.kt"); } + @Test @TestMetadata("classPropertyOverriddenByFunction.kt") public void testClassPropertyOverriddenByFunction() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/accidentalOverrides/classPropertyOverriddenByFunction.kt"); } + @Test @TestMetadata("defaultFunction_old.kt") public void testDefaultFunction_old() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/accidentalOverrides/defaultFunction_old.kt"); } + @Test @TestMetadata("delegatedFunctionOverriddenByProperty_old.kt") public void testDelegatedFunctionOverriddenByProperty_old() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/accidentalOverrides/delegatedFunctionOverriddenByProperty_old.kt"); } + @Test @TestMetadata("genericClassFunction.kt") public void testGenericClassFunction() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/accidentalOverrides/genericClassFunction.kt"); } + @Test @TestMetadata("privateClassFunctionOverriddenByProperty.kt") public void testPrivateClassFunctionOverriddenByProperty() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/accidentalOverrides/privateClassFunctionOverriddenByProperty.kt"); } + @Test @TestMetadata("traitFunctionOverriddenByPropertyNoImpl.kt") public void testTraitFunctionOverriddenByPropertyNoImpl() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/accidentalOverrides/traitFunctionOverriddenByPropertyNoImpl.kt"); } + @Test @TestMetadata("traitFunctionOverriddenByProperty_old.kt") public void testTraitFunctionOverriddenByProperty_old() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/accidentalOverrides/traitFunctionOverriddenByProperty_old.kt"); } + @Test @TestMetadata("traitPropertyOverriddenByFunctionNoImpl.kt") public void testTraitPropertyOverriddenByFunctionNoImpl() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/accidentalOverrides/traitPropertyOverriddenByFunctionNoImpl.kt"); } + @Test @TestMetadata("traitPropertyOverriddenByFunction_old.kt") public void testTraitPropertyOverriddenByFunction_old() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/accidentalOverrides/traitPropertyOverriddenByFunction_old.kt"); } } + @Nested @TestMetadata("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/bridges") @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class Bridges extends AbstractDiagnosticsTestWithOldJvmBackend { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_OLD, testDataFilePath); - } - + public class Bridges extends AbstractDiagnosticsTestWithOldJvmBackend { + @Test public void testAllFilesPresentInBridges() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/bridges"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_OLD, true); } + @Test @TestMetadata("class_old.kt") public void testClass_old() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/bridges/class_old.kt"); } + @Test @TestMetadata("fakeOverrideTrait_old.kt") public void testFakeOverrideTrait_old() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/bridges/fakeOverrideTrait_old.kt"); } + @Test @TestMetadata("trait_old.kt") public void testTrait_old() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/bridges/trait_old.kt"); } } + @Nested @TestMetadata("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/erasure") @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class Erasure extends AbstractDiagnosticsTestWithOldJvmBackend { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_OLD, testDataFilePath); - } - + public class Erasure extends AbstractDiagnosticsTestWithOldJvmBackend { + @Test public void testAllFilesPresentInErasure() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/erasure"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_OLD, true); } + @Test @TestMetadata("clashFromInterfaceAndSuperClass_old.kt") public void testClashFromInterfaceAndSuperClass_old() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/erasure/clashFromInterfaceAndSuperClass_old.kt"); } + @Test @TestMetadata("collections.kt") public void testCollections() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/erasure/collections.kt"); } + @Test @TestMetadata("delegateToTwoTraits.kt") public void testDelegateToTwoTraits() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/erasure/delegateToTwoTraits.kt"); } + @Test @TestMetadata("delegationAndOwnMethod.kt") public void testDelegationAndOwnMethod() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/erasure/delegationAndOwnMethod.kt"); } + @Test @TestMetadata("delegationToTraitImplAndOwnMethod.kt") public void testDelegationToTraitImplAndOwnMethod() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/erasure/delegationToTraitImplAndOwnMethod.kt"); } + @Test @TestMetadata("extensionProperties.kt") public void testExtensionProperties() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/erasure/extensionProperties.kt"); } + @Test @TestMetadata("genericType.kt") public void testGenericType() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/erasure/genericType.kt"); } + @Test @TestMetadata("inheritFromTwoTraits_old.kt") public void testInheritFromTwoTraits_old() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/erasure/inheritFromTwoTraits_old.kt"); } + @Test @TestMetadata("kotlinAndJavaCollections.kt") public void testKotlinAndJavaCollections() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/erasure/kotlinAndJavaCollections.kt"); } + @Test @TestMetadata("nullableType.kt") public void testNullableType() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/erasure/nullableType.kt"); } + @Test @TestMetadata("superTraitAndDelegationToTraitImpl_old.kt") public void testSuperTraitAndDelegationToTraitImpl_old() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/erasure/superTraitAndDelegationToTraitImpl_old.kt"); } + @Test @TestMetadata("twoTraitsAndOwnFunction_old.kt") public void testTwoTraitsAndOwnFunction_old() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/erasure/twoTraitsAndOwnFunction_old.kt"); } + @Test @TestMetadata("typeMappedToJava.kt") public void testTypeMappedToJava() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/erasure/typeMappedToJava.kt"); } + @Test @TestMetadata("typeParameter.kt") public void testTypeParameter() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/erasure/typeParameter.kt"); } + @Test @TestMetadata("typeParameterWithBound.kt") public void testTypeParameterWithBound() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/erasure/typeParameterWithBound.kt"); } + @Test @TestMetadata("typeParameterWithTwoBounds.kt") public void testTypeParameterWithTwoBounds() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/erasure/typeParameterWithTwoBounds.kt"); } + @Test @TestMetadata("typeParameterWithTwoBoundsInWhere.kt") public void testTypeParameterWithTwoBoundsInWhere() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/erasure/typeParameterWithTwoBoundsInWhere.kt"); } } + @Nested @TestMetadata("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/finalMembersFromBuiltIns") @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class FinalMembersFromBuiltIns extends AbstractDiagnosticsTestWithOldJvmBackend { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_OLD, testDataFilePath); - } - + public class FinalMembersFromBuiltIns extends AbstractDiagnosticsTestWithOldJvmBackend { + @Test public void testAllFilesPresentInFinalMembersFromBuiltIns() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/finalMembersFromBuiltIns"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_OLD, true); } + @Test @TestMetadata("enumMembers.kt") public void testEnumMembers() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/finalMembersFromBuiltIns/enumMembers.kt"); } + @Test @TestMetadata("waitNotifyGetClass_old.kt") public void testWaitNotifyGetClass_old() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/finalMembersFromBuiltIns/waitNotifyGetClass_old.kt"); } } + @Nested @TestMetadata("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/functionAndProperty") @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class FunctionAndProperty extends AbstractDiagnosticsTestWithOldJvmBackend { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_OLD, testDataFilePath); - } - + public class FunctionAndProperty extends AbstractDiagnosticsTestWithOldJvmBackend { + @Test public void testAllFilesPresentInFunctionAndProperty() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/functionAndProperty"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_OLD, true); } + @Test @TestMetadata("class.kt") public void testClass() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/functionAndProperty/class.kt"); } + @Test @TestMetadata("classObject.kt") public void testClassObject() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/functionAndProperty/classObject.kt"); } + @Test @TestMetadata("classPropertyInConstructor.kt") public void testClassPropertyInConstructor() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/functionAndProperty/classPropertyInConstructor.kt"); } + @Test @TestMetadata("extensionFunctionAndNormalFunction.kt") public void testExtensionFunctionAndNormalFunction() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/functionAndProperty/extensionFunctionAndNormalFunction.kt"); } + @Test @TestMetadata("extensionPropertyAndFunction.kt") public void testExtensionPropertyAndFunction() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/functionAndProperty/extensionPropertyAndFunction.kt"); } + @Test @TestMetadata("functionAndSetter.kt") public void testFunctionAndSetter() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/functionAndProperty/functionAndSetter.kt"); } + @Test @TestMetadata("functionAndVar.kt") public void testFunctionAndVar() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/functionAndProperty/functionAndVar.kt"); } + @Test @TestMetadata("localClass.kt") public void testLocalClass() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/functionAndProperty/localClass.kt"); } + @Test @TestMetadata("localClassInClass.kt") public void testLocalClassInClass() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/functionAndProperty/localClassInClass.kt"); } + @Test @TestMetadata("nestedClass.kt") public void testNestedClass() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/functionAndProperty/nestedClass.kt"); } + @Test @TestMetadata("object.kt") public void testObject() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/functionAndProperty/object.kt"); } + @Test @TestMetadata("objectExpression.kt") public void testObjectExpression() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/functionAndProperty/objectExpression.kt"); } + @Test @TestMetadata("objectExpressionInConstructor.kt") public void testObjectExpressionInConstructor() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/functionAndProperty/objectExpressionInConstructor.kt"); } + @Test @TestMetadata("privateClassPropertyNoClash.kt") public void testPrivateClassPropertyNoClash() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/functionAndProperty/privateClassPropertyNoClash.kt"); } + @Test @TestMetadata("topLevel.kt") public void testTopLevel() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/functionAndProperty/topLevel.kt"); } + @Test @TestMetadata("topLevelDifferentFiles.kt") public void testTopLevelDifferentFiles() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/functionAndProperty/topLevelDifferentFiles.kt"); } + @Test @TestMetadata("topLevelGetter.kt") public void testTopLevelGetter() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/functionAndProperty/topLevelGetter.kt"); } + @Test @TestMetadata("trait_old.kt") public void testTrait_old() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/functionAndProperty/trait_old.kt"); } } + @Nested @TestMetadata("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/specialNames") @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class SpecialNames extends AbstractDiagnosticsTestWithOldJvmBackend { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_OLD, testDataFilePath); - } - + public class SpecialNames extends AbstractDiagnosticsTestWithOldJvmBackend { + @Test public void testAllFilesPresentInSpecialNames() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/specialNames"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_OLD, true); } + @Test @TestMetadata("classObjectCopiedField.kt") public void testClassObjectCopiedField() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/specialNames/classObjectCopiedField.kt"); } + @Test @TestMetadata("classObjectCopiedFieldObject_old.kt") public void testClassObjectCopiedFieldObject_old() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/specialNames/classObjectCopiedFieldObject_old.kt"); } + @Test @TestMetadata("classObject_old.kt") public void testClassObject_old() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/specialNames/classObject_old.kt"); } + @Test @TestMetadata("dataClassCopy.kt") public void testDataClassCopy() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/specialNames/dataClassCopy.kt"); } + @Test @TestMetadata("defaults_old.kt") public void testDefaults_old() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/specialNames/defaults_old.kt"); } + @Test @TestMetadata("delegationBy_old.kt") public void testDelegationBy_old() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/specialNames/delegationBy_old.kt"); } + @Test @TestMetadata("enum.kt") public void testEnum() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/specialNames/enum.kt"); } + @Test @TestMetadata("innerClassField_old.kt") public void testInnerClassField_old() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/specialNames/innerClassField_old.kt"); } + @Test @TestMetadata("instance_old.kt") public void testInstance_old() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/specialNames/instance_old.kt"); } + @Test @TestMetadata("propertyMetadataCache_old.kt") public void testPropertyMetadataCache_old() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/specialNames/propertyMetadataCache_old.kt"); } } + @Nested @TestMetadata("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/statics") @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class Statics extends AbstractDiagnosticsTestWithOldJvmBackend { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_OLD, testDataFilePath); - } - + public class Statics extends AbstractDiagnosticsTestWithOldJvmBackend { + @Test public void testAllFilesPresentInStatics() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/statics"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_OLD, true); } + @Test @TestMetadata("jkjk.kt") public void testJkjk() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/statics/jkjk.kt"); } + @Test @TestMetadata("kotlinClassExtendsJavaClass.kt") public void testKotlinClassExtendsJavaClass() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/statics/kotlinClassExtendsJavaClass.kt"); } + @Test @TestMetadata("kotlinClassExtendsJavaClassExtendsJavaClass.kt") public void testKotlinClassExtendsJavaClassExtendsJavaClass() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/statics/kotlinClassExtendsJavaClassExtendsJavaClass.kt"); } + @Test @TestMetadata("kotlinClassImplementsJavaInterface.kt") public void testKotlinClassImplementsJavaInterface() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/statics/kotlinClassImplementsJavaInterface.kt"); } + @Test @TestMetadata("kotlinClassImplementsJavaInterfaceExtendsJavaInteface.kt") public void testKotlinClassImplementsJavaInterfaceExtendsJavaInteface() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/statics/kotlinClassImplementsJavaInterfaceExtendsJavaInteface.kt"); } + @Test @TestMetadata("kotlinMembersVsJavaNonVisibleStatics.kt") public void testKotlinMembersVsJavaNonVisibleStatics() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/statics/kotlinMembersVsJavaNonVisibleStatics.kt"); } } + @Nested @TestMetadata("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/synthesized") @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class Synthesized extends AbstractDiagnosticsTestWithOldJvmBackend { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_OLD, testDataFilePath); - } - + public class Synthesized extends AbstractDiagnosticsTestWithOldJvmBackend { + @Test public void testAllFilesPresentInSynthesized() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/synthesized"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_OLD, true); } + @Test @TestMetadata("enumValuesValueOf.kt") public void testEnumValuesValueOf() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/synthesized/enumValuesValueOf.kt"); } } + @Nested @TestMetadata("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/traitImpl") @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class TraitImpl extends AbstractDiagnosticsTestWithOldJvmBackend { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_OLD, testDataFilePath); - } - + public class TraitImpl extends AbstractDiagnosticsTestWithOldJvmBackend { + @Test public void testAllFilesPresentInTraitImpl() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/traitImpl"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_OLD, true); } + @Test @TestMetadata("defaultVsNonDefault_old.kt") public void testDefaultVsNonDefault_old() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/traitImpl/defaultVsNonDefault_old.kt"); } + @Test @TestMetadata("kt43611.kt") public void testKt43611() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/traitImpl/kt43611.kt"); } + @Test @TestMetadata("oneTrait_old.kt") public void testOneTrait_old() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/traitImpl/oneTrait_old.kt"); } + @Test @TestMetadata("traitFunctionOverriddenByPropertyInTrait_old.kt") public void testTraitFunctionOverriddenByPropertyInTrait_old() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/traitImpl/traitFunctionOverriddenByPropertyInTrait_old.kt"); } + @Test @TestMetadata("traitPropertyOverriddenByFunctionInTrait_old.kt") public void testTraitPropertyOverriddenByFunctionInTrait_old() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/traitImpl/traitPropertyOverriddenByFunctionInTrait_old.kt"); } + @Test @TestMetadata("twoTraits_old.kt") public void testTwoTraits_old() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/duplicateJvmSignature/traitImpl/twoTraits_old.kt"); @@ -575,23 +623,22 @@ public class DiagnosticsTestWithOldJvmBackendGenerated extends AbstractDiagnosti } } + @Nested @TestMetadata("compiler/testData/diagnostics/testsWithJvmBackend/valueClasses") @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class ValueClasses extends AbstractDiagnosticsTestWithOldJvmBackend { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_OLD, testDataFilePath); - } - + public class ValueClasses extends AbstractDiagnosticsTestWithOldJvmBackend { + @Test public void testAllFilesPresentInValueClasses() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithJvmBackend/valueClasses"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_OLD, true); } + @Test @TestMetadata("cloneable.kt") public void testCloneable() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/valueClasses/cloneable.kt"); } + @Test @TestMetadata("cloneable.fir.kt") public void testCloneable_fir() throws Exception { runTest("compiler/testData/diagnostics/testsWithJvmBackend/valueClasses/cloneable.fir.kt"); diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/backend/handlers/JvmBackendDiagnosticsHandler.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/backend/handlers/JvmBackendDiagnosticsHandler.kt new file mode 100644 index 00000000000..c9969ecc23f --- /dev/null +++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/backend/handlers/JvmBackendDiagnosticsHandler.kt @@ -0,0 +1,35 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.test.backend.handlers + +import org.jetbrains.kotlin.psi.KtFile +import org.jetbrains.kotlin.test.frontend.classic.handlers.ClassicDiagnosticReporter +import org.jetbrains.kotlin.test.frontend.classic.handlers.withNewInferenceModeEnabled +import org.jetbrains.kotlin.test.model.BinaryArtifacts +import org.jetbrains.kotlin.test.model.FrontendKinds +import org.jetbrains.kotlin.test.model.TestModule +import org.jetbrains.kotlin.test.services.TestServices +import org.jetbrains.kotlin.test.services.dependencyProvider + +class JvmBackendDiagnosticsHandler(testServices: TestServices) : JvmBinaryArtifactHandler(testServices) { + private val reporter = ClassicDiagnosticReporter(testServices) + + override fun processModule(module: TestModule, info: BinaryArtifacts.Jvm) { + val testFileToKtFileMap = testServices.dependencyProvider.getArtifact(module, FrontendKinds.ClassicFrontend).ktFiles + val ktFileToTestFileMap = testFileToKtFileMap.entries.map { it.value to it.key }.toMap() + val generationState = info.classFileFactory.generationState + val diagnostics = generationState.collectedExtraJvmDiagnostics.all() + val configuration = reporter.createConfiguration(module) + val withNewInferenceModeEnabled = testServices.withNewInferenceModeEnabled() + for (diagnostic in diagnostics) { + val ktFile = diagnostic.psiFile as? KtFile ?: continue + val testFile = ktFileToTestFileMap[ktFile] ?: continue + reporter.reportDiagnostic(diagnostic, module, testFile, configuration, withNewInferenceModeEnabled) + } + } + + override fun processAfterAllModules(someAssertionWasFailed: Boolean) {} +} diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/directives/DiagnosticsDirectives.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/directives/DiagnosticsDirectives.kt index 983511bbde4..52f043cdd35 100644 --- a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/directives/DiagnosticsDirectives.kt +++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/directives/DiagnosticsDirectives.kt @@ -5,6 +5,7 @@ package org.jetbrains.kotlin.test.directives +import org.jetbrains.kotlin.test.backend.handlers.JvmBackendDiagnosticsHandler import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives.USE_JAVAC import org.jetbrains.kotlin.test.directives.model.SimpleDirectivesContainer @@ -46,4 +47,12 @@ object DiagnosticsDirectives : SimpleDirectivesContainer() { Render debug info about dynamic calls """.trimIndent() ) + + val REPORT_JVM_DIAGNOSTICS_ON_FRONTEND by directive( + description = """ + Collect additional jvm specific diagnostics on frontend + Note that this directive is not needed if ${JvmBackendDiagnosticsHandler::class} + is enabled in test + """.trimIndent() + ) } diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/frontend/classic/handlers/ClassicDiagnosticReporter.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/frontend/classic/handlers/ClassicDiagnosticReporter.kt new file mode 100644 index 00000000000..6a67ae63292 --- /dev/null +++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/frontend/classic/handlers/ClassicDiagnosticReporter.kt @@ -0,0 +1,150 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.test.frontend.classic.handlers + +import org.jetbrains.kotlin.checkers.utils.DiagnosticsRenderingConfiguration +import org.jetbrains.kotlin.codeMetaInfo.model.CodeMetaInfo +import org.jetbrains.kotlin.codeMetaInfo.model.DiagnosticCodeMetaInfo +import org.jetbrains.kotlin.codeMetaInfo.model.ParsedCodeMetaInfo +import org.jetbrains.kotlin.config.JVMConfigurationKeys +import org.jetbrains.kotlin.config.LanguageFeature +import org.jetbrains.kotlin.diagnostics.Diagnostic +import org.jetbrains.kotlin.platform.isCommon +import org.jetbrains.kotlin.platform.js.isJs +import org.jetbrains.kotlin.platform.jvm.isJvm +import org.jetbrains.kotlin.platform.konan.isNative +import org.jetbrains.kotlin.test.directives.DiagnosticsDirectives +import org.jetbrains.kotlin.test.model.TestFile +import org.jetbrains.kotlin.test.model.TestModule +import org.jetbrains.kotlin.test.services.* + +class ClassicDiagnosticReporter(private val testServices: TestServices) { + private val globalMetadataInfoHandler: GlobalMetadataInfoHandler + get() = testServices.globalMetadataInfoHandler + + fun createConfiguration(module: TestModule): DiagnosticsRenderingConfiguration { + return DiagnosticsRenderingConfiguration( + platform = null, + withNewInference = module.languageVersionSettings.supportsFeature(LanguageFeature.NewInference), + languageVersionSettings = module.languageVersionSettings, + skipDebugInfoDiagnostics = testServices.compilerConfigurationProvider.getCompilerConfiguration(module) + .getBoolean(JVMConfigurationKeys.IR) + ) + } + + fun reportDiagnostic( + diagnostic: Diagnostic, + module: TestModule, + file: TestFile, + configuration: DiagnosticsRenderingConfiguration, + withNewInferenceModeEnabled: Boolean + ) { + globalMetadataInfoHandler.addMetadataInfosForFile( + file, + diagnostic.toMetaInfo( + module, + file, + configuration.withNewInference, + withNewInferenceModeEnabled + ) + ) + } + + private fun Diagnostic.toMetaInfo( + module: TestModule, + file: TestFile, + newInferenceEnabled: Boolean, + withNewInferenceModeEnabled: Boolean + ): List = textRanges.map { range -> + val metaInfo = DiagnosticCodeMetaInfo(range, ClassicMetaInfoUtils.renderDiagnosticNoArgs, this) + if (withNewInferenceModeEnabled) { + metaInfo.attributes += if (newInferenceEnabled) OldNewInferenceMetaInfoProcessor.NI else OldNewInferenceMetaInfoProcessor.OI + } + if (file !in module.files) { + val targetPlatform = module.targetPlatform + metaInfo.attributes += when { + targetPlatform.isJvm() -> "JVM" + targetPlatform.isJs() -> "JS" + targetPlatform.isNative() -> "NATIVE" + targetPlatform.isCommon() -> "COMMON" + else -> error("Should not be here") + } + } + val existing = globalMetadataInfoHandler.getExistingMetaInfosForActualMetadata(file, metaInfo) + if (existing.any { it.description != null }) { + metaInfo.replaceRenderConfiguration(ClassicMetaInfoUtils.renderDiagnosticWithArgs) + } + metaInfo + } +} + +class OldNewInferenceMetaInfoProcessor(testServices: TestServices) : AdditionalMetaInfoProcessor(testServices) { + companion object { + const val OI = "OI" + const val NI = "NI" + } + + override fun processMetaInfos(module: TestModule, file: TestFile) { + /* + * Rules for OI/NI attribute: + * ┌──────────┬──────┬──────┬──────────┐ + * │ │ OI │ NI │ nothing │ <- reported + * ├──────────┼──────┼──────┼──────────┤ + * │ nothing │ both │ both │ nothing │ + * │ OI │ OI │ both │ OI │ + * │ NI │ both │ NI │ NI │ + * │ both │ both │ both │ opposite │ <- OI if NI enabled in test and vice versa + * └──────────┴──────┴──────┴──────────┘ + * ^ existed + */ + if (!testServices.withNewInferenceModeEnabled()) return + val newInferenceEnabled = module.languageVersionSettings.supportsFeature(LanguageFeature.NewInference) + val (currentFlag, otherFlag) = when (newInferenceEnabled) { + true -> NI to OI + false -> OI to NI + } + val matchedExistedInfos = mutableSetOf() + val matchedReportedInfos = mutableSetOf() + val allReportedInfos = globalMetadataInfoHandler.getReportedMetaInfosForFile(file) + for ((_, reportedInfos) in allReportedInfos.groupBy { Triple(it.start, it.end, it.tag) }) { + val existedInfos = globalMetadataInfoHandler.getExistingMetaInfosForActualMetadata(file, reportedInfos.first()) + for ((reportedInfo, existedInfo) in reportedInfos.zip(existedInfos)) { + matchedExistedInfos += existedInfo + matchedReportedInfos += reportedInfo + if (currentFlag !in reportedInfo.attributes) continue + if (currentFlag in existedInfo.attributes) continue + reportedInfo.attributes.remove(currentFlag) + } + } + + if (allReportedInfos.size != matchedReportedInfos.size) { + for (info in allReportedInfos) { + if (info !in matchedReportedInfos) { + info.attributes.remove(currentFlag) + } + } + } + + val allExistedInfos = globalMetadataInfoHandler.getExistingMetaInfosForFile(file) + if (allExistedInfos.size == matchedExistedInfos.size) return + + val newInfos = allExistedInfos.mapNotNull { + if (it in matchedExistedInfos) return@mapNotNull null + if (currentFlag in it.attributes) return@mapNotNull null + it.copy().apply { + if (otherFlag !in attributes) { + attributes += otherFlag + } + } + } + globalMetadataInfoHandler.addMetadataInfosForFile(file, newInfos) + } +} + + +fun TestServices.withNewInferenceModeEnabled(): Boolean { + return DiagnosticsDirectives.WITH_NEW_INFERENCE in moduleStructure.allDirectives +} diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/frontend/classic/handlers/ClassicDiagnosticsHandler.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/frontend/classic/handlers/ClassicDiagnosticsHandler.kt index de29d974388..6d9bd3d063b 100644 --- a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/frontend/classic/handlers/ClassicDiagnosticsHandler.kt +++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/frontend/classic/handlers/ClassicDiagnosticsHandler.kt @@ -11,18 +11,10 @@ import org.jetbrains.kotlin.asJava.getJvmSignatureDiagnostics import org.jetbrains.kotlin.checkers.diagnostics.SyntaxErrorDiagnostic import org.jetbrains.kotlin.checkers.utils.CheckerTestUtil import org.jetbrains.kotlin.checkers.utils.DiagnosticsRenderingConfiguration -import org.jetbrains.kotlin.codeMetaInfo.model.CodeMetaInfo -import org.jetbrains.kotlin.codeMetaInfo.model.DiagnosticCodeMetaInfo -import org.jetbrains.kotlin.codeMetaInfo.model.ParsedCodeMetaInfo -import org.jetbrains.kotlin.config.JVMConfigurationKeys -import org.jetbrains.kotlin.config.LanguageFeature import org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl import org.jetbrains.kotlin.diagnostics.Diagnostic import org.jetbrains.kotlin.diagnostics.Errors -import org.jetbrains.kotlin.platform.isCommon -import org.jetbrains.kotlin.platform.js.isJs import org.jetbrains.kotlin.platform.jvm.isJvm -import org.jetbrains.kotlin.platform.konan.isNative import org.jetbrains.kotlin.psi.KtDeclaration import org.jetbrains.kotlin.psi.KtFile import org.jetbrains.kotlin.resolve.AnalyzingUtils @@ -30,6 +22,7 @@ import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowValueFactoryImpl import org.jetbrains.kotlin.test.directives.AdditionalFilesDirectives import org.jetbrains.kotlin.test.directives.DiagnosticsDirectives import org.jetbrains.kotlin.test.directives.DiagnosticsDirectives.MARK_DYNAMIC_CALLS +import org.jetbrains.kotlin.test.directives.DiagnosticsDirectives.REPORT_JVM_DIAGNOSTICS_ON_FRONTEND import org.jetbrains.kotlin.test.directives.LanguageSettingsDirectives import org.jetbrains.kotlin.test.directives.model.DirectivesContainer import org.jetbrains.kotlin.test.frontend.classic.ClassicFrontendOutputArtifact @@ -51,6 +44,8 @@ class ClassicDiagnosticsHandler(testServices: TestServices) : ClassicFrontendAna private val diagnosticsService: DiagnosticsService get() = testServices.diagnosticsService + private val reporter = ClassicDiagnosticReporter(testServices) + @OptIn(ExperimentalStdlibApi::class) override fun processModule(module: TestModule, info: ClassicFrontendOutputArtifact) { var allDiagnostics = info.analysisResult.bindingContext.diagnostics + computeJvmSignatureDiagnostics(info) @@ -62,42 +57,18 @@ class ClassicDiagnosticsHandler(testServices: TestServices) : ClassicFrontendAna } val diagnosticsPerFile = allDiagnostics.groupBy { it.psiFile } - val withNewInferenceModeEnabled = testServices.withNewInferenceModeEnabled() - - val configuration = DiagnosticsRenderingConfiguration( - platform = null, - withNewInference = info.languageVersionSettings.supportsFeature(LanguageFeature.NewInference), - languageVersionSettings = info.languageVersionSettings, - skipDebugInfoDiagnostics = testServices.compilerConfigurationProvider.getCompilerConfiguration(module) - .getBoolean(JVMConfigurationKeys.IR) - ) + val configuration = reporter.createConfiguration(module) for ((file, ktFile) in info.ktFiles) { val diagnostics = diagnosticsPerFile[ktFile] ?: emptyList() for (diagnostic in diagnostics) { if (!diagnostic.isValid) continue if (!diagnosticsService.shouldRenderDiagnostic(module, diagnostic.factory.name)) continue - globalMetadataInfoHandler.addMetadataInfosForFile( - file, - diagnostic.toMetaInfo( - module, - file, - configuration.withNewInference, - withNewInferenceModeEnabled - ) - ) + reporter.reportDiagnostic(diagnostic, module, file, configuration, withNewInferenceModeEnabled) } for (errorElement in AnalyzingUtils.getSyntaxErrorRanges(ktFile)) { - globalMetadataInfoHandler.addMetadataInfosForFile( - file, - SyntaxErrorDiagnostic(errorElement).toMetaInfo( - module, - file, - configuration.withNewInference, - withNewInferenceModeEnabled - ) - ) + reporter.reportDiagnostic(SyntaxErrorDiagnostic(errorElement), module, file, configuration, withNewInferenceModeEnabled) } processDebugInfoDiagnostics(configuration, module, file, ktFile, info, withNewInferenceModeEnabled) } @@ -105,6 +76,7 @@ class ClassicDiagnosticsHandler(testServices: TestServices) : ClassicFrontendAna private fun computeJvmSignatureDiagnostics(info: ClassicFrontendOutputArtifact): Set { if (testServices.moduleStructure.modules.any { !it.targetPlatform.isJvm() }) return emptySet() + if (REPORT_JVM_DIAGNOSTICS_ON_FRONTEND !in testServices.moduleStructure.allDirectives) return emptySet() val bindingContext = info.analysisResult.bindingContext val project = info.project val jvmSignatureDiagnostics = HashSet() @@ -122,32 +94,6 @@ class ClassicDiagnosticsHandler(testServices: TestServices) : ClassicFrontendAna return jvmSignatureDiagnostics } - private fun Diagnostic.toMetaInfo( - module: TestModule, - file: TestFile, - newInferenceEnabled: Boolean, - withNewInferenceModeEnabled: Boolean - ): List = textRanges.map { range -> - val metaInfo = DiagnosticCodeMetaInfo(range, ClassicMetaInfoUtils.renderDiagnosticNoArgs, this) - if (withNewInferenceModeEnabled) { - metaInfo.attributes += if (newInferenceEnabled) OldNewInferenceMetaInfoProcessor.NI else OldNewInferenceMetaInfoProcessor.OI - } - if (file !in module.files) { - val targetPlatform = module.targetPlatform - metaInfo.attributes += when { - targetPlatform.isJvm() -> "JVM" - targetPlatform.isJs() -> "JS" - targetPlatform.isNative() -> "NATIVE" - targetPlatform.isCommon() -> "COMMON" - else -> error("Should not be here") - } - } - val existing = globalMetadataInfoHandler.getExistingMetaInfosForActualMetadata(file, metaInfo) - if (existing.any { it.description != null }) { - metaInfo.replaceRenderConfiguration(ClassicMetaInfoUtils.renderDiagnosticWithArgs) - } - metaInfo - } private fun processDebugInfoDiagnostics( configuration: DiagnosticsRenderingConfiguration, @@ -175,79 +121,9 @@ class ClassicDiagnosticsHandler(testServices: TestServices) : ClassicFrontendAna ) debugAnnotations.mapNotNull { debugAnnotation -> if (!diagnosticsService.shouldRenderDiagnostic(module, debugAnnotation.diagnostic.factory.name)) return@mapNotNull null - globalMetadataInfoHandler.addMetadataInfosForFile( - file, - debugAnnotation.diagnostic.toMetaInfo(module, file, configuration.withNewInference, withNewInferenceModeEnabled) - ) + reporter.reportDiagnostic(debugAnnotation.diagnostic, module, file, configuration, withNewInferenceModeEnabled) } } override fun processAfterAllModules(someAssertionWasFailed: Boolean) {} } - -class OldNewInferenceMetaInfoProcessor(testServices: TestServices) : AdditionalMetaInfoProcessor(testServices) { - companion object { - const val OI = "OI" - const val NI = "NI" - } - - override fun processMetaInfos(module: TestModule, file: TestFile) { - /* - * Rules for OI/NI attribute: - * ┌──────────┬──────┬──────┬──────────┐ - * │ │ OI │ NI │ nothing │ <- reported - * ├──────────┼──────┼──────┼──────────┤ - * │ nothing │ both │ both │ nothing │ - * │ OI │ OI │ both │ OI │ - * │ NI │ both │ NI │ NI │ - * │ both │ both │ both │ opposite │ <- OI if NI enabled in test and vice versa - * └──────────┴──────┴──────┴──────────┘ - * ^ existed - */ - if (!testServices.withNewInferenceModeEnabled()) return - val newInferenceEnabled = module.languageVersionSettings.supportsFeature(LanguageFeature.NewInference) - val (currentFlag, otherFlag) = when (newInferenceEnabled) { - true -> NI to OI - false -> OI to NI - } - val matchedExistedInfos = mutableSetOf() - val matchedReportedInfos = mutableSetOf() - val allReportedInfos = globalMetadataInfoHandler.getReportedMetaInfosForFile(file) - for ((_, reportedInfos) in allReportedInfos.groupBy { Triple(it.start, it.end, it.tag) }) { - val existedInfos = globalMetadataInfoHandler.getExistingMetaInfosForActualMetadata(file, reportedInfos.first()) - for ((reportedInfo, existedInfo) in reportedInfos.zip(existedInfos)) { - matchedExistedInfos += existedInfo - matchedReportedInfos += reportedInfo - if (currentFlag !in reportedInfo.attributes) continue - if (currentFlag in existedInfo.attributes) continue - reportedInfo.attributes.remove(currentFlag) - } - } - - if (allReportedInfos.size != matchedReportedInfos.size) { - for (info in allReportedInfos) { - if (info !in matchedReportedInfos) { - info.attributes.remove(currentFlag) - } - } - } - - val allExistedInfos = globalMetadataInfoHandler.getExistingMetaInfosForFile(file) - if (allExistedInfos.size == matchedExistedInfos.size) return - - val newInfos = allExistedInfos.mapNotNull { - if (it in matchedExistedInfos) return@mapNotNull null - if (currentFlag in it.attributes) return@mapNotNull null - it.copy().apply { - if (otherFlag !in attributes) { - attributes += otherFlag - } - } - } - globalMetadataInfoHandler.addMetadataInfosForFile(file, newInfos) - } -} - -private fun TestServices.withNewInferenceModeEnabled(): Boolean { - return DiagnosticsDirectives.WITH_NEW_INFERENCE in moduleStructure.allDirectives -} diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/generators/GenerateNewCompilerTests.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/generators/GenerateNewCompilerTests.kt index 6b2106958a1..eb9a06cde4c 100644 --- a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/generators/GenerateNewCompilerTests.kt +++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/generators/GenerateNewCompilerTests.kt @@ -6,6 +6,7 @@ package org.jetbrains.kotlin.test.generators import org.jetbrains.kotlin.generators.util.TestGeneratorUtil +import org.jetbrains.kotlin.test.TargetBackend import org.jetbrains.kotlin.test.runners.* fun main(args: Array) { @@ -30,6 +31,14 @@ fun main(args: Array) { testClass { model("diagnostics/testsWithJsStdLib") } + + testClass { + model("diagnostics/testsWithJvmBackend", targetBackend = TargetBackend.JVM_OLD) + } + + testClass { + model("diagnostics/testsWithJvmBackend", targetBackend = TargetBackend.JVM_IR) + } } testGroup("compiler/tests-common-new/tests-gen", "compiler/fir/analysis-tests/testData") { diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/AbstractDiagnosticTest.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/AbstractDiagnosticTest.kt index 983f75cd296..e3db8408a71 100644 --- a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/AbstractDiagnosticTest.kt +++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/AbstractDiagnosticTest.kt @@ -8,6 +8,8 @@ package org.jetbrains.kotlin.test.runners import org.jetbrains.kotlin.config.ExplicitApiMode import org.jetbrains.kotlin.platform.jvm.JvmPlatforms import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder +import org.jetbrains.kotlin.test.directives.DiagnosticsDirectives +import org.jetbrains.kotlin.test.directives.DiagnosticsDirectives.REPORT_JVM_DIAGNOSTICS_ON_FRONTEND import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives.USE_PSI_CLASS_FILES_READING import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives.WITH_STDLIB import org.jetbrains.kotlin.test.directives.LanguageSettingsDirectives.EXPLICIT_API_MODE @@ -36,6 +38,7 @@ abstract class AbstractDiagnosticTest : AbstractKotlinCompilerTest() { defaultDirectives { +USE_PSI_CLASS_FILES_READING + +REPORT_JVM_DIAGNOSTICS_ON_FRONTEND } enableMetaInfoHandler() diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/AbstractDiagnosticsTestWithJvmBackend.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/AbstractDiagnosticsTestWithJvmBackend.kt new file mode 100644 index 00000000000..bc2c416e36e --- /dev/null +++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/AbstractDiagnosticsTestWithJvmBackend.kt @@ -0,0 +1,84 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.test.runners + +import org.jetbrains.kotlin.platform.jvm.JvmPlatforms +import org.jetbrains.kotlin.test.backend.classic.ClassicJvmBackendFacade +import org.jetbrains.kotlin.test.backend.handlers.JvmBackendDiagnosticsHandler +import org.jetbrains.kotlin.test.backend.ir.JvmIrBackendFacade +import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder +import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives +import org.jetbrains.kotlin.test.frontend.classic.ClassicFrontend2ClassicBackendConverter +import org.jetbrains.kotlin.test.frontend.classic.ClassicFrontend2IrConverter +import org.jetbrains.kotlin.test.frontend.classic.ClassicFrontendFacade +import org.jetbrains.kotlin.test.frontend.classic.handlers.ClassicDiagnosticsHandler +import org.jetbrains.kotlin.test.frontend.classic.handlers.DeclarationsDumpHandler +import org.jetbrains.kotlin.test.frontend.classic.handlers.OldNewInferenceMetaInfoProcessor +import org.jetbrains.kotlin.test.model.BackendKind +import org.jetbrains.kotlin.test.model.BackendKinds +import org.jetbrains.kotlin.test.model.DependencyKind +import org.jetbrains.kotlin.test.model.FrontendKinds +import org.jetbrains.kotlin.test.services.AdditionalDiagnosticsSourceFilesProvider +import org.jetbrains.kotlin.test.services.CoroutineHelpersSourceFilesProvider +import org.jetbrains.kotlin.test.services.configuration.JvmEnvironmentConfigurator + +abstract class AbstractDiagnosticsTestWithJvmBackend : AbstractKotlinCompilerTest() { + abstract val targetBackendKind: BackendKind<*> + + override fun TestConfigurationBuilder.configuration() { + globalDefaults { + frontend = FrontendKinds.ClassicFrontend + backend = targetBackendKind + targetPlatform = JvmPlatforms.defaultJvmPlatform + dependencyKind = DependencyKind.Binary + } + + defaultDirectives { + +JvmEnvironmentConfigurationDirectives.USE_PSI_CLASS_FILES_READING + } + + enableMetaInfoHandler() + + useConfigurators(::JvmEnvironmentConfigurator) + + useMetaInfoProcessors(::OldNewInferenceMetaInfoProcessor) + useAdditionalSourceProviders( + ::AdditionalDiagnosticsSourceFilesProvider, + ::CoroutineHelpersSourceFilesProvider, + ) + + useFrontendFacades(::ClassicFrontendFacade) + + useFrontendHandlers( + ::DeclarationsDumpHandler, + ::ClassicDiagnosticsHandler, + ) + + useFrontend2BackendConverters( + ::ClassicFrontend2ClassicBackendConverter, + ::ClassicFrontend2IrConverter + ) + + useBackendFacades( + ::ClassicJvmBackendFacade, + ::JvmIrBackendFacade + ) + + useArtifactsHandlers( + ::JvmBackendDiagnosticsHandler + ) + } +} + +abstract class AbstractDiagnosticsTestWithOldJvmBackend : AbstractDiagnosticsTestWithJvmBackend() { + override val targetBackendKind: BackendKind<*> + get() = BackendKinds.ClassicBackend +} + +abstract class AbstractDiagnosticsTestWithJvmIrBackend : AbstractDiagnosticsTestWithJvmBackend() { + override val targetBackendKind: BackendKind<*> + get() = BackendKinds.IrBackend +} diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/AbstractDiagnosticsTestWithJvmBackend.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/AbstractDiagnosticsTestWithJvmBackend.kt deleted file mode 100644 index 6c569a66476..00000000000 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/AbstractDiagnosticsTestWithJvmBackend.kt +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.checkers - -import org.jetbrains.kotlin.analyzer.AnalysisResult -import org.jetbrains.kotlin.codegen.ClassBuilderFactories -import org.jetbrains.kotlin.codegen.GenerationUtils -import org.jetbrains.kotlin.config.CompilerConfiguration -import org.jetbrains.kotlin.config.JVMConfigurationKeys -import org.jetbrains.kotlin.config.JvmTarget -import org.jetbrains.kotlin.config.LanguageVersionSettings -import org.jetbrains.kotlin.context.ModuleContext -import org.jetbrains.kotlin.psi.KtFile -import org.jetbrains.kotlin.resolve.BindingTrace - -abstract class AbstractDiagnosticsTestWithJvmBackend : AbstractDiagnosticsTest() { - - override fun analyzeModuleContents( - moduleContext: ModuleContext, - files: List, - moduleTrace: BindingTrace, - languageVersionSettings: LanguageVersionSettings, - separateModules: Boolean, - jvmTarget: JvmTarget - ): AnalysisResult { - val analysisResult = - super.analyzeModuleContents( - moduleContext, files, moduleTrace, languageVersionSettings, separateModules, jvmTarget - ) - - val generationState = - GenerationUtils.generateFiles(project, files, environment.configuration, ClassBuilderFactories.TEST, analysisResult) - - for (diagnostic in generationState.collectedExtraJvmDiagnostics.all()) { - moduleTrace.report(diagnostic) - } - return analysisResult - } - - // DO NOT use FE-based diagnostics for JVM signature conflict - override fun shouldSkipJvmSignatureDiagnostics(groupedByModule: Map>): Boolean = true -} - -abstract class AbstractDiagnosticsTestWithOldJvmBackend : AbstractDiagnosticsTestWithJvmBackend() - -abstract class AbstractDiagnosticsTestWithJvmIrBackend : AbstractDiagnosticsTestWithJvmBackend() { - override fun updateConfiguration(configuration: CompilerConfiguration) { - configuration.put(JVMConfigurationKeys.IR, true) - } -} diff --git a/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt b/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt index 3e5577872e0..2cb24bacb7f 100644 --- a/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt +++ b/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt @@ -79,14 +79,6 @@ fun main(args: Array) { model("diagnostics/testsWithJava15") } - testClass { - model("diagnostics/testsWithJvmBackend", targetBackend = TargetBackend.JVM_OLD) - } - - testClass { - model("diagnostics/testsWithJvmBackend", targetBackend = TargetBackend.JVM_IR) - } - testClass { model("multiplatform", extension = null, recursive = true, excludeParentDirs = true) }