On Thu, 30 Apr 2026 09:35:10 GMT, Maurizio Cimadamore <[email protected]> 
wrote:

>> src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java 
>> line 3306:
>> 
>>> 3304:                             return VariableDeclKind.LocalVarDecl;
>>> 3305:                         }
>>> 3306:                         else if(peekToken(lookahead, COLON) ||  // in 
>>> the init part of an enhanced for loop
>> 
>> This will also allow ELVD in a non-for each loop, right?
>
> E.g.
> 
> 
> for (P(int x) = bar ; ; ) { }

I see -- this logic says "ELVD" on the above loop -- but then the `for` parser 
logic rejects it because it expects a `:` after the pattern (and here we have 
`=`). All good then.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/30556#discussion_r3166998128

Reply via email to