Most Java code is also syntactically valid Groovy code. However, there are a few exceptions which leads me to my question:
Which constructs/features in Java are syntactically invalid in Groovy? Please provide concrete examples of Java code (Java 1.6) that is NOT valid Groovy code (Groovy 1.6).
Update:
So far we've got five examples of syntactically valid Java code that is not valid Groovy code:
- 1.) Array initializations
- 2.) Inner classes
- 3.) "def" is a keyword in Groovy, but not in Java
- 4.) "$$"-strings - parsed as an invalid GStrings in Groovy
- 5.) Non-static initialization blocks -- class Foo { Integer x; { x = 1; } }
Is this the complete list? Any further examples?
Update #1: I've started a bounty to bump this question. The bounty will be granted to the person who provides the most comprehensive list of examples. So far we've uncovered five examples, but I'm sure there a quite some more out there. So keep them coming!