Hello.
Yesterday I started working on this issue (sorry for the delay BTW, had to meet some hard deadlines at work) and I ran into a problem with the GemGenerator.
There are already Gems defined for javax.xml.bind.annotation.XmlElementDecl.class and javax.xml.bind.annotation.XmlElementRef.class like this:
@GemDefinition(XmlElementDecl.class)
@GemDefinition(XmlElementRef.class)
as they are used in the XmlElementDeclSelector that is used to select which method from the [usually] ObjectFactory should be used (otherwise compilation fails with the ambiguous mapping methods found error). So I (naively) assumed that I need to add another two @GemDefinitions to the GemGenerator - jakarta.xml.bind.annotation.XmlElementDecl.class and jakarta.xml.bind.annotation.XmlElementRef.class, so I can create XmlElementDeclSelector for Jakarta and so on. And so I (naively) tried, like this:
@GemDefinition(javax.xml.bind.annotation.XmlElementDecl.class)
@GemDefinition(javax.xml.bind.annotation.XmlElementRef.class)
@GemDefinition(jakarta.xml.bind.annotation.XmlElementDecl.class)
@GemDefinition(jakarta.xml.bind.annotation.XmlElementRef.class)
The problem is, is that GemProcessor generates Gems based on a type's simple name, so naturally when I try to define two Gems for two annotations that have the same name, even though they are from different packages, conflict arises, and such attempt ends up in a compilation error. More precisely:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project mapstruct-processor: Compilation failure: Compilation failure:
[ERROR] java.lang.IllegalStateException: javax.annotation.processing.FilerException: Attempt to recreate a file for type org.mapstruct.ap.internal.gem.XmlElementDeclGem
I'm a bit stuck on the implementation due to this issue. So I would like to ask if you could give me some advice or a hint on how I could solve this problem? Maybe I'm approaching the problem or the implementation in the wrong way?
(Tagging @filiphr, @sjaakd and @Zegveld as currently the most active core team members (as per my understanding).)
Thank you and please forgive me for bothering you.