feat(build): support JDK 21 - #139
Conversation
🤖 CodeAnt AI — Review Status
|
Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0b97f995fa
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
8c4d2e5 to
969b215
Compare
Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
969b215 to
75426f2
Compare
Migrate deprecated Gradle APIs while retaining JDK 8 compatibility. Bump protobuf-gradle-plugin 0.9.1 -> 0.9.6 for Gradle 8 support. Move protobuf generation from src/ to build/generated and exclude legacy generated sources so incremental builds cannot compile duplicate classes. Update the custom actuator guides for the relocated codegen path and lifecycle. Declare jacocoTestReport dependency on classes so Gradle 8 task validation holds when test is excluded from the graph. Refresh dependency verification metadata for the upgraded build tooling.
Accept JDK 8 or newer on x86_64 and JDK 17 or newer on ARM64 while continuing to emit Java 8 bytecode. Select VM options from the build JVM and remove runtime gates that previously required exact JDK versions. Rework install_dependencies.sh to keep any JDK meeting the architecture minimum, and drop the now-dead gate code and its tests. Make JDK 21 static mocking work by excluding Mockito transitive Byte Buddy 1.12.19 and declaring 1.17.7 directly while retaining JDK 8 runtime compatibility. Remove the obsolete 1.12.19 verification entries.
Upgrade JaCoCo, Lombok, AspectJ runtime/weaver, and the Gradle test-retry plugin. Remove the unused JDK 17-only AspectJ compiler tools and refresh strict dependency verification metadata, including the required plugin POM checksum.
Move the legacy-compatible MathWrapper into the platform common source set and remove the x86 Math implementation. This keeps transcendental results deterministic across JDKs and architectures.
Exercise every supported architecture and JDK combination in pull requests: x86_64 on JDK 8, 17 and 21, and ARM64 on JDK 17 and 21, covering Linux for both plus macOS on JDK 21. This guards the architecture minimums as well as newer-JDK compatibility. Pin JDK 17 explicitly on Rocky Linux and assert the active version: "Development Tools" pulls in java-1.8.0-openjdk-headless, whose alternatives priority outranks the JDK 17 package and would otherwise leave the build on a JRE without javac.
75426f2 to
1c05cca
Compare
Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1c05cca949
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Error Prone 2.42.0 ships Java 17 class files, so enabling it on JDK 11 through 16 fails while loading the compiler plugin. Skip the custom checker below JDK 17 and keep it enabled for supported newer JDKs.
Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
User description
What does this PR do?
Modernizes the build toolchain and widens the supported JDK envelope, in 5 commits:
build(gradle): Gradle 7.6.4 → 8.14.5. Migrates removed Gradle 7 APIs (reportenabled→required,mainClassName→application.mainClass,fileMode→filePermissions, archive properties), bumps protobuf-gradle-plugin 0.9.1 → 0.9.6, and relocates protobuf codegen out ofprotocol/src/intobuild/generated. Legacy generated sources left inprotocol/src/main/javaby older builds are excluded from compilation and purged automatically, so existing checkouts upgrade without duplicate-class failures. DeclaresjacocoTestReport's dependency onclassesso Gradle 8 task validation holds forbuild -x test.feat(build): per-arch JDK minimums. The build now accepts JDK 8+ on x86_64 and JDK 17+ on ARM64 (previously exact 8/17), while--release 8keeps all bytecode Java 8 (major 52). The runtime exact-JDK gate inFullNodeis removed (see rationale below). Test mocking works on JDK 21 by excluding Mockito's Byte Buddy 1.12.19 and declaring 1.17.7 directly.install_dependencies.shnow keeps any JDK meeting the architecture minimum instead of requiring an exact version, and validates the same JVM gradlew would use —JAVA_HOMEfirst, thenPATH— requiringjavacin that same installation so a JRE is never mistaken for a JDK, and exiting non-zero when the resulting environment cannot build.build(deps): JDK-compatible tooling. lombok 1.18.46, AspectJ 1.9.25 (aspectjtools dropped — unused), JaCoCo 0.8.15, test-retry 1.6.5.fix(math): unify pow behavior across architectures. Removes the x86-onlyMathWrapper(rawMath.pow) and promotes the StrictMath + mainnet-patch-table implementation (already used by all ARM64 nodes to sync from genesis) as the single cross-arch implementation. All 48 historicalpowspecial cases are preserved byte-for-byte.ci: every supported architecture × JDK combination is now built. x86_64 on JDK 8 (Debian 11), 17 (Rocky Linux 8) and 21 (Ubuntu 24.04); ARM64 on JDK 17 and 21 (Ubuntu 24.04) plus JDK 21 on macOS 26. The Rocky Linux job additionally pins JDK 17 explicitly and asserts the active version —dnf groupinstall "Development Tools"pulls injava-1.8.0-openjdk-headless, whose RHEL alternatives priority (1800502 vs 1) hijacksjavaand would leave the build on a JRE withoutjavac.Why are these changes required?
The exact-JDK runtime pin existed solely because x86 consensus
powdepended on JDK 8'sMath.powintrinsics. UnifyingMathWrapperonStrictMath(bit-reproducible by spec across JDKs and architectures) removes that dependency, which is what makes the minimum-based JDK envelope sound. Gradle 7.6.4 cannot run modern JDKs; 8.14.5 supports building on JDK 8–24.Consensus note: on mainnet/nile/shasta
ALLOW_STRICT_MATH(chain parameter 87, activated by mainnet proposal 101) is active, so new blocks useStrictMathWrapperand this change only affects historical replay, which the 48-entry table reproduces exactly — behaviour already validated by every ARM64 node syncing mainnet from genesis. Private chains that have not activated the parameter still executeMathWrapper.powon the live path and should upgrade all x86 nodes in lockstep (or activate the proposal first).This PR has been tested by:
AllowTvmLondonTest,ValidateMultiSignContractTeston JDK 21; a disjoint set on JDK 25); each passes cleanly when run on its own on both JDK 17 and JDK 21, so they are load-sensitive rather than JDK-specific.protocol/src/) rebuilt on this branch without clean — no duplicate classesbuild -x test)FullNode.jarboots and produces blocks on a JDK 25 private chain; packaged JDK17+ vmoptions validated on 17/21/25JAVA_HOMEpointing at a JRE, a JDK below the architecture minimum, a JDK 8jresubdirectory, or an invalid path are all rejected;PATH-only JDK 8/17 andJAVA_HOME-set JDK 17 are accepted; a machine with nojavais detected as suchgradle-wrapper.jarbyte-identical to the official 8.14.5 release; every changedverification-metadata.xmlchecksum re-derived from Maven Central / Gradle Plugin PortalFollow up
sun.misc.Unsafe(warn-only on JDK 24/25; JDK 26 plans deny-by-default per JEP 498) — revisit with a netty upgradebuildFinished,configurations.archives, eager task APIs) remain and will need attention at the next Gradle majorExtra details
bin/vmoptions are selected when the distribution is built (build JDK < 17 → CMS file, ≥ 17 → ZGC file) rather than detected at node startup, so a distribution targets its build JDK's runtime family;java -jaris runtime-agnostic (verified 8→25).Build rockylinux (JDK 17 / x86_64),Build macos26 (JDK 21 / aarch64)) and one job is added (Build ubuntu24 (JDK 21 / x86_64|aarch64)) — branch-protection required checks need a one-time update. The added job runs in parallel, so wall-clock CI time is unchanged.MathWrappervariants (one renamed, one deleted), plus dead-code removal inFullNode,ArchandTronError.CodeAnt-AI Description
Support newer JDKs while keeping builds and runtime behavior compatible across architectures
What Changed
javac, and reports failure when the environment cannot build.Impact
✅ JDK 21 builds on x86_64 and ARM64✅ Fewer setup failures from incompatible or incomplete Java installations✅ Consistent power results across architectures💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
Preserve Org Learnings with CodeAnt
You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.