Today I realized what we (or may be just I) live in very strange world. Let me describe why.
I work now on problem of making GORM domain classes accessible in GWT client-side code. It is an interesting task by itself and I plan to dedicate several separated posts to it but in general it is very simple. I want to define my server data objects in Groovy and be able to request them in from client-side code without coding too much.
What I realized debugging my code is how many different compilers, generators and even instrumenters involved in run of my one single test.
- Javac. I use it to compile Java part of my generator and the test to be run by JUnit.
- Groovyc. Most interesting part of my generator is written on Groovy
- BTW, compilation of unit tests in GWT involves generation of client-side part of the test. It’s a long story, which I will probably need to blog separately later. For now we just notice one more generation step.
- My generator use Groovy compiler to parse Groovy sources of domain classes. Main task for the generator is to create client-side twins for domain classes and make them serializable.
- Of course, serialization may not happen for free. Fortunately GWT provide default generator, which takes care for generation such code for java source, generated by me.
- Again, just for record we should notice that my generator not only written on Groovy but also depends on Groovy runtime, which does some code instrumentation in magical GroovyClassLoader.
- There is one more thing, which I am afraid to speak about. GORM uses Hibernate and Spring. How many code generation and instrumentation used inside? God knows.
- I know only that even GORM iteself uses some to access Hibernate and Spring.
That’t it. But something is wrong in this world, isn’t it?