Thread extension properties deprecated in favor of synthetic extension properties.

Executor.invoke and ExecutorService.invoke deprecated.
This commit is contained in:
Ilya Gorbunov
2015-07-22 16:48:05 +03:00
parent ed8edd2ce4
commit ceb3b7da9d
@@ -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 <T: Any> ThreadLocal<T>.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 <T> ExecutorService.invoke(action: () -> T): Future<T> {
return submit(action)
}
}