Rename exception variables in empty catch blocks

The Spring codebase sometimes ignores exceptions in catch blocks on
purpose. This is often called out by an inline comment.
We should make this more obvious by renaming the exception argument in
the catch block to declare whether the exception is "ignored" or
"expected".

See gh-35047

Signed-off-by: Vincent Potucek <vpotucek@me.com>
[brian.clozel@broadcom.com: rework commit message]
Signed-off-by: Brian Clozel <brian.clozel@broadcom.com>
This commit is contained in:
Vincent Potucek
2025-06-13 16:03:24 +02:00
committed by Brian Clozel
parent cd3ac44fb0
commit 0d4dfb6c1f
46 changed files with 66 additions and 108 deletions

View File

@@ -453,9 +453,9 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
ClassUtils.toClassArray(ifcs), targetClass.getClassLoader());
targetMethod = ClassUtils.getMostSpecificMethod(targetMethod, compositeInterface);
}
catch (IllegalArgumentException ex) {
// Implemented interfaces probably expose conflicting method signatures...
// Proceed with original target method.
// Implemented interfaces probably expose conflicting method signatures...
// Proceed with original target method.
catch (IllegalArgumentException ignored) {
}
}
}
@@ -478,7 +478,7 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
try {
shadowMatch = pointcutExpression.matchesMethodExecution(methodToMatch);
}
catch (ReflectionWorldException ex) {
catch (ReflectionWorldException ignored) {
// Failed to introspect target method, probably because it has been loaded
// in a special ClassLoader. Let's try the declaring ClassLoader instead...
try {
@@ -501,7 +501,7 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
try {
shadowMatch = pointcutExpression.matchesMethodExecution(methodToMatch);
}
catch (ReflectionWorldException ex) {
catch (ReflectionWorldException ignored) {
// Could neither introspect the target class nor the proxy class ->
// let's try the original method's declaring class before we give up...
try {