Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/beam_PreCommit_Java_HBase_IO_Direct.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ jobs:
github_job: ${{ matrix.job_name }} (${{ matrix.job_phrase }})
- name: Setup environment
uses: ./.github/actions/setup-environment-action
with:
java-vesion: 11
- name: run HBase IO build script
uses: ./.github/actions/gradle-command-self-hosted-action
with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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')) {

options.compilerArgs -= [
'-Xlint:-this-escape',
]
}
if (ver == '8') {
def java8Home = project.findProperty("java8Home")
options.fork = true
Expand Down
Loading