Check that a method signature conforms to a functional interface
- Dominant language
- Java
- Stars
- 7.2k
- Forks
- 820
- Avg merge
- 5h 9m
- Merged PRs (30d)
- 50
Description
It would be useful to have an annotation like `@ConformsTo(Callable.class)` one can use on a method, which error-prone can check at compile time. Making sure that methods intended for use with Streams API as combiners or merge operators have the correct signature one possible use case; verifying signatures for methods intended for reflective use is another (admittedly minor) case.
It's probably best to have a way to indicate our intention about the receiver: `@ConformsTo(statically = AsyncFunction.class)` would be equivalent to `@ConformsTo(AsyncCallable.class)` on an (instance) method with with the signature `ListenableFuture doWork()`.
The annotations above are really straw-man examples; if you think this is worthwhile we can think about better alternatives.
Contributor guide
Assessment
This issue has not been assessed yet.