From 5488972b53ba2bd6936e4a7b1e33be97f2897423 Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Thu, 3 Mar 2016 14:49:51 +0300 Subject: [PATCH] Minor, don't create empty tmpdir in codegen tests w/o Java --- .../codegen/AbstractBlackBoxCodegenTest.java | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/AbstractBlackBoxCodegenTest.java b/compiler/tests/org/jetbrains/kotlin/codegen/AbstractBlackBoxCodegenTest.java index 0fcf3391eed..50ce7e037ce 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/AbstractBlackBoxCodegenTest.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/AbstractBlackBoxCodegenTest.java @@ -104,23 +104,25 @@ public abstract class AbstractBlackBoxCodegenTest extends CodegenTestCase { myEnvironment.getProject(), myFiles.getPsiFiles(), new JvmPackagePartProvider(myEnvironment) ).getFactory(); - File kotlinOut; - try { - kotlinOut = KotlinTestUtils.tmpDir(toString()); - } - catch (IOException e) { - throw ExceptionUtilsKt.rethrow(e); - } - - OutputUtilsKt.writeAllTo(classFileFactory, kotlinOut); - if (javaSourceDir != null) { + // If there are Java files, they should be compiled against the class files produced by Kotlin, so we dump them to the disk + File kotlinOut; + try { + kotlinOut = KotlinTestUtils.tmpDir(toString()); + } + catch (IOException e) { + throw ExceptionUtilsKt.rethrow(e); + } + + OutputUtilsKt.writeAllTo(classFileFactory, kotlinOut); + File output = CodegenTestUtil.compileJava( findJavaSourcesInDirectory(javaSourceDir), Collections.singletonList(kotlinOut.getPath()), javacOptions ); // Add javac output to classpath so that the created class loader can find generated Java classes JvmContentRootsKt.addJvmClasspathRoot(configuration, output); } + blackBox(); }