From 911963bafda4c83523ee6cc144d9b70f4acfbffe Mon Sep 17 00:00:00 2001 From: Jinseong Jeon Date: Mon, 13 Jun 2022 09:56:45 -0700 Subject: [PATCH] CLI: utilize JRT path split (w/o magic number) --- .../cli/jvm/modules/CoreJrtFileSystem.kt | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/modules/CoreJrtFileSystem.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/modules/CoreJrtFileSystem.kt index c140fbe78cb..e9f4b5bf222 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/modules/CoreJrtFileSystem.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/modules/CoreJrtFileSystem.kt @@ -71,16 +71,6 @@ class CoreJrtFileSystem : DeprecatedVirtualFileSystem() { return handlers[jdkHomePath]?.findFile(pathInImage) } - private fun splitPath(path: String): Pair { - val separator = path.indexOf(URLUtil.JAR_SEPARATOR) - if (separator < 0) { - throw IllegalArgumentException("Path in CoreJrtFileSystem must contain a separator: $path") - } - val localPath = path.substring(0, separator) - val pathInJar = path.substring(separator + 2) - return Pair(localPath, pathInJar) - } - override fun refresh(asynchronous: Boolean) {} override fun refreshAndFindFileByPath(path: String): VirtualFile? = findFileByPath(path) @@ -92,6 +82,16 @@ class CoreJrtFileSystem : DeprecatedVirtualFileSystem() { fun isModularJdk(jdkHome: File): Boolean = loadJrtFsJar(jdkHome) != null + fun splitPath(path: String): Pair { + val separator = path.indexOf(URLUtil.JAR_SEPARATOR) + if (separator < 0) { + throw IllegalArgumentException("Path in CoreJrtFileSystem must contain a separator: $path") + } + val localPath = path.substring(0, separator) + val pathInJar = path.substring(separator + URLUtil.JAR_SEPARATOR.length) + return Pair(localPath, pathInJar) + } + private val jrtFsClassLoaderCache = ContainerUtil.createConcurrentWeakValueMap() } }