diff --git a/lsp/kotlin/src/main/java/com/itsaky/androidide/lsp/kotlin/compiler/index/SourceFileIndexer.kt b/lsp/kotlin/src/main/java/com/itsaky/androidide/lsp/kotlin/compiler/index/SourceFileIndexer.kt index 3e1fa3eb1e..fd5d98d734 100644 --- a/lsp/kotlin/src/main/java/com/itsaky/androidide/lsp/kotlin/compiler/index/SourceFileIndexer.kt +++ b/lsp/kotlin/src/main/java/com/itsaky/androidide/lsp/kotlin/compiler/index/SourceFileIndexer.kt @@ -58,6 +58,7 @@ import org.slf4j.LoggerFactory import java.io.FileNotFoundException import java.nio.file.NoSuchFileException import java.nio.file.Path +import java.nio.file.Paths import java.time.Instant import kotlin.io.path.pathString @@ -154,7 +155,7 @@ internal suspend fun indexSourceFile( * on a full pass, or an edit's superseded parse) finds no FIR for its declarations (ADFA-5763). * Skip it: the refresh that produced the newer instance queued that instance's own pass. */ - if (resolvesTo.orNull(Path.of(metadata.filePath), ktFile) != true) { + if (resolvesTo.orNull(Paths.get(metadata.filePath), ktFile) != true) { logger.debug("Skipping {}: FIR resolves its path to another instance", metadata.filePath) return@read null } @@ -249,7 +250,7 @@ private fun KaSession.analyzeDeclaration( scope.apply { setExtra("fpth", filePath) // False means the instance was superseded mid-pass; true means the failure has another cause. - setTag("instanceMatches", resolvesTo.orNull(Path.of(filePath), dcl.containingKtFile)?.toString() ?: "unknown") + setTag("instanceMatches", resolvesTo.orNull(Paths.get(filePath), dcl.containingKtFile)?.toString() ?: "unknown") setExtra("dcl", dcl.name) setExtra("dcl.dbg", dcl.getDebugText()) setExtra( diff --git a/lsp/kotlin/src/main/java/com/itsaky/androidide/lsp/kotlin/compiler/vfs/ListingJarFileSystem.kt b/lsp/kotlin/src/main/java/com/itsaky/androidide/lsp/kotlin/compiler/vfs/ListingJarFileSystem.kt index 23a8880c6e..77ad568dda 100644 --- a/lsp/kotlin/src/main/java/com/itsaky/androidide/lsp/kotlin/compiler/vfs/ListingJarFileSystem.kt +++ b/lsp/kotlin/src/main/java/com/itsaky/androidide/lsp/kotlin/compiler/vfs/ListingJarFileSystem.kt @@ -8,6 +8,7 @@ import org.slf4j.LoggerFactory import java.io.IOException import java.nio.file.NoSuchFileException import java.nio.file.Path +import java.nio.file.Paths import java.util.concurrent.ConcurrentHashMap private val logger = LoggerFactory.getLogger(ListingJarFileSystem::class.java) @@ -41,7 +42,7 @@ class ListingJarFileSystem( override fun findFileByPath(path: String): VirtualFile? { val separator = path.indexOf(JAR_SEPARATOR) require(separator >= 0) { "Path in JarFileSystem must contain a separator: $path" } - val jar = Path.of(path.substring(0, separator)).toAbsolutePath().normalize() + val jar = Paths.get(path.substring(0, separator)).toAbsolutePath().normalize() return handlerFor(jar)?.findFile(path.substring(separator + JAR_SEPARATOR.length)) } @@ -67,7 +68,7 @@ class ListingJarFileSystem( val handler = install(key, snapshot) if (isCurrent(handler)) return handler retire(key, handler) - val retried = install(key, snapshotOf(Path.of(key)) ?: return null) + val retried = install(key, snapshotOf(Paths.get(key)) ?: return null) if (isCurrent(retried)) return retried retire(key, retried) logger.warn("JAR {} changed again while it was being looked up", key) @@ -98,7 +99,7 @@ class ListingJarFileSystem( /** Reads only the cache's map: no stat and no path lock, so it is safe after any lookup. */ private fun isCurrent(handler: ListingJarHandler): Boolean { - val current = cache.peek(Path.of(handler.jarPath)) ?: return false + val current = cache.peek(Paths.get(handler.jarPath)) ?: return false return current.generation() <= handler.snapshot.generation() }