Summary of Join Point Matching
Prev | Chapter 1. Join Point Signatures | Next

## Summary of Join Point Matching

A join point has potentially multiple signatures, but only one set of modifiers. A kinded primitive pointcut matches a particular join point if and only if:

1. They are of the same kind
2. The signature pattern (exactly) matches at least one signature of the join point
3. The modifiers pattern matches the modifiers of the subject of the join point

Given the hierarchy

            interface Q {
              R m(String s);
            }

            class P implements Q {
              @Foo
              public R m(String s) {...}
            }

            class S extends P {
              @Bar
              public R' m(String s) {...}
            }

            class T extends S {}

and the program fragment:

            P p = new P();
            S s = new S();
            T t = new T();
            ...
            p.m("hello");
            s.m("hello");
            t.m("hello");

The the pointcut `call(@Foo R P.m(String))` matches the call `p.m("hello")` since both the signature and the modifiers match. It does not match the call `s.m("hello")` because even though the signature pattern matches one of the signatures of the join point, the modifiers pattern does not match the modifiers of the method m in S which is the static target of the call.

The pointcut `call(R' m(String))` matches the calls `t.m("hello")` and `s.m("hello")`. It does not match the call `p.m("hello")` since the signature pattern does not match any signature for the call join point of m in P.

Prev | Home | Next
Join Point Modifiers | Up | Chapter 2. Annotations