Groovy as "Better Java"
Many Groovy frameworks is using this (see, for example Groovy XML handling ), but if I'm writing regular code, I want to see here compilation errors. Finally, Groovy 2.0 provides a feature of strict compilation time checking.
Let's take such class:
It passes a compilation w/o any problem.But if we will add @TypeChecked (this annotation may be used for a class or a method), we will receive compilation errors:
This type checking is turned on automatically also if we are turning on static compilation for the class, using annotation @CompileStatic:
So now I can use Groovy for production code, instead of Java! Full list of compile time messages for @TypeChecked you can see here.
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)