Skip to main content

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

I'm afraid you can't do that then, AspectJ won't let you.  The
composition mechanism is the reweaving strategy I talked about.
Applying the second aspect causes us to revert to the original code
and apply both aspects together.  Reweaving has downsides - code bloat
(although the diff is compressed) and other tools can modify the
bytecode before the reweave and damage AspectJs ability to apply the
diff.  But I have not had the time to look at the alternatives like
recognizing what other aspects did and ignoring their join points for
a subsequent weave.

cheers,
Andy

2009/6/16 tauseef rana <tauseefrana@xxxxxxxxx>:
> Hi,
> I am doing a research to find out the composition mechanism in aspectj.
> Reweaving is the thing I donot want.
> I want to reuse my composite in step 1 (weaved result from a class and an
> aspect) for further weaving, that means in step2 i want to weave the result
> of step 1 with another aspect and so on.
>
> Regards
> Tauseef
>
> On Tue, Jun 16, 2009 at 4:21 PM, Andy Clement <andrew.clement@xxxxxxxxx>
> wrote:
>>
>> 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
>> >
>> >
>> _______________________________________________
>> aspectj-dev mailing list
>> aspectj-dev@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/aspectj-dev
>
>
> _______________________________________________
> aspectj-dev mailing list
> aspectj-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-dev
>
>


Back to the top