Foundation: Java 21 baseline + migration status by devin-ai-integration[bot] · Pull Request #17 · hitomimimi/cloudstack · GitHub
Skip to content

Foundation: Java 21 baseline + migration status#17

Open
devin-ai-integration[bot] wants to merge 3 commits into
att/4.22.0.0from
demo/java-21-foundation-v11
Open

Foundation: Java 21 baseline + migration status#17
devin-ai-integration[bot] wants to merge 3 commits into
att/4.22.0.0from
demo/java-21-foundation-v11

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented May 11, 2026

Copy link
Copy Markdown

Description

This PR lays the foundation for migrating Apache CloudStack 4.22.0.0 from JDK 11 to JDK 21. It contains three atomic changes:

  1. JDK version bumpcs.jdk.version property in root pom.xml changed from 11 to 21. All 25 modules in the server dependency tree (mvn install -DskipTests -pl server -am) compile successfully under OpenJDK 21.

  2. CI workflow updatesbuild.yml updated from JDK 17 to 21. trigger-package-and-publish.yml received its missing Apache License header and a trailing-whitespace fix. Other CI workflows (ci.yml, codecov.yml, sonar-check.yml) are gated by github.repository == 'apache/cloudstack' and are not modified.

  3. Migration status documentJAVA_21_MIGRATION_STATUS.md added at repo root with module-by-module analysis (7,596 Java files, 253 deprecated API hits across 9 categories), a critical cglib blocker finding, and a 6-phase rollout plan with effort estimates.

Known blocker: cglib-nodep:3.3.0 (unmaintained since 2019) cannot process JDK 21 class files (major version 65), blocking 64 DAO unit tests in engine/schema. Fix requires migrating to ByteBuddy — tracked as Phase 2 in the status document.

Key items for reviewer attention:

  • cs.jdk.version jumps from 11→21. Verify this property's usage as source/target level is appropriate for all downstream modules.
  • The pre-existing argLine in pom.xml contains -noverify, which is deprecated in JDK 21 and may need removal in a follow-up.
  • Confirm that fork-gated workflows (ci.yml, etc. checking github.repository == 'apache/cloudstack') are correctly excluded from this change scope.
  • Deprecated API counts in the migration doc are approximate (regex-based scan); verify accuracy before using for sprint planning.

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • Build/CI
  • Test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

Sandbox BUILD SUCCESS (25/25 modules, JDK 21):

BUILD SUCCESS

How Has This Been Tested?

  • Sandbox build verified: mvn install -DskipTests -Dcheckstyle.skip=true -pl server -am under OpenJDK 21.0.7 — all 25 modules compiled successfully.
  • VMInstanceDaoImplTest executed under JDK 21 to verify test-layer compatibility; cglib blocker confirmed via dependency analysis (cglib-nodep:3.3.0 in engine/schema dependency tree).
  • CI (build.yml) expected to pass with JDK 21 (compilation with -DskipTests).

How did you try to break this feature and the system with this change?

  • Ran the full server module tree compilation (25 modules) to surface any JDK 21 incompatibilities — none found at compile time.
  • Ran DAO unit tests to probe runtime compatibility — identified cglib as the blocking dependency.
  • Verified that no application source code was modified — this PR is build/CI/docs only.

Link to Devin session: https://app.devin.ai/sessions/ceb6e2ff79f541ce97922e8aba3b5daa
Requested by: @hitomimimi


Open in Devin Review

devin-ai-integration Bot and others added 3 commits May 11, 2026 14:27
Co-Authored-By: hitomi.sawamura@gmail.com <hitomi.sawamura@gmail.com>
… issues

Co-Authored-By: hitomi.sawamura@gmail.com <hitomi.sawamura@gmail.com>
Co-Authored-By: hitomi.sawamura@gmail.com <hitomi.sawamura@gmail.com>
@devin-ai-integration

Copy link
Copy Markdown
Author

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

View 4 additional findings in Devin Review.

Open in Devin Review

Comment thread pom.xml

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

🔴 JDK 21 bytecode target breaks cglib-nodep 3.3.0 at runtime, causing application startup failures

Bumping cs.jdk.version to 21 sets <source>21</source><target>21</target> in maven-compiler-plugin (pom.xml:1085-1086), producing class files with major version 65. However, cs.cglib.version remains at 3.3.0 (pom.xml:134), and cglib-nodep 3.3.0 bundles ASM 7.x which only supports class file versions up to ~57 (JDK 13). When cglib tries to enhance JDK 21 class files, it will throw IllegalArgumentException: Unsupported class file major version 65. This is not just a test issue — cglib Enhancer is called at runtime during Spring bean initialization in ComponentInstantiationPostProcessor.postProcessBeforeInstantiation() (utils/src/main/java/com/cloud/utils/component/ComponentInstantiationPostProcessor.java:87-93) for all beans implementing ComponentMethodInterceptable, and in AsyncCallbackDispatcher (framework/ipc/src/main/java/org/apache/cloudstack/framework/async/AsyncCallbackDispatcher.java:27-30) for async callback proxies. The CI workflow masks this by using -DskipTests.

Prompt for agents
The root cause is that cs.jdk.version was bumped to 21 while cglib-nodep remains at 3.3.0, which cannot handle JDK 21 class files (major version 65). cglib-nodep is unmaintained (last release 2019). There are two possible approaches:

1. Replace cglib-nodep with ByteBuddy across all usages. This requires updating ComponentInstantiationPostProcessor.java, MethodCapturer.java, ComponentNamingPolicy.java (in utils module), AsyncCallbackDispatcher.java, RpcCallbackDispatcher.java (in framework/ipc module), and any Spring XML/config that references cglib. Also update the pom.xml dependency declarations in the root pom, utils/pom.xml, framework/ipc/pom.xml, and plugins/user-authenticators/ldap/pom.xml.

2. If the migration must be phased, keep cs.jdk.version at 11 (or use the --release 11 flag) until cglib is replaced, so that class files are still produced at a version cglib can handle. This allows building with JDK 21 as the toolchain while maintaining binary compatibility.

Also note that Spring Framework 5.3.26 repackages cglib internally and that version also predates JDK 21 support (added in Spring 5.3.30+). The org.springframework.version should be bumped to at least 5.3.30 as well.
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Good catch — this is a known blocker that we've already documented. The cglib-nodep:3.3.0 incompatibility with JDK 21 class files (major version 65) is called out in JAVA_21_MIGRATION_STATUS.md as a Critical Blocker and tracked as Phase 2 (Dependency Updates) in the 6-phase rollout plan.

The fix (migrating cglib → ByteBuddy + bumping Spring to 5.3.30+) is intentionally scoped as a follow-up task, not part of this foundation PR. This PR establishes the baseline and documents all blockers so they can be addressed systematically.

The cglib finding has also been saved to the Devin Knowledge base for persistence across sessions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant