Cleanup: fix some compiler warnings (mostly deprecations, javaClass)
This commit is contained in:
@@ -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) {
|
||||
|
||||
+4
-4
@@ -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<*>
|
||||
|
||||
Reference in New Issue
Block a user