Since the principles of generative programming apply to other languages as well, why use Java? One could argue that Java is not particularly well suited to code generation. After all, C++ has built-in support for code generation with macros and templates. Scripting languages like Perl are very good with string operations and might be better suited for writing generators. Despite these valid objections, Java is particularly suited to GP for five reasons:
High quality type information acts as a valuable implicit specification document.
Flexible class loading supports any combination of binding times and binding modes.
Java source files are simple to read and generate.
Java bytecode files are simple to read and generate. ...