bindInterceptor(): Throw an exception if method annotated with @MyInterceptor is not interceptable
- Dominant language
- Java
- Stars
- 12.7k
- Forks
- 1.7k
- Avg merge
- 11m
- Merged PRs (30d)
- 2
Description
Sorry, I have to get back to #431.
If I want to intercept methods by a specific method annotation, this annotation will be silently ignored if applied to `private` or `final` methods. This is a major issue. I mean, I'm now writing an annotation processor so we get an error if someone tries to intercept a method that isn't interceptable. That's just unacceptably complex for such a common use case. It's fatal if a Method annotated with e.g. `@IsolatedTransaction` just silently won't be intercepted. It *must* be an error at some point.
It would have been better to provide a method `Matchers.anyInterceptableMethod()` instead of just skipping `final` and `private` methods to allow using `Matchers.any()`. But, oh well, probably a lot of code now uses `Matchers.any()`.
So, another solution would be to add a new `bindInterceptor()` method that applies the matcher to *all* methods, including those that can't be intercepted because they're `private` or `final`. Using this method would throw an exception if a matcher matches a method that can't be intercepted.
Contributor guide
Assessment
This issue has not been assessed yet.