1
1
/*
2
- * Copyright 2002-2017 the original author or authors.
2
+ * Copyright 2002-2018 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
33
33
import org .springframework .util .Assert ;
34
34
35
35
/**
36
- * Implementation of AspectJ ProceedingJoinPoint interface
37
- * wrapping an AOP Alliance MethodInvocation.
36
+ * An implementation of the AspectJ {@link ProceedingJoinPoint} interface
37
+ * wrapping an AOP Alliance {@link org.aopalliance.intercept. MethodInvocation} .
38
38
*
39
- * <p><b>Note</b>: the {@code getThis()} method returns the current Spring AOP proxy.
39
+ * <p><b>Note</b>: The {@code getThis()} method returns the current Spring AOP proxy.
40
40
* The {@code getTarget()} method returns the current Spring AOP target (which may be
41
- * {@code null} if there is no target), and is a plain POJO without any advice.
42
- * <b>If you want to call the object and have the advice take effect, use
43
- * {@code getThis()}.</b> A common example is casting the object to an
44
- * introduced interface in the implementation of an introduction.
45
- *
46
- * <p>Of course there is no such distinction between target and proxy in AspectJ.
41
+ * {@code null} if there is no target instance) as a plain POJO without any advice.
42
+ * <b>If you want to call the object and have the advice take effect, use {@code getThis()}.</b>
43
+ * A common example is casting the object to an introduced interface in the implementation of
44
+ * an introduction. There is no such distinction between target and proxy in AspectJ itself.
47
45
*
48
46
* @author Rod Johnson
49
47
* @author Juergen Hoeller
@@ -58,7 +56,7 @@ public class MethodInvocationProceedingJoinPoint implements ProceedingJoinPoint,
58
56
private final ProxyMethodInvocation methodInvocation ;
59
57
60
58
@ Nullable
61
- private Object [] defensiveCopyOfArgs ;
59
+ private Object [] args ;
62
60
63
61
/** Lazily initialized signature object */
64
62
@ Nullable
@@ -79,6 +77,7 @@ public MethodInvocationProceedingJoinPoint(ProxyMethodInvocation methodInvocatio
79
77
this .methodInvocation = methodInvocation ;
80
78
}
81
79
80
+
82
81
@ Override
83
82
public void set$AroundClosure (AroundClosure aroundClosure ) {
84
83
throw new UnsupportedOperationException ();
@@ -120,20 +119,18 @@ public Object getTarget() {
120
119
121
120
@ Override
122
121
public Object [] getArgs () {
123
- if (this .defensiveCopyOfArgs == null ) {
124
- Object [] argsSource = this .methodInvocation .getArguments ();
125
- this .defensiveCopyOfArgs = new Object [argsSource .length ];
126
- System .arraycopy (argsSource , 0 , this .defensiveCopyOfArgs , 0 , argsSource .length );
122
+ if (this .args == null ) {
123
+ this .args = this .methodInvocation .getArguments ().clone ();
127
124
}
128
- return this .defensiveCopyOfArgs ;
125
+ return this .args ;
129
126
}
130
127
131
128
@ Override
132
129
public Signature getSignature () {
133
130
if (this .signature == null ) {
134
131
this .signature = new MethodSignatureImpl ();
135
132
}
136
- return signature ;
133
+ return this . signature ;
137
134
}
138
135
139
136
@ Override
0 commit comments