- Sort Score
- Result 10 results
- Languages All
Results 1 - 5 of 5 for delegateClosureOf (0.25 sec)
-
platforms/documentation/docs/src/snippets/kotlinDsl/interoperability-delegate-closure-of/kotlin/build.gradle.kts
import org.akhikhl.gretty.FarmExtension plugins { id("org.gretty") version "4.0.3" } // tag::delegateClosureOf[] farms { farm("OldCoreWar", delegateClosureOf<FarmExtension> { // Config for the war here }) }
Registered: Wed Jun 12 18:38:38 UTC 2024 - Last Modified: Mon Nov 27 17:53:42 UTC 2023 - 257 bytes - Viewed (0) -
platforms/core-configuration/kotlin-dsl/src/test/kotlin/org/gradle/kotlin/dsl/GroovyInteroperabilityTest.kt
val list = arrayListOf<Int>() delegateClosureOf<MutableList<Int>> { add(42) }.apply { delegate = list call() } assertEquals(42, list.first()) } @Test fun `can use closure with a null delegate call`() { var passedIntoClosure: Any? = "Something non null" delegateClosureOf<Any?> { passedIntoClosure = this }.apply { delegate = null
Registered: Wed Jun 12 18:38:38 UTC 2024 - Last Modified: Wed Aug 02 08:06:49 UTC 2023 - 10.1K bytes - Viewed (0) -
platforms/core-configuration/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/GroovyInteroperability.kt
* configured Closure delegate. * * @param T the expected type of the delegate argument to the closure. * @param action the function to be adapted. * * @see [KotlinClosure1] */ fun <T> Any.delegateClosureOf(action: T.() -> Unit) = object : Closure<Unit>(this, this) { @Suppress("unused") // to be called dynamically by Groovy fun doCall() = uncheckedCast<T>(delegate).action() } /**
Registered: Wed Jun 12 18:38:38 UTC 2024 - Last Modified: Wed Aug 02 08:06:49 UTC 2023 - 9.7K bytes - Viewed (0) -
platforms/documentation/docs/src/docs/userguide/api/kotlin_dsl.adoc
.Use `delegateClosureOf<T> {}` ==== include::sample[dir="snippets/kotlinDsl/interoperability-delegate-closure-of/kotlin",files="build.gradle.kts[tags=delegateClosureOf]"] ==== There sometimes isn't a good way to tell, from looking at the source code, which version to use. Usually, if you get a `NullPointerException` with `closureOf<T> {}`, using `delegateClosureOf<T> {}` will resolve the problem.
Registered: Wed Jun 12 18:38:38 UTC 2024 - Last Modified: Mon Apr 22 20:16:10 UTC 2024 - 55.4K bytes - Viewed (0) -
testing/architecture-test/src/changes/archunit-store/public-api-methods-return-allowed-types.txt
Method <org.gradle.kotlin.dsl.GroovyInteroperabilityKt.delegateClosureOf(java.lang.Object, kotlin.jvm.functions.Function1)> has arguments/return type groovy.lang.Closure, kotlin.Unit that are not Gradle public API or primitive or built-in JDK classes or Kotlin classes in (GroovyInteroperability.kt:0)
Registered: Wed Jun 12 18:38:38 UTC 2024 - Last Modified: Fri Jun 07 12:21:31 UTC 2024 - 91.3K bytes - Viewed (0)