This is an automated email from the ASF dual-hosted git repository. yhu pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/beam.git
The following commit(s) were added to refs/heads/master by this push: new fd22129cee0 Fix java17 PostCommit ARM test config issue (#28234) fd22129cee0 is described below commit fd22129cee02400d841b590d25e95ccbfeaa0a4e Author: Celeste Zeng <61256376+celeste-z...@users.noreply.github.com> AuthorDate: Thu Aug 31 13:10:59 2023 -0700 Fix java17 PostCommit ARM test config issue (#28234) --- .../groovy/org/apache/beam/gradle/BeamModulePlugin.groovy | 13 ++++++++----- .../java/org/apache/beam/examples/snippets/Snippets.java | 11 ++++++----- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy b/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy index 584f8124bf0..ba090bc556c 100644 --- a/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy +++ b/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy @@ -1053,14 +1053,15 @@ 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 + // Use -source 8 -target 8 when targeting Java 8 and running on JDK > 8 // - // Consider migrating compilation and testing to use JDK 9+ and setting '--release=8' as + // Consider migrating compilation and testing to use JDK 9+ and setting '-source 8 -target 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. if (JavaVersion.VERSION_1_8.compareTo(JavaVersion.toVersion(project.javaVersion)) == 0 && JavaVersion.VERSION_1_8.compareTo(JavaVersion.current()) < 0) { - options.compilerArgs += ['--release', '8'] + options.compilerArgs += ['-source', '8'] + options.compilerArgs += ['-target', '8'] // TODO(https://github.com/apache/beam/issues/23901): Fix // optimizerOuterThis breakage options.compilerArgs += ['-XDoptimizeOuterThis=false'] @@ -1088,7 +1089,8 @@ class BeamModulePlugin implements Plugin<Project> { options.fork = true options.forkOptions.javaHome = java11Home as File options.compilerArgs += ['-Xlint:-path'] - options.compilerArgs.addAll(['--release', '11']) + options.compilerArgs += ['-source', '11'] + options.compilerArgs += ['-target', '11'] } project.tasks.withType(Test) { useJUnit() @@ -1488,7 +1490,8 @@ class BeamModulePlugin implements Plugin<Project> { if (project.hasProperty("compileAndRunTestsWithJava17")) { def java17Home = project.findProperty("java17Home") project.tasks.compileTestJava { - options.compilerArgs.addAll(['--release', '17']) + options.compilerArgs += ['-target', '17'] + options.compilerArgs += ['-source', '17'] project.ext.setJava17Options(options) } project.tasks.withType(Test) { diff --git a/examples/java/src/main/java/org/apache/beam/examples/snippets/Snippets.java b/examples/java/src/main/java/org/apache/beam/examples/snippets/Snippets.java index 808b55a92fa..3ca431455a0 100644 --- a/examples/java/src/main/java/org/apache/beam/examples/snippets/Snippets.java +++ b/examples/java/src/main/java/org/apache/beam/examples/snippets/Snippets.java @@ -1357,27 +1357,28 @@ public class Snippets { } public interface Service { - List<Record> readNextRecords(long position) throws ThrottlingException; + List<RecordPosition> readNextRecords(long position) throws ThrottlingException; } - public interface Record { + public interface RecordPosition { long getPosition(); } // [START SDF_UserInitiatedCheckpoint] @ProcessElement public ProcessContinuation processElement( - RestrictionTracker<OffsetRange, Long> tracker, OutputReceiver<Record> outputReceiver) { + RestrictionTracker<OffsetRange, Long> tracker, + OutputReceiver<RecordPosition> outputReceiver) { long currentPosition = tracker.currentRestriction().getFrom(); Service service = initializeService(); try { while (true) { - List<Record> records = service.readNextRecords(currentPosition); + List<RecordPosition> records = service.readNextRecords(currentPosition); if (records.isEmpty()) { // Return a short delay if there is no data to process at the moment. return ProcessContinuation.resume().withResumeDelay(Duration.standardSeconds(10)); } - for (Record record : records) { + for (RecordPosition record : records) { if (!tracker.tryClaim(record.getPosition())) { return ProcessContinuation.stop(); }