I experimented with putting the annotations into a different directory that has nothing but annotations.
Even though the annotations are only referenced by their use in persistent classes, the DataNucleus enhancer still wants to enhance them. [ERROR] Failed to execute goal org.apache.jdo:jdo-exectck:3.2-SNAPSHOT:enhance (default) on project jdo-tck: Execution default of goal org.apache.jdo:jdo-exectck:3.2-SNAPSHOT:enhance failed: Class "org.apache.jdo.tck.pc.compositeAnnotation.DatastoreIdDiscriminatorClassNameInheritanceSuperclass" has been specified with an inheritance strategy of "superclass-table", yet no superclass exists or none exists with its own table! -> [Help 1] So it looks like we will need to change DataNucleus enhancer in order for these tests to work. Craig > On Jul 20, 2017, at 12:03 PM, Craig Russell <apache....@gmail.com> wrote: > > Hi Andy, > > It looks like the DN enhancer recognizes the annotation as a > persistence-capable class because it is annotated with PersistenceCapable but > doesn't recognize it as an annotation that should not be enhanced. > > I looked at the code and think that perhaps a patch like this would fix it. > org.datanucleus.enhancer.ClassEnhancerImpl around line 298 after the cls > object is obtained: > > if (cls.isAnnotation()) > { > return false; > } > > Other possible solutions: move the composite annotations out of the package > into a sibling package. This probably works but is awkward. > > We could try to remove the annotation classes from the list of classes to > enhance, but this would really slow things down by needing to get the class > object from the class names even though it isn't really needed for anything > else. > > Thanks, > > Craig > >> On Jul 19, 2017, at 5:46 PM, Craig Russell <apache....@gmail.com> wrote: >> >> Hi, >> >> I'm trying to run the tck including this composite annotation: >> >> @Target(ElementType.TYPE) >> @Retention(RetentionPolicy.RUNTIME) >> @javax.jdo.annotations.PersistenceCapable(detachable="true", >> identityType=IdentityType.DATASTORE) >> @javax.jdo.annotations.DatastoreIdentity(strategy=IdGeneratorStrategy.IDENTITY, >> column="DATASTORE_IDENTITY") >> @javax.jdo.annotations.Discriminator(strategy=DiscriminatorStrategy.CLASS_NAME, >> column="DISCRIMINATOR", indexed="true") >> @javax.jdo.annotations.Inheritance(strategy=InheritanceStrategy.SUPERCLASS_TABLE) >> >> public @interface DatastoreIdDiscriminatorClassNameInheritanceSuperclass { } >> >> When I run the enhancement step, it complains: >> >> Failed to execute goal org.apache.jdo:jdo-exectck:3.2-SNAPSHOT:enhance >> (default) on project jdo-tck: Execution default of goal >> org.apache.jdo:jdo-exectck:3.2-SNAPSHOT:enhance failed: Class >> "org.apache.jdo.tck.pc.companyAnnotatedFC.DatastoreIdDiscriminatorClassNameInheritanceSuperclass" >> has been specified with an inheritance strategy of "superclass-table", yet >> no superclass exists or none exists with its own table! -> [Help 1] >> >> It looks like the enhancer is trying to enhance this class, but it should >> not. An annotation cannot be persistent so it should not be enhanced. >> >> Any ideas? >> >> Thanks, >> >> Craig >> >> Craig L Russell >> c...@apache.org >> > > Craig L Russell > Secretary, Apache Software Foundation > c...@apache.org http://db.apache.org/jdo > Craig L Russell Secretary, Apache Software Foundation c...@apache.org http://db.apache.org/jdo