Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] type pattern matching


Thanks for your patience.

<on matching patterns with wildcards against type names>
I'm not sure why you'd say we're matching suffixes or prefixes
rather than the fully-qualified type name.

See https://bugs.eclipse.org/bugs/show_bug.cgi?id=73073

Type pattern "A*" matches fully qualified name "ShadowingAndAccess.Aspect.A", and it seemed to me A* actually
matched the suffix A.

It might be that matching with wildcards also takes the current
scope into account. However, if that were true, adding a * to
a pattern can never stop it matching. This is however what happens
in the following program:

------------------------------------------
import test2.A.*;
aspect X{
    // replace B* by B to get a match
    pointcut pc() : call(* B*.foo(..));
    after () : pc() {
        System.out.println("matched");
    }
}
------------------------------------------
package test2;
public class A {
    B b= new B();
    public class B {
      public void foo() {}
    }
    public static void main(String[] args) {
      new A().b.foo();
    }
}
-------------------------------------------

I'd be most grateful for an explanation that includes both examples.

First you wanted type patterns
to behave like method/field patterns, and now you want method-call
declaring type patterns to behave like method-execution declaring
type patterns.

Just to be clear, I never said I wanted anything; I'm merely asking
what the intended meaning is, just in case ajc doesn't exactly
implement that meaning. Probably I'm just not reading the docs
carefully enough!





Back to the top