Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] inter-type declaration of a field variable is not serialized using Java 5 Annotations

Are you on an up to date version of AspectJ that came out since that
fix went in?  If you are then please reopen the bug and attach your
new testcase.

cheers
Andy.

On 23/01/2008, Guillaume Lasnier <guillaume.lasnier@xxxxxxxxxxx> wrote:
>
>
>
>
>             Hi,
>
> I am running into the same problem described here :
> http://dev.eclipse.org/mhonarc/lists/aspectj-users/msg07308.html.
>
>
>
> Except I use the @Annotations style. I wrote an example taken from
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=168063
>
>
>
> I have the following interface :
>
>
>
> public interface IPersistable extends Serializable {
>
>
>
>     int getId();
>
>
>
>     void setId(int id);
>
>
>
> }
>
>
>
> And the following aspect :
>
> @Aspect
>
> public class Persistability {
>
>
>
>     static class Persistable implements IPersistable {
>
>
>
>         private int id;
>
>
>
>         public Persistable() {
>
>             super();
>
>         }
>
>
>
>         public int getId() {
>
>             return id;
>
>         }
>
>
>
>         public void setId(int id) {
>
>             this.id = id;
>
>         }
>
>
>
>     }
>
>
>
>     @DeclareParents(value = "PersistabilityTest", defaultImpl =
> Persistable.class)
>
>     private IPersistable observable;
>
>
>
>     /**
>
>      *
>
>      * @param bean
>
>      */
>
>     @Pointcut("initialization(IPersistable.new(..)) && this(bean) &&
> !this(Persistable)")
>
>     void init(IPersistable bean) {
>
>     }
>
>
>
>     /**
>
>      * @param bean
>
>      */
>
>     @Before("init(bean)")
>
>     public void beforeInit(IPersistable bean) {
>
>         bean.setId(System.identityHashCode(bean));
>
>     }
>
>
>
> }
>
>
>
> And the Test :
>
> public class PersistabilityTest {
>
>
>
>     @Test
>
>     public void testSerialization() throws Exception {
>
>
>
>         PersistabilityTest persistabilityTest1 = new PersistabilityTest();
>
>         ByteArrayOutputStream bos = new ByteArrayOutputStream();
>
>         ObjectOutputStream oos = new ObjectOutputStream(bos);
>
>
>
>         oos.writeObject(persistabilityTest1);
>
>
>
>         ByteArrayInputStream bis = new
> ByteArrayInputStream(bos.toByteArray());
>
>         ObjectInputStream ois = new ObjectInputStream(bis);
>
>
>
>         PersistabilityTest persistabilityTest2 = (PersistabilityTest)
> ois.readObject();
>
>
>
>         Assert.assertTrue(persistabilityTest1 instanceof IPersistable);
>
>
>
>         Assert.assertTrue(persistabilityTest2 instanceof IPersistable);
>
>         System.out.println("persistabilityTest2 is Persistable id=" +
> ((IPersistable) persistabilityTest2).getId());
>
>
>
>         Assert.assertEquals(((IPersistable) persistabilityTest1).getId(),
> ((IPersistable) persistabilityTest2).getId());
>
>
>
>     }
>
> }
>
>
>
> The test fails at the last line where I expect the id to be equal
>
>
>
> When I look at the decompiled code for PersistabilityTest, the ITD field
> delegate is transient!!
>
>
>
> Do I have to file a bug for this issue?
>
>
>
> Regards
>
>
>
> Guillaume Lasnier • Technical Architecture Team Leader • SunGard • Asset
> Arena • 147 Bureaux de la Colline, Bâtiment E • 92213 Saint-Cloud CEDEX •
> France • Phone: +33 1 55 39 18 74 • Fax: +33 1 55 39 18 01 •
> http://www.sungard.com/assetarena
>
> P Think before you print
>
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>


Back to the top