Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-dev] weaving in steps

Applying additional aspects to a class uses a process called reweaving.

Based on these two observations:
- Undoing the effect of a previous aspect is complicated.
- Recognizing and doing the right thing for all the new join points
that the original aspect has introduced via the bytecode
infrastructure that makes advice and ITDs work is very messy.

Reweaving then stores a compressed diff in the class file describing
how to get back to the original class file.  When you attempt to
'reweave' with a new aspect, we apply the diff, go back to the
original class file and apply your new aspect plus any aspects
previously applied (they were stored as a list in the class file).

So your step 1 will apply asp1.
Your step2 will go back to the original and apply asp1 and asp2
Your step3 will go back to the original and apply asp1, asp2 and asp3.

There is nothing special you have to do, the reweaving process is all
handled for you, but you must make sure the original aspects that
applied to the class are still around for the weaver to find and
reapply.

Something like this sequence:

ajc Asp1.aj Foo.java -d bin
ajc -inpath bin Asp2.aj -d bin2
ajc -inpath bin2 Asp3.aj -d bin3

> In donot want to weave asp1 and asp2 in step 2, and similarly I donot want
> to weave asp1, asp2 and asp3 in step3. How can  I do that?

>From that, it sounds like reweaving might not be what you want - can
you explain why you don't want the aspects rewoven during steps 2 and
3.  Are you purely thinking from a performance point of view?

Andy

2009/6/16 tauseef rana <tauseefrana@xxxxxxxxx>:
> Hi,
>
> I have a java application class (add.java) and three aspects (asp1.aj,
> asp2.aj and asp3.aj). I want to weave all aspects in to the add class in
> steps and not all in one step. For example;
>
> Step1: weave asp1 to add class
> Step2: weave asp2 to the result class (the weaved class) of  step1.
> Step3: weave asp3 to the result class (the weaved class) of step2
>
> In donot want to weave asp1 and asp2 in step 2, and similarly I donot want
> to weave asp1, asp2 and asp3 in step3. How can  I do that?
>
> Regards
> Tauseef
>
> _______________________________________________
> aspectj-dev mailing list
> aspectj-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-dev
>
>


Back to the top