Skip to content

Commit

Permalink
[IC] Revert the paths hashing introduced in 5562c95
Browse files Browse the repository at this point in the history
`File.hashCode()` behavior is OS-dependent. This can lead to the loss of mapping between a path and its related data in PersistentHashMap — for instance, when a map generated on Microsoft Windows is used on macOS. Notably, this can occur even though both systems use case-insensitive filesystems by default. This commit returns the hashing based on OS-independent path strings
^KT-64016 Verification Pending
  • Loading branch information
ALikhachev authored and Space Team committed Dec 14, 2023
1 parent 44c0909 commit 89a8e1c
Showing 1 changed file with 1 addition and 3 deletions.
Expand Up @@ -47,9 +47,7 @@ private class FileDescriptor(private val pathConverter: FileToPathConverter) : K
// If we use a RelocatableFileToPathConverter instead, the file paths will be normalized first, so we'll get the same hash codes:
// [In "/path/to/project1"] File("src/foo.kt").hashCode() = 789
// [In "/path/to/project2"] File("src/foo.kt").hashCode() = 789
// It's also important to get the hash code using `File.hashCode()` instead of `String.hashCode()` because the hashCode() method
// needs to account for case-insensitive filesystems.
return File(pathConverter.toPath(file)).hashCode()
return pathConverter.toPath(file).hashCode()
}

override fun isEqual(file1: File, file2: File): Boolean {
Expand Down

0 comments on commit 89a8e1c

Please sign in to comment.