@@ -737,7 +737,12 @@ public class AjParser extends Parser { | |||
} else if (CharOperation.equals(name, "returning".toCharArray())) { | |||
adviceDecl.kind = AdviceKind.AfterReturning; | |||
} else { | |||
//XXX illegal name here | |||
problemReporter().parseError( | |||
start, | |||
end, | |||
name, | |||
String.valueOf(name), | |||
new String[] {"throwing", "returning", ":"}); | |||
} | |||
} | |||
@@ -6897,5 +6897,16 @@ | |||
</message> | |||
</compile> | |||
</ajc-test> | |||
<ajc-test dir="bugs" | |||
title="Appropriate message for 'after() thowing(Throwable th)' syntax error" | |||
pr="49638" | |||
> | |||
<compile | |||
files="AfterThrowingAdviceSyntaxError.java" > | |||
<message kind="error" line="21" /> | |||
<message kind="error" line="23" /> | |||
</compile> | |||
</ajc-test> | |||
</suite> |
@@ -0,0 +1,28 @@ | |||
import org.aspectj.lang.*; | |||
public class AfterThrowingAdviceSyntaxError { | |||
public static void main(String[] args) { | |||
perform(); | |||
} | |||
private static void perform() { | |||
Object nullObj = null; | |||
nullObj.toString(); | |||
} | |||
} | |||
aspect ExceptionLoggerAspectV2 | |||
{ | |||
pointcut exceptionLogMethods() | |||
: call(* *.*(..)) && !within(ExceptionLoggerAspectV2); | |||
after() thowing(Throwable ex) : exceptionLogMethods() { | |||
Signature sig = thisJoinPointStaticPart.getSignature(); | |||
System.out.printl("WARNING: " | |||
+ sig.getDeclaringType().getName() + " " | |||
+ sig.getName() + " " | |||
+ "Exception logger aspect " + ex); | |||
} | |||
} |