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.

DeclareSoft.java 422B

1234567891011121314151617181920212223242526
  1. import java.io.*;
  2. import org.aspectj.lang.*;
  3. public class DeclareSoft {
  4. public static void main(String[] args) {
  5. try {
  6. new DeclareSoft().m();
  7. } catch (SoftException se) {
  8. return;
  9. }
  10. }
  11. void m() {
  12. InputStream s = new FileInputStream("foobar");
  13. s.close();
  14. }
  15. }
  16. aspect A {
  17. //declare soft: IOException: execution(void m());
  18. declare soft: IOException: foo();
  19. pointcut foo(): execution(void m());
  20. }