The following two articles briefly explain the implementation principles of annotations in JAVA, which are relatively easy to understand. You can try to implement a simple demo;
Understand custom annotations in an hour
Understand the Annotation Processor Tool in an hour
Android APT (compile-time code generation) best practices