uschindler commented on issue #12655: URL: https://github.com/apache/lucene/issues/12655#issuecomment-1759401511
> > because the loop variable is not final (like in Java) > > In groovy closures do have access to their full context (including local variables outside). That code used gstring, which is a dynamically evaluated string - if you used a string concatenation, it'd be immutable and worked fine. The problem was not the gstring/strings. Problem was that the `onlyIf` closure is executed at execution time (so delayed) and not at config time. At execution time, the for loop was already on jdkVersion==21 (the last entry because the loop had already executed at config time). By using a `each` closure the `jdkVersion` is private to the closure and the build-time evaluation has its own `jdkVersion` variable (which is a constant). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org