Refine null-safety in the spring-aop module

See gh-34154
This commit is contained in:
Sébastien Deleuze 2024-12-26 15:30:59 +01:00
parent 9516d9b822
commit 4fa33dfece
2 changed files with 4 additions and 4 deletions

View File

@ -570,7 +570,7 @@ public abstract class AbstractAspectJAdvice implements Advice, AspectJPrecedence
for (PointcutParameter parameter : parameterBindings) { for (PointcutParameter parameter : parameterBindings) {
String name = parameter.getName(); String name = parameter.getName();
Integer index = this.argumentBindings.get(name); Integer index = this.argumentBindings.get(name);
Assert.notNull(index, "Index must not be null"); Assert.state(index != null, "Index must not be null");
adviceInvocationArgs[index] = parameter.getBinding(); adviceInvocationArgs[index] = parameter.getBinding();
numBound++; numBound++;
} }
@ -578,14 +578,14 @@ public abstract class AbstractAspectJAdvice implements Advice, AspectJPrecedence
// binding from returning clause // binding from returning clause
if (this.returningName != null) { if (this.returningName != null) {
Integer index = this.argumentBindings.get(this.returningName); Integer index = this.argumentBindings.get(this.returningName);
Assert.notNull(index, "Index must not be null"); Assert.state(index != null, "Index must not be null");
adviceInvocationArgs[index] = returnValue; adviceInvocationArgs[index] = returnValue;
numBound++; numBound++;
} }
// binding from thrown exception // binding from thrown exception
if (this.throwingName != null) { if (this.throwingName != null) {
Integer index = this.argumentBindings.get(this.throwingName); Integer index = this.argumentBindings.get(this.throwingName);
Assert.notNull(index, "Index must not be null"); Assert.state(index != null, "Index must not be null");
adviceInvocationArgs[index] = ex; adviceInvocationArgs[index] = ex;
numBound++; numBound++;
} }

View File

@ -157,7 +157,7 @@ public class BeanFactoryAspectJAdvisorsBuilder {
} }
else { else {
MetadataAwareAspectInstanceFactory factory = this.aspectFactoryCache.get(aspectName); MetadataAwareAspectInstanceFactory factory = this.aspectFactoryCache.get(aspectName);
Assert.notNull(factory, "Factory must not be null"); Assert.state(factory != null, "Factory must not be null");
advisors.addAll(this.advisorFactory.getAdvisors(factory)); advisors.addAll(this.advisorFactory.getAdvisors(factory));
} }
} }