Java / MapStruct Java Interview questions part 2
Explain the internal working of MapStruct's annotation processing?
MapStruct is built on the standard Java annotation processing API (JSR 269), which lets a library plug into javac's compilation rounds before bytecode is produced.
Because this happens through the compiler's own type-checking APIs rather than loading classes at runtime, the processor can see generics, inherited properties, and type hierarchies precisely as the compiler understands them, which is why mismatches are reported as ordinary compiler diagnostics tied to the exact line and property involved.
Once the generated source is compiled, the processor's job is done - there is no MapStruct code left running inside the application at all.
More Related questions...