[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
RE: [aspectj-users] Parameter construction pointcut?
|
> -----Original Message-----
> From: aspectj-users-bounces@xxxxxxxxxxx
> [mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Eric Bodden
> Sent: Wednesday, August 15, 2007 3:54 AM
> To: aspectj-users@xxxxxxxxxxx
> Subject: Re: [aspectj-users] Parameter construction pointcut?
>
> On 13/08/07, Daniels, Troy (US SSA)
> <troy.daniels@xxxxxxxxxxxxxx> wrote:
> > When looking at source code, it should be fairly easy to
> define a cutpoint that ...
>
> Yes, but you cannot consider source code because AspectJ is
> woven in terms of bytecode.
>
I hadn't realized that.
> Consider this:
>
> public static void main(String args[]) {
> String result = doAllTheStuffInTheWorld();
> logger.debug("Result is:" + result);
> System.out.println(result);
> }
>
> In this case, do you not want to execute
> doAllTheStuffInTheWorld(), just because it's result value is
> logged? Makes no sense, does it?
Correct. It's also not relevant to the example that I was talking about. The pointcut that I was discussing would (possibly) prevent the concatenation of "Result is:" and result. doAllTheStuffInTheWorld is outside of the parentheses, so it always gets called. It's only relevant if you rewrite it as
String result;
logger.debug("Result is:" + (result = doAllTheStuffInTheWorld());
(assuming that's valid Java and not just a C construct).
>
> > Speaking with the blissful ignorance of someone totally
> unfamiliar with the AspectJ source, I expect that it would be
> possible to create such a point cut, but it would only work
> for compile-time weaving. If the ApsectJ team is committed
> to having compile-time and run-time weaving be
> interchangeable, that means this type of cutpoint is not doable.
>
> This has nothing to do with compile time vs. load time but
> with bytecode vs. source code.
That does make a significant different. I was assuming that compile-time weaving worked on source code but load time weaving worked on bytecode. If everything works on bytecode, then this is probably not possible.
Troy
>
> Eric
>
> --
> Eric Bodden
> Sable Research Group
> McGill University, Montréal, Canada
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>