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>
--- /dev/null
+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
--- /dev/null
+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
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;
}