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


(Jordan Zimmerman) #1

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”


(Luke Daley) #2

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

def m(Closure c) {
    c()
}
    m
{
    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.


(Jordan Zimmerman) #3

Will do