Make factory method search algorithm used for `@MethodSource` reusable
There are two aspects I would like to reuse of the MethodSource annotation mechanism:
- the logic to find a suiting method (implemented in MethodArgumentsProvider.findMethod)
- The tooling support associated with it -- intellij allows to jump to the method, include it in references etc. (see https://github.com/JetBrains/intellij-community/blob/master/plugins/junit/src/com/intellij/execution/junit/references/JUnitReferenceContributor.kt)
Deliverables
- [ ] for point 1: make MethodArgumentsProvider.findMethod re-usable
- [ ] for point 2:
- [ ] introduce a marker Annotation which specifies (as contract) that the
valueof the annotation represents method references - [ ] annotate MethodSource with this annotation (the intellij junit plugin could then base it's implementation on the marker annotation)
- [ ] introduce a marker Annotation which specifies (as contract) that the
I'm curious about your concrete use case. Could you please share a few more details?
I provide an own annotation which is like MethodSource but has a different implementation. I currently copy part of junits implementation: https://github.com/tegonal/minimalist/blob/feature/generators/src/main/kotlin/com/tegonal/minimalist/providers/ArgsArgumentProvider.kt#L138
@sbrannen Seeing that you renamed the issue, I am particularly interested in point 2 because I can copy the implementation but I cannot introduce a marker annotation and annotate MethodSource with it. Put differently, that's the more important part for my use case.
~~I can also create a separate issue if you prefer to split the two aspects.~~ => I wasn't aware of the @Language annotation (org.intellij.lang.annotations.Language) which solves my issue for intellij mostly.