From: jhugunin Date: Thu, 4 Sep 2003 15:49:08 +0000 (+0000) Subject: test and fix for Bugzilla Bug 42539 X-Git-Tag: V1_1_1~36 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=8660cc12bfbcd6f4957abd4dfc84735de6c048cf;p=aspectj.git test and fix for Bugzilla Bug 42539 throw derivative pointcuts not advised --- diff --git a/tests/ajcTests.xml b/tests/ajcTests.xml index db51bfc2c..6f9e4dddf 100644 --- a/tests/ajcTests.xml +++ b/tests/ajcTests.xml @@ -6720,4 +6720,14 @@ aspectpath="lib.jar"/> + + + + + + + + diff --git a/tests/bugs/throwsSignature/ExceptionAspect.java b/tests/bugs/throwsSignature/ExceptionAspect.java new file mode 100644 index 000000000..db15fcb6b --- /dev/null +++ b/tests/bugs/throwsSignature/ExceptionAspect.java @@ -0,0 +1,10 @@ +public aspect ExceptionAspect +{ + pointcut exceptionThrower() : + execution(public * ExceptionBugTest.*(..) throws Exception+); + + declare warning : exceptionThrower() : "throws both"; + + declare error : execution(public * ExceptionBugTest.*(..) throws Exception) : + "throws Exception"; +} \ No newline at end of file diff --git a/tests/bugs/throwsSignature/ExceptionBugTest.java b/tests/bugs/throwsSignature/ExceptionBugTest.java new file mode 100644 index 000000000..e77f28381 --- /dev/null +++ b/tests/bugs/throwsSignature/ExceptionBugTest.java @@ -0,0 +1,8 @@ +public class ExceptionBugTest { + int x; + class MyException extends Exception {} + + public void method1() throws Exception { x = 1; } // warning here + + public void method2() throws MyException { x = 2; } // warning here +} \ No newline at end of file diff --git a/weaver/src/org/aspectj/weaver/patterns/ThrowsPattern.java b/weaver/src/org/aspectj/weaver/patterns/ThrowsPattern.java index 2b6be4863..5de0c16b7 100644 --- a/weaver/src/org/aspectj/weaver/patterns/ThrowsPattern.java +++ b/weaver/src/org/aspectj/weaver/patterns/ThrowsPattern.java @@ -91,7 +91,7 @@ public class ThrowsPattern extends PatternNode { ResolvedTypeX[] types) { for (int i = types.length - 1; i >= 0; i--) { - if (typePattern.matchesExactly(types[i])) return true; + if (typePattern.matchesStatically(types[i])) return true; } return false; }