[External] : Re: Classfile API cleanup of labelToBci from CodeModel and CodeBuilder and removal of impl.LabelResolver

Michael van Acken michael.van.acken at gmail.com
Fri Aug 19 07:13:16 UTC 2022


Am Fr., 19. Aug. 2022 um 09:01 Uhr schrieb Adam Sotona <
adam.sotona at oracle.com>:

>
>
>
>
> *From: *Michael van Acken <michael.van.acken at gmail.com>
>
> This sounds interesting.  Right now I am staying away from the higher
> level entry points,
>
> because of their WIP implementation -- as I found out when I tried to use
> ifThenElse().
>
> `trying` doesn't seem to support finally right now.
>
>
>
> CodeBuilder.CatchBuilder::catchingAll(…) represents finally block
>

I was referring to the part where the code of the finally block is
duplicated
into all paths right after their respective handled regions.  Looking at the
CodeBuilder source code, I can't find any of this.


>
> Having access to a BlockCodeBuilder instance and its isEmpty would solve my
>
> problem.  Is this something that can be done from the public API?
>
>
>
> CodeBuilder::block(…)
>

This method encapsulates a BlockCodeBuilder instance, but does not
provide it to the caller (the `child` below):

    default CodeBuilder block(Consumer<BlockCodeBuilder> handler) {
        Label breakLabel = newLabel();
        BlockCodeBuilderImpl child = new BlockCodeBuilderImpl(this,
breakLabel);
        child.start();
        handler.accept(child);
        child.end();
        labelBinding(breakLabel);
        return this;
    }

-- mva
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/classfile-api-dev/attachments/20220819/745a1a7c/attachment.htm>


More information about the classfile-api-dev mailing list