Upgrade to JDK 17
halibobo1205 opened this issue · 13 comments
Background
Java-Tron currently only supports Oracle JDK 8. However, despite the wide usage of JDK 8, it is no longer the most preferable option for development for multiple reasons and limitations. For instance, the End of Public Updates process for legacy releases and the End of Commercial Use under the Oracle Technology Network License Agreement for Java SE both hold that. On the contrary, JDK 17 is the LTS (Long Term Support) version of Oracle announced for free commercial use in 2021. It has significant improvements in performance, stability, and security, with advantages as follows:
- Free Java License: Free Use License for All Users.
Caution
Oracle JDK Development Kit 17.0.12 is the last planned update of JDK 17 under the NFTC. Updates after September 2024 will be licensed under the Java SE OTN License (OTN) and production use beyond the limited free grants of the OTN license will require a fee. I suggest moving to OpenJDK 17, see more distributions.
- LTS: Long-Term-Support, Premier Support Until September 2026 or later.
- AArch64 Port
Important
- JEP 237: Linux/AArch64 Port(Release 9)
- JEP 388: Windows/AArch64 Port(Release 16)
- JEP 391: macOS/AArch64 Port(Release 17)
- Garbage Collectors
Important
- Language
Important
- JEP 306: Restore Always-Strict Floating-Point Semantics(Release 17)
- JEP 409: Sealed Classes(Release 17)
- JEP 361: Switch Expressions(Release 14)
Related Issues and PRs
- #5954
- #5807
- #5338
- #4746
- #4498
- #4472
- #4524
- #4211
- #4133
- #3897
- #3604
- #3542
- #3540
- #3528
- #3514
- #3504
- #2379
- #2311
- #2164
- #1179
- #1105
- #339
- #295
Scope of Impact
- Build and deployment processes
- Core application codes
- Third-party dependencies
- Development and testing environments
As far as I know
For besu, Java 21 or later is required to build Besu
Will java-tron limit the java version, or is it still compatible with java8
When do you plan to begin this upgrade?JDK 8 is unable to keep up with the times.
Background
Java-Tron currently only supports Oracle JDK 8. However, despite the wide usage of JDK 8, it is no longer the most preferable option for development for multiple reasons and limitations. For instance, the End of Public Updates process for legacy releases and the End of Commercial Use under the Oracle Technology Network License Agreement for Java SE both hold that. On the contrary, JDK 17 is the LTS (Long Term Support) version of Oracle announced for free commercial use in 2021. It has significant improvements in performance, stability, and security, with advantages as follows:
- Free Java License: Free Use License for All Users.
[!CAUTION]
Oracle JDK Development Kit 17.0.12 is the last planned update of JDK 17 under the NFTC. Updates after September 2024 will be licensed under the Java SE OTN License (OTN) and production use beyond the limited free grants of the OTN license will require a fee. I suggest moving to OpenJDK 17, see more distributions.
- LTS: Long-Term-Support, Premier Support Until September 2026 or later.
- AArch64 Port
[!IMPORTANT]
- JEP 237: Linux/AArch64 Port(Release 9)
- JEP 388: Windows/AArch64 Port(Release 16)
- JEP 391: macOS/AArch64 Port(Release 17)
- Garbage Collectors
[!IMPORTANT]
- Language
[!IMPORTANT]
- JEP 306: Restore Always-Strict Floating-Point Semantics(Release 17)
- JEP 409: Sealed Classes(Release 17)
- JEP 361: Switch Expressions(Release 14)
Related Issues and PRs
- #5954
- #5807
- #5338
- #4746
- #4498
- #4472
- #4524
- #4211
- #4133
- #3897
- #3604
- #3542
- #3540
- #3528
- #3514
- #3504
- #2379
- #2311
- #2164
- #1179
- #1105
- #339
- #295
Scope of Impact
- Build and deployment processes
- Core application codes
- Third-party dependencies
- Development and testing environments
Java 21 or later is required to build
@CarlChaoCarl Java 17 or later is required to build Java-Tron.
When do you plan to begin this upgrade?JDK 8 is unable to keep up with the times.
@abn2357 The current phase is under discussion, and the evaluation will be based on the workload.
Try to work with both JDK8 and JDK17.
Here are some common considerations:
Caution
- Floating-point arithmetic
Jdk17 may have subtle differences in floating-point precision and behavior.
Comprehensive testing is necessary for applications that rely on precise floating-point calculations.
Important
2. Default Behavior Changes
- JEP 358: Helpful NullPointerExceptions: Provides more detailed information for NullPointerExceptions(JDK 14+)
- JSR 376: Java Platform Module System: Introduces the Java Module System(JDK 9+)
- Default Garbage Collector: JDK 8: Uses Parallel GC by default, JDK 17: Uses G1 GC by default
- ... ...
Important
3. JVM options Changes
- log JVM options
- Garbage options
- ... ...
Important
4. Third-party dependencies
Ensure all third-party libraries and dependencies support JDK17.
Some incompatible dependencies may need to be updated or replaced.
- springframework
- lombok
- javax
- mockito
- ... ...
Important
5. Gradle plugins
Ensure all Gradle plugins support JDK17.
Some incompatible plugins may need to be updated or replaced.
- jacoco
- checkstyle
- ... ...
Important
6. Build and deployment process:
- Update build scripts to support JDK17.
- Ensure CI/CD pipelines can be built and tested in JDK17 environments.
- Docker support
Important
7. Cross-JDK testing
- Establish comprehensive test suites to ensure the functionality works correctly on JDK.
- Conduct performance benchmarking to compare JKD8 and JDK17 performance differences.
This issue has been added to the core devs community call #23, welcome to share the latest progress @halibobo1205, and discuss together with @CarlChaoCarl @abn2357 @thuthu24.
Caution
8. Strong data consistency and finality
Final data consistency is required for blockchain, and the world state usually guarantees it. Unfortunately, Java-Tron doesn't have a world state.
We need to think about how to ensure final data consistency.
Caution
- Floating-point arithmetic
Jdk17 may have subtle differences in floating-point precision and behavior.
Comprehensive testing is necessary for applications that rely on precise floating-point calculations.
- Math.pow different result : Tron Should Use
StrictMath
to Avoid Cross-JDK Consistency Issues. To ensure Cross-JDK compatibility for Java-Tron, I suggest a new proposal to convertMath
toStrictMath
, just like for cross-platform compatibility
Important
Commercial Use
under the Java SE OTN License (OTN), only free for:
( i) Personal Use,
(ii) Development Use,
(iii) Oracle Approved Product Use, and/or
(iv) Oracle Cloud Infrastructure Use.
Tron's other behavior should be identified as Commercial Use.
Important
JDK version compatibility
- Java 17 or later is required to build Java-Tron?
- Compatible with JDK8 and JDK17+?
Important
JDK provider
- Oracle JDK?
- Open JDK?