JDK-8300691 - final variables in for loop headers should accept updates
Archie Cobbs
archie.cobbs at gmail.com
Wed Oct 16 23:11:13 UTC 2024
Hi Maurizio,
On Wed, Oct 16, 2024 at 4:37 PM Maurizio Cimadamore <
maurizio.cimadamore at oracle.com> wrote:
> Instead, it would be better if you just created a new visitor in Flow
> whose only responsibility is that of populating the DummyVariable map you
> already have.
>
> This new visitor might keep track of the innermost "interesting" enclosing
> context, and when you create the dummy variable, you note that context down.
>
Nice idea... see 08c8b1f3c64
<https://github.com/openjdk/jdk/compare/master...archiecobbs:jdk:dummy-variable-detector?expand=1>
for a stab at it.
I added special logic to include pseudo-tags for STATIC_INITIALIZER and
INSTANCE_INITIALIZER.
There are surely some trade-offs regarding what types are "interesting",
might be worth tweaking.
Here are the stats from the JDK:
42 METHODDEF
32 IF
21 TRY
10 FORLOOP
3 DOLOOP
2 WHILELOOP
2 CASE
1 FOREACHLOOP
-Archie
--
Archie L. Cobbs
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-dev/attachments/20241016/d21f2669/attachment.htm>
More information about the amber-dev
mailing list