diff options
author | aclement <aclement> | 2004-08-27 10:03:54 +0000 |
---|---|---|
committer | aclement <aclement> | 2004-08-27 10:03:54 +0000 |
commit | b5e6307a63b0513cb058e8d6e56ff87287bdfa15 (patch) | |
tree | 70b0ee884349a3ed4d54190eca286ed975106764 /tests/bugs | |
parent | bd5021a1dd1f070a4be9192beb4daece84d3c1a8 (diff) | |
download | aspectj-b5e6307a63b0513cb058e8d6e56ff87287bdfa15.tar.gz aspectj-b5e6307a63b0513cb058e8d6e56ff87287bdfa15.zip |
fix for Bugzilla Bug 72150
AJC possible bug with static nested classes
Diffstat (limited to 'tests/bugs')
-rw-r--r-- | tests/bugs/java5/arrayCloning/A.java | 6 | ||||
-rw-r--r-- | tests/bugs/java5/arrayCloning/C.java | 41 | ||||
-rw-r--r-- | tests/bugs/java5/arrayCloning/OneFiveCode.jar | bin | 0 -> 1467 bytes | |||
-rw-r--r-- | tests/bugs/java5/arrayCloning/explanation.txt | 2 | ||||
-rw-r--r-- | tests/bugs/java5/arrayCloning/rebuild.bat | 4 |
5 files changed, 53 insertions, 0 deletions
diff --git a/tests/bugs/java5/arrayCloning/A.java b/tests/bugs/java5/arrayCloning/A.java new file mode 100644 index 000000000..10cb71381 --- /dev/null +++ b/tests/bugs/java5/arrayCloning/A.java @@ -0,0 +1,6 @@ +aspect A { + Object around(): call(* clone(..)) { + return proceed(); + } +} + diff --git a/tests/bugs/java5/arrayCloning/C.java b/tests/bugs/java5/arrayCloning/C.java new file mode 100644 index 000000000..8886906f5 --- /dev/null +++ b/tests/bugs/java5/arrayCloning/C.java @@ -0,0 +1,41 @@ +import java.lang.reflect.*; + +class C { + + public static B.D[] arr = new B.D[5]; + + public static void main(String[]argv) { + arr[0] = new B.D(42); + arr[1] = new B.D(22); + arr[2] = new B.D(46); + arr[3] = new B.D(50); + arr[4] = new B.D(54); + + B.D[] arr2 = arr.clone(); + + + // Check the clone is OK + if (arr2[0].i!=42) throw new RuntimeException("Call that a clone 0"); + if (arr2[1].i!=22) throw new RuntimeException("Call that a clone 1"); + if (arr2[2].i!=46) throw new RuntimeException("Call that a clone 2"); + if (arr2[3].i!=50) throw new RuntimeException("Call that a clone 3"); + if (arr2[4].i!=54) throw new RuntimeException("Call that a clone 4"); + System.err.println("Clone OK - attempting value manipulation"); + + // Change the clone, check the original is OK + arr2[2] = new B.D(1); + if (arr[2].i == 1) throw new RuntimeException("Shouldnt have affected original"); + if (arr2[2].i != 1) throw new RuntimeException("Should have affected clone"); + + + System.err.println("Clone OK - finished"); + } +} + + +class B { + public static class D { + public int i; + D(int x) { i=x;} + } +} diff --git a/tests/bugs/java5/arrayCloning/OneFiveCode.jar b/tests/bugs/java5/arrayCloning/OneFiveCode.jar Binary files differnew file mode 100644 index 000000000..0196f39b0 --- /dev/null +++ b/tests/bugs/java5/arrayCloning/OneFiveCode.jar diff --git a/tests/bugs/java5/arrayCloning/explanation.txt b/tests/bugs/java5/arrayCloning/explanation.txt new file mode 100644 index 000000000..b3f4de2c0 --- /dev/null +++ b/tests/bugs/java5/arrayCloning/explanation.txt @@ -0,0 +1,2 @@ +Under Java 1.4 the target of a clone() method called on an array type was 'Object.clone' in the byte code. +Under Java 1.5 this has been changed to be (correctly) a call to the clone() method on the array type.
\ No newline at end of file diff --git a/tests/bugs/java5/arrayCloning/rebuild.bat b/tests/bugs/java5/arrayCloning/rebuild.bat new file mode 100644 index 000000000..f0004a93e --- /dev/null +++ b/tests/bugs/java5/arrayCloning/rebuild.bat @@ -0,0 +1,4 @@ +erase *.class
+javac C.java
+jar -cvMf OneFiveCode.jar *.class
+erase *.class
|