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.

123456789101112131415161718192021222324252627282930313233343536
  1. import org.aspectj.lang.*;
  2. import org.aspectj.testing.*;
  3. import java.io.*;
  4. public class EmptyStack{
  5. public static void main(String[] args){
  6. try {
  7. EmptyStackAspect.InnerEmptyStackAspect a = EmptyStackAspect.InnerEmptyStackAspect.aspectOf();
  8. } catch (java.util.EmptyStackException ese) {
  9. String msg = "";
  10. class PW extends PrintWriter {
  11. PW() { super((Writer)null); }
  12. String msg = "";
  13. public void write(int c) { msg += c; }
  14. }
  15. PW pw = new PW();
  16. ese.printStackTrace(pw);
  17. Tester.check(false, pw.msg);
  18. } catch (NoAspectBoundException nae) {
  19. Tester.note("caught NoAspectBound");
  20. }
  21. Tester.check("caught NoAspectBound");
  22. }
  23. }
  24. abstract aspect EmptyStackAspect {
  25. pointcut testCut();
  26. public static aspect InnerEmptyStackAspect percflow(testCut()){
  27. }
  28. }
  29. aspect MyEmptyStackAspect extends EmptyStackAspect issingleton() {
  30. pointcut testCut(): call(void EmptyStack.test(..)) ;
  31. }