Join Slack
Powered by
I need to write in Kotlin DSL: filter {lin...
# announcements
j
Jan Vomlel
10/29/2018, 11:34 AM
I need to write in Kotlin DSL: filter {line -> if (true/*some condition*/) line else null } Filter is defined here:
https://docs.gradle.org/current/dsl/org.gradle.api.tasks.Copy.html#org.gradle.api.tasks.Copy:filter(org.gradle.api.Transformer)
But compiler does not compile it, because null is not String. Filter is defined in java and null is allowed there. How to write it in Kotlin?
j
jmfayard
10/29/2018, 11:37 AM
Is the Java type declared as non null? Else that should work
h
hho
10/29/2018, 11:37 AM
#C19FD9681
j
Jan Vomlel
10/29/2018, 12:20 PM
They are not declared as not null: public AbstractCopyTask filter(Transformer<String, String> transformer) {....
Jan Vomlel
10/29/2018, 2:57 PM
It is problem idea and kts. Idea shows error on this kts file, but in runtime or in kt file it is ok.
3
Views
Open in Slack
Previous
Next