From 511a7155cba33ed4679550c2a7e9f95453b512bf Mon Sep 17 00:00:00 2001 From: Konstantin Kolosovsky Date: Mon, 18 Jun 2018 18:06:56 +0300 Subject: [PATCH] svn: Convert "WorkingCopy" to kotlin --- .../src/org/jetbrains/idea/svn/WorkingCopy.kt | 55 ++++--------------- 1 file changed, 11 insertions(+), 44 deletions(-) diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/WorkingCopy.kt b/plugins/svn4idea/src/org/jetbrains/idea/svn/WorkingCopy.kt index 612222de4b3c..ed6e9148b5dc 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/WorkingCopy.kt +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/WorkingCopy.kt @@ -1,51 +1,18 @@ -// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package org.jetbrains.idea.svn; +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +package org.jetbrains.idea.svn -import org.jetbrains.annotations.NotNull; -import org.jetbrains.idea.svn.api.Url; +import org.jetbrains.idea.svn.api.Url -import java.io.File; +import java.io.File -public class WorkingCopy { - private final boolean myIs17Copy; - @NotNull private final File myFile; - @NotNull private final Url myUrl; +// TODO: is17Copy is currently true in all constructor usages - remove this field and revise is17Copy() usages +class WorkingCopy(val file: File, val url: Url, val is17Copy: Boolean) { + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is WorkingCopy) return false - // TODO: is17Copy is currently true in all constructor usages - remove this field and revise is17Copy() usages - public WorkingCopy(@NotNull File file, @NotNull Url url, boolean is17Copy) { - myFile = file; - myUrl = url; - myIs17Copy = is17Copy; + return file == other.file } - @NotNull - public File getFile() { - return myFile; - } - - @NotNull - public Url getUrl() { - return myUrl; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - WorkingCopy that = (WorkingCopy)o; - - if (!myFile.equals(that.myFile)) return false; - - return true; - } - - @Override - public int hashCode() { - return myFile.hashCode(); - } - - public boolean is17Copy() { - return myIs17Copy; - } + override fun hashCode() = file.hashCode() }