[PRL] AspectJ "feature"

Doug Orleans dougo at place.org
Tue Apr 5 15:37:10 EDT 2005


John Clements writes:
 > What happens is...
 > 
 > 
 > nothing.  No compile error, runs fine.  The advice is _not_ applied, no 
 > output to stdout.

What happens if you compile with -Xlint?

 > Is this something that Gregor et. al. consider "the right thing?"

I think the problem is that sometimes it is the right thing, and
sometimes it isn't, and it's hard for the compiler to tell the
difference.  When it is the right thing, you definitely don't want the
compiler to throw an error, and you probably don't even want to see a
warning.  So the -Xlint option is off by default.

(I don't actually know if this is true about the specific thing you're
complaining about-- I'm actually surprised that the code inside an
advice body isn't treated as a black box of Java code that's sent to
the Java compiler underneath.  So I'm just extrapolating from some
other similar things I vaguely remember about AspectJ.  But maybe this
is actually just a bug in ajc.)

--Doug

P.S. See the answer to this question in the AspectJ FAQ:

  11.  My advice is not running (or running twice), and I don't know why.

If that doesn't seem to apply to this case, you might want to post to
the aspectj-users list about it.



More information about the PRL mailing list