aboutsummaryrefslogtreecommitdiffstats
path: root/tests/bugs152/pr129282/ExceptionHandler.aj
diff options
context:
space:
mode:
Diffstat (limited to 'tests/bugs152/pr129282/ExceptionHandler.aj')
-rw-r--r--tests/bugs152/pr129282/ExceptionHandler.aj39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/bugs152/pr129282/ExceptionHandler.aj b/tests/bugs152/pr129282/ExceptionHandler.aj
new file mode 100644
index 000000000..3ff3f47e2
--- /dev/null
+++ b/tests/bugs152/pr129282/ExceptionHandler.aj
@@ -0,0 +1,39 @@
+// with the exception handler, the advice isn't actually throwing the
+// exception for the method - therefore, expect warnings when the methods
+// don't throw the exception themselves.
+public aspect ExceptionHandler {
+
+ pointcut p() : handler(*);
+
+ before() throws MyException : p() {
+ throw new MyException();
+ }
+
+
+}
+
+class C {
+
+ public void method1() {
+ try {
+ new C().throwingMethod();
+ new C().throwingMethod2();
+ } catch (MyException e) {
+ e.printStackTrace();
+ }
+ }
+
+ // dont want 'declared exception not actually thrown'
+ // warning for this method because it's throwing it
+ public void throwingMethod() throws MyException {
+ throw new MyException();
+ }
+
+ // do want 'declared exception not actually thrown'
+ // warning because it doesn't throw it
+ public void throwingMethod2() throws MyException {
+ }
+}
+
+class MyException extends Exception {
+}