throw derivative pointcuts not advisedtags/V1_1_1
@@ -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> |
@@ -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"; | |||
} |
@@ -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 | |||
} |
@@ -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; | |||
} |