AST

Abstract Syntax Tree transformations in Groovy.

Groovy Advanced AST Transforms – Part 2 with 10+ Examples

Groovy advanced AST transforms beyond @ToString and @Canonical. Part 2 covers @TupleConstructor, @MapConstructor, @Delegate, @Memoized, @AutoClone, @Sortable, @Newify, and combining multiple transforms. “The best boilerplate is the boilerplate you never write. AST transformations are your compiler doing your chores.” Dierk König, Groovy in Action Last Updated: March 2026 | Tested on: Groovy 5.x, Java 17+ | Difficulty: Intermediate | Reading Time: 20 minutes This is Part 2 of our AST transformations series. Part 1 covered the essentials – @ToString, @EqualsAndHashCode, ... Read More

Groovy Compilation Lifecycle – 10+ Tested Examples

The Groovy compilation lifecycle involves 9 distinct phases. Explore all of them with 12 tested examples covering GroovyClassLoader, CompilationUnit, AST transform hooks, script vs class compilation, and joint Java-Groovy compilation. “Understanding how the compiler thinks is the difference between fighting the language and flowing with it – every advanced Groovy technique traces back to knowing what happens between source code and bytecode.” Dierk König, Groovy in Action Last Updated: March 2026 | Tested on: Groovy 5.x, Java 17+ | Difficulty: ... Read More

Groovy Custom Annotations – Create Your Own with 10 Tested Examples

Groovy custom annotations are versatile. See 10 tested examples covering annotation declaration, retention policies, AST transformations, and runtime processing. “Annotations are metadata that give your code a voice – they tell the compiler, the runtime, and other developers what your intentions are without cluttering your logic.” Joshua Bloch, Effective Java Last Updated: March 2026 | Tested on: Groovy 4.x / 5.x, Java 11+ | Difficulty: Advanced | Reading Time: 18 minutes Groovy ships with a rich set of built-in annotations ... Read More