Lines 13-18
Link Here
|
13 |
|
13 |
|
14 |
package org.aspectj.runtime.reflect; |
14 |
package org.aspectj.runtime.reflect; |
15 |
|
15 |
|
|
|
16 |
import java.util.Stack; |
17 |
|
16 |
import org.aspectj.lang.JoinPoint; |
18 |
import org.aspectj.lang.JoinPoint; |
17 |
import org.aspectj.lang.ProceedingJoinPoint; |
19 |
import org.aspectj.lang.ProceedingJoinPoint; |
18 |
import org.aspectj.lang.Signature; |
20 |
import org.aspectj.lang.Signature; |
Lines 135-164
Link Here
|
135 |
} |
137 |
} |
136 |
|
138 |
|
137 |
// To proceed we need a closure to proceed on |
139 |
// To proceed we need a closure to proceed on |
138 |
private AroundClosure arc; |
140 |
private Stack<AroundClosure> arcs = new Stack(); |
139 |
|
141 |
|
140 |
public void set$AroundClosure(AroundClosure arc) { |
142 |
public void set$AroundClosure(AroundClosure arc) { |
141 |
this.arc = arc; |
143 |
// If arc is null this is the 'unset' |
|
|
144 |
if (arc==null) { |
145 |
this.arcs.pop(); |
146 |
} else { |
147 |
this.arcs.push(arc); |
148 |
} |
142 |
} |
149 |
} |
143 |
|
150 |
|
144 |
public Object proceed() throws Throwable { |
151 |
public Object proceed() throws Throwable { |
145 |
// when called from a before advice, but be a no-op |
152 |
// when called from a before advice, but be a no-op |
146 |
if (arc == null) |
153 |
if (arcs.isEmpty()) |
147 |
return null; |
154 |
return null; |
148 |
else |
155 |
else |
149 |
return arc.run(arc.getState()); |
156 |
return arcs.peek().run(arcs.peek().getState()); |
150 |
} |
157 |
} |
151 |
|
158 |
|
152 |
public Object proceed(Object[] adviceBindings) throws Throwable { |
159 |
public Object proceed(Object[] adviceBindings) throws Throwable { |
153 |
// when called from a before advice, but be a no-op |
160 |
// when called from a before advice, but be a no-op |
154 |
if (arc == null) |
161 |
if (arcs.isEmpty()) |
155 |
return null; |
162 |
return null; |
156 |
else { |
163 |
else { |
157 |
|
164 |
|
158 |
// Based on the bit flags in the AroundClosure we can determine what to |
165 |
// Based on the bit flags in the AroundClosure we can determine what to |
159 |
// expect in the adviceBindings array. We may or may not be expecting |
166 |
// expect in the adviceBindings array. We may or may not be expecting |
160 |
// the first value to be a new this or a new target... (see pr126167) |
167 |
// the first value to be a new this or a new target... (see pr126167) |
161 |
int flags = arc.getFlags(); |
168 |
int flags = arcs.peek().getFlags(); |
162 |
boolean unset = (flags & 0x100000) != 0; |
169 |
boolean unset = (flags & 0x100000) != 0; |
163 |
boolean thisTargetTheSame = (flags & 0x010000) != 0; |
170 |
boolean thisTargetTheSame = (flags & 0x010000) != 0; |
164 |
boolean hasThis = (flags & 0x001000) != 0; |
171 |
boolean hasThis = (flags & 0x001000) != 0; |
Lines 167-173
Link Here
|
167 |
boolean bindsTarget = (flags & 0x000001) != 0; |
174 |
boolean bindsTarget = (flags & 0x000001) != 0; |
168 |
|
175 |
|
169 |
// state is always consistent with caller?,callee?,formals...,jp |
176 |
// state is always consistent with caller?,callee?,formals...,jp |
170 |
Object[] state = arc.getState(); |
177 |
Object[] state = arcs.peek().getState(); |
171 |
|
178 |
|
172 |
// these next two numbers can differ because some join points have a this and |
179 |
// these next two numbers can differ because some join points have a this and |
173 |
// target that are the same (eg. call) - and yet you can bind this and target |
180 |
// target that are the same (eg. call) - and yet you can bind this and target |
Lines 218-224
Link Here
|
218 |
// state[i] = adviceBindings[formalIndex]; |
225 |
// state[i] = adviceBindings[formalIndex]; |
219 |
// } |
226 |
// } |
220 |
// } |
227 |
// } |
221 |
return arc.run(state); |
228 |
return arcs.peek().run(state); |
222 |
} |
229 |
} |
223 |
} |
230 |
} |
224 |
|
231 |
|