It became interesting to me, but with the help of what can I generate code in methods, describing what to generate with annotations?
For example, there is the Lombok library, which generates code, depending on annotations. There is the @NonNull annotation, which is applied like this:
void method(@NonNull Object arg) {} And it generates a check, something like:
if (arg == null) throw new NullPointerException(); But, having rummaged in the source code of the library, I realized that I did not understand anything.
Actually the question is: how is it possible to generate code by taking any fields of a class / method at the compilation stage?