Skip to content

Ignore JVM array descriptors when packaging HiveMQ extensions - #12168

Merged
kiview merged 1 commit into
mainfrom
claude/project-thread-r3zs73
Nov 15, 2026
Merged

kiview merged 1 commit into
mainfrom
claude/project-thread-r3zs73

Conversation

@kiview

@kiview kiview commented Nov 15, 2026 •

Copy link
Copy Markdown
Member

Takes over #11928 by @sci-jvm-study, whose fork branch doesn't allow maintainer edits. It keeps their original commit and authorship, cherry-picked onto current main. Supersedes #11928 and its duplicate #12157.

Fixes #10074.

What does this PR do?

HiveMQExtension.putSubclassesIntoJar collects class names from Javassist's constant pool and passes them to JavaArchive.addClass(String). It only skipped object array descriptors ([L...). However, ConstPool#getClassNames() also returns primitive array descriptors such as [B and multi-dimensional ones such as [[Ljava.lang.String;. These aren't class names, so addClass failed with a PatternSyntaxException.

The fix skips every JVM array descriptor by checking for [ instead of [L.

Changes

  • Ignore all array descriptors returned from the constant pool when packaging extension classes.
  • Regression test: ContainerWithExtensionSubclassIT adds PrimitiveArrayClass, whose byte-array cast puts [B into its constant pool. The test fails without the fix.

Testing

Full GitHub Actions CI is green on this branch, including :testcontainers-hivemq:check.

🤖 Generated with Claude Code

https://claude.ai/code/session_015e4ZbYTmY9fpibo9mwk7Ps

@coderabbitai

coderabbitai Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Pre-merge checks: Passed 3

Check name Status Explanation
New Module Registration Passed The check applies only when the PR adds a new directory directly under modules/. The PR (#12168, author kiview) does not add one. Its diff against the merge base 597f59c touches only existing modules…
Public Api Compatibility Passed The check fails only when the PR removes, renames, or changes the signature, return type, or visibility of a public or protected class, method, constructor, or field under src/main/java without a depr…
Tests For Behaviour Changes Passed The PR changes behaviour in production code. In modules/hivemq/src/main/java/org/testcontainers/hivemq/HiveMQExtension.java, the filter at line 155 changed from startsWith("[L") to `startsWith("["…
Full details: New Module Registration

Explanation

The check applies only when the PR adds a new directory directly under modules/. The PR (#12168, author kiview) does not add one. Its diff against the merge base 597f59c touches only existing modules: modules/hivemq (HiveMQExtension.java, ContainerWithExtensionSubclassIT.java, and the added test class PrimitiveArrayClass.java) and modules/localstack (two test files). The added file under modules/hivemq/src/test/java/.../hivemq/util/ sits inside the existing hivemq module, so it does not create a module. Because the check does not apply, the registration items (issue templates, dependabot, labeler, docs page, mkdocs nav) are not evaluated.

Full details: Public Api Compatibility

Explanation

The check fails only when the PR removes, renames, or changes the signature, return type, or visibility of a public or protected class, method, constructor, or field under src/main/java without a deprecated replacement. Commit e6100f9, the PR head, touches three files. Its only change under src/main/java is in modules/hivemq/src/main/java/org/testcontainers/hivemq/HiveMQExtension.java, where the condition startsWith("[L") becomes startsWith("[") inside the private method putSubclassesIntoJar (line 140). No signature, return type, visibility, or public or protected member changes. The other two files, ContainerWithExtensionSubclassIT.java and the new PrimitiveArrayClass.java, are under src/test/java and are outside the check's scope. The check is therefore satisfied and no public API is affected.

Full details: Tests For Behaviour Changes

Explanation

The PR changes behaviour in production code. In modules/hivemq/src/main/java/org/testcontainers/hivemq/HiveMQExtension.java, the filter at line 155 changed from startsWith("[L") to startsWith("["). This is a bug fix: primitive array descriptors such as [B no longer reach JavaArchive.addClass, which raised a PatternSyntaxException. The PR also adds a regression test under src/test (the module's modules/hivemq/src/test/java tree). ContainerWithExtensionSubclassIT now calls .addAdditionalClass(PrimitiveArrayClass.class). PrimitiveArrayClass casts an Object to byte[], which places [B in the constant pool. The test therefore exercises the changed filter path. The check's src/main/java and src/test paths map to the module-scoped paths in this repository. The test is an integration test that needs Docker. It is still a test under src/test that exercises the change, so the check passes. I did not run the test, because the build toolchain is unavailable in this sandbox.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@kiview kiview changed the title [CI only] Run CI for #11928 (HiveMQ array descriptor fix) Ignore JVM array descriptors when packaging HiveMQ extensions Nov 15, 2026
@kiview
kiview marked this pull request as ready for review November 15, 2026 17:19
@kiview
kiview requested a review from a team as a code owner November 15, 2026 17:19
@kiview
kiview merged commit e16dca9 into main Nov 15, 2026
102 checks passed
@kiview
kiview deleted the claude/project-thread-r3zs73 branch November 15, 2026 17:19
@kiview kiview added this to the next milestone Nov 15, 2026 — with Claude
@kiview kiview self-assigned this Nov 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: HiveMQExtension / Class Loading Issue

1 participant