summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjhugunin <jhugunin>2003-09-04 15:49:08 +0000
committerjhugunin <jhugunin>2003-09-04 15:49:08 +0000
commit8660cc12bfbcd6f4957abd4dfc84735de6c048cf (patch)
tree174a6319b9427d56a9707a89743ba5354eb647d5
parentc1ada785adc3a05f9df4b96469b64e5c77d398de (diff)
downloadaspectj-8660cc12bfbcd6f4957abd4dfc84735de6c048cf.tar.gz
aspectj-8660cc12bfbcd6f4957abd4dfc84735de6c048cf.zip
test and fix for Bugzilla Bug 42539
throw derivative pointcuts not advised
-rw-r--r--tests/ajcTests.xml10
-rw-r--r--tests/bugs/throwsSignature/ExceptionAspect.java10
-rw-r--r--tests/bugs/throwsSignature/ExceptionBugTest.java8
-rw-r--r--weaver/src/org/aspectj/weaver/patterns/ThrowsPattern.java2
4 files changed, 29 insertions, 1 deletions
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"/>
<run class="PerCFlowCompileFromJarTest"/>
</ajc-test>
+
+ <ajc-test dir="bugs/throwsSignature"
+ pr="42539"
+ title="throw derivative pointcuts not advised">
+ <compile files="ExceptionBugTest.java,ExceptionAspect.java">
+ <message line="5" kind="warning" text="throws both"/>
+ <message line="5" kind="error" text="throws Exception"/>
+ <message line="7" kind="warning" text="throws both"/>
+ </compile>
+ </ajc-test>
</suite>
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;
}