Closure Input being called with null argument


(Fredrik Reveny) #1

I’m trying to provide a custom task called AppendTask which looks like this:

The problem I’m having is users of this task type have to ignore calls with a null argument because Gradle internally calls the task that way at some point. So if I create an AppendTask like this:
task(testAppend, Type: AppendTask) {
inputMaps << [file(“a.txt”), file(“b.txt”)]
filter {
if (line == null) { throw new Exception() }
}
}

I get a stacktrace like this:
at
at org.gradle.util.GUtil.uncheckedCall(GUtil.java:401)
… 72 more

Gradle’s CopyTask doesn’t require a null check. What is this uncheckedCall business? What am I missing?