Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Another intertype declaration question

You should file this as a documentation bug (search if there 
is an existing bug already).

For old style/auto-generated code, I think the new style
should serve just as well.

Old style:
aspect MyAspect {
    public String (Point || Line || Square).getName() { 
        return name; 
    }
}

can be ported to new stule as follows:
New style:
aspect MyAspect {
    private static interface Figure {
    }
 
    declare parent: Point || Line || Square implements Figure;

    public String Figure.getName() { 
        return name; 
    }
}

I think the reason for this change was implementation issues
(but I don't recall it completely; it must be somewhere in 
old archives).

-Ramnivas

--- Charles Zhang <czhang@xxxxxxxxxxxxxxxx> wrote:
> Thanks. I guess the programming guide needs to be updated. Can this
> be
> reported as a bug?
> BTW, the old style is very nice to supporting aspects in
> auto-generated
> code. I wonder why they took it off. Performance reasons?
> 
> Charles
> 
> On Thu, 5 Feb 2004, Ramnivas Laddad wrote:
> 
> > That was true in 1.0.
> >
> > In 1.1, this is no longer supported. Even in 1.0, the
> > suggested idiom was the prefered way.
> >
> > See:
> >
>
http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/aspectj-home/doc/README-11.html#SINGLE_INTERCLASS_TARGET
> >
> > -Ramnivas
> >
> > --- Charles Zhang <czhang@xxxxxxxxxxxxxxxx> wrote:
> > > But according to the programming guide,
> > > One declaration can introduce several elements in several classes
> as
> > > well.
> > > For example,
> > >
> > >   public String (Point || Line || Square).getName()  { return
> name; }
> > >
> > > Does this mean something else? Thanks.
> > >
> > > Charles
> > >
> > > On Wed, 4 Feb 2004, Ramnivas Laddad wrote:
> > >
> > > > No, it won't work. You need to try something like the
> following:
> > > >
> > > > interface Cl {
> > > > }
> > > >
> > > > declare parents: (Cla || Cla2) implements Cl;
> > > >
> > > > int Cl.print(){
> > > >     throw new RuntimeException();
> > > > }
> > > >
> > > > -Ramnivas
> > > >
> > > > --- Charles Zhang <czhang@xxxxxxxxxxxxxxxx> wrote:
> > > > > Does this work?
> > > > > int (Cla || Cla2).print(){
> > > > > 	throw new RuntimeException();
> > > > > }
> > > > > I have two dummy classes, Cla and Cla2. Compiler says
> > > > > /home/czhang/eclipse/workspace/Test/Test.java:16 Syntax error
> on
> > > > > token
> > > > > "(", "around", "aspect", "privileged", "pointcut", "before",
> > > "after",
> > > > > "declare", "Identifier" expected
> > > > > int (Cla || Cla2).print()
> > > > >     ^
> > > > >
> > > > > Charles
> > > >
> > > >
> > > > =====
> > > > Ramnivas Laddad,
> > > > Author, AspectJ in Action
> > > > http://www.manning.com/laddad
> > > > http://www.amazon.com/exec/obidos/ASIN/1930110936
> > > >
> > > > Check out my aspect-oriented refactoring articles:
> > > > http://tinyurl.com/yqm96
> > > > http://tinyurl.com/288nn
> > > >
> > > > __________________________________
> > > > Do you Yahoo!?
> > > > Yahoo! Finance: Get your refund fast by filing online.
> > > > http://taxes.yahoo.com/filing.html
> > > > _______________________________________________
> > > > aspectj-users mailing list
> > > > aspectj-users@xxxxxxxxxxx
> > > > http://dev.eclipse.org/mailman/listinfo/aspectj-users
> > > >
> > > _______________________________________________
> > > aspectj-users mailing list
> > > aspectj-users@xxxxxxxxxxx
> > > http://dev.eclipse.org/mailman/listinfo/aspectj-users
> >
> >
> > __________________________________
> > Do you Yahoo!?
> > Yahoo! Finance: Get your refund fast by filing online.
> > http://taxes.yahoo.com/filing.html
> > _______________________________________________
> > aspectj-users mailing list
> > aspectj-users@xxxxxxxxxxx
> > http://dev.eclipse.org/mailman/listinfo/aspectj-users
> >
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/aspectj-users


__________________________________
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html


Back to the top