From: aclement Date: Wed, 10 Jan 2007 16:10:56 +0000 (+0000) Subject: test and fix for 168063 - incorrectly tagging a field as transient X-Git-Tag: Root_extensions~52 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=d0650f0835a1830584fcb79f405286c8a6357d47;p=aspectj.git test and fix for 168063 - incorrectly tagging a field as transient --- diff --git a/tests/bugs160/pr168063/A.java b/tests/bugs160/pr168063/A.java new file mode 100644 index 000000000..c4831ff9d --- /dev/null +++ b/tests/bugs160/pr168063/A.java @@ -0,0 +1,40 @@ +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.Serializable; + + +public class A { + public static void main(String[] args) throws Exception { + A obj1 = new A(); + + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + ObjectOutputStream oos = new ObjectOutputStream(baos); + oos.writeObject(obj1); + oos.close(); + byte[] data = baos.toByteArray(); + + ByteArrayInputStream bais = new ByteArrayInputStream(data); + ObjectInputStream ois = new ObjectInputStream(bais); + Object o = ois.readObject(); + + int before = ((Persistable)obj1).getPersistableId(); + int after = ((Persistable)o).getPersistableId(); + if (before!=after) + System.out.println("The data was lost! before="+before+" after="+after); + else + System.out.println("It worked, data preserved!"); + } +} + +interface Persistable extends Serializable { + abstract public int getPersistableId(); +} + +aspect PersistableImpl { + declare parents: A extends Persistable; + + final public int Persistable.persistableId = 42; + public int Persistable.getPersistableId() { return persistableId; } +} diff --git a/tests/features152/synthetic/TheWholeShow.aj b/tests/features152/synthetic/TheWholeShow.aj index 0fa1c6642..bd91561c7 100644 --- a/tests/features152/synthetic/TheWholeShow.aj +++ b/tests/features152/synthetic/TheWholeShow.aj @@ -11,7 +11,7 @@ public class TheWholeShow { public static void main(String[] args) { Field[] twsFields = TheWholeShow.class.getDeclaredFields(); for (Field f : twsFields) { - if (!f.getName().equals("f") && !f.getName().equals("x")) { + if (!f.getName().equals("f") && !f.getName().equals("x") && !f.getName().startsWith("ajc$interField$")) { if (!f.isSynthetic()) { System.err.println("Found non-synthetic field: " + f.getName()); throw new IllegalStateException("Found non-synthetic field: " + f.getName()); diff --git a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml index 1ca3b4b59..cac283505 100644 --- a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml +++ b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml @@ -84,7 +84,7 @@ - + @@ -117,7 +117,7 @@ - + diff --git a/tests/src/org/aspectj/systemtest/ajc160/Ajc160Tests.java b/tests/src/org/aspectj/systemtest/ajc160/Ajc160Tests.java index adc134330..980b1e601 100644 --- a/tests/src/org/aspectj/systemtest/ajc160/Ajc160Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc160/Ajc160Tests.java @@ -21,6 +21,7 @@ import junit.framework.Test; */ public class Ajc160Tests extends org.aspectj.testing.XMLBasedAjcTestCase { + public void testIncorrectlyMarkingFieldTransient_pr168063() { runTest("incorrectly marking field transient");} public void testInheritedAnnotations_pr169706() { runTest("inherited annotations");} public void testGenericFieldNPE_pr165885() { runTest("generic field npe");} public void testIncorrectOptimizationOfIstore_pr166084() { runTest("incorrect optimization of istore"); } diff --git a/tests/src/org/aspectj/systemtest/ajc160/ajc160.xml b/tests/src/org/aspectj/systemtest/ajc160/ajc160.xml index a83215452..fcb85ea0e 100644 --- a/tests/src/org/aspectj/systemtest/ajc160/ajc160.xml +++ b/tests/src/org/aspectj/systemtest/ajc160/ajc160.xml @@ -16,6 +16,15 @@ + + + + + + + + +