Re: [abc-users] Weaving Adaptor in abc?

From: Alex Villazon <alex.villazon_at_lu.unisi.ch>
Date: Tue, 7 Oct 2008 19:30:27 +0200

On Oct 7, 2008, at 7:09 PM, Eric Bodden wrote:

> Hi Alex.
>
> I am not one of the original implementers/designers of abc but I will
> try to answer your questions to the best of my knowledge.
>
>> Is there a weaving adaptor similar to AspectJ's WeavingAdaptor
>> enabling
>> easy third party integration of abc?
>
> Not yet but looking at the interface I believe that it should be
> possible to provide such an interface (although that's probably not a
> project that can be completed in a day or two).

Hi Eric,
    That would be great. I agree it will require some additional work.

>
>
>> All we need is something like:
>>
>> byte[] weaveClass(java.lang.String name, byte[] bytes);
>>
>> and probably we could specify the location of the aspect sources (and
>> classpath) in the constructor of the adaptor.. AspectJ's
>> WeavingAdaptor
>> uses by default aspectpath.lst and classpath.lst The first one
>> contains the
>> compiled aspect, and the second the list of jars needed for the
>> weaving.
>
> What is the "bytes" argument good for here? Are the contents of this
> byte array not the same as the ones that one would obtain by loading
> the class given its name using the classpath that was provided in the
> constructor?
>

     Our tool uses a pipeline of transformations. Therefore, the
byte[] bytes could be already different to what is in the classpath.
I think AspectJ's classpath.lst is used to do some analysis during
weaving, so typically rt.jar has to be there, but it's not instrumented.

>> Concerning the limitation of abc to make separate compilation, we
>> could use
>> the following workaround:
>>
>> - compile the aspect with a dummy set of classes, so as to create
>> the
>> compiled aspect (needed by our framework to be loaded).
>> - put the reference to the source of the aspect in the
>> aspectpath.lst
>> (instead of the compiled one as with AspectJ..). This should
>> emulate the
>> -argfile aspectpath.lst
>>
>> What I'm not sure is if the compiled aspect will be the same in
>> both cases
>> (I guess so..)
>
> I think this may actually work. I am reasonably sure that both aspects
> should be the same. There may be issues with inconsistent
> (pseudo-random) method names being generated for the same aspect on
> multiple executions but if this is the case then it could certainly be
> fixed.
>

   Right. I also saw that abc does not use a prefix for advices (as ajc
$ in ajc).... We could adapt that in our tool also.

Many thanks,

Alex

> Eric
>
> --
> Eric Bodden
> Sable Research Group
> McGill University, Montréal, Canada
>
Received on Tue Oct 07 2008 - 18:30:35 BST

This archive was generated by hypermail 2.2.0 : Wed Oct 15 2008 - 17:50:12 BST