diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java index 05f58ea2e99..fe8bafd973c 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java @@ -41679,6 +41679,86 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT } } + @Nested + @TestMetadata("compiler/testData/codegen/box/testsWithJava15") + @TestDataPath("$PROJECT_ROOT") + public class TestsWithJava15 { + @Test + public void testAllFilesPresentInTestsWithJava15() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/testsWithJava15"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @Nested + @TestMetadata("compiler/testData/codegen/box/testsWithJava15/records") + @TestDataPath("$PROJECT_ROOT") + public class Records { + @Test + public void testAllFilesPresentInRecords() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/testsWithJava15/records"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @Test + @TestMetadata("bytecodeShapeForJava.kt") + public void testBytecodeShapeForJava() throws Exception { + runTest("compiler/testData/codegen/box/testsWithJava15/records/bytecodeShapeForJava.kt"); + } + + @Test + @TestMetadata("collectionSizeOverrides.kt") + public void testCollectionSizeOverrides() throws Exception { + runTest("compiler/testData/codegen/box/testsWithJava15/records/collectionSizeOverrides.kt"); + } + + @Test + @TestMetadata("dataJvmRecord.kt") + public void testDataJvmRecord() throws Exception { + runTest("compiler/testData/codegen/box/testsWithJava15/records/dataJvmRecord.kt"); + } + + @Test + @TestMetadata("jvmRecordBinary.kt") + public void testJvmRecordBinary() throws Exception { + runTest("compiler/testData/codegen/box/testsWithJava15/records/jvmRecordBinary.kt"); + } + + @Test + @TestMetadata("propertiesOverrides.kt") + public void testPropertiesOverrides() throws Exception { + runTest("compiler/testData/codegen/box/testsWithJava15/records/propertiesOverrides.kt"); + } + + @Test + @TestMetadata("propertiesOverridesAllCompatibilityJvmDefault.kt") + public void testPropertiesOverridesAllCompatibilityJvmDefault() throws Exception { + runTest("compiler/testData/codegen/box/testsWithJava15/records/propertiesOverridesAllCompatibilityJvmDefault.kt"); + } + + @Test + @TestMetadata("propertiesOverridesEnableJvmDefault.kt") + public void testPropertiesOverridesEnableJvmDefault() throws Exception { + runTest("compiler/testData/codegen/box/testsWithJava15/records/propertiesOverridesEnableJvmDefault.kt"); + } + + @Test + @TestMetadata("recordDifferentPropertyOverride.kt") + public void testRecordDifferentPropertyOverride() throws Exception { + runTest("compiler/testData/codegen/box/testsWithJava15/records/recordDifferentPropertyOverride.kt"); + } + + @Test + @TestMetadata("recordDifferentSyntheticProperty.kt") + public void testRecordDifferentSyntheticProperty() throws Exception { + runTest("compiler/testData/codegen/box/testsWithJava15/records/recordDifferentSyntheticProperty.kt"); + } + + @Test + @TestMetadata("recordPropertyAccess.kt") + public void testRecordPropertyAccess() throws Exception { + runTest("compiler/testData/codegen/box/testsWithJava15/records/recordPropertyAccess.kt"); + } + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/testsWithJava9") @TestDataPath("$PROJECT_ROOT") diff --git a/compiler/testData/codegen/java15/box/records/bytecodeShapeForJava.kt b/compiler/testData/codegen/box/testsWithJava15/records/bytecodeShapeForJava.kt similarity index 100% rename from compiler/testData/codegen/java15/box/records/bytecodeShapeForJava.kt rename to compiler/testData/codegen/box/testsWithJava15/records/bytecodeShapeForJava.kt diff --git a/compiler/testData/codegen/java15/box/records/collectionSizeOverrides.kt b/compiler/testData/codegen/box/testsWithJava15/records/collectionSizeOverrides.kt similarity index 100% rename from compiler/testData/codegen/java15/box/records/collectionSizeOverrides.kt rename to compiler/testData/codegen/box/testsWithJava15/records/collectionSizeOverrides.kt diff --git a/compiler/testData/codegen/java15/box/records/dataJvmRecord.kt b/compiler/testData/codegen/box/testsWithJava15/records/dataJvmRecord.kt similarity index 100% rename from compiler/testData/codegen/java15/box/records/dataJvmRecord.kt rename to compiler/testData/codegen/box/testsWithJava15/records/dataJvmRecord.kt diff --git a/compiler/testData/compileKotlinAgainstKotlinJdk15/jvmRecordBinary.kt b/compiler/testData/codegen/box/testsWithJava15/records/jvmRecordBinary.kt similarity index 65% rename from compiler/testData/compileKotlinAgainstKotlinJdk15/jvmRecordBinary.kt rename to compiler/testData/codegen/box/testsWithJava15/records/jvmRecordBinary.kt index 59f7770f952..2a6571f1fd6 100644 --- a/compiler/testData/compileKotlinAgainstKotlinJdk15/jvmRecordBinary.kt +++ b/compiler/testData/codegen/box/testsWithJava15/records/jvmRecordBinary.kt @@ -2,16 +2,16 @@ // !LANGUAGE: +JvmRecordSupport // JVM_TARGET: 15 // ENABLE_JVM_PREVIEW + +// MODULE: lib // FILE: A.kt @JvmRecord data class MyRecord(val foo: String, val bar: String) +// MODULE: main(lib) // FILE: B.kt -fun main() { +fun box(): String { val myRecord = MyRecord("O", "K") - val s = myRecord.foo + myRecord.bar - if (s != "OK") { - throw AssertionError("fail: $s") - } + return myRecord.foo + myRecord.bar } diff --git a/compiler/testData/codegen/java15/box/records/propertiesOverrides.kt b/compiler/testData/codegen/box/testsWithJava15/records/propertiesOverrides.kt similarity index 100% rename from compiler/testData/codegen/java15/box/records/propertiesOverrides.kt rename to compiler/testData/codegen/box/testsWithJava15/records/propertiesOverrides.kt diff --git a/compiler/testData/codegen/java15/box/records/propertiesOverridesAllCompatibilityJvmDefault.kt b/compiler/testData/codegen/box/testsWithJava15/records/propertiesOverridesAllCompatibilityJvmDefault.kt similarity index 100% rename from compiler/testData/codegen/java15/box/records/propertiesOverridesAllCompatibilityJvmDefault.kt rename to compiler/testData/codegen/box/testsWithJava15/records/propertiesOverridesAllCompatibilityJvmDefault.kt diff --git a/compiler/testData/codegen/java15/box/records/propertiesOverridesEnableJvmDefault.kt b/compiler/testData/codegen/box/testsWithJava15/records/propertiesOverridesEnableJvmDefault.kt similarity index 100% rename from compiler/testData/codegen/java15/box/records/propertiesOverridesEnableJvmDefault.kt rename to compiler/testData/codegen/box/testsWithJava15/records/propertiesOverridesEnableJvmDefault.kt diff --git a/compiler/testData/codegen/java15/box/records/recordDifferentPropertyOverride.kt b/compiler/testData/codegen/box/testsWithJava15/records/recordDifferentPropertyOverride.kt similarity index 100% rename from compiler/testData/codegen/java15/box/records/recordDifferentPropertyOverride.kt rename to compiler/testData/codegen/box/testsWithJava15/records/recordDifferentPropertyOverride.kt diff --git a/compiler/testData/codegen/java15/box/records/recordDifferentSyntheticProperty.kt b/compiler/testData/codegen/box/testsWithJava15/records/recordDifferentSyntheticProperty.kt similarity index 100% rename from compiler/testData/codegen/java15/box/records/recordDifferentSyntheticProperty.kt rename to compiler/testData/codegen/box/testsWithJava15/records/recordDifferentSyntheticProperty.kt diff --git a/compiler/testData/codegen/java15/box/records/recordPropertyAccess.kt b/compiler/testData/codegen/box/testsWithJava15/records/recordPropertyAccess.kt similarity index 100% rename from compiler/testData/codegen/java15/box/records/recordPropertyAccess.kt rename to compiler/testData/codegen/box/testsWithJava15/records/recordPropertyAccess.kt diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java index 0c27b5b1140..f757261ae98 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java @@ -41523,6 +41523,86 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { } } + @Nested + @TestMetadata("compiler/testData/codegen/box/testsWithJava15") + @TestDataPath("$PROJECT_ROOT") + public class TestsWithJava15 { + @Test + public void testAllFilesPresentInTestsWithJava15() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/testsWithJava15"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + + @Nested + @TestMetadata("compiler/testData/codegen/box/testsWithJava15/records") + @TestDataPath("$PROJECT_ROOT") + public class Records { + @Test + public void testAllFilesPresentInRecords() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/testsWithJava15/records"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + + @Test + @TestMetadata("bytecodeShapeForJava.kt") + public void testBytecodeShapeForJava() throws Exception { + runTest("compiler/testData/codegen/box/testsWithJava15/records/bytecodeShapeForJava.kt"); + } + + @Test + @TestMetadata("collectionSizeOverrides.kt") + public void testCollectionSizeOverrides() throws Exception { + runTest("compiler/testData/codegen/box/testsWithJava15/records/collectionSizeOverrides.kt"); + } + + @Test + @TestMetadata("dataJvmRecord.kt") + public void testDataJvmRecord() throws Exception { + runTest("compiler/testData/codegen/box/testsWithJava15/records/dataJvmRecord.kt"); + } + + @Test + @TestMetadata("jvmRecordBinary.kt") + public void testJvmRecordBinary() throws Exception { + runTest("compiler/testData/codegen/box/testsWithJava15/records/jvmRecordBinary.kt"); + } + + @Test + @TestMetadata("propertiesOverrides.kt") + public void testPropertiesOverrides() throws Exception { + runTest("compiler/testData/codegen/box/testsWithJava15/records/propertiesOverrides.kt"); + } + + @Test + @TestMetadata("propertiesOverridesAllCompatibilityJvmDefault.kt") + public void testPropertiesOverridesAllCompatibilityJvmDefault() throws Exception { + runTest("compiler/testData/codegen/box/testsWithJava15/records/propertiesOverridesAllCompatibilityJvmDefault.kt"); + } + + @Test + @TestMetadata("propertiesOverridesEnableJvmDefault.kt") + public void testPropertiesOverridesEnableJvmDefault() throws Exception { + runTest("compiler/testData/codegen/box/testsWithJava15/records/propertiesOverridesEnableJvmDefault.kt"); + } + + @Test + @TestMetadata("recordDifferentPropertyOverride.kt") + public void testRecordDifferentPropertyOverride() throws Exception { + runTest("compiler/testData/codegen/box/testsWithJava15/records/recordDifferentPropertyOverride.kt"); + } + + @Test + @TestMetadata("recordDifferentSyntheticProperty.kt") + public void testRecordDifferentSyntheticProperty() throws Exception { + runTest("compiler/testData/codegen/box/testsWithJava15/records/recordDifferentSyntheticProperty.kt"); + } + + @Test + @TestMetadata("recordPropertyAccess.kt") + public void testRecordPropertyAccess() throws Exception { + runTest("compiler/testData/codegen/box/testsWithJava15/records/recordPropertyAccess.kt"); + } + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/testsWithJava9") @TestDataPath("$PROJECT_ROOT") diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java index 47bbb482274..b58ed6a7fd9 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java @@ -41679,6 +41679,86 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes } } + @Nested + @TestMetadata("compiler/testData/codegen/box/testsWithJava15") + @TestDataPath("$PROJECT_ROOT") + public class TestsWithJava15 { + @Test + public void testAllFilesPresentInTestsWithJava15() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/testsWithJava15"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @Nested + @TestMetadata("compiler/testData/codegen/box/testsWithJava15/records") + @TestDataPath("$PROJECT_ROOT") + public class Records { + @Test + public void testAllFilesPresentInRecords() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/testsWithJava15/records"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @Test + @TestMetadata("bytecodeShapeForJava.kt") + public void testBytecodeShapeForJava() throws Exception { + runTest("compiler/testData/codegen/box/testsWithJava15/records/bytecodeShapeForJava.kt"); + } + + @Test + @TestMetadata("collectionSizeOverrides.kt") + public void testCollectionSizeOverrides() throws Exception { + runTest("compiler/testData/codegen/box/testsWithJava15/records/collectionSizeOverrides.kt"); + } + + @Test + @TestMetadata("dataJvmRecord.kt") + public void testDataJvmRecord() throws Exception { + runTest("compiler/testData/codegen/box/testsWithJava15/records/dataJvmRecord.kt"); + } + + @Test + @TestMetadata("jvmRecordBinary.kt") + public void testJvmRecordBinary() throws Exception { + runTest("compiler/testData/codegen/box/testsWithJava15/records/jvmRecordBinary.kt"); + } + + @Test + @TestMetadata("propertiesOverrides.kt") + public void testPropertiesOverrides() throws Exception { + runTest("compiler/testData/codegen/box/testsWithJava15/records/propertiesOverrides.kt"); + } + + @Test + @TestMetadata("propertiesOverridesAllCompatibilityJvmDefault.kt") + public void testPropertiesOverridesAllCompatibilityJvmDefault() throws Exception { + runTest("compiler/testData/codegen/box/testsWithJava15/records/propertiesOverridesAllCompatibilityJvmDefault.kt"); + } + + @Test + @TestMetadata("propertiesOverridesEnableJvmDefault.kt") + public void testPropertiesOverridesEnableJvmDefault() throws Exception { + runTest("compiler/testData/codegen/box/testsWithJava15/records/propertiesOverridesEnableJvmDefault.kt"); + } + + @Test + @TestMetadata("recordDifferentPropertyOverride.kt") + public void testRecordDifferentPropertyOverride() throws Exception { + runTest("compiler/testData/codegen/box/testsWithJava15/records/recordDifferentPropertyOverride.kt"); + } + + @Test + @TestMetadata("recordDifferentSyntheticProperty.kt") + public void testRecordDifferentSyntheticProperty() throws Exception { + runTest("compiler/testData/codegen/box/testsWithJava15/records/recordDifferentSyntheticProperty.kt"); + } + + @Test + @TestMetadata("recordPropertyAccess.kt") + public void testRecordPropertyAccess() throws Exception { + runTest("compiler/testData/codegen/box/testsWithJava15/records/recordPropertyAccess.kt"); + } + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/testsWithJava9") @TestDataPath("$PROJECT_ROOT") diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/backend/classic/JavaCompilerFacade.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/backend/classic/JavaCompilerFacade.kt index a36a987209c..7ca9021661e 100644 --- a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/backend/classic/JavaCompilerFacade.kt +++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/backend/classic/JavaCompilerFacade.kt @@ -68,7 +68,7 @@ class JavaCompilerFacade(private val testServices: TestServices) { } private fun compileJavaFiles(module: TestModule, jvmTarget: JvmTarget, files: List, javacOptions: List, ignoreErrors: Boolean) { - val targetIsJava8OrLower = System.getProperty("java.version").startsWith("1.") + val targetIsJava8OrLower = System.getProperty("java.version").startsWith("1.") && jvmTarget <= JvmTarget.JVM_1_6 if (USE_JAVAC_BASED_ON_JVM_TARGET !in module.directives || targetIsJava8OrLower) { org.jetbrains.kotlin.test.compileJavaFiles( files, diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/backend/handlers/JvmBoxRunner.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/backend/handlers/JvmBoxRunner.kt index d9cf2074817..59d968b9400 100644 --- a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/backend/handlers/JvmBoxRunner.kt +++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/backend/handlers/JvmBoxRunner.kt @@ -15,6 +15,7 @@ import org.jetbrains.kotlin.test.TestJdkKind import org.jetbrains.kotlin.test.clientserver.TestProxy import org.jetbrains.kotlin.test.directives.CodegenTestDirectives import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives.JDK_KIND +import org.jetbrains.kotlin.test.directives.LanguageSettingsDirectives.ENABLE_JVM_PREVIEW import org.jetbrains.kotlin.test.directives.model.singleOrZeroValue import org.jetbrains.kotlin.test.model.BinaryArtifacts import org.jetbrains.kotlin.test.model.DependencyKind @@ -199,14 +200,15 @@ class JvmBoxRunner(testServices: TestServices) : JvmBinaryArtifactHandler(testSe "${mainFile.nameWithoutExtension}Kt" ).joinToString(".") - val command = arrayOf( + val command = listOfNotNull( javaExe.absolutePath, "-ea", + runIf(ENABLE_JVM_PREVIEW in module.directives) { "--enable-preview" }, "-classpath", classPath.joinToString(File.pathSeparator, transform = { File(it.toURI()).absolutePath }), mainFqName, ) - val process = ProcessBuilder(*command).inheritIO().start() + val process = ProcessBuilder(command).inheritIO().start() process.waitFor(1, TimeUnit.MINUTES) process.outputStream.flush() return when (process.exitValue()) { diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/codegen/AbstractJvmBlackBoxCodegenTestBase.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/codegen/AbstractJvmBlackBoxCodegenTestBase.kt index cb2a9028aa6..79d1912aa32 100644 --- a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/codegen/AbstractJvmBlackBoxCodegenTestBase.kt +++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/codegen/AbstractJvmBlackBoxCodegenTestBase.kt @@ -13,6 +13,9 @@ import org.jetbrains.kotlin.test.backend.handlers.BytecodeListingHandler import org.jetbrains.kotlin.test.backend.handlers.BytecodeTextHandler import org.jetbrains.kotlin.test.bind import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder +import org.jetbrains.kotlin.test.directives.CodegenTestDirectives +import org.jetbrains.kotlin.test.directives.CodegenTestDirectives.IGNORE_DEXING +import org.jetbrains.kotlin.test.directives.CodegenTestDirectives.USE_JAVAC_BASED_ON_JVM_TARGET import org.jetbrains.kotlin.test.directives.DiagnosticsDirectives.DIAGNOSTICS import org.jetbrains.kotlin.test.directives.DiagnosticsDirectives.REPORT_ONLY_EXPLICITLY_DEFINED_DEBUG_INFO import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives.JDK_KIND @@ -53,12 +56,22 @@ abstract class AbstractJvmBlackBoxCodegenTestBase): TestJdkKind { - return TestJdkKind.FULL_JDK_15 - } -} diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractCustomJDKBlackBoxCodegenTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractCustomJDKBlackBoxCodegenTest.kt index 19b8888db66..9ddb3a74610 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractCustomJDKBlackBoxCodegenTest.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractCustomJDKBlackBoxCodegenTest.kt @@ -15,61 +15,6 @@ import org.jetbrains.kotlin.test.util.KtTestUtil import java.io.File import java.util.concurrent.TimeUnit -@OptIn(ObsoleteTestInfrastructure::class) -abstract class AbstractCustomJDKBlackBoxCodegenTest : AbstractBlackBoxCodegenTest() { - @Throws(Exception::class) - override fun doTest(filePath: String) { - val file = File(filePath) - val expectedText = - KtTestUtil.doLoadFile(file) + - "\n" + - """ - fun main() { - val res = box() - if (res != "OK") throw AssertionError(res) - } - """.trimIndent() - val testFiles = createTestFilesFromFile(file, expectedText) - doMultiFileTest(file, testFiles) - } - - override fun extractConfigurationKind(files: List): ConfigurationKind { - return ConfigurationKind.NO_KOTLIN_REFLECT - } - - override fun runJavacTask(files: MutableCollection, options: List) { - assert(KotlinTestUtils.compileJavaFilesExternally(files, options, getJdkHome())) { - "Javac failed: $options on $files" - } - } - - override fun getTestJdkKind(files: List): TestJdkKind { - return getTestJdkKind() - } - - abstract fun getTestJdkKind(): TestJdkKind - abstract fun getJdkHome(): File - - open fun getAdditionalJvmArgs(): List = emptyList() - - abstract override fun getPrefix(): String - - override fun blackBox(reportProblems: Boolean, unexpectedBehaviour: Boolean) { - val tmpdir = KotlinTestUtils.tmpDirForTest(this) - val fileFactory = generateClassesInFile() - fileFactory.writeAll(tmpdir, null) - - runJvmInstance( - getJdkHome(), getAdditionalJvmArgs(), - classPath = listOfNotNull( - tmpdir, ForTestCompileRuntime.runtimeJarForTests(), - javaClassesOutputDirectory - ), - classNameToRun = getFacadeFqName(myFiles.psiFile)!! - ) - } -} - @OptIn(ObsoleteTestInfrastructure::class) internal fun runJvmInstance( jdkHome: File, diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractIrCompileKotlinAgainstKotlinJdk15Test.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractIrCompileKotlinAgainstKotlinJdk15Test.kt deleted file mode 100644 index f7c555620b6..00000000000 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractIrCompileKotlinAgainstKotlinJdk15Test.kt +++ /dev/null @@ -1,18 +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.codegen - -import org.jetbrains.kotlin.test.TargetBackend - -abstract class AbstractIrCompileKotlinAgainstKotlinJdk15Test : AbstractCompileKotlinAgainstKotlinJdk15Test() { - override fun getBackendA(): TargetBackend { - return TargetBackend.JVM_IR - } - - override fun getBackendB(): TargetBackend { - return TargetBackend.JVM_IR - } -} diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractJdk15BlackBoxCodegenTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractJdk15BlackBoxCodegenTest.kt deleted file mode 100644 index de0a07b0643..00000000000 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractJdk15BlackBoxCodegenTest.kt +++ /dev/null @@ -1,20 +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.codegen - -import org.jetbrains.kotlin.test.TestJdkKind -import org.jetbrains.kotlin.test.util.KtTestUtil -import java.io.File - -abstract class AbstractJdk15BlackBoxCodegenTest : AbstractCustomJDKBlackBoxCodegenTest() { - override fun getTestJdkKind(): TestJdkKind = TestJdkKind.FULL_JDK_15 - override fun getJdkHome(): File = KtTestUtil.getJdk15Home() - override fun getPrefix(): String = "java15/box" - - override fun getAdditionalJvmArgs(): List = listOf("--enable-preview") - - override fun verifyWithDex(): Boolean = false -} diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractJdk15IrBlackBoxCodegenTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractJdk15IrBlackBoxCodegenTest.kt deleted file mode 100644 index 199427f71c6..00000000000 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/codegen/AbstractJdk15IrBlackBoxCodegenTest.kt +++ /dev/null @@ -1,13 +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.codegen - -import org.jetbrains.kotlin.test.TargetBackend - -abstract class AbstractJdk15IrBlackBoxCodegenTest : AbstractJdk15BlackBoxCodegenTest() { - override val backend: TargetBackend - get() = TargetBackend.JVM_IR -} diff --git a/compiler/tests-for-compiler-generator/tests/org/jetbrains/kotlin/test/generators/GenerateJUnit3CompilerTests.kt b/compiler/tests-for-compiler-generator/tests/org/jetbrains/kotlin/test/generators/GenerateJUnit3CompilerTests.kt index 5d76ad668c2..458209fce71 100644 --- a/compiler/tests-for-compiler-generator/tests/org/jetbrains/kotlin/test/generators/GenerateJUnit3CompilerTests.kt +++ b/compiler/tests-for-compiler-generator/tests/org/jetbrains/kotlin/test/generators/GenerateJUnit3CompilerTests.kt @@ -110,14 +110,6 @@ fun generateJUnit3CompilerTests(args: Array) { model("codegen/asmLike", targetBackend = TargetBackend.JVM) } - testClass { - model("codegen/java15/box") - } - - testClass { - model("codegen/java15/box", targetBackend = TargetBackend.JVM_IR) - } - testClass { model("codegen/script", extension = "kts") } @@ -253,14 +245,6 @@ fun generateJUnit3CompilerTests(args: Array) { ) } - testClass { - model("compileKotlinAgainstKotlinJdk15") - } - - testClass { - model("compileKotlinAgainstKotlinJdk15", targetBackend = TargetBackend.JVM_IR) - } - testClass { model("modules.xml", extension = "xml") } diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinJdk15TestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinJdk15TestGenerated.java deleted file mode 100644 index 19d206eaa0e..00000000000 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinJdk15TestGenerated.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2010-2021 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.codegen; - -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.TestMetadata; -import org.junit.runner.RunWith; - -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 */ -@SuppressWarnings("all") -@TestMetadata("compiler/testData/compileKotlinAgainstKotlinJdk15") -@TestDataPath("$PROJECT_ROOT") -@RunWith(JUnit3RunnerWithInners.class) -public class CompileKotlinAgainstKotlinJdk15TestGenerated extends AbstractCompileKotlinAgainstKotlinJdk15Test { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); - } - - public void testAllFilesPresentInCompileKotlinAgainstKotlinJdk15() throws Exception { - KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/compileKotlinAgainstKotlinJdk15"), Pattern.compile("^(.+)\\.kt$"), null, true); - } - - @TestMetadata("jvmRecordBinary.kt") - public void testJvmRecordBinary() throws Exception { - runTest("compiler/testData/compileKotlinAgainstKotlinJdk15/jvmRecordBinary.kt"); - } -} diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/IrCompileKotlinAgainstKotlinJdk15TestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/IrCompileKotlinAgainstKotlinJdk15TestGenerated.java deleted file mode 100644 index 1b891250c70..00000000000 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/IrCompileKotlinAgainstKotlinJdk15TestGenerated.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2010-2021 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.codegen; - -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 java.io.File; -import java.util.regex.Pattern; - -/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ -@SuppressWarnings("all") -@TestMetadata("compiler/testData/compileKotlinAgainstKotlinJdk15") -@TestDataPath("$PROJECT_ROOT") -@RunWith(JUnit3RunnerWithInners.class) -public class IrCompileKotlinAgainstKotlinJdk15TestGenerated extends AbstractIrCompileKotlinAgainstKotlinJdk15Test { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); - } - - public void testAllFilesPresentInCompileKotlinAgainstKotlinJdk15() throws Exception { - KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/compileKotlinAgainstKotlinJdk15"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); - } - - @TestMetadata("jvmRecordBinary.kt") - public void testJvmRecordBinary() throws Exception { - runTest("compiler/testData/compileKotlinAgainstKotlinJdk15/jvmRecordBinary.kt"); - } -} diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/Jdk15BlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/Jdk15BlackBoxCodegenTestGenerated.java deleted file mode 100644 index 93a1dab640c..00000000000 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/Jdk15BlackBoxCodegenTestGenerated.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright 2010-2021 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.codegen; - -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.TestMetadata; -import org.junit.runner.RunWith; - -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 */ -@SuppressWarnings("all") -@TestMetadata("compiler/testData/codegen/java15/box") -@TestDataPath("$PROJECT_ROOT") -@RunWith(JUnit3RunnerWithInners.class) -public class Jdk15BlackBoxCodegenTestGenerated extends AbstractJdk15BlackBoxCodegenTest { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); - } - - public void testAllFilesPresentInBox() throws Exception { - KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/java15/box"), Pattern.compile("^(.+)\\.kt$"), null, true); - } - - @TestMetadata("compiler/testData/codegen/java15/box/records") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class Records extends AbstractJdk15BlackBoxCodegenTest { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); - } - - public void testAllFilesPresentInRecords() throws Exception { - KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/java15/box/records"), Pattern.compile("^(.+)\\.kt$"), null, true); - } - - @TestMetadata("bytecodeShapeForJava.kt") - public void testBytecodeShapeForJava() throws Exception { - runTest("compiler/testData/codegen/java15/box/records/bytecodeShapeForJava.kt"); - } - - @TestMetadata("collectionSizeOverrides.kt") - public void testCollectionSizeOverrides() throws Exception { - runTest("compiler/testData/codegen/java15/box/records/collectionSizeOverrides.kt"); - } - - @TestMetadata("dataJvmRecord.kt") - public void testDataJvmRecord() throws Exception { - runTest("compiler/testData/codegen/java15/box/records/dataJvmRecord.kt"); - } - - @TestMetadata("propertiesOverrides.kt") - public void testPropertiesOverrides() throws Exception { - runTest("compiler/testData/codegen/java15/box/records/propertiesOverrides.kt"); - } - - @TestMetadata("propertiesOverridesAllCompatibilityJvmDefault.kt") - public void testPropertiesOverridesAllCompatibilityJvmDefault() throws Exception { - runTest("compiler/testData/codegen/java15/box/records/propertiesOverridesAllCompatibilityJvmDefault.kt"); - } - - @TestMetadata("propertiesOverridesEnableJvmDefault.kt") - public void testPropertiesOverridesEnableJvmDefault() throws Exception { - runTest("compiler/testData/codegen/java15/box/records/propertiesOverridesEnableJvmDefault.kt"); - } - - @TestMetadata("recordDifferentPropertyOverride.kt") - public void testRecordDifferentPropertyOverride() throws Exception { - runTest("compiler/testData/codegen/java15/box/records/recordDifferentPropertyOverride.kt"); - } - - @TestMetadata("recordDifferentSyntheticProperty.kt") - public void testRecordDifferentSyntheticProperty() throws Exception { - runTest("compiler/testData/codegen/java15/box/records/recordDifferentSyntheticProperty.kt"); - } - - @TestMetadata("recordPropertyAccess.kt") - public void testRecordPropertyAccess() throws Exception { - runTest("compiler/testData/codegen/java15/box/records/recordPropertyAccess.kt"); - } - } -} diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/Jdk15IrBlackBoxCodegenTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/Jdk15IrBlackBoxCodegenTestGenerated.java deleted file mode 100644 index dacbcf063f8..00000000000 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/Jdk15IrBlackBoxCodegenTestGenerated.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright 2010-2021 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.codegen; - -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 java.io.File; -import java.util.regex.Pattern; - -/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ -@SuppressWarnings("all") -@TestMetadata("compiler/testData/codegen/java15/box") -@TestDataPath("$PROJECT_ROOT") -@RunWith(JUnit3RunnerWithInners.class) -public class Jdk15IrBlackBoxCodegenTestGenerated extends AbstractJdk15IrBlackBoxCodegenTest { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); - } - - public void testAllFilesPresentInBox() throws Exception { - KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/java15/box"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); - } - - @TestMetadata("compiler/testData/codegen/java15/box/records") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class Records extends AbstractJdk15IrBlackBoxCodegenTest { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); - } - - public void testAllFilesPresentInRecords() throws Exception { - KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/java15/box/records"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); - } - - @TestMetadata("bytecodeShapeForJava.kt") - public void testBytecodeShapeForJava() throws Exception { - runTest("compiler/testData/codegen/java15/box/records/bytecodeShapeForJava.kt"); - } - - @TestMetadata("collectionSizeOverrides.kt") - public void testCollectionSizeOverrides() throws Exception { - runTest("compiler/testData/codegen/java15/box/records/collectionSizeOverrides.kt"); - } - - @TestMetadata("dataJvmRecord.kt") - public void testDataJvmRecord() throws Exception { - runTest("compiler/testData/codegen/java15/box/records/dataJvmRecord.kt"); - } - - @TestMetadata("propertiesOverrides.kt") - public void testPropertiesOverrides() throws Exception { - runTest("compiler/testData/codegen/java15/box/records/propertiesOverrides.kt"); - } - - @TestMetadata("propertiesOverridesAllCompatibilityJvmDefault.kt") - public void testPropertiesOverridesAllCompatibilityJvmDefault() throws Exception { - runTest("compiler/testData/codegen/java15/box/records/propertiesOverridesAllCompatibilityJvmDefault.kt"); - } - - @TestMetadata("propertiesOverridesEnableJvmDefault.kt") - public void testPropertiesOverridesEnableJvmDefault() throws Exception { - runTest("compiler/testData/codegen/java15/box/records/propertiesOverridesEnableJvmDefault.kt"); - } - - @TestMetadata("recordDifferentPropertyOverride.kt") - public void testRecordDifferentPropertyOverride() throws Exception { - runTest("compiler/testData/codegen/java15/box/records/recordDifferentPropertyOverride.kt"); - } - - @TestMetadata("recordDifferentSyntheticProperty.kt") - public void testRecordDifferentSyntheticProperty() throws Exception { - runTest("compiler/testData/codegen/java15/box/records/recordDifferentSyntheticProperty.kt"); - } - - @TestMetadata("recordPropertyAccess.kt") - public void testRecordPropertyAccess() throws Exception { - runTest("compiler/testData/codegen/java15/box/records/recordPropertyAccess.kt"); - } - } -}