[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] InterType: introducing serialVersionUID into @Persistable

#: Tomasz Nazar changed the world a bit at a time by saying on 9/19/2005 12:38 PM :#
On the next beautiful day: Mon, 19 September, 2005, Alexandru Popescu wrote:

Thanks for quick answer, but..

According to www.eclipse.org/aspectj/doc/next/adk15notebook/annotations-itds.html an annotation type cannot be the target of an inter-type declaration. What you need is to push your ITD on an type annotated with @Persistable.

I've seen this doc, and wondering why that's the case. Basically it is possible having some inter-types using marker interfaces.

So you probably need a marker interface and than do the ITD:
interface PersistenceAware {};
declare parents @Persistable * implements java.io.Serializable;
declare parents @Persistable * implements PersistenceAware;

static final PersistenceAware.serialVersionUID = 17L;

1) Both "static" and "final" fields doesn't work with _interface_ (compiler error)

because any field declared/defined in an interface is already static final ;-).

2) The problem with above (when applying inter-type field to an
_interface_) is that as a result I have other field than

@Persistable Pojo.class:
public class Pojo implements java.io.Serializable, PersistenceAware
    public long ajc$interField$MyAspect$PersistenceAware$serialVersionUID;
    //..and I need simple public final _static_ serialVersionUID...

I guess this naming is used to avoid any colissions. But I am not sure if this is correct, as you will be completely unable to access it. Or am I missing something here?

3) When applying to a concrete _class_ with:
@Persistable Pojo.class:
public class Pojo implements java.io.Serializable
    static final PojoConcrete.serialVersionUID = 17L;
    //it works, but I don't want the pointcut based on a concrete


same as above. not sure what to say. guys?