Validate afterThrowing method signature in ThrowsAdviceInterceptor#1896
Validate afterThrowing method signature in ThrowsAdviceInterceptor#1896plx927 wants to merge 8 commits intospring-projects:mainfrom
afterThrowing method signature in ThrowsAdviceInterceptor#1896Conversation
|
I've opened SPR-17088 for the |
|
ok, I will continue to find such case to improve framework and try to find a wider-spread solution, thank you for your encouragement! |
|
It's well spotted indeed, thanks for raising it! As for a wider-spread solution, this is in particular about a common exception type that we would raise in case of an unexpected method signature for a reflectively invoked callback in other parts of the framework. I'm not keen on introducing an exception type just for AOP throws advices there. |
|
I got it. Just now, i found there is an |
|
|
|
ok, i am doing it! |
Includes related polishing in the advice interceptor implementations. Issue: SPR-17088
|
@jhoeller this pr need add more commit? |
afterThrowing method signature in ThrowsAdviceInterceptor
I found
MethodAfterAdviceInterceptorimplementsAfterAdvice, so i thinkMethodBeforeAdviceInterceptoralso should implementsBeforeAdviceto indicate that is a BeforeAdvice.Recently when i search spring source code, i found when
ThrowsAdviceInterceptoris constructed, it just found methods which name isafterThrowingand last param is ThrowableSubclass; but sometimes developer may be disorder the 4 param due to careless(eg:afterThrowing( Object[] args, Method method, Object target, ServletException ex)
), now the error only can be found when exception occur, i think framework should be reminder developer in time, when
ThrowsAdviceInterceptoris constructed, if we find he/she write error, we should tell he/she that error occurs as soon as possible.