diff --git a/spring-aop/src/main/java/org/springframework/aop/ProxyMethodInvocation.java b/spring-aop/src/main/java/org/springframework/aop/ProxyMethodInvocation.java index d6f929f8a66..a85fba986e1 100644 --- a/spring-aop/src/main/java/org/springframework/aop/ProxyMethodInvocation.java +++ b/spring-aop/src/main/java/org/springframework/aop/ProxyMethodInvocation.java @@ -58,14 +58,14 @@ public interface ProxyMethodInvocation extends MethodInvocation { * @return an invocable clone of this invocation. * {@code proceed()} can be called once per clone. */ - MethodInvocation invocableClone(Object... arguments); + MethodInvocation invocableClone(@Nullable Object... arguments); /** * Set the arguments to be used on subsequent invocations in the any advice * in this chain. * @param arguments the argument array */ - void setArguments(Object... arguments); + void setArguments(@Nullable Object... arguments); /** * Add the specified user attribute with the given value to this invocation. diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/AopProxyUtils.java b/spring-aop/src/main/java/org/springframework/aop/framework/AopProxyUtils.java index 7967fef25eb..92af3267334 100644 --- a/spring-aop/src/main/java/org/springframework/aop/framework/AopProxyUtils.java +++ b/spring-aop/src/main/java/org/springframework/aop/framework/AopProxyUtils.java @@ -253,7 +253,7 @@ public abstract class AopProxyUtils { * @return a cloned argument array, or the original if no adaptation is needed * @since 4.2.3 */ - static Object[] adaptArgumentsIfNecessary(Method method, Object @Nullable [] arguments) { + static @Nullable Object[] adaptArgumentsIfNecessary(Method method, @Nullable Object[] arguments) { if (ObjectUtils.isEmpty(arguments)) { return new Object[0]; } diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/ReflectiveMethodInvocation.java b/spring-aop/src/main/java/org/springframework/aop/framework/ReflectiveMethodInvocation.java index e4158ee852f..1e640e4ac57 100644 --- a/spring-aop/src/main/java/org/springframework/aop/framework/ReflectiveMethodInvocation.java +++ b/spring-aop/src/main/java/org/springframework/aop/framework/ReflectiveMethodInvocation.java @@ -67,7 +67,7 @@ public class ReflectiveMethodInvocation implements ProxyMethodInvocation, Clonea protected final Method method; - protected Object[] arguments; + protected @Nullable Object[] arguments; private final @Nullable Class targetClass; @@ -103,7 +103,7 @@ public class ReflectiveMethodInvocation implements ProxyMethodInvocation, Clonea * but would complicate the code. And it would work only for static pointcuts. */ protected ReflectiveMethodInvocation( - Object proxy, @Nullable Object target, Method method, Object @Nullable [] arguments, + Object proxy, @Nullable Object target, Method method, @Nullable Object[] arguments, @Nullable Class targetClass, List interceptorsAndDynamicMethodMatchers) { this.proxy = proxy; @@ -141,12 +141,13 @@ public class ReflectiveMethodInvocation implements ProxyMethodInvocation, Clonea } @Override - public final Object[] getArguments() { + public final @Nullable Object[] getArguments() { return this.arguments; } @Override - public void setArguments(Object... arguments) { + @SuppressWarnings("NullAway") // https://github.com/uber/NullAway/issues/1113 + public void setArguments(@Nullable Object... arguments) { this.arguments = arguments; } @@ -218,7 +219,8 @@ public class ReflectiveMethodInvocation implements ProxyMethodInvocation, Clonea * @see java.lang.Object#clone() */ @Override - public MethodInvocation invocableClone(Object... arguments) { + @SuppressWarnings("NullAway") // https://github.com/uber/NullAway/issues/1113 + public MethodInvocation invocableClone(@Nullable Object... arguments) { // Force initialization of the user attributes Map, // for having a shared Map reference in the clone. if (this.userAttributes == null) { diff --git a/spring-aop/src/main/java/org/springframework/aop/support/AopUtils.java b/spring-aop/src/main/java/org/springframework/aop/support/AopUtils.java index f6fa3424156..d27f4b66c32 100644 --- a/spring-aop/src/main/java/org/springframework/aop/support/AopUtils.java +++ b/spring-aop/src/main/java/org/springframework/aop/support/AopUtils.java @@ -347,7 +347,7 @@ public abstract class AopUtils { * @throws Throwable if thrown by the target method * @throws org.springframework.aop.AopInvocationException in case of a reflection error */ - public static @Nullable Object invokeJoinpointUsingReflection(@Nullable Object target, Method method, Object[] args) + public static @Nullable Object invokeJoinpointUsingReflection(@Nullable Object target, Method method, @Nullable Object[] args) throws Throwable { // Use reflection to invoke the method. @@ -377,7 +377,7 @@ public abstract class AopUtils { */ private static class KotlinDelegate { - public static Object invokeSuspendingFunction(Method method, @Nullable Object target, Object... args) { + public static Object invokeSuspendingFunction(Method method, @Nullable Object target, @Nullable Object... args) { Continuation continuation = (Continuation) args[args.length -1]; Assert.state(continuation != null, "No Continuation available"); CoroutineContext context = continuation.getContext().minusKey(Job.Key);