summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/features151/serialveruid/AnAspect.java5
-rw-r--r--tests/features151/serialveruid/Basic.java19
-rw-r--r--tests/features151/serialveruid/BigHorribleClass.java28
-rw-r--r--tests/src/org/aspectj/systemtest/ajc151/AllTestsAspectJ151.java1
-rw-r--r--tests/src/org/aspectj/systemtest/ajc151/SerialVersionUIDTests.java35
-rw-r--r--tests/src/org/aspectj/systemtest/ajc151/serialversionuid.xml37
6 files changed, 125 insertions, 0 deletions
diff --git a/tests/features151/serialveruid/AnAspect.java b/tests/features151/serialveruid/AnAspect.java
new file mode 100644
index 000000000..eff8137e8
--- /dev/null
+++ b/tests/features151/serialveruid/AnAspect.java
@@ -0,0 +1,5 @@
+aspect AnAspect {
+ before(): staticinitialization(BigHorribleClass) {
+
+ }
+} \ No newline at end of file
diff --git a/tests/features151/serialveruid/Basic.java b/tests/features151/serialveruid/Basic.java
new file mode 100644
index 000000000..f2093d59b
--- /dev/null
+++ b/tests/features151/serialveruid/Basic.java
@@ -0,0 +1,19 @@
+import java.io.Serializable;
+import java.lang.reflect.Field;
+
+public class Basic implements Serializable {
+ public static void main(String[] args) {
+ try {
+ Basic b = (Basic)Basic.class.newInstance();
+ Field f = Basic.class.getDeclaredField("serialVersionUID");
+ long l = f.getLong(b);
+ System.err.println("SerialVersionUID is "+l);
+ } catch (Exception e) {
+ System.err.println("Problem: "+e.toString());
+ }
+ }
+}
+
+aspect X {
+ before(): staticinitialization(Basic) {}
+} \ No newline at end of file
diff --git a/tests/features151/serialveruid/BigHorribleClass.java b/tests/features151/serialveruid/BigHorribleClass.java
new file mode 100644
index 000000000..7668307b2
--- /dev/null
+++ b/tests/features151/serialveruid/BigHorribleClass.java
@@ -0,0 +1,28 @@
+import java.io.Serializable;
+import java.lang.reflect.Field;
+
+public class BigHorribleClass implements Serializable,Comparable {
+ public static void main(String[] args) {
+ try {
+ BigHorribleClass b = (BigHorribleClass)BigHorribleClass.class.newInstance();
+ Field f = BigHorribleClass.class.getDeclaredField("serialVersionUID");
+ long l = f.getLong(b);
+ System.err.println("SerialVersionUID is "+l);
+ } catch (Exception e) {
+ System.err.println("Problem: "+e.toString());
+ }
+ }
+
+ public int anInt;
+
+ public static boolean aBoolean = false;
+
+ public long foo = 376;
+
+ public void m() {}
+ public int compareTo(Object o) { return 0;}
+ public String m2(boolean b,long l, String s) { return "";}
+
+ public static transient short fo2 = 3;
+
+} \ No newline at end of file
diff --git a/tests/src/org/aspectj/systemtest/ajc151/AllTestsAspectJ151.java b/tests/src/org/aspectj/systemtest/ajc151/AllTestsAspectJ151.java
index a3929851a..8f64f29d8 100644
--- a/tests/src/org/aspectj/systemtest/ajc151/AllTestsAspectJ151.java
+++ b/tests/src/org/aspectj/systemtest/ajc151/AllTestsAspectJ151.java
@@ -21,6 +21,7 @@ public class AllTestsAspectJ151 {
suite.addTest(Ajc151Tests.suite());
suite.addTest(NewarrayJoinpointTests.suite());
suite.addTest(AtAroundTests.suite());
+ suite.addTest(SerialVersionUIDTests.suite());
//$JUnit-END$
return suite;
}
diff --git a/tests/src/org/aspectj/systemtest/ajc151/SerialVersionUIDTests.java b/tests/src/org/aspectj/systemtest/ajc151/SerialVersionUIDTests.java
new file mode 100644
index 000000000..fc0c0d276
--- /dev/null
+++ b/tests/src/org/aspectj/systemtest/ajc151/SerialVersionUIDTests.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andy Clement - initial implementation
+ *******************************************************************************/
+package org.aspectj.systemtest.ajc151;
+
+import java.io.File;
+
+import junit.framework.Test;
+
+import org.aspectj.testing.XMLBasedAjcTestCase;
+
+
+public class SerialVersionUIDTests extends XMLBasedAjcTestCase {
+
+ public void testTheBasics() { runTest("basic"); }
+ public void testTheBasicsWithLint() { runTest("basic - lint"); }
+ public void testHorrible() { runTest("horrible"); }
+
+ //
+ public static Test suite() {
+ return XMLBasedAjcTestCase.loadSuite(SerialVersionUIDTests.class);
+ }
+
+ protected File getSpecFile() {
+ return new File("../tests/src/org/aspectj/systemtest/ajc151/serialversionuid.xml");
+ }
+
+}
diff --git a/tests/src/org/aspectj/systemtest/ajc151/serialversionuid.xml b/tests/src/org/aspectj/systemtest/ajc151/serialversionuid.xml
new file mode 100644
index 000000000..c18adaed7
--- /dev/null
+++ b/tests/src/org/aspectj/systemtest/ajc151/serialversionuid.xml
@@ -0,0 +1,37 @@
+<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]>
+
+<!-- AspectJ v1.5.1 Tests -->
+<suite>
+
+ <ajc-test dir="features151/serialveruid" title="basic">
+ <compile files="Basic.java" options="-1.5 -XaddSerialVersionUID"/>
+ <run class="Basic">
+ <stderr>
+ <line text="SerialVersionUID is 7052682057082172300"/>
+ </stderr>
+ </run>
+ </ajc-test>
+
+ <ajc-test dir="features151/serialveruid" title="basic - lint">
+ <compile files="Basic.java" options="-1.5 -XaddSerialVersionUID -Xlint:warning">
+ <message kind="warning" text="calculated SerialVersionUID for type Basic"/>
+ </compile>
+ <run class="Basic">
+ <stderr>
+ <line text="SerialVersionUID is 7052682057082172300"/>
+ </stderr>
+ </run>
+ </ajc-test>
+
+ <ajc-test dir="features151/serialveruid" title="horrible">
+ <compile files="BigHorribleClass.java,AnAspect.java" options="-1.5 -XaddSerialVersionUID -Xlint:warning">
+ <message kind="warning" text="calculated SerialVersionUID for type BigHorribleClass"/>
+ </compile>
+ <run class="BigHorribleClass">
+ <stderr>
+ <line text="SerialVersionUID is 6512414869923012873"/>
+ </stderr>
+ </run>
+ </ajc-test>
+
+</suite> \ No newline at end of file