elect
06/04/2020, 11:37 AMtasks.withType(JmhTask::class.java) { }
where tasks
is a TaskContainer
type, which extends interface DomainObjectCollection<T>
DomainObjectCollection<T>::withType
is defined as <S extends T> DomainObjectCollection<S> withType(Class<S> type, Action<? super S> configureAction)
I'd like to type instead tasks<JmhTask> { }
, so I wrote:
inline operator fun <reified S> TaskContainer.invoke(configureAction: Action<in S>?) = withType(S::class.java, configureAction)
but withType
is marked red:
None of the following functions can be called with the arguments supplied.
withType(Class<TypeVariable(S)!>, Action<in TypeVariable(S)!>) where S = TypeVariable(S) for fun <S : Task!> withType(type: Class<S!>, configureAction: Action<in S!>): DomainObjectCollection<S!> defined in org.gradle.api.tasks.TaskContainer
Zach Klippenstein (he/him) [MOD]
06/04/2020, 2:54 PMelect
06/04/2020, 2:55 PM<reified S: Task>