[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-users] InterType: introducing serialVersionUID into @Persistable
|
On the next beautiful day: Mon, 19 September, 2005, Alexandru Popescu wrote:
> > 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 ;-).
Maybe. But my aim is to introduce "static" and "final" field to some
_class_ marked with an annotation. Tell me how to achieve that and you're
the winner ;)
> > 2) The problem with above (when applying inter-type field to an
> > _interface_) is that as a result I have other field than
> > 'serialVersionUID':
> >
> > @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?
The actual aspect's code:
public privileged aspect MyAspect
{
declare parents: @Persistable * implements PersistenceAware;
public long PersistenceAware.XXX = 17;
}
Resulting (decompiled) @Persistable ManagedPojo.class:
public class ManagedPojo
implements PersistenceAware
{
public long ajc$interField$MyAspect$PersistenceAware$XXX;
public ManagedPojo()
{
MyAspect.ajc$interFieldInit$MyAspect$PersistenceAware$XXX(this);
}
}
======================================================
> > 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
> > //class
> > }
> > Tomasz
>
> same as above. not sure what to say. guys?
> ./alex
The concrete code for that case:
public privileged aspect MyAspect
{
declare parents: @Persistable * implements PersistenceAware;
public long ManagedPojo.XXX = 17;
}
And the resulting (decompiled) @Persistable ManagedPojo.class:
public class ManagedPojo
implements PersistenceAware
{
public ManagedPojo()
{
MyAspect.ajc$interFieldInit$MyAspect$ManagedPojo$XXX(this);
}
public long XXX;
}
XXX <-> serialVersionUID
--
_i______'simplicity_is_the_key'__________tomasz_nazar
_ii____'i_am_concern_oriented'________________PJKM.pl
_iii__'patsystem.sf.net'___________________linux_user
_Heaven_&_Fellows,_PPP______________________prevayler