In Java I can do this:
return a
&& b
&& c;
In Groovy, it returns a compile error: unexpected token: &&
. It also occurs if I omit the return
keyword in Groovy. However if I wrap the statement in parentheses, it works fine.
In all the Groovy resources I've read, I've been told that I should be able to write "straight Java" wherever I want. Is this a bug? If not, what is the reason for this design decision?
I looked here, but did not find this issue listed. I understand that there are some things that cannot be inherited from Java, but this wouldn't seem like one of those things.