mapstruct-idea icon indicating copy to clipboard operation
mapstruct-idea copied to clipboard

IntelliJ plugin currently does not support meta annotations

Open Blackbaud-JasonBodnar opened this issue 3 years ago • 1 comments

From a Gitter discussion:

jcbodnar @jcbodnar Aug 04 2021 13:48 Alright, I have an annotation:

@Retention(RetentionPolicy.CLASS) @Mapping(target = "formId", ignore = true) @Mapping(target = "id", expression = "java(java.util.UUID.randomUUID())") @Mapping(source = "order", target = "widgetOrder") public @interface ToWidgetEntity { } When I use it on a mapping method:

@ToWidgetEntity WidgetEntity apiToEntity(Widget source); IntelliJ gives me a warning about Unmapped target properties: id, widgetOrder,

I'm using the latest version of the plugin.

Zegveld @Zegveld Aug 05 2021 05:51 Did some analysis, it seems that if your annotation is in the same file as the mapper it will work as expected. But when it is in a seperate file it suddenly fails to find the mapstruct annotations on the annotation. Might be that the RetentionPolicy of the mapstruct annotations is blocking this usage. Taking a further look.

Zegveld @Zegveld Aug 05 2021 06:03 Ok, here's what I found out: it works if the annotation is inside the same file as the mapper. it works if the annotation is in another module. Failures: it fails if the annotation is inside the same module, but in another file than the mapper.

jcbodnar @jcbodnar Aug 05 2021 09:24 My scenario is #3. I guess I could put it in the same file as the mapper.

Filip Hrisafov @filiphr Aug 07 2021 13:15 @jcbodnar, the IntelliJ plugin currently does not support meta annotations. Can you please create an issue for this?

Blackbaud-JasonBodnar avatar Feb 22 '22 21:02 Blackbaud-JasonBodnar

I moved this to the MapStruct IntelliJ plugin repository since it is related to that

filiphr avatar Apr 07 '22 17:04 filiphr

Closing this in favour of #129

filiphr avatar Apr 25 '23 20:04 filiphr