diff options
Diffstat (limited to 'tests/bugs')
24 files changed, 279 insertions, 0 deletions
diff --git a/tests/bugs/serialVersionUID/AfterReturningStaticinitializationAdvice.aj b/tests/bugs/serialVersionUID/AfterReturningStaticinitializationAdvice.aj new file mode 100644 index 000000000..0415a4b20 --- /dev/null +++ b/tests/bugs/serialVersionUID/AfterReturningStaticinitializationAdvice.aj @@ -0,0 +1,9 @@ +public aspect AfterReturningStaticinitializationAdvice {
+
+ pointcut staticInit () :
+ staticinitialization(*Test);
+
+ after () returning : staticInit() {
+ System.out.println("? AfterReturningStaticinitializationAdvice.staticInit()");
+ }
+}
diff --git a/tests/bugs/serialVersionUID/AroundClosureExecutionAdvice.aj b/tests/bugs/serialVersionUID/AroundClosureExecutionAdvice.aj new file mode 100644 index 000000000..43211d6ec --- /dev/null +++ b/tests/bugs/serialVersionUID/AroundClosureExecutionAdvice.aj @@ -0,0 +1,22 @@ +import java.io.InvalidClassException;
+import org.aspectj.testing.Tester;
+
+public aspect AroundClosureExecutionAdvice {
+
+ pointcut run () :
+ execution(public void run());
+
+ void around () : run () {
+ Runnable runnable = new Runnable() {
+ public void run () {
+ System.out.println("> AroundClosureExecutionAdvice.run()");
+
+ proceed();
+
+ System.out.println("< AroundClosureExecutionAdvice.run()");
+ }
+ };
+ runnable.run();
+ }
+
+}
diff --git a/tests/bugs/serialVersionUID/AroundExecutionAdvice.aj b/tests/bugs/serialVersionUID/AroundExecutionAdvice.aj new file mode 100644 index 000000000..6da62e42a --- /dev/null +++ b/tests/bugs/serialVersionUID/AroundExecutionAdvice.aj @@ -0,0 +1,14 @@ +public aspect AroundExecutionAdvice {
+
+ pointcut run () :
+ execution(public void run());
+
+ void around () : run () {
+ System.out.println("> AroundExecutionAdvice.run()");
+
+ proceed();
+
+ System.out.println("< AroundExecutionAdvice.run()");
+ }
+
+}
diff --git a/tests/bugs/serialVersionUID/BeforeExecutionAdvice.aj b/tests/bugs/serialVersionUID/BeforeExecutionAdvice.aj new file mode 100644 index 000000000..109cddc37 --- /dev/null +++ b/tests/bugs/serialVersionUID/BeforeExecutionAdvice.aj @@ -0,0 +1,9 @@ +public aspect BeforeExecutionAdvice {
+
+ pointcut run (Test test) :
+ execution(public void run()) && this(test);
+
+ before (Test test) : run (test) {
+ System.out.println("? BeforeExecutionAdvice.run() test=" + test);
+ }
+}
\ No newline at end of file diff --git a/tests/bugs/serialVersionUID/ClinitTest.java b/tests/bugs/serialVersionUID/ClinitTest.java new file mode 100644 index 000000000..367f35b51 --- /dev/null +++ b/tests/bugs/serialVersionUID/ClinitTest.java @@ -0,0 +1,16 @@ +import java.io.Serializable; + +public class ClinitTest implements Serializable { + + private int i; + private static boolean b = true; + + public void run () { + System.out.println("? Clinit.run()"); + } + + public static void main(String[] args) throws Exception { + ClinitTest test = new ClinitTest(); + Util.write(Util.DEFAULT_NAME,test); + } +}
\ No newline at end of file diff --git a/tests/bugs/serialVersionUID/DeclareExtends.aj b/tests/bugs/serialVersionUID/DeclareExtends.aj new file mode 100644 index 000000000..e2114ed1a --- /dev/null +++ b/tests/bugs/serialVersionUID/DeclareExtends.aj @@ -0,0 +1,5 @@ +public aspect DeclareExtends {
+
+ declare parents : Test extends Thread;
+
+}
diff --git a/tests/bugs/serialVersionUID/DeclareImplements.aj b/tests/bugs/serialVersionUID/DeclareImplements.aj new file mode 100644 index 000000000..9f311793f --- /dev/null +++ b/tests/bugs/serialVersionUID/DeclareImplements.aj @@ -0,0 +1,5 @@ +public aspect DeclareImplements {
+
+ declare parents : *Test implements Runnable;
+
+}
diff --git a/tests/bugs/serialVersionUID/DeclareImplementsSerializable.aj b/tests/bugs/serialVersionUID/DeclareImplementsSerializable.aj new file mode 100644 index 000000000..7c0daa130 --- /dev/null +++ b/tests/bugs/serialVersionUID/DeclareImplementsSerializable.aj @@ -0,0 +1,7 @@ +import java.io.Serializable;
+
+public aspect DeclareImplementsSerializable {
+
+ declare parents : NonSerializableTest implements Serializable;
+
+}
diff --git a/tests/bugs/serialVersionUID/ITDField.aj b/tests/bugs/serialVersionUID/ITDField.aj new file mode 100644 index 000000000..26d4e52a0 --- /dev/null +++ b/tests/bugs/serialVersionUID/ITDField.aj @@ -0,0 +1,5 @@ +public aspect ITDField {
+
+ private long Test.longField = 999999999L;
+
+}
diff --git a/tests/bugs/serialVersionUID/ITDField.class b/tests/bugs/serialVersionUID/ITDField.class Binary files differnew file mode 100644 index 000000000..9904cf76e --- /dev/null +++ b/tests/bugs/serialVersionUID/ITDField.class diff --git a/tests/bugs/serialVersionUID/ITDMethod.aj b/tests/bugs/serialVersionUID/ITDMethod.aj new file mode 100644 index 000000000..a7a635a1f --- /dev/null +++ b/tests/bugs/serialVersionUID/ITDMethod.aj @@ -0,0 +1,7 @@ +public aspect ITDMethod {
+
+ private void Test.voidMethod () {
+ System.out.println("? ITDMethod.voidMethod()");
+ }
+
+}
diff --git a/tests/bugs/serialVersionUID/NonSerializableTest.java b/tests/bugs/serialVersionUID/NonSerializableTest.java new file mode 100644 index 000000000..b321495f2 --- /dev/null +++ b/tests/bugs/serialVersionUID/NonSerializableTest.java @@ -0,0 +1,14 @@ +public class NonSerializableTest { + + private int i; + + public void run () { + System.out.println("NonSerializableTest.run()"); + i++; + } + + public static void main (String[] args) throws Exception { + NonSerializableTest test = new NonSerializableTest(); + test.run(); + } +}
\ No newline at end of file diff --git a/tests/bugs/serialVersionUID/PerThisAspect$ajcMightHaveAspect.class b/tests/bugs/serialVersionUID/PerThisAspect$ajcMightHaveAspect.class Binary files differnew file mode 100644 index 000000000..df5dc53f0 --- /dev/null +++ b/tests/bugs/serialVersionUID/PerThisAspect$ajcMightHaveAspect.class diff --git a/tests/bugs/serialVersionUID/PerThisAspect.aj b/tests/bugs/serialVersionUID/PerThisAspect.aj new file mode 100644 index 000000000..df31e0253 --- /dev/null +++ b/tests/bugs/serialVersionUID/PerThisAspect.aj @@ -0,0 +1,10 @@ +public aspect PerThisAspect perthis(this(Test)) {
+
+ pointcut run (Test test) :
+ execution(public void run()) && this(test);
+
+ before (Test test) : run (test) {
+ System.out.println("? PerThisAspect.run() test=" + test + " this=" + this);
+ }
+
+}
diff --git a/tests/bugs/serialVersionUID/PerThisAspect.class b/tests/bugs/serialVersionUID/PerThisAspect.class Binary files differnew file mode 100644 index 000000000..906edd329 --- /dev/null +++ b/tests/bugs/serialVersionUID/PerThisAspect.class diff --git a/tests/bugs/serialVersionUID/PrivilegedAspect.aj b/tests/bugs/serialVersionUID/PrivilegedAspect.aj new file mode 100644 index 000000000..0a959f7e6 --- /dev/null +++ b/tests/bugs/serialVersionUID/PrivilegedAspect.aj @@ -0,0 +1,13 @@ +import java.io.InvalidClassException;
+import org.aspectj.testing.Tester;
+
+public privileged aspect PrivilegedAspect {
+
+ pointcut run (Test test) :
+ execution(public void run()) && this(test);
+
+ before (Test test) : run (test) {
+ System.out.println("? PrivilegedAspect.run() i=" + test.i);
+ }
+
+}
diff --git a/tests/bugs/serialVersionUID/SuidTest.java b/tests/bugs/serialVersionUID/SuidTest.java new file mode 100644 index 000000000..9e93283ed --- /dev/null +++ b/tests/bugs/serialVersionUID/SuidTest.java @@ -0,0 +1,16 @@ +import java.io.Serializable; + +public class SuidTest implements Serializable { + + static final long serialVersionUID = 8904684881596717140L; + private int i; + + public void run () { + System.out.println("? SuidTest.run()"); + } + + public static void main(String[] args) throws Exception { + SuidTest test = new SuidTest(); + Util.write(Util.DEFAULT_NAME,test); + } +}
\ No newline at end of file diff --git a/tests/bugs/serialVersionUID/TJP.aj b/tests/bugs/serialVersionUID/TJP.aj new file mode 100644 index 000000000..585426042 --- /dev/null +++ b/tests/bugs/serialVersionUID/TJP.aj @@ -0,0 +1,34 @@ +public aspect TJP {
+
+ pointcut run () :
+ execution(public void *.run());
+
+ before () : run () {
+ System.out.println("? TJP.execRun() thisJoinPointStaticPart=" + thisJoinPointStaticPart);
+ }
+
+ pointcut write () :
+ call(public void *.run());
+
+ before () : write () {
+ System.out.println("? TJP.callRun() thisJoinPointStaticPart=" + thisJoinPointStaticPart);
+ }
+
+ before () : write () {
+ System.out.println("? TJP.callRun() thisEnclosingJoinPointStaticPart=" + thisEnclosingJoinPointStaticPart);
+ }
+
+ pointcut getI () :
+ get(int i);
+
+ before () : getI () {
+ System.out.println("? TJP.getI() thisJoinPoint=" + thisJoinPoint);
+ }
+
+ pointcut setI () :
+ set(int i);
+
+ before () : setI () {
+ System.out.println("? TJP.setI() thisJoinPoint=" + thisJoinPoint);
+ }
+}
\ No newline at end of file diff --git a/tests/bugs/serialVersionUID/Test.class b/tests/bugs/serialVersionUID/Test.class Binary files differnew file mode 100644 index 000000000..6b4e2fea1 --- /dev/null +++ b/tests/bugs/serialVersionUID/Test.class diff --git a/tests/bugs/serialVersionUID/Test.java b/tests/bugs/serialVersionUID/Test.java new file mode 100644 index 000000000..2e267b3b3 --- /dev/null +++ b/tests/bugs/serialVersionUID/Test.java @@ -0,0 +1,17 @@ +import java.io.Serializable; + +public class Test implements Serializable { + + private int i; + + public void run () { + System.out.println("Test.run()"); + i++; + } + + public static void main (String[] args) throws Exception { + Test test = new Test(); + test.run(); + Util.write(Util.DEFAULT_NAME,test); + } +} diff --git a/tests/bugs/serialVersionUID/Util.class b/tests/bugs/serialVersionUID/Util.class Binary files differnew file mode 100644 index 000000000..c9ff29160 --- /dev/null +++ b/tests/bugs/serialVersionUID/Util.class diff --git a/tests/bugs/serialVersionUID/Util.java b/tests/bugs/serialVersionUID/Util.java new file mode 100644 index 000000000..ec98bd149 --- /dev/null +++ b/tests/bugs/serialVersionUID/Util.java @@ -0,0 +1,74 @@ +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.InvalidClassException; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.ObjectStreamClass; +//import java.util.Arrays; +//import java.util.List; + +import org.aspectj.testing.Tester; + +public class Util { + + public final static String DEFAULT_COMMAND = "-read"; + public final static String DEFAULT_NAME = "test.ser"; + + public static void fail (String name) throws Exception { + try { + Object obj = read(name); + Tester.checkFailed("java.io.InvalidClassException"); + } + catch (InvalidClassException ex) { + System.out.println("? Util.fail() ex=" + ex); + } + } + + public static Object read (String name) throws Exception { + Object obj; + File file = new File(name); + file.deleteOnExit(); + ObjectInputStream in = null; + + try { + in = new ObjectInputStream(new FileInputStream(file)); + obj = in.readObject(); + System.out.println("? Util.read() obj=" + obj); + } + finally { + in.close(); + } + + return obj; + } + + public static void write (String name, Object obj) throws IOException { + + File file = new File(name); +// File file = File.createTempFile(name,null); + ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(file)); + out.writeObject(obj); + out.close(); + + System.out.println("? Util.write() suid=" + ObjectStreamClass.lookup(obj.getClass())); + } + + public static void main (String[] args) throws Exception { + String command = (args.length > 0)? args[0] : DEFAULT_COMMAND; + String name = (args.length > 1)? args[1] : DEFAULT_NAME; + + if (command.equals("-read")) { + Object obj = read(name); + } + else if (command.equals("-fail")) { + fail(name); + } +// if (args.length > 0) { +// } +// else { +// System.out.println("Usage: Util -fail | -read [name]"); +// } + } +} diff --git a/tests/bugs/serialVersionUID/Xlint.properties b/tests/bugs/serialVersionUID/Xlint.properties new file mode 100644 index 000000000..79715ef12 --- /dev/null +++ b/tests/bugs/serialVersionUID/Xlint.properties @@ -0,0 +1,2 @@ +shadowNotInStructure = ignore +needsSerialVersionUIDField = warning diff --git a/tests/bugs/serialVersionUID/injar.jar b/tests/bugs/serialVersionUID/injar.jar Binary files differnew file mode 100644 index 000000000..7a8996bb2 --- /dev/null +++ b/tests/bugs/serialVersionUID/injar.jar |