1
1
/*
2
- * Copyright 2002-2015 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.
32
32
import org .springframework .util .Assert ;
33
33
34
34
/**
35
- * Implementation of AspectJ ProceedingJoinPoint interface
36
- * wrapping an AOP Alliance MethodInvocation.
35
+ * An implementation of the AspectJ {@link ProceedingJoinPoint} interface
36
+ * wrapping an AOP Alliance {@link org.aopalliance.intercept. MethodInvocation} .
37
37
*
38
- * <p><b>Note</b>: the {@code getThis()} method returns the current Spring AOP proxy.
38
+ * <p><b>Note</b>: The {@code getThis()} method returns the current Spring AOP proxy.
39
39
* The {@code getTarget()} method returns the current Spring AOP target (which may be
40
- * {@code null} if there is no target), and is a plain POJO without any advice.
41
- * <b>If you want to call the object and have the advice take effect, use
42
- * {@code getThis()}.</b> A common example is casting the object to an
43
- * introduced interface in the implementation of an introduction.
44
- *
45
- * <p>Of course there is no such distinction between target and proxy in AspectJ.
40
+ * {@code null} if there is no target instance) as a plain POJO without any advice.
41
+ * <b>If you want to call the object and have the advice take effect, use {@code getThis()}.</b>
42
+ * A common example is casting the object to an introduced interface in the implementation of
43
+ * an introduction. There is no such distinction between target and proxy in AspectJ itself.
46
44
*
47
45
* @author Rod Johnson
48
46
* @author Juergen Hoeller
@@ -56,7 +54,7 @@ public class MethodInvocationProceedingJoinPoint implements ProceedingJoinPoint,
56
54
57
55
private final ProxyMethodInvocation methodInvocation ;
58
56
59
- private Object [] defensiveCopyOfArgs ;
57
+ private Object [] args ;
60
58
61
59
/** Lazily initialized signature object */
62
60
private Signature signature ;
@@ -75,6 +73,7 @@ public MethodInvocationProceedingJoinPoint(ProxyMethodInvocation methodInvocatio
75
73
this .methodInvocation = methodInvocation ;
76
74
}
77
75
76
+
78
77
@ Override
79
78
public void set$AroundClosure (AroundClosure aroundClosure ) {
80
79
throw new UnsupportedOperationException ();
@@ -115,20 +114,18 @@ public Object getTarget() {
115
114
116
115
@ Override
117
116
public Object [] getArgs () {
118
- if (this .defensiveCopyOfArgs == null ) {
119
- Object [] argsSource = this .methodInvocation .getArguments ();
120
- this .defensiveCopyOfArgs = new Object [argsSource .length ];
121
- System .arraycopy (argsSource , 0 , this .defensiveCopyOfArgs , 0 , argsSource .length );
117
+ if (this .args == null ) {
118
+ this .args = this .methodInvocation .getArguments ().clone ();
122
119
}
123
- return this .defensiveCopyOfArgs ;
120
+ return this .args ;
124
121
}
125
122
126
123
@ Override
127
124
public Signature getSignature () {
128
125
if (this .signature == null ) {
129
126
this .signature = new MethodSignatureImpl ();
130
127
}
131
- return signature ;
128
+ return this . signature ;
132
129
}
133
130
134
131
@ Override
0 commit comments