From d5e2ac0efc8ba0a331862751cc19b52d36bf9639 Mon Sep 17 00:00:00 2001 From: Sergey Bogolepov Date: Tue, 3 Aug 2021 19:13:07 +0700 Subject: [PATCH] Fix KotlinLibraryResolverImpl.kt on Windows `absoluteFile` is not enough to make path unique. For example, it doesn't expand things like '..' and 'IDEAPR~1' on Windows. `canonicalFile` seems to solve the problem. --- .../resolver/impl/KotlinLibraryResolverImpl.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/compiler/util-klib-metadata/src/org/jetbrains/kotlin/library/metadata/resolver/impl/KotlinLibraryResolverImpl.kt b/compiler/util-klib-metadata/src/org/jetbrains/kotlin/library/metadata/resolver/impl/KotlinLibraryResolverImpl.kt index f85bce6abc6..1a2389c7552 100644 --- a/compiler/util-klib-metadata/src/org/jetbrains/kotlin/library/metadata/resolver/impl/KotlinLibraryResolverImpl.kt +++ b/compiler/util-klib-metadata/src/org/jetbrains/kotlin/library/metadata/resolver/impl/KotlinLibraryResolverImpl.kt @@ -111,7 +111,7 @@ class KotlinLibraryResolverImpl internal constructor( val result = KotlinLibraryResolverResultImpl(rootLibraries) val cache = mutableMapOf() - cache.putAll(rootLibraries.map { it.library.libraryFile.absoluteFile to it }) + cache.putAll(rootLibraries.map { it.library.libraryFile.canonicalFile to it }) var newDependencies = rootLibraries do { @@ -121,12 +121,12 @@ class KotlinLibraryResolverImpl internal constructor( .filterNot { searchPathResolver.isProvidedByDefault(it) } .mapNotNull { searchPathResolver.resolve(it)?.let(::KotlinResolvedLibraryImpl) } .map { resolved -> - val absoluteFile = resolved.library.libraryFile.absoluteFile - if (absoluteFile in cache) { - library.addDependency(cache[absoluteFile]!!) + val canonicalFile = resolved.library.libraryFile.canonicalFile + if (canonicalFile in cache) { + library.addDependency(cache[canonicalFile]!!) null } else { - cache.put(absoluteFile, resolved) + cache.put(canonicalFile, resolved) library.addDependency(resolved) resolved }