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.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import org.aspectj.testing.Tester;
  2. import java.util.*;
  3. public class AfterFinally {
  4. public static void main(String[] args) {
  5. new AfterFinally().m("hi");
  6. }
  7. private String getX() { return "X"; }
  8. public Collection m(String key) {
  9. String x = null;
  10. ArrayList y = new ArrayList();
  11. Iterator i = null;
  12. try {
  13. x = this.getX();
  14. Collection personList = new ArrayList();
  15. y.add("foo");
  16. //prepStmt.setString(1, name);
  17. i = y.iterator();
  18. while (i.hasNext()) {
  19. personList.add(new String(i.next() + " foo"));
  20. }
  21. return personList;
  22. } catch (Exception e) {
  23. throw new RuntimeException("bad:" + e);
  24. } finally {
  25. x.toString();
  26. y.toString();
  27. i.toString();
  28. }
  29. }
  30. }
  31. aspect A {
  32. before(): execution(* *(..)) && within(AfterFinally) {
  33. System.out.println(thisJoinPoint);
  34. }
  35. after(): execution(* *(..)) && within(AfterFinally) {
  36. System.out.println(thisJoinPoint);
  37. }
  38. }