Cleanup: fix some compiler warnings (mostly deprecations, javaClass)

This commit is contained in:
Mikhail Glukhikh
2017-02-21 17:38:43 +03:00
parent d0cc1635db
commit b121bf8802
445 changed files with 773 additions and 949 deletions
@@ -90,7 +90,7 @@ private inline fun tryConnectToDaemon(port: Int, report: (DaemonReportCategory,
when (daemon) {
null -> report(DaemonReportCategory.EXCEPTION, "daemon not found")
is CompileService -> return daemon
else -> report(DaemonReportCategory.EXCEPTION, "Unable to cast compiler service, actual class received: ${daemon.javaClass.name}")
else -> report(DaemonReportCategory.EXCEPTION, "Unable to cast compiler service, actual class received: ${daemon::class.java.name}")
}
}
catch (e: Throwable) {
@@ -44,22 +44,22 @@ interface CompileService : Remote {
class Good<out R>(val result: R) : CallResult<R>() {
override fun get(): R = result
override fun equals(other: Any?): Boolean = other is Good<*> && this.result == other.result
override fun hashCode(): Int = this.javaClass.hashCode() + (result?.hashCode() ?: 1)
override fun hashCode(): Int = this::class.java.hashCode() + (result?.hashCode() ?: 1)
}
class Ok : CallResult<Nothing>() {
override fun get(): Nothing = throw IllegalStateException("Get is inapplicable to Ok call result")
override fun equals(other: Any?): Boolean = other is Ok
override fun hashCode(): Int = this.javaClass.hashCode() + 1 // avoiding clash with the hash of class itself
override fun hashCode(): Int = this::class.java.hashCode() + 1 // avoiding clash with the hash of class itself
}
class Dying : CallResult<Nothing>() {
override fun get(): Nothing = throw IllegalStateException("Service is dying")
override fun equals(other: Any?): Boolean = other is Dying
override fun hashCode(): Int = this.javaClass.hashCode() + 1 // see comment to Ok.hashCode
override fun hashCode(): Int = this::class.java.hashCode() + 1 // see comment to Ok.hashCode
}
class Error(val message: String) : CallResult<Nothing>() {
override fun get(): Nothing = throw Exception(message)
override fun equals(other: Any?): Boolean = other is Error && this.message == other.message
override fun hashCode(): Int = this.javaClass.hashCode() + message.hashCode()
override fun hashCode(): Int = this::class.java.hashCode() + message.hashCode()
}
val isGood: Boolean get() = this is Good<*>