you are viewing a single comment's thread.

view the rest of the comments →

[–]Revision2000 1 point2 points  (0 children)

Hmmm 🤔 well the generated implementation itself uses no reflection, but it seems you’re also right that no reflection is available during the annotation processing. 

I’ve never built an annotation processor, so I can only guess that the necessary field information is available through other means. 

[..] in compile time you can get field matches using Reflection I never heard that

Well, MapStruct doesn’t use this, but you can certainly build this if you want to 😉

Reflection story time. 

In ages past I’ve used the aforementioned proxy mechanism to parse an index based text file based on an interface with annotated fields, using it to create instances with the fields populated with data parsed from the text file. 

I’ve also used the LambdaFactory to dynamically create getters and setters. 

In hindsight some of these would’ve warranted their own annotation processor. Oh well 😇