From dfd3f50c525d5a4755b6c82302d577b7c5de1df8 Mon Sep 17 00:00:00 2001 From: Evgeny Gerashchenko Date: Sun, 8 Apr 2012 16:51:46 +0400 Subject: [PATCH] Made VirtualFile subtype of Hashable. --- examples/example-vfs/src/VirtualFile.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/example-vfs/src/VirtualFile.kt b/examples/example-vfs/src/VirtualFile.kt index 0e83dbc7c35..a9e6f8514ea 100644 --- a/examples/example-vfs/src/VirtualFile.kt +++ b/examples/example-vfs/src/VirtualFile.kt @@ -12,7 +12,7 @@ import kotlin.util.* /** * Abstract virtual file. */ -public abstract class VirtualFile(public val path : String) { +public abstract class VirtualFile(public val path : String) : Hashable { protected abstract val kind : String /** @@ -43,12 +43,12 @@ public abstract class VirtualFile(public val path : String) { */ public abstract fun openInputStream() : InputStream - fun equals(other : Any?) : Boolean { + public override fun equals(other : Any?) : Boolean { return other is VirtualFile && kind == other.kind && path == other.path } - fun hashCode() : Int { - // FIXME rewrite without casting when it will be possible + public override fun hashCode() : Int { + // FIXME rewrite without casting when it will be possible (KT-1741) return (kind as java.lang.String).hashCode() * 31 + (path as java.lang.String).hashCode() }