This message was deleted.
# kotlin-dsl
s
This message was deleted.
v
I wonder whether that is maybe a KTIJ or KT bug. As far as I can see the switch from Kotlin to Java is at
gradle-8.2.1/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/NamedDomainObjectContainerExtensions.kt:329
where
container.create(...)
is called which returns
Configuration
. The package where this method is in is annotated with
org.gradle.api.NonNullApi
which is meta-annotated with
org.jetbrains.annotations.NotNull
and
javax.annotation.Nonnull
. So I wonder whether not KT(IJ) should handle it as
Configuration
instead of
Configuration!
.
c
Yep… IntelliJ is still warning if I call it directly:
Copy code
val direct = configurations.create("direct")
Still leaves direct as
Configuration!
a
I've noticed this problem too, it's annoying. Might it be a problem with the property delegation getValue() function? Using
T & Any
as the return type in this workaround resolves the warning for me:
Copy code
import org.gradle.kotlin.dsl.getValue as getValueOriginal

operator fun <T> ExistingDomainObjectDelegate<out T>.getValue(receiver: Any?, property: KProperty<*>): T & Any =
    getValueOriginal(receiver, property) as (T & Any)

val x by configurations.creating {  } // no warning
v
Yep… IntelliJ is still warning if I call it directly:
Copy code
val direct = configurations.create("direct")
Still leaves direct as
Configuration!
Well, it is not so sure what it thinks, here:
t
Kind of related issue which is fixed in 1.9.0 Kotlin
👀 1
p
I reopened https://github.com/gradle/gradle/issues/9242 as it still happens
👌 1