Using InstanceGenerator, only the last annotation on an interface method is inherited no matter how many there are
delocalizer opened this issue · 1 comments
delocalizer commented
e.g. if interface has this:
@RdfProperty(":wasDerivedFrom") @OneToMany(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST, CascadeType.MERGE}) public Collection getWasDerivedFrom();
Then implementation has only OneToMany
annotation, not RdfProperty
:
groovy:000> for (Object m:generatedImpl.class.getMethods()) { println "${m.name}\t${m.getAnnotations()}" } getWasGeneratedBy [@javax.persistence.OneToMany(targetEntity=void, cascade=[PERSIST, MERGE], fetch=LAZY, mappedBy=, orphanRemoval=false)]
delocalizer commented
I tracked down the cause to InstanceGenerator#inheritAnnotations
use of setAnnotation()
inside iteration over the original annotations; it should be addAnnotation()