Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-dev] Re: after() and around() advice does not work on handler join points.

Hi -

Jim.Hugunin@xxxxxxxx wrote:

<snip>

> This is an example of a common pattern that would let us 
> find the end of most exception handlers. [...] However, 
> what should ajc do when this pattern isn't present or 
> when it's wrong?

<snip>

> I suspect that this issue could be resolved with some hard 
> thought and analysis of all the possible edge cases; however, 
> this feature was not deemed important enough to delay the 
> 1.1 release until that analysis could be done.

I believe good compiler writers could figure out what current 
compilers do, but I'm less confident about future compilers.  
For example, in the 1.4.1 change notes for javac:

  For the try-finally language construct in which the finally clause 
  is fairly simple, javac will inline the finally clause instead of 
  using jsr. In the future, javac may become even more aggressive 
  in its inlining of the finally clause. 

So code from finally clauses may show up in "handler" bytecode.
If after advice could run after the code for a finally clause 
(and even throw an exception), that would be wrong, in many ways.

We have confidence in our bytecode decompilation for the most 
join points (and have changed others accordingly), but this one I
think is the best case for a limited join point.  Before advice 
can be implemented and is useful, but the others are risky to 
implement and perhaps less useful, so I think it would be wise
not to try.

Wes


Back to the top