On Thu, 2 Apr 2026 15:52:40 GMT, Aggelos Biboudis <[email protected]> wrote:
> This is the proposed patch for Enhanced Local Variable Declarations (Preview). > > - [x] I confirm that I make this contribution in accordance with the [OpenJDK > Interim AI Policy](https://openjdk.org/legal/ai). In https://github.com/openjdk/jdk/pull/30556/commits/c49c0e12a641961055b356c41224c58bf4e3466e I would like some re-review about my placement of binding variables. I use the same translation strategy for both enhanced for and ELVD statement but I place the binding vars differently since in the enhanced-for the binding vars need to be in the innermost scope. Can you double check if that is a correct way to use the `bindingContext` @lahodaj? Addressed all comments but one. @vicente-romero-oracle regarding this: > seems to have redundancies that can be avoided. I think this is in conflict with @mcimadamore's comment "Nice and simple -- generate pattern instance of, then call translate, which will deal with it :-)". The translation is simple since it delegates to `instanceof <pattern>`. If I try to optimize I may lose this elegance. However, if there is a way to unpack the `instanceof` and post-process it, while retaining the semantics with nested patterns (null checks, etc), please let me know. WDYT? ------------- PR Comment: https://git.openjdk.org/jdk/pull/30556#issuecomment-4373563316
