lukecwik commented on code in PR #23771:
URL: https://github.com/apache/beam/pull/23771#discussion_r1002233998
##########
buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy:
##########
@@ -913,6 +913,11 @@ class BeamModulePlugin implements Plugin<Project> {
project.tasks.withType(JavaCompile).configureEach {
options.encoding = "UTF-8"
+ // Use --release 8 when targeting Java 8 and running on JDK > 8
Review Comment:
```suggestion
// Use --release 8 when targeting Java 8 and running on JDK > 8
//
// Consider migrating compilation and testing to use JDK 9+ and
setting '--release=8' as
// the default allowing 'applyJavaNature' to override it for the few
modules that need JDK 9+
// artifacts. See https://stackoverflow.com/a/43103038/4368200 for
additional details.
```
##########
sdks/java/container/agent/build.gradle:
##########
@@ -59,6 +59,7 @@ if (project.hasProperty('java11Home')) {
project.tasks.each {
it.onlyIf {
project.hasProperty('java11Home') || project.hasProperty('java17Home')
- || JavaVersion.VERSION_1_8.compareTo(JavaVersion.current()) < 0
+ || (JavaVersion.VERSION_1_8.compareTo(JavaVersion.current()) < 0
+ &&
JavaVersion.VERSION_1_8.compareTo(JavaVersion.toVersion(project.javaVersion)) <
0)
Review Comment:
I don't think this change is necessary since we override the compilation of
this to use JDK 11 or JDK 17 regardless of what project.javaVersion is set to.
##########
buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy:
##########
@@ -913,6 +913,11 @@ class BeamModulePlugin implements Plugin<Project> {
project.tasks.withType(JavaCompile).configureEach {
options.encoding = "UTF-8"
+ // Use --release 8 when targeting Java 8 and running on JDK > 8
+ if
(JavaVersion.VERSION_1_8.compareTo(JavaVersion.toVersion(project.javaVersion))
== 0
+ && JavaVersion.VERSION_1_8.compareTo(JavaVersion.current()) < 0) {
Review Comment:
We would want to set the `--release` flag for `compileTestJava` task as well
to ensure artifacts built there don't run into the class / method loading
problem as described in https://stackoverflow.com/a/43103038/4368200
##########
sdks/java/testing/jpms-tests/build.gradle:
##########
@@ -134,6 +134,7 @@ plugins.withType(JavaPlugin).configureEach{
project.tasks.each {
it.onlyIf {
project.hasProperty("compileAndRunTestsWithJava17")
- || JavaVersion.VERSION_1_8.compareTo(JavaVersion.current()) < 0
+ || (JavaVersion.VERSION_1_8.compareTo(JavaVersion.current()) < 0
+ &&
JavaVersion.VERSION_1_8.compareTo(JavaVersion.toVersion(project.javaVersion)) <
0)
Review Comment:
I don't think this change is necessary since we override the java compile
within BeamModulePlugin.groovy pointing it to JDK 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]