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


##########
runners/google-cloud-dataflow-java/worker/build.gradle:
##########
@@ -154,6 +154,10 @@ applyJavaNature(
 
/******************************************************************************/
 // Configure the worker root project
 
+tasks.withType(Test).configureEach {
+  jvmArgs '--add-opens=java.base/java.lang=ALL-UNNAMED'
+}

Review Comment:
   ![high](https://www.gstatic.com/codereviewagent/high-priority.svg)
   
   Adding `--add-opens` directly to `jvmArgs` will cause test execution to fail 
on Java 8 environments because Java 8 does not recognize this JVM option. To 
maintain compatibility with Java 8, wrap the JVM argument configuration in a 
check for Java 9 or higher.
   
   ```
   tasks.withType(Test).configureEach {
     if (JavaVersion.current().isJava9Compatible()) {
       jvmArgs '--add-opens=java.base/java.lang=ALL-UNNAMED'
     }
   }
   ```



##########
sdks/java/io/hcatalog/build.gradle:
##########
@@ -40,6 +40,10 @@ hadoopVersions.each {kv -> 
configurations.create("hadoopVersion$kv.key")}
 
 def hive_version = "4.0.1"
 
+tasks.withType(Test).configureEach {
+   jvmArgs '--add-opens=java.base/java.net=ALL-UNNAMED'
+}

Review Comment:
   ![high](https://www.gstatic.com/codereviewagent/high-priority.svg)
   
   Adding `--add-opens` directly to `jvmArgs` will cause test execution to fail 
on Java 8 environments because Java 8 does not recognize this JVM option. To 
maintain compatibility with Java 8, wrap the JVM argument configuration in a 
check for Java 9 or higher. This also corrects the indentation to 2 spaces.
   
   ```
   tasks.withType(Test).configureEach {
     if (JavaVersion.current().isJava9Compatible()) {
       jvmArgs '--add-opens=java.base/java.net=ALL-UNNAMED'
     }
   }
   ```



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