Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-users] Use of generics intertypes

Following on from last email.  Is there anyway to pass multiple types as
parameters?

e.g. something like 

aspect Foo<A || B> { .... }

abstract aspect Foo<T> {
   declare parents: T implements Serializable;
}


I'm wanting to achieve 

aspect Foo{
   declare parents: (A || B) implements Serializable;
}


> -----Original Message-----
> From: aspectj-users-bounces@xxxxxxxxxxx [mailto:aspectj-users-
> bounces@xxxxxxxxxxx] On Behalf Of Andy Clement
> Sent: 12 December 2007 10:46
> To: aspectj-users@xxxxxxxxxxx
> Subject: Re: [aspectj-users] Use of generics intertypes
> 
> When i first implemented generics support I didn't think we would be
> able to manage it due to limitations in how we were extending the JDT
> compiler.  But I now believe we can do it - and I would like to at
> some point.
> 
> Andy.
> 
> On 12/12/2007, neil loughran <loughran@xxxxxxxxxxxxxxxx> wrote:
> > Thanks Andy,
> >
> > Is this something planned for the future?
> >
> > Cheers
> > Neil
> >
> > > -----Original Message-----
> > > From: aspectj-users-bounces@xxxxxxxxxxx [mailto:aspectj-users-
> > > bounces@xxxxxxxxxxx] On Behalf Of Andy Clement
> > > Sent: 12 December 2007 10:36
> > > To: aspectj-users@xxxxxxxxxxx
> > > Subject: Re: [aspectj-users] Use of generics intertypes
> > >
> > > > Cannot make inter-type declarations on type variables, use an
> interface
> > > and
> > > > declare parents public void T.setName() { }
> > >
> > > you cannot (currently) make itds on type variables like this:
> > >
> > > >     public void T.setName() {... } // error
> > >
> > > but you can:
> > >
> > > interface Marker {}
> > >
> > > public void Marker.setName { ... }
> > >
> > > declare parents:  T implements Marker;
> > >
> > > But you need to be careful in this area, it does still have a few bugs
> > > I'm afraid...
> > >
> > > Andy.
> > >
> > >
> > > On 12/12/2007, neil loughran <loughran@xxxxxxxxxxxxxxxx> wrote:
> > > > Folks,
> > > >
> > > > I'm investigating the usage of generics in AspectJ and I am really
> > > liking
> > > > how it is implemented.  However, one problem I've come across is
> that of
> > > > generic introductions.
> > > >
> > > > For example, given the abstract aspect below
> > > >
> > > > abstract aspect Foo<T,S> {
> > > >
> > > >     declare parents: T implements Serializable;
> > > >     declare parents: S implements Serializable;
> > > >
> > > >     public void T.setName() {... } // error
> > > >
> > > > }
> > > >
> > > > And the concrete aspect
> > > >
> > > > aspect Test extends Foo<Person,Student> {
> > > >
> > > > }
> > > >
> > > > I get the following error:
> > > >
> > > > Cannot make inter-type declarations on type variables, use an
> interface
> > > and
> > > > declare parents public void T.setName() { }
> > > >
> > > >
> > > > But I'm not entirely sure what this means.  Can anyone advise
> (sic)...?
> > > I'm
> > > > unsure why my original code doesn't work.
> > > >
> > > > Regards
> > > > Neil Loughran
> > > >
> > > >
> > > >
> > > >
> > > > _______________________________________________
> > > > aspectj-users mailing list
> > > > aspectj-users@xxxxxxxxxxx
> > > > https://dev.eclipse.org/mailman/listinfo/aspectj-users
> > > >
> > > _______________________________________________
> > > aspectj-users mailing list
> > > aspectj-users@xxxxxxxxxxx
> > > https://dev.eclipse.org/mailman/listinfo/aspectj-users
> >
> > _______________________________________________
> > aspectj-users mailing list
> > aspectj-users@xxxxxxxxxxx
> > https://dev.eclipse.org/mailman/listinfo/aspectj-users
> >
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users



Back to the top