KT-57154: Fix JRT-FS contents served for wrong JDK home on JDK 9+

If the compiler runtime JDK is 9+,
it will already contain JrtFileSystemProvider and won't use provided
classloader
In order to fix KT-57154 we need to provide "java.home" argument to
newFileSystem

In order to reduce the severity of the leak in KT-56789 we cache
instances of FileSystem itself forever
Otherwise, each invocation of newFileSystem on JDK 9+ will leak
classloader, which is created deep inside the JDK code

Add unit test for JRT-FS contents served through CoreJrtFs

Add Gradle Integration test to 
test if the daemon correctly reads JDK contents from the specified 
toolchain and not from its runtime JDK

^KT-57154
Regression test for ^KT-57077
This commit is contained in:
Simon Ogorodnik
2023-03-28 10:38:46 +00:00
committed by Space Team
parent 563781a246
commit ae32eff543
7 changed files with 158 additions and 17 deletions
@@ -7,6 +7,7 @@
package org.jetbrains.kotlin.codegen.jdk
import org.jetbrains.kotlin.test.jvm.compiler.CoreJrtFsTest
import org.jetbrains.kotlin.test.runners.codegen.*
import org.junit.platform.runner.JUnitPlatform
import org.junit.platform.suite.api.ExcludeTags
@@ -26,7 +27,9 @@ import org.junit.runner.RunWith
IrBlackBoxCodegenTestGenerated::class,
IrBlackBoxInlineCodegenWithBytecodeInlinerTestGenerated::class,
IrCompileKotlinAgainstInlineKotlinTestGenerated::class
IrCompileKotlinAgainstInlineKotlinTestGenerated::class,
CoreJrtFsTest::class
)
@IncludeClassNamePatterns(".*Test.*Generated")
@ExcludeTags("<modernJava>")