The question is already in the title, and this is a less specific version of the question that I asked earlier :
How do you write an annotation in java that adds a default constructor to a class?
There is a project that is already doing this: http://projectlombok.org/
Technically, you need to connect to the Java compiler. Compiling Java code is done in stages: first, all sources are collected. Then the parser creates the AST. The code generation phase then turns the AST into a byte code.
, AST , . AST, .
: http://notatube.blogspot.com/2010/11/project-lombok-trick-explained.html
, Lombok AST, .
, , , AFAIK.
Lombok - , AFAIK.
https://blogs.oracle.com/darcy/entry/properties_via_annotation_processing