Because semicolons are optional, groovy is sensitive to newlines and occasionally parses a statement in a way that is unexpected. In this case, it considers Callable<String> callable = new Callable<String>() to be an entire statement. Java is smart enough to see that it's an anonymous inner class since the statement isn't terminated at the end of the line, but the first line is syntatically correct groovy and stops parsing.

The solution is to escape the newline with a backslash, to force groovy to continue parsing the statement. Alternatively, you could put the opening brace at the end of the line (i.e. standard java coding style).