File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed
main/kotlin/com/tschuchort/compiletesting
test/kotlin/com/tschuchort/compiletesting Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -506,7 +506,10 @@ class KotlinCompilation : AbstractKotlinCompilation<K2JVMCompilerArguments>() {
506506 if (jdkHome != null && jdkHome!! .canonicalPath != processJdkHome.canonicalPath) {
507507 /* If a JDK home is given, try to run javac from there so it uses the same JDK
508508 as K2JVMCompiler. Changing the JDK of the system java compiler via the
509- "--system" and "-bootclasspath" options is not so easy. */
509+ "--system" and "-bootclasspath" options is not so easy.
510+ If the jdkHome is the same as the current process, we still run an in process compilation because it is
511+ expensive to fork a process to compile.
512+ */
510513 log(" compiling java in a sub-process because a jdkHome is specified" )
511514 val jdkBinFile = File (jdkHome, " bin" )
512515 check(jdkBinFile.exists()) { " No JDK bin folder found at: ${jdkBinFile.toPath()} " }
@@ -539,7 +542,7 @@ class KotlinCompilation : AbstractKotlinCompilation<K2JVMCompilerArguments>() {
539542 val isJavac9OrLater = isJdk9OrLater()
540543 val javacArgs = baseJavacArgs(isJavac9OrLater).apply {
541544 if (jdkHome == null ) {
542- log(" jdkHome is set to null, removing booth classpath from java compilation" )
545+ log(" jdkHome is set to null, removing boot classpath from java compilation" )
543546 // erase bootclasspath or JDK path because no JDK was specified
544547 if (isJavac9OrLater)
545548 addAll(" --system" , " none" )
Original file line number Diff line number Diff line change @@ -184,7 +184,7 @@ class KotlinCompilationTests {
184184 assertThat(result.exitCode).isEqualTo(ExitCode .COMPILATION_ERROR )
185185 assertThat(result.messages).contains(" Unable to find package java.lang" )
186186 assertThat(result.messages).contains(
187- " jdkHome is set to null, removing booth classpath from java compilation"
187+ " jdkHome is set to null, removing boot classpath from java compilation"
188188 )
189189 }
190190
@@ -826,7 +826,7 @@ class KotlinCompilationTests {
826826 " jdkHome is not specified. Using system java compiler of the host process."
827827 )
828828 assertThat(result.messages).doesNotContain(
829- " jdkHome is set to null, removing booth classpath from java compilation"
829+ " jdkHome is set to null, removing boot classpath from java compilation"
830830 )
831831 }
832832
@@ -855,7 +855,7 @@ class KotlinCompilationTests {
855855 " compiling java in a sub-process because a jdkHome is specified"
856856 )
857857 assertThat(logs).doesNotContain(
858- " jdkHome is set to null, removing booth classpath from java compilation"
858+ " jdkHome is set to null, removing boot classpath from java compilation"
859859 )
860860 }
861861
You can’t perform that action at this time.
0 commit comments