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.

InnerMethodCall2.aj 726B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import java.io.FileNotFoundException;
  2. aspect InnerMethodCall2 {
  3. pointcut p() : call(* C1.c1Method());
  4. before() throws FileNotFoundException : p() {
  5. throw new FileNotFoundException();
  6. }
  7. }
  8. class MainClass {
  9. public void amethod() {
  10. new C() {
  11. public void mymethod() throws FileNotFoundException {
  12. new C() {
  13. public void mymethod() throws FileNotFoundException {
  14. new C1().c1Method();
  15. }
  16. };
  17. }
  18. };
  19. }
  20. }
  21. class C1 {
  22. // don't want the 'declared exception not actually thrown'
  23. // exception because the advice is effectively throwing it
  24. public void c1Method() throws FileNotFoundException {
  25. }
  26. }
  27. abstract class C {
  28. public abstract void mymethod() throws FileNotFoundException;
  29. }