aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authoraclement <aclement>2007-01-10 16:10:56 +0000
committeraclement <aclement>2007-01-10 16:10:56 +0000
commitd0650f0835a1830584fcb79f405286c8a6357d47 (patch)
treeb8e792d3fbcc6c6d11e0bd990d06d0f526b8db02 /tests
parent18535100f9d21aea94134defd298fc277b06ee57 (diff)
downloadaspectj-d0650f0835a1830584fcb79f405286c8a6357d47.tar.gz
aspectj-d0650f0835a1830584fcb79f405286c8a6357d47.zip
test and fix for 168063 - incorrectly tagging a field as transient
Diffstat (limited to 'tests')
-rw-r--r--tests/bugs160/pr168063/A.java40
-rw-r--r--tests/features152/synthetic/TheWholeShow.aj2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/ajc150.xml4
-rw-r--r--tests/src/org/aspectj/systemtest/ajc160/Ajc160Tests.java1
-rw-r--r--tests/src/org/aspectj/systemtest/ajc160/ajc160.xml9
5 files changed, 53 insertions, 3 deletions
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 @@
<run class="Declaration1">
<stdout>
<line text="public java.lang.String Test.firstProperty has annotation:true"/>
- <line text="public transient java.lang.String Test.ajc$interField$Declaration1$TestInterface$secondProperty has annotation:true"/>
+ <line text="public java.lang.String Test.ajc$interField$Declaration1$TestInterface$secondProperty has annotation:true"/>
</stdout>
</run>
</ajc-test>
@@ -117,7 +117,7 @@
<run class="Declaration2">
<stdout>
<line text="public java.lang.String Test.firstProperty has annotation:true"/>
- <line text="public transient java.lang.String Test.ajc$interField$Declaration2$TestInterface$secondProperty has annotation:true"/>
+ <line text="public java.lang.String Test.ajc$interField$Declaration2$TestInterface$secondProperty has annotation:true"/>
</stdout>
</run>
</ajc-test>
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 @@
</compile>
</ajc-test>
+ <ajc-test dir="bugs160/pr168063" title="incorrectly marking field transient">
+ <compile files="A.java"/>
+ <run class="A">
+ <stdout>
+ <line text="It worked, data preserved!"/>
+ </stdout>
+ </run>
+ </ajc-test>
+
<ajc-test dir="bugs160/pr166084" title="incorrect optimization of istore">
<compile files="X.java" inpath="simple.jar"/>
<run class="Simple"/>