[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-users] null thisJoinPointStaticPart when advising constructor execution
|
Can you tell me what kind of constructors lead to that being null? A
simple (complete) program that fails would be great. This program:
---
aspect Test {
public static void main(String []argv) {
new C();
}
pointcut methodUnderTestExecution1() :
(execution(* *(..)) || execution(new(..))) && !within(Test);
before(): methodUnderTestExecution1() {
Object sig = thisJoinPointStaticPart.getSignature();
System.out.println(sig);
}
}
class C { }
---
works fine and prints C().
cheers
Andy
On 18 March 2010 13:09, Hagai Cibulski <hagaic@xxxxxxxxx> wrote:
> Hi All!
>
> Could use some help here…
>
>
>
> I'm tracing methods execution stemming from JUnit tests using AspectJ, using
> the following pointcut:
>
> pointcut methodUnderTestExecution() :
>
> execution(* *(..))
>
> && mutFilter();
>
>
>
> before(): methodUnderTestExecution() {
>
> Signature sig = thisJoinPointStaticPart.getSignature();
>
> …
>
> So far, that works fine!
>
>
>
> However, when trying to add constructor execution to the pointcut, I get
> some unexpected behaviors:
>
>
>
> pointcut methodUnderTestExecution1() :
>
> (execution(* *(..)) || execution(new(..)))
>
> && mutFilter();
>
>
>
> before(): methodUnderTestExecution1() {
>
> Signature sig = thisJoinPointStaticPart.getSignature();
>
> // thisJoinPointStaticPart == null L
>
> …
>
>
>
> For some constructors in the application under test the advice causes
> NullPointerException because thisJoinPointStaticPart == null
>
>
>
> Anyone?
>
>
>
>
>
> Thanks,
>
> Hagai
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>