Project: AspectJ
Bug 42539 throw derivative pointcuts not advised.
Reported: 2003-09-04 11:15:58 | Status: resolved fixed

Given the following point cut and advice: public aspect ExceptionAspect { pointcut exceptionThrower() : execution(public * ExceptionBugTest.*(..) throws Exception+); declare warning : exceptionThrower() : "throws Exception+"; } And the to be aspected code: public class ExceptionBugTest { class MyException extends Exception { } public void method1() throws Exception { } public void method2() throws MyException { } } listing file default.lst: C:\temp\AJC Bug\ExceptionAspect.aj C:\temp\AJC Bug\ExceptionBugTest.java AJC does not advise ExceptionBugTest.method2(). The output from the compilation is the following: C:\temp\AJC Bug>ajc -argfile default.lst -classpath %ASPECTJ_HOME%\lib\aspectjrt.jar C:\eclipse\workspace\AJC Bug\ExceptionBugTest.java:11 throws Exception+ From the aspect-j mailing list, contributed by Jim Hugunin: &lt;detail&gt;The bug was caused because the code for ThrowsPattern mistakenly used the internal protected method TypePattern.matchesExactly instead of the external public method TypePattern.matchesStatically. Because the classes were in the same package, Java's accessibility rules allowed this. It would be nice if there was an easy way to specifiy that a method could only be accessed from subtypes.&lt;/detail&gt;

Files changed in fix:
tests/bugs/throwsSignature/ExceptionAspect.java tests/bugs/throwsSignature/ExceptionBugTest.java weaver/src/org/aspectj/weaver/patterns/ThrowsPattern.java