From ceb3b7da9d69207fb4cc2e4b26a8ef92204222fc Mon Sep 17 00:00:00 2001 From: Ilya Gorbunov Date: Wed, 22 Jul 2015 16:48:05 +0300 Subject: [PATCH] Thread extension properties deprecated in favor of synthetic extension properties. Executor.invoke and ExecutorService.invoke deprecated. --- libraries/stdlib/src/kotlin/concurrent/Thread.kt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libraries/stdlib/src/kotlin/concurrent/Thread.kt b/libraries/stdlib/src/kotlin/concurrent/Thread.kt index 247dafcbe40..36fbb988b0a 100644 --- a/libraries/stdlib/src/kotlin/concurrent/Thread.kt +++ b/libraries/stdlib/src/kotlin/concurrent/Thread.kt @@ -11,6 +11,7 @@ public val currentThread: Thread /** * Exposes the name of this thread as a property. */ +deprecated("Remove import of koltin.concurrent.name to use synthetic extension property instead.") public var Thread.name: String get() = getName() set(value) { @@ -21,6 +22,7 @@ public var Thread.name: String * Exposes the daemon flag of this thread as a property. * The Java Virtual Machine exits when the only threads running are all daemon threads. */ +deprecated("Use synthetic extension property isDaemon instead.", ReplaceWith("this.isDaemon")) public var Thread.daemon: Boolean get() = isDaemon() set(value) { @@ -30,12 +32,14 @@ public var Thread.daemon: Boolean /** * Exposes the alive state of this thread as a property. */ +deprecated("Use synthetic extension property isAlive instead.", ReplaceWith("this.isAlive")) public val Thread.alive: Boolean get() = isAlive() /** * Exposes the priority of this thread as a property. */ +deprecated("Remove import of koltin.concurrent.priority to use synthetic extension property instead.") public var Thread.priority: Int get() = getPriority() set(value) { @@ -45,6 +49,7 @@ public var Thread.priority: Int /** * Exposes the context class loader of this thread as a property. */ +deprecated("Remove import of koltin.concurrent.contextClassLoader to use synthetic extension property instead.") public var Thread.contextClassLoader: ClassLoader? get() = getContextClassLoader() set(value) { @@ -100,6 +105,7 @@ public inline fun ThreadLocal.getOrSet(default: () -> T): T { * Allows you to use the executor as a function to * execute the given block on the [Executor]. */ +deprecated("Use Executor.execute(Runnable) instead.") // do not specify ReplaceWith("execute(action)") due to KT-8597 public fun Executor.invoke(action: () -> Unit) { execute(action) } @@ -108,6 +114,7 @@ public fun Executor.invoke(action: () -> Unit) { * Allows you to use the executor service as a function to * execute the given block on the [ExecutorService]. */ +deprecated("Use ExecutorService.submit(Callable) instead.") // do not specify ReplaceWith("submit(action)") due to KT-8597 public fun ExecutorService.invoke(action: () -> T): Future { return submit(action) -} \ No newline at end of file +}