I am working on my Groovy validators.
I think I found a way to get them to work with immutable objects. They are actually pseudo-immutable. I do not prevent subclassing. The fields are not final; the setters can be called, but nothing happens. Also, it only works with the Map constructor.
I did it all with Java annotations. I tried doing some AST transformation. That is a few hours of my life I will not get back.
I will work on it for a few more days, and perhaps announce it on the Groovy mailing list. Perhaps someone will help with AST transformation.
The Groovy website is being changed. Perhaps the new website will go into more detail about AST.
Image from “Sacra Parallela (florilège damascénien)”, a 9th century manuscript housed at the Bibliothèque nationale de France. Source gallica.bnf.fr / BnF; image assumed allowed under Fair Use.