Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

TestClass.java 1004B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. //package debugger;
  2. public class TestClass {
  3. public static void main(String[] args) {
  4. new TestClass().go();
  5. }
  6. void go() {
  7. String s = "s";
  8. String ss = "ss";
  9. String sss = "sss";
  10. a();
  11. }
  12. void a() {
  13. int i3 = 3;
  14. b();
  15. }
  16. void b() {
  17. int i1 = 1;
  18. int i2 = 2;
  19. c();
  20. }
  21. void c() {
  22. String c = "c";
  23. System.out.println(c);
  24. }
  25. }
  26. aspect TestClassAspect of eachobject(instanceof(TestClass)) {
  27. pointcut a(): receptions(* a(..)) && instanceof(TestClass);
  28. pointcut b(): receptions(* b(..)) && instanceof(TestClass);
  29. pointcut c(): receptions(* c(..)) && instanceof(TestClass);
  30. before(): a() {
  31. System.out.println("before a");
  32. }
  33. before(): b() {
  34. System.out.println("before b");
  35. }
  36. before(): c() {
  37. System.out.println("before c");
  38. }
  39. after(): a() {
  40. long l = 123;
  41. System.out.println("after a");
  42. }
  43. after(): b() {
  44. System.out.println("after b");
  45. }
  46. after(): c() {
  47. System.out.println("after c");
  48. }
  49. }