Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Formal language specification

Hey Adrian,

From: "Adrian Powell" <aspectj-users@xxxxxxxxxxxxxxxx>

> >    I was looking for a document which would formally describe AspectJ
> >language grammar and its expected behaviour but couldn't find anything
like
> >
> >
> Have you looked at the Programmer's Guide off www.eclipse.org/aspectj ?
> Appendix B covers the language semantics in some depth:
>

Yes, I have. I know this guide. Ok, I admit it's not bad but it isn't
complete in my opinion.
I think that the section about context exposure lacks some important
informations.

It doesn't specify what this, target and args pointcuts collect in different
pointcut types
(by pointcut types I mean call, execution, get, set and so on)

I was a little surprised that the following advice was never executed:

after(Object o)  : call(Object+.new()) && target(o) {
    // do something with o
}

It seems that call_constructor pointcut never exposes target object and it
can't be collected by target pointcut.
Unfortunatelly I haven't seen it stated in the guide.

Another thing is collecting args by pointcut which is later used in cflow
pointcut. If that cflow is then matched more than once
in given joinpoint then which args will be exposed?

Example (not very useful in real life but simple):

public class A {
    void doSth() {
    }

    int factor(int x) {
        doSth();
        if (x <= 1) {
            return 1;
       }
        return x * factor(x-1);
    }
    public static void main(String[] args) {
        new A().factor(11);
    }
}


public aspect AAsp {
 pointcut pc(int x) : execution(* A.factor(int)) && args(x);
 before(int x) : execution(* A.doSth()) && cflow(pc(x)) {
  System.out.println(x);
 }
}

After running this example we can see that x value is always taken from the
latest cflow match. However I can't see in specification if it is a feature
and I can rely on it.


I think all such undefined behaviors should be defined :) Shall I report
them in Bugzilla?

Regards,
Luke



Back to the top