RFR: 8372635: Lambdas do not copy over SYNTHETIC flag for local variables
covers1624
duke at openjdk.org
Wed Dec 10 15:00:07 UTC 2025
On Wed, 10 Dec 2025 14:19:54 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:
>> This only preserves the SYNTHETIC or FINAL flags of the original sym. I don't think it makes all local vars synthetic, but we should check if these two are the only flags we want to propagate. Or should we switch to a blacklist where we explicitly remove the unwanted flags?
>>
>> Also this flag processing should probably be shared by LOCAL_VAR and PARAM.
>
> Exactly - this code should copy the specified flags, if they are set. I.e. if the original variable is not synthetic, the new one won't be synthetic either. If the original variable is synthetic, the flag will be transferred to the new variable.
>
> Given the handling of local variables and parameters is slightly different, I am not sure unifying the flags manipulation is quite feasible.
Hi, I was the one who found this bug and filed it via @sciwhiz12 on the issue tracker.
I was a bit confused by these flags, and didn't dig deep enough, but I'm not overly sure why these aren't just preserved as-is. Considering these are all Javac internal flags, my knowledge here is limited.
Are there any flags applicable to locals that shouldn't be copied when lowering lambdas?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28724#discussion_r2606927722
More information about the compiler-dev
mailing list