Refine spring-aop arguments nullness
See gh-28797
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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];
|
||||
}
|
||||
|
||||
@@ -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<Object> 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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user