From 09bd1dfd3ada55ca7a34bc7f510452ac772021fe Mon Sep 17 00:00:00 2001 From: Alex Plate Date: Fri, 8 May 2020 19:57:13 +0300 Subject: [PATCH] [Workspace Model] VirtualFileUrl is not a dataclass anymore GitOrigin-RevId: 9467d756238bc3a8e238fe8f8cea470245b933ad --- .../workspaceModel-core/src/VirtualFileUrl.kt | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/platform/workspaceModel-core/src/VirtualFileUrl.kt b/platform/workspaceModel-core/src/VirtualFileUrl.kt index d074ffae5386..b272e2185467 100644 --- a/platform/workspaceModel-core/src/VirtualFileUrl.kt +++ b/platform/workspaceModel-core/src/VirtualFileUrl.kt @@ -4,8 +4,7 @@ import java.io.File import java.nio.file.Path // TODO Do we want to make it inline? -data class VirtualFileUrl(private val id: Int, internal val manager: VirtualFileUrlManager) -{ +class VirtualFileUrl(private val id: Int, internal val manager: VirtualFileUrlManager) { val url: String get() = manager.getUrlById(id) @@ -39,6 +38,19 @@ data class VirtualFileUrl(private val id: Int, internal val manager: VirtualFile //override fun equals(other: Any?): Boolean = id == (other as? VirtualFileUrl)?.id //override fun hashCode(): Int = id override fun toString(): String = url + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (javaClass != other?.javaClass) return false + + other as VirtualFileUrl + + if (id != other.id) return false + + return true + } + + override fun hashCode(): Int = id } fun VirtualFileUrl.append(relativePath: String): VirtualFileUrl {