3 ms·
How do you identify the executed code? I don't even know how to start. You cannot single-step into it from the annotation, nor can you select the annotation, "g
by moring 3y ago
How do you identify the executed code? I don't even know how to start. You cannot single-step into it from the annotation, nor can you select the annotation, "go to definition" and see the code. You can "find usages" for the annotation which gives you a lot of places that may or may not be the code that gets executed.
Imagine I'm looking at a class that is annotated. What is the next step to find the code that gets executed for the annotations?
- stcroixx 3y agoLook at the annotation classes code? That’s how I do it. It can’t be anywhere else.
- ivan_gammel 3y ago1. Download the source code of the framework (one click in IDE) 2. “Find usages” on annotation/annotation properties leads you to init stage, where metamodel is usually built 3. “Find usages” on metamodel classes leads you to the implementation of the behavior defined by annotation 4. Run your code with the breakpoint inside the annotated code. Check the stack trace at the breakpoint, look at the methods and fields of the framework classes in it to validate your understanding of how it works from step 3. The RetentionPolicy.SOURCE annotations are handled by an annotation processor at compile time, so it is a bit different, but the general idea is the same.