gemini-code-assist[bot] commented on code in PR #39343:
URL: https://github.com/apache/beam/pull/39343#discussion_r3588741892
##########
buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy:
##########
@@ -993,6 +993,13 @@ class BeamModulePlugin implements Plugin<Project> {
if (!project.findProperty("java${ver}Home")) {
return
}
+ // TODO(yathu): remove this once generated code (antlr) no longer
trigger "this-escape", see above
+ // Unpin global opts when ver is lower than current
+ if (JavaVersion.current().compareTo(JavaVersion.VERSION_21) >= 0 &&
JavaVersion.toVersion(ver) < JavaVersion.VERSION_21) {
Review Comment:

In Groovy, we can use native comparison operators (`>=`, `<`) on
`Comparable` objects like `JavaVersion` instead of verbose `.compareTo(...)`
calls. Additionally, using `JavaVersion.toVersion('21')` instead of
`JavaVersion.VERSION_21` is safer and prevents potential runtime errors on
older Gradle versions (prior to 8.4) that do not define
`JavaVersion.VERSION_21`.
```
if (JavaVersion.current() >= JavaVersion.toVersion('21') &&
JavaVersion.toVersion(ver) < JavaVersion.toVersion('21')) {
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]