Slackbot
07/28/2022, 10:38 PMtony
07/28/2022, 10:40 PMAction
tony
07/28/2022, 10:40 PMEli Graber
07/28/2022, 10:42 PMorg.gradle.kotlin.dsl
so I wasn't 100% sureEli Graber
07/28/2022, 10:43 PMpublic fun Foo(action: Action<Bar> = Actions.doNothing())
tony
07/28/2022, 10:43 PM@JvmOverloads
?Eli Graber
07/28/2022, 10:44 PMtony
07/28/2022, 10:46 PMEli Graber
07/28/2022, 10:46 PMgrossws
07/28/2022, 11:11 PMJohn
07/29/2022, 1:11 AMfun <T> Any.closureOf(action: T.() -> Unit): Closure<Any?> =
KotlinClosure1(action, this, this)
/**
* Adapts an unary Kotlin function to an unary Groovy [Closure].
*
* @param T the type of the single argument to the closure.
* @param V the return type.
* @param function the function to be adapted.
* @param owner optional owner of the Closure.
* @param thisObject optional _this Object_ of the Closure.
*
* @see [Closure]
*/
class KotlinClosure1<in T : Any?, V : Any>(
val function: T.() -> V,
owner: Any? = null,
thisObject: Any? = null
) : Closure<V?>(owner, thisObject) {
@Suppress("unused") // to be called dynamically by Groovy
fun doCall(it: T): V = it.function()
}