[PRL] AspectJ "feature"

Pengcheng Wu wupc at ccs.neu.edu
Tue Apr 5 15:59:32 EDT 2005


On Tue, 5 Apr 2005, John Clements wrote:

> QUIZ QUESTION: what happens if you make a mistake in the name of the
> method called inside the advice?  E.G:
>
> ...
> 		if (! c.legalwhoopsbadnameDx(dx)) {
> ...
>
>
> What happens is...
>
>
> nothing.  No compile error, runs fine.  The advice is _not_ applied, no
> output to stdout.  I can only guess that type information from the body
> (in this case, the existence of a 'legalwhoopsbadnameDx' method) is
> implicitly added to the pointcut,

I don't know why you got nothing. When I compiled your program with ajc
1.1.1, I got:

ajc *.java
C:\temp\CheckDX.java:4 The method
legalwhoopsbadnameDx(int) is undefined for the type Counter
if (! c.legalwhoopsbadnameDx(dx)) {
        ^^^^^^^^^^^^^^^^^^^^

1 error


I am pretty sure the compiler does check this kind of errors.

--Pengcheng





More information about the PRL mailing list