JVM_IR: Enable loadJava tests

This commit is contained in:
Mads Ager
2019-05-27 14:25:20 +02:00
committed by Alexander Udalov
parent 65f06454be
commit 5be0bd4a56
15 changed files with 5175 additions and 0 deletions
@@ -121,6 +121,7 @@ public abstract class AbstractLoadJavaTest extends TestCaseWithTmpdir {
File txtFile = getTxtFileFromKtFile(ktFileName);
CompilerConfiguration configuration = newConfiguration(configurationKind, TestJdkKind.MOCK_JDK, getClasspath(), Collections.emptyList());
updateConfiguration(configuration);
if (useTypeTableInSerializer) {
configuration.put(JVMConfigurationKeys.USE_TYPE_TABLE, true);
}
@@ -189,6 +190,8 @@ public abstract class AbstractLoadJavaTest extends TestCaseWithTmpdir {
protected void configureEnvironment(KotlinCoreEnvironment environment) {}
protected void updateConfiguration(CompilerConfiguration configuration) {}
protected void doTestJavaAgainstKotlin(String expectedFileName) throws Exception {
File expectedFile = new File(expectedFileName);
File sourcesDir = new File(expectedFileName.replaceFirst("\\.txt$", ""));
@@ -196,6 +199,7 @@ public abstract class AbstractLoadJavaTest extends TestCaseWithTmpdir {
FileUtil.copyDir(sourcesDir, new File(tmpdir, "test"), pathname -> pathname.getName().endsWith(".java"));
CompilerConfiguration configuration = KotlinTestUtils.newConfiguration(ConfigurationKind.JDK_ONLY, getJdkKind());
updateConfiguration(configuration);
ContentRootsKt.addKotlinSourceRoot(configuration, sourcesDir.getAbsolutePath());
JvmContentRootsKt.addJavaSourceRoot(configuration, new File("compiler/testData/loadJava/include"));
JvmContentRootsKt.addJavaSourceRoot(configuration, tmpdir);
@@ -0,0 +1,14 @@
/*
* Copyright 2010-2019 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.jvm.compiler.ir
import org.jetbrains.kotlin.config.CompilerConfiguration
import org.jetbrains.kotlin.config.JVMConfigurationKeys
import org.jetbrains.kotlin.jvm.compiler.AbstractLoadJavaWithFastClassReadingTest
abstract class AbstractIrLoadJavaTest : AbstractLoadJavaWithFastClassReadingTest() {
override fun updateConfiguration(configuration: CompilerConfiguration) = configuration.put(JVMConfigurationKeys.IR, true)
}