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.

> 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.

Perhaps less useful? How so? Before is the most limited of the advice
types.

Consider (forgive syntax errors, no compiler nearby)

after(Exception thrown) : handler(Exception caught) throwing (thrown){
  if(caught != thrown){
    thrown.initCause(caught);
  }
}

With before there's no way to detect when a handler throws an exception of
its own. FYI, after throwing on handlers is the one piece of advice we have
in production currently. Now, it still may not be worth the cost of
implementing, but...

Cheers,

Nick
--- Wes Isberg <wes@xxxxxxxxxxxxxx> wrote:
> 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
> _______________________________________________
> aspectj-dev mailing list
> aspectj-dev@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/aspectj-dev


__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/


Back to the top