[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: FW: [asm] Fwd: [aspectj-dev] Extension of ASM to SupportAspectJAttributes?
|
abc does not, at present, support separate compilation for aspects.
It does do weaving into class files, but once an aspect is compiled,
all the aspect-specific info is gone.
abc uses the polyglot parser generator ppg (a java-cup derivative)
for parsing source.
On Mon, 25 Apr 2005, Alexandre Vasseur wrote:
> In the AW 2 container, we were using sort of a toString - thus using
> bcel to read it back, and then parsing it again using our own JavaCC
> based parser in our own AST.
>
> Does ABC accepts binary formed aspects compiled with AspectJ ? If not,
> then it means ABC is just parsing the source code representation into
> their own represention based on their own (Sable parser based ?) AST.
>
> Alex
>
> On 4/25/05, Ron Bodkin <rbodkin@xxxxxxxxxxxxxx> wrote:
> > Fair enough. Alex's subsequent summary that the AjAttribute contains
> > serialized AST representations is a good one (from some inspection). While
> > this may well be the most efficient format, it certainly couples the
> > attribute spec. to the AJ implementation, which makes it less likely as a
> > possible standard for storing aspect information in bytecode.
> >
> > Alex & Jonas, how much of this did you tackle in supporting AspectJ weaving
> > in the AW 2.0 weaving container? I wonder how abc handles this.
> >
> > -----Original Message-----
> > From: aspectj-dev-bounces@xxxxxxxxxxx
> > [mailto:aspectj-dev-bounces@xxxxxxxxxxx] On Behalf Of Adrian Colyer
> > Sent: Monday, April 25, 2005 1:34 AM
> > To: AspectJ developer discussions
> > Subject: Re: FW: [asm] Fwd: [aspectj-dev] Extension of ASM to
> > SupportAspectJAttributes?
> >
> > Yep, the very most accurate kind of all. See the AjAttribute.read method in
> > org.aspectj.weaver.AjAttribute. The doc is completely up-to-date if a
> > little verbose :)
> >
> > 24 April 2005 19:10
> > To: "'AspectJ developer discussions'" <aspectj-dev@xxxxxxxxxxx>
> > cc:
> > From: "Ron Bodkin" <rbodkin@xxxxxxxxxxxxxx>
> > Subject: FW: [asm] Fwd: [aspectj-dev] Extension of ASM to Support
> > AspectJAttributes?
> >
> > Back to AspectJ-dev... Is there any documentation out there for the format
> > of AspectJ byte code attributes?
> >
> > -----Original Message-----
> > From: Eugene Kuleshov [mailto:eu@xxxxxxxxxx]
> > Sent: Sunday, April 24, 2005 11:04 AM
> > To: Ron Bodkin
> > Cc: Eugene Kuleshov; Alexandre Vasseur; asm@xxxxxxxxxxxxx; Chris Nokleberg;
> > BRUNETON Eric RD-MAPS-GRE
> > Subject: Re: [asm] Fwd: [aspectj-dev] Extension of ASM to Support
> > AspectJAttributes?
> >
> > Ron,
> >
> > I see...
> >
> > I don't mind to put this attribute to the list of default ASM
> > attributes, unless Eric have objections for that.
> >
> > Do you have format specs for this attribute or maybe ASM-based
> > implementation? :-)
> >
> > regards,
> > Eugene
> >
> > Ron Bodkin wrote:
> > > It seems to me that AspectJ support would benefit other users of ASM. Re:
> > the attribute format it dates back to 2001 so the annotation attributes
> > didn't exist. If they did you could debate whether they'd be appropriate
> > for
> > use by a language extension.
> > > -----Original Message-----
> > > From: Eugene Kuleshov <eu@xxxxxxxx>
> > > Date: Sun, 24 Apr 2005 08:26:29
> > > To:Alexandre Vasseur <avasseur@xxxxxxxxx>
> > > Cc:"asm@xxxxxxxxxxxxx" <asm@xxxxxxxxxxxxx>, Ron Bodkin
> > <rbodkin@xxxxxxxxxxxxxx>, Chris Nokleberg <chris@xxxxxxxxxxx>
> > > Subject: Re: [asm] Fwd: [aspectj-dev] Extension of ASM to Support AspectJ
> > > Attributes?
> > >
> > > Alexandre Vasseur wrote:
> > >
> > > Maybe the best approach would be to add an option to JarJar tool to
> > > specify custom attributes (e.g. list of additional classes and put these
> > > classes in a classpath). This way you can plug in any additional
> > > attributes to JarJar.
> > >
> > > By the way, I wonder why AspectJ didn't use standard annotation
> > > attibutes and needed a proprietory AjAtrribute?
> > >
> > > regards,
> > > Eugene
> > >
> > >
> > >
> > >>I am forwarding here an interesting use-case around JarJar, and a
> > >>request regarding ASM thingies to read AspectJ custom attribute
> > >>(AjAtrribute) coming from Ron - initially on AspectJ mailing list
> > >>Alex
> > >>
> > >>---------- Forwarded message ----------
> > >>From: Ron Bodkin <rbodkin@xxxxxxxxxxxxxx>
> > >>Date: Apr 24, 2005 3:25 AM
> > >>Subject: [aspectj-dev] Extension of ASM to Support AspectJ Attributes?
> > >>To: AspectJ developer discussions <aspectj-dev@xxxxxxxxxxx>
> > >>
> > >>
> > >>Hi All,
> > >>
> > >>Does anyone have an extension to Objectweb's ASM library that defines the
> > >>bytecode attributes that AspectJ attributes use? It looks like this would
> > be
> > >>relatively easy to write, as long as you know the format for these
> > >>attributes. you would just define subclasses of Attribute that understand
> > >>how to parse the AspectJ-specific attributes.
> > >>
> > >>I ask because I've been trying to use a tool, "jar jar links", which lets
> > >>you rename packages in dependent jars (e.g., mapping
> > >>org.apache.commons.logging to org.myprod.foo.commons.logging) and collect
> > >>the result as a single jar. This uses asm to parse & emit the classes,
> > >>transforming any packages it encounters. Jar jar's home page is
> > >>http://tonicsystems.com/products/jarjar/ (it can be hard to Google for,
> > as
> > >>you can imagine!)
> > >>
> > >>I wrote a little aspect that patches asm to not choke on unknown
> > attributes
> > >>and to just emit them unchanged. This lets you jarjar up a project with
> > >>AspectJ aspects as long as you don't need library aspects or to reweave
> > any
> > >>aspects (since it doesn't know how to fix up the types inside AspectJ
> > >>pointcut attributes). It would also be nice to contribute a more
> > >>maintainable version of the enhancement to be included in jarjar, since
> > this
> > >>use of AspectJ to patch asm is expedient but dubious as an improvement in
> > >>modularity and the project is probably not going to adopt AspectJ for
> > this
> > >>purpose.
> > >>
> > >>Here's the aspect I'm currently using:
> > >>
> > >>import org.objectweb.asm.Attribute;
> > >>import org.objectweb.asm.ByteVector;
> > >>import org.objectweb.asm.ClassReader;
> > >>import org.objectweb.asm.Label;
> > >>
> > >>public privileged aspect PatchClassWriter {
> > >>
> > >> pointcut checkingAttr() :
> > >> call(boolean Attribute.isUnknown()) && within(Attribute);
> > >>
> > >> // bypass attribute checks
> > >> boolean around() : checkingAttr() {
> > >> //System.out.println("checkAttr");
> > >> return false;
> > >> }
> > >>
> > >> // store the content for unknown attributes
> > >> private byte[] Attribute.content;
> > >>
> > >> // match names for 2.0 RC1 and the apparently refactored version
> > in
> > >>cvs head
> > >> pointcut inRead() :
> > >> execution(Attribute ClassReader.a(..)) ||
> > >> execution(Attribute ClassReader.readAttribute (..));
> > >>
> > >> // replace the read method in ClassReader
> > >> Attribute around(ClassReader cr, Attribute[] attrs, String type,
> > int
> > >>off, int len, char[] buf, int codeOff, Label[] labels) :
> > >> inRead() && args(attrs, type, off,len,buf,codeOff,labels) &&
> > >>this(cr) {
> > >> //System.out.println("in read attr for"+cr);
> > >> for (int i = 0; i < attrs.length; ++i) {
> > >> if (attrs[i].type.equals(type)) {
> > >> return attrs[i].read(cr, off, len, buf,
> > >>codeOff, labels);
> > >> }
> > >> }
> > >>
> > >> //System.out.println("storing attribute data for "+cr);
> > >> Attribute res = new Attribute(type);
> > >> res.content = new byte[len];
> > >> System.arraycopy(cr.b, off, res.content, 0, len);
> > >>
> > >> return res;
> > >> }
> > >>
> > >> // output the stored byte array...
> > >> after(Attribute attribute) returning(ByteVector bv) :
> > >> execution(ByteVector write(..)) && within(Attribute) &&
> > >>this(attribute) {
> > >> //System.out.println("reemitting attribute data for
> > >>"+attribute);
> > >> bv.putByteArray(attribute.content, 0,
> > attribute.content.length);
> > >> }
> > >>
> > >> //declare warning: checkingAttr(): "check attr";
> > >> //declare warning: inRead(): "in read";
> > >>
> > >>}
> > >
> > >
> > >
> > > Sent wirelessly via BlackBerry from T-Mobile.
> >
> > _______________________________________________
> > 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
> >
> _______________________________________________
> aspectj-dev mailing list
> aspectj-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-dev
>