1

I'm working on a class for a group of Java dev colleagues that want to learn more about Groovy, which I know well enough to do work in it, but not at an academic level.

I want to start with "All java is Groovy" to assuage the inevitable "change of language" anxiety, but these being developers, will go out of their way to find an edge case where this is not true. I was hoping to head them off at the pass and point these out ahead of time, but I couldn't think of any.

Michael Campbell
  • 2,022
  • 1
  • 17
  • 22
  • which java language version are we talking about? – Binkan Salaryman Aug 03 '15 at 14:42
  • Thanks. Any, really, but let's go with java 7 to avoid the lambda stuff. – Michael Campbell Aug 03 '15 at 14:43
  • just remembered, groovy classes have stricter naming requirements than java ones, see [how to define a groovy class with a main function that creates a new object that is an instance of another class](http://stackoverflow.com/q/28905499/217324). The [question i closed this as a duplicate of](http://stackoverflow.com/q/687601/217324) is probably still not complete (though still worth reading, i think), so reopening. – Nathan Hughes Aug 03 '15 at 14:52

1 Answers1

4

Not all Java is Groovy (sorry to burst your bubble) ;-)

Apart from the differences described in the documentation, there are a few others:

  • Array initialisation {} vs []
  • do..while blocks don't exist in Groovy
  • Lambdas aren't part of the Groovy parser

Plus there's probably a few others

tim_yates
  • 167,322
  • 27
  • 342
  • 338