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.aj 844B

1234567891011121314151617181920212223242526272829
  1. public class DeclareSoft {
  2. public void throwException() throws Exception {
  3. throw new Exception("This should be softened");
  4. }
  5. public void throwRuntimeException() {
  6. throw new RuntimeException("Under enh 42743 this should not be softened");
  7. }
  8. public static void main(String[] args) throws Exception {
  9. DeclareSoft ds = new DeclareSoft();
  10. try {
  11. ds.throwException();
  12. } catch (org.aspectj.lang.SoftException se) {}
  13. try {
  14. ds.throwRuntimeException();
  15. } catch(org.aspectj.lang.SoftException se) {
  16. throw new RuntimeException("Runtime exception was innappropriately softened");
  17. } catch (RuntimeException ex) {}
  18. }
  19. }
  20. aspect Softener {
  21. declare soft: Exception : execution(* DeclareSoft.throw*(..));
  22. }