Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] execution pointcut questions

SADER, KEITH D (Contractor) wrote:
I'm trying to set a pointcut like the following

pointcut exceptionThrowers() : execution(public * my.pkg..*.*(..) throws Exception+);

and I've found that the throws Exception+ part of the pointcut doesn't work as I expect.
<snip>

I just confirmed that this is a bug in ajc-1.1.0 (and in 1.1.1rc1). The '+' on type patterns in throws clauses is ignored. Please submit this as a bug report to https://dev.eclipse.org (-> Bug Reports) (product AspectJ, component Compiler), ideally with a small test case showing the bug.

<detail>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 specify that a method could only be accessed from subtypes.</detail>

Second, while using Eclipse to inspect the 'methods advised' per advice is nifty, is there a command-line version of this in ajc?

I use declare warning to do this, i.e.:

  declare warning: exceptionThrowers(): "throws Exception+";

-Jim




Back to the top