Why can't I place the opening brace on the next line of my task declaration?

Is this a Goovy-ism or a Gradle parsing bug?

This works:

task docs(type: Javadoc) {

… }

But this doesn’t:

task docs(type: Javadoc)


… }

The second generates an error: “Ambiguous expression could be a parameterless closure expression”

This is definitely a bug. While it’s not exactly the same, that’s semantically close to:

def m(Closure c) {
    println 1

Which Groovy does support, so Gradle should.

It would be great if you could raise an issue for this at http://issues.gradle.org.

Will do