Re: Detecting finally blocks?

Godmar Back <[email protected]>
Newsgroups gmane.comp.java.objectweb.asm
Message-ID <[email protected]>
finally is not present in the bytecode, usually, so what you suggest cannot
be done.
(Older javac versions used a special nested subroutine and a JSR call to
implement finally, but that's no longer done.)

The code inside a finally will simply appear multiple times where it is
executing.

 - Godmar

On Thu, Dec 17, 2009 at 3:06 PM, Jonathan Byrne <
[email protected]> wrote:

> Hi,
>
> I'm parsing bytecode by extending MethodAdapter, and I'm trying to
> detected when I reach a "finally" block, to clarify:
>
> try {
> }
> catch(SomeException e) {
> }
> finally {
>    // I'd like to know when I'm here
> }
>
> In,
>
> public void visitTryCatchBlock(Label start, Label end, Label handler,
> String type)
>
> the last parameter "type" is set to "null" for finally blocks, but
> other non-finally blocks are "null" too.
>
> I'd greatly appreciate any pointers on how to detect when I reach a
> finally block.
>
> Many thanks,
> Jon.
>
>
> --
> You receive this message as a subscriber of the [email protected] mailing list.
> To unsubscribe: mailto:[email protected]
> For general help: mailto:[email protected]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
>
>
message-footer.txt (text/plain, 238 B)
-- 
You receive this message as a subscriber of the [email protected] mailing list.
To unsubscribe: mailto:[email protected]
For general help: mailto:[email protected]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.