You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

InnerMethodCall.aj 906B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import java.io.FileNotFoundException;
  2. public aspect InnerMethodCall {
  3. pointcut p() : call(public * C1.m2());
  4. before() throws FileNotFoundException : p() {
  5. throw new FileNotFoundException();
  6. }
  7. pointcut p2() : call(public * C1.m4());
  8. before() : p2() {
  9. }
  10. }
  11. class C1 {
  12. public void m1() {
  13. new C2() {
  14. public void m6() throws FileNotFoundException {
  15. new C1().m2();
  16. }
  17. };
  18. }
  19. // don't want the 'declared exception not actually
  20. // thrown' warning because the advice is affecting
  21. // this method
  22. public void m2() throws FileNotFoundException {
  23. }
  24. public void m3() {
  25. new C2() {
  26. public void m6() throws FileNotFoundException {
  27. new C1().m4();
  28. }
  29. };
  30. }
  31. // do want the 'declared exception not actually
  32. // thrown' warning
  33. public void m4() throws FileNotFoundException {
  34. }
  35. }
  36. abstract class C2 {
  37. public abstract void m6() throws FileNotFoundException;
  38. }