Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] withincode(clinit)

On Tue, 21 Dec 2004, pope wrote:

> [quote Ramnivas Laddad::on 12/21/2004 11:14 AM]
> > How about:
> >
> > withincode(staticinitialization(TypeX))
> >
> > -Ramnivas
> >
>
> I was not sure this is supported :-). I missed this in your excellent
> book. Many thanks.

I don't think it is supported. Certainly doesn't seem to work with ajc
1.2.1.

One possible workaround, depending on whether your static initializer
calls anything else that might match and how much you care about runtime
overhead, would be to use cflow:

cflow(staticinitialization(TypeX))

But remember that this will match in anything the static initializer
calls, too.

cflow(staticinitialization(TypeX)) &&
!cflowbelow(cflow(staticinitialization(TypeX)) && call(* *(..)))

would probably work without this inaccuracy, but at significant runtime
overhead for your entire program because of the need to check the nested
cflow everywhere. I haven't tested it very well either.

Of course, there may be some syntax I hadn't thought of that will do this
properly, or I might have mistyped something while trying out the
withincode(...) thing above with ajc :-)

Cheers,

Ganesh



Back to the top