Re: Re: Detecting finally blocks?
Scott Vachalek <[email protected]>
| Newsgroups | gmane.comp.java.objectweb.asm |
|---|---|
| Message-ID | <[email protected]> |
The finally block itself may appear multiple times due to inlining, but I think a catch block with null type should only be the catch-all block which gets created implicitly whenever a finally block is present. Any catch blocks which are declared by the programmer should have the type declared in the source. This is just the habit of Java compilers though; I don't think it's required by the JVM spec, so it's not something you can rely upon entirely. But I've never seen a null catch generated by javac for any other reason. The contents of the handler (save exception, repeat finally code, throw saved exception) are also very predictable. On Thu, Dec 17, 2009 at 3:07 PM, Godmar Back <[email protected]> wrote: > > 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 >> >> > > > -- > 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