Hello Ashsih, Thanks for sharing the details.
I tested the changes with both JDK 17 and JDK 21 using ./gradlew clean test, and the build/tests completed successfully on both versions. One observation during the JDK 21 build: I noticed compiler warnings similar to the below: > Task :compileJava UtilCache.java:1: warning: [dangling-doc-comments] documentation comment is not attached to any declaration ExecutionPool.java:1: warning: [dangling-doc-comments] documentation comment is not attached to any declaration ..... It looks like the JDK 21 compiler is interpreting the license headers starting with /**************** as dangling Javadoc comments due to the /** sequence at the beginning. Could you please confirm if this is expected behavior with JDK 21, or if any cleanup is required? Overall, the approach of keeping Java 17 as the target version while validating Java 21 compatibility looks good. Please let me know if I am missing anything. Kind Regards, Chandan Khandelwal On Thu, Jul 16, 2026 at 3:49 PM Ashish Vijaywargiya <[email protected]> wrote: > Hello All, > > I recently worked on a Jira issue (Upgrade java version to 21): > https://issues.apache.org/jira/browse/OFBIZ-13306 > > First of all, I provided support for Java 21 in the OFBiz trunk code. And > then after reading the comment on Jira, I concluded to provide support for > both Java17 and Java21 in the ofbiz trunk. > > More details below: > > Since Release24.09 still runs on Java 17, we've rolled trunk's compile > target back to Java 17 while keeping it tested on Java 21 too. > > Summary: > > 1) build.gradle and gradle.yml now target Java 17 again (bytecode, javadoc, > CI). Please refer how I have used metrix support in gradle.yml file. > > 2) CI now runs a JDK matrix (17 and 21) on every push/PR, skipping 21 for > release* branches. > > 3) Reverted Java 19+ only calls (Locale.of, Thread.threadId) back to their > pre-19 equivalents across 16 files, since JDK 17 doesn't have them. > > 4) Confirmed those older calls are only "deprecated," not "removed," so > they're safe on both JDK versions. > > 5) Cleaned up all resulting compiler warnings with narrowly-scoped > @SuppressWarnings("deprecation"). > > 6) Also caught and reverted two committed secret values in > security.properties back to blank. > > 7) Ran the full unit test suite (423 tests) on both JDK 17 and JDK 21 — 0 > warnings, 0 failures on both. > > 8) I have built and run the code on my laptop. Here is the console output. > > > https://issues.apache.org/jira/secure/attachment/13083276/console-output-java17.txt > > > https://issues.apache.org/jira/secure/attachment/13083277/console-output-java21.txt > > Here is the PR of my work: > https://github.com/apache/ofbiz-framework/pull/1460 > > Now I am all set to start using ofbiz trunk code on Java21 in my laptop and > others can also do the same. > > Please let me know if you may require further assistance on this work. > > Thanks & Regards, > Ashish Vijaywargiya > https://www.linkedin.com/in/ashishvijaywargiya/ >
