~/talk

Metaprogramming With The Groovy Compiler - Part 2 of 2

links:none on file
slides:none on file

Shows how Groovy compile-time metaprogramming uses AST transformations to mutate classes: a magicNumber annotation triggers an AST transform that injects a public method so getMagicNumber returns 42 in the generated .class file, the unit test passes, and Java can call the added method. Demonstrates Grails examples (allowedMethods moved from runtime to compile time, controller actions wrapped with try/catch, domain classes gaining static count), and notes standard transforms like singleton and immutable that modify bytecode at compile time.

AI-written summary · about

  1. 0:00Introduction to talk
  2. 1:46Compile-time metaprogramming overview
  3. 8:10Grails compile-time transformations
  4. 14:36AST transformations explained
  5. 19:56Building a magic number AST
  6. 29:04Testing the AST transformation
  7. 31:14AST transformation limitations
  8. 35:07Bytecode impact and Java interop
  9. 36:10Grails domain class ASTs
  10. 38:16Controller action AST modifications
  11. 41:49AST vs AOP comparison
  12. 44:05Global vs local AST transformations
  13. 46:33Grails framework ASTs
  14. 48:19Built-in Groovy AST transformations
  15. 50:48Takeaways and conclusion
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.