gemini-code-assist[bot] commented on code in PR #39337:
URL: https://github.com/apache/beam/pull/39337#discussion_r3585555030


##########
sdks/java/testing/nexmark/build.gradle:
##########
@@ -114,6 +114,19 @@ if (isSparkRunner) {
   }
 }
 
+def sparkJvmArgs() {
+  def testJavaVer = project.findProperty('testJavaVersion') ? 
(project.property('testJavaVersion') as int) : 
JavaVersion.current().majorVersion.toInteger()
+  if (testJavaVer >= 17) {

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   Parsing `testJavaVersion` directly as an integer using `as int` can throw a 
`NumberFormatException` if the version is specified in a format like `"1.8"` or 
`"11.0"`.
   
   Using Gradle's built-in `JavaVersion.toVersion()` is much more robust as it 
correctly handles various Java version string formats (e.g., `"1.8"`, `"8"`, 
`"17"`) and allows for safe comparison using `JavaVersion` enum constants.
   
   ```
     def testJavaVer = project.findProperty('testJavaVersion') ? 
JavaVersion.toVersion(project.property('testJavaVersion')) : 
JavaVersion.current()
     if (testJavaVer >= JavaVersion.VERSION_17) {
   ```



-- 
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]

Reply via email to