pholser/junit-quickcheck

Allow creating sub-annotation from @Property

Closed this issue · 5 comments

We have a case in which we would like to be able to do:
@Property(trials = 1) public @interface GeneratedData { }
but we can't since @Property doesn't allow Target.ANNOTATION_TYPE

@pholser I have a quick fix for it if you would add me to the contributors.

@walkowl Thanks for your interest in junit-quickcheck!

Is your fix in any way related to #173 or #170? In those, I'm proposing to allow meta-annotation search for @Property and other annotations. It sounds like you may be asking only for marking @Property with Target.ANNOTATION_TYPE. That would be only a prerequisite for what I'm proposing to do with the other GH issues.

Let me know how you'd like to proceed. Thanks!

Thanks for a quick reply.

Marking @Property with Target.ANNOTATION_TYPE is exactly what I was planning to do but after looking at the #173 I think it is not currently supported anyway (only one level of annotations)? We can close this issue as a duplicate of #173 and I'm happy to work on it (add the ANNOTATION_TYPE and support the annotation tree). Does it make sense?

@walkowl If you're interested in putting together a pull request for these changes, I'm all for it!

My initial thought was that when looking for annotations on property parameters, property methods, etc., junit-quickcheck should find meta-present annotations if no annotations are directly present or present on the element. I considered bringing in junit-platform-commons 1.3 (or whatever is most recent release) as a dependency, to leverage its AnnotationUtils. That also would allow junit-quickcheck's annotation searching to mirror more closely how JUnit 5 will find annotations.

Closing -- will address under #173.