diff --git a/compiler/fir/analysis-tests/build.gradle.kts b/compiler/fir/analysis-tests/build.gradle.kts index a234ffec9ea..e090cf7a08a 100644 --- a/compiler/fir/analysis-tests/build.gradle.kts +++ b/compiler/fir/analysis-tests/build.gradle.kts @@ -62,37 +62,19 @@ if (kotlinBuildProperties.isInJpsBuildIdeaSync) { } } -fun Test.configureTest(configureJUnit: JUnitPlatformOptions.() -> Unit = {}) { - dependsOn(":dist") - workingDir = rootDir - useJUnitPlatform { - configureJUnit() - } - useJsIrBoxTests(version = version, buildDir = layout.buildDirectory) -} - - projectTest( - jUnitMode = JUnitMode.JUnit5, - defineJDKEnvVariables = listOf(JdkMajorVersion.JDK_1_8, JdkMajorVersion.JDK_11_0, JdkMajorVersion.JDK_17_0) -) { - configureTest { - excludeTags("Jdk21Test") - } -} - -// Separate configuration is only necessary while JDK 21 is not released, so cannot be obtained via toolchain. -// See KT-58765 for tracking -projectTest( - "jdk21Tests", jUnitMode = JUnitMode.JUnit5, defineJDKEnvVariables = listOf( + JdkMajorVersion.JDK_1_8, + JdkMajorVersion.JDK_11_0, + JdkMajorVersion.JDK_17_0, JdkMajorVersion.JDK_21_0 ) ) { - configureTest { - includeTags("Jdk21Test") - } + dependsOn(":dist") + workingDir = rootDir + useJUnitPlatform() + useJsIrBoxTests(version = version, buildDir = layout.buildDirectory) } testsJar() diff --git a/compiler/tests-common-new/build.gradle.kts b/compiler/tests-common-new/build.gradle.kts index 8c9697d27d7..74a5321a4c0 100644 --- a/compiler/tests-common-new/build.gradle.kts +++ b/compiler/tests-common-new/build.gradle.kts @@ -54,37 +54,15 @@ sourceSets { } } -fun Test.configureTest(configureJUnit: JUnitPlatformOptions.() -> Unit = {}) { - dependsOn(":dist") - workingDir = rootDir - useJUnitPlatform { - configureJUnit() - } -} - projectTest( jUnitMode = JUnitMode.JUnit5, defineJDKEnvVariables = listOf( JdkMajorVersion.JDK_11_0 // e.g. org.jetbrains.kotlin.test.runners.ForeignAnnotationsCompiledJavaTestGenerated.Java11Tests ) ) { - configureTest { - excludeTags("Jdk21Test") - } -} - -// Separate configuration is only necessary while JDK 21 is not released, so cannot be obtained via toolchain. -// See KT-58765 for tracking -projectTest( - "jdk21Tests", - jUnitMode = JUnitMode.JUnit5, - defineJDKEnvVariables = listOf( - JdkMajorVersion.JDK_21_0 - ) -) { - configureTest { - includeTags("Jdk21Test") - } + dependsOn(":dist") + workingDir = rootDir + useJUnitPlatform() } testsJar() 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 599f1a2bf4b..a7143516e57 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 @@ -122,6 +122,14 @@ abstract class AbstractDiagnosticTest : AbstractKotlinCompilerTest() { } } + forTestsMatching("compiler/testData/diagnostics/tests/testsWithJava21/*") { + defaultDirectives { + JDK_KIND with TestJdkKind.FULL_JDK_21 + +WITH_STDLIB + +WITH_REFLECT + } + } + forTestsMatching("compiler/testData/diagnostics/tests/multiplatform/*") { defaultDirectives { LANGUAGE with "+MultiPlatformProjects" diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/AbstractFirDiagnosticTest.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/AbstractFirDiagnosticTest.kt index 5b3ed5e426b..e2bad1cd7d5 100644 --- a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/AbstractFirDiagnosticTest.kt +++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/AbstractFirDiagnosticTest.kt @@ -51,26 +51,6 @@ abstract class AbstractFirDiagnosticTestBase(val parser: FirParser) : AbstractKo } } -@Jdk21Test -abstract class AbstractFirPsiJdk21DiagnosticTest : AbstractFirDiagnosticTestBase(FirParser.Psi) { - override fun configure(builder: TestConfigurationBuilder) { - super.configure(builder) - builder.defaultDirectives { - JDK_KIND with TestJdkKind.FULL_JDK_21 - } - } -} - -@Jdk21Test -abstract class AbstractFirLightTreeJdk21DiagnosticTest : AbstractFirDiagnosticTestBase(FirParser.LightTree) { - override fun configure(builder: TestConfigurationBuilder) { - super.configure(builder) - builder.defaultDirectives { - JDK_KIND with TestJdkKind.FULL_JDK_21 - } - } -} - abstract class AbstractFirPsiDiagnosticTest : AbstractFirDiagnosticTestBase(FirParser.Psi) abstract class AbstractFirLightTreeDiagnosticsTest : AbstractFirDiagnosticTestBase(FirParser.LightTree) { override fun configure(builder: TestConfigurationBuilder) { @@ -218,6 +198,14 @@ fun TestConfigurationBuilder.baseFirDiagnosticTestConfiguration( } } + forTestsMatching("compiler/testData/diagnostics/tests/testsWithJava21/*") { + defaultDirectives { + JDK_KIND with TestJdkKind.FULL_JDK_21 + +WITH_STDLIB + +WITH_REFLECT + } + } + forTestsMatching("compiler/fir/analysis-tests/testData/resolveWithStdlib/properties/backingField/*") { defaultDirectives { LANGUAGE + "+ExplicitBackingFields" diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/AbstractJdk21DiagnosticTest.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/AbstractJdk21DiagnosticTest.kt deleted file mode 100644 index cc8b436a49c..00000000000 --- a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/AbstractJdk21DiagnosticTest.kt +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2010-2023 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.test.TestJdkKind -import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder -import org.jetbrains.kotlin.test.directives.ConfigurationDirectives -import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives - -@Jdk21Test -abstract class AbstractJdk21DiagnosticTest : AbstractDiagnosticTest() { - override fun configure(builder: TestConfigurationBuilder) { - super.configure(builder) - builder.defaultDirectives { - JvmEnvironmentConfigurationDirectives.JDK_KIND with TestJdkKind.FULL_JDK_21 - +ConfigurationDirectives.WITH_STDLIB - +JvmEnvironmentConfigurationDirectives.WITH_REFLECT - } - } -} \ No newline at end of file diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/Jdk21Test.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/Jdk21Test.kt deleted file mode 100644 index 2b1432cd94c..00000000000 --- a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/Jdk21Test.kt +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright 2010-2023 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.junit.jupiter.api.Tag - -/** - * This tag is only necessary while JDK 21 is not released, so cannot be obtained via toolchain. - * See KT-58765 for tracking - */ -@Tag("Jdk21Test") -annotation class Jdk21Test diff --git a/compiler/tests-for-compiler-generator/tests/org/jetbrains/kotlin/test/generators/GenerateJUnit5CompilerTests.kt b/compiler/tests-for-compiler-generator/tests/org/jetbrains/kotlin/test/generators/GenerateJUnit5CompilerTests.kt index 6f87e6115d5..8e83651186e 100644 --- a/compiler/tests-for-compiler-generator/tests/org/jetbrains/kotlin/test/generators/GenerateJUnit5CompilerTests.kt +++ b/compiler/tests-for-compiler-generator/tests/org/jetbrains/kotlin/test/generators/GenerateJUnit5CompilerTests.kt @@ -26,10 +26,6 @@ fun generateJUnit5CompilerTests(args: Array, mainClassName: String?) { model("diagnostics/testsWithStdLib", excludedPattern = excludedCustomTestdataPattern) } - testClass { - model("diagnostics/testsWithJdk21", excludedPattern = excludedCustomTestdataPattern) - } - testClass { model("diagnostics/tests/javac", pattern = "^(.*)\\.kts?$", excludedPattern = excludedCustomTestdataPattern) } @@ -218,14 +214,6 @@ fun generateJUnit5CompilerTests(args: Array, mainClassName: String?) { model("diagnostics/testsWithStdLib", excludedPattern = excludedCustomTestdataPattern) } - testClass { - model("diagnostics/testsWithJdk21", excludedPattern = excludedCustomTestdataPattern) - } - - testClass { - model("diagnostics/testsWithJdk21", excludedPattern = excludedCustomTestdataPattern) - } - testClass(suiteTestClassName = "FirOldFrontendMPPDiagnosticsWithPsiTestGenerated") { model("diagnostics/tests/multiplatform", pattern = "^(.*)\\.kts?$", excludedPattern = excludedCustomTestdataPattern) }