Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

CallsToArray.java 720B

1234567891011121314151617181920212223242526272829
  1. import org.aspectj.testing.Tester;
  2. public class CallsToArray {
  3. public static void main(String[] args) {
  4. byte[] a = new byte[] {0, 1};
  5. byte[] b = (byte[])a.clone();
  6. Tester.check(a != b, "cloned array is different");
  7. Tester.check(a[0] == b[0] && a[1] == b[1], "but compares equal");
  8. Tester.check(A.returnedClone == b, "advice did right thing");
  9. }
  10. }
  11. aspect A {
  12. static Object returnedClone;
  13. after () returning(Object cloned): call(Object Object.clone()) {
  14. System.out.println("running advice");
  15. A.returnedClone = cloned;
  16. }
  17. /*
  18. static after () returning(Object cloned): calls(Object .clone()) {
  19. System.out.println("running advice on byte[]");
  20. A.returnedClone = cloned;
  21. }
  22. */
  23. }