That still doesn't work, the kotlin compiler can't...
# gradle
j
That still doesn't work, the kotlin compiler can't figure out the type signatures.
@bamboo Is this a Kotlin Compiler bug? Should this be opened in youtrack?
b
I have to take a deeper look at the API, let me see
Hm,
public <T extends Task & JavaForkOptions> void applyTo(TaskCollection tasks)
The type parameter is not mentioned in the parameters so there’s no hook for Kotlin to infer the type
The API needs to be fixed
I think Kotlin should let you call the function if you pass the type argument explicitly for now:
applyTo<MyTaskType>(...)
Does it?
I’m making a test locally
j
Thanks!
b
I’ve corrected the API locally to be
public <T extends Task & JavaForkOptions> void applyTo(TaskCollection<T> tasks)
but Kotlin still can’t figure out the following code is valid:
applyTo(tasks.withType<JavaExec>())
JavaExec
is both a
Task
and
JavaForkOptions
so there’s a Kotlin compiler issue here too.
It makes sense to open an issue against the Kotlin compiler YT also
j
be inferred by a capable compiler.
Bahahahah 😆 Thanks for the fix.
b
😉
j
Do you want to open the issue against Kotlin or should I? You could probably describe the issue better than I can.
b
ok
j
You should mention that the commit will close this: https://github.com/gradle/gradle/issues/2702
b
I’ll attach the PR to the issue once CI is green
Maybe Kotlin 1.1.4 can handle it? I haven’t have the time to check it yet