Skip to content

Fix: Mockito inline mock maker failing on JDK 21#10946

Open
saisafe wants to merge 1 commit intothunderbird:mainfrom
saisafe:test-resolve
Open

Fix: Mockito inline mock maker failing on JDK 21#10946
saisafe wants to merge 1 commit intothunderbird:mainfrom
saisafe:test-resolve

Conversation

@saisafe
Copy link
Copy Markdown

@saisafe saisafe commented Apr 25, 2026

Problem

Running tests on JDK 21 fails with:

Could not initialize inline Byte Buddy mock maker.
Could not self-attach to current VM using external process

This affects all JVM library modules using the thunderbird.library.jvm plugin.

Fix

Add JVM args -XX:+EnableDynamicAgentLoading and
-Djdk.attach.allowAttachSelf=true to the thunderbird.library.jvm
convention plugin so all JVM modules allow Mockito's ByteBuddy agent
to self-attach when running tests on JDK 17+.

Testing

Verified all JVM module tests pass with this fix on JDK 21.

Could not initialize inline Byte Buddy mock maker.
Could not self-attach to current VM using external process

This affects all JVM library modules using the `thunderbird.library.jvm` plugin.

Fix:
Add JVM args `-XX:+EnableDynamicAgentLoading` and
`-Djdk.attach.allowAttachSelf=true` to the `thunderbird.library.jvm`
convention plugin so all JVM modules allow Mockito's ByteBuddy agent
to self-attach when running tests on JDK 17+.

Testing:
Verified all JVM module tests pass with this fix on JDK 21.
@saisafe saisafe requested a review from a team as a code owner April 25, 2026 09:01
@saisafe saisafe requested a review from jbott-tbird April 25, 2026 09:01
@saisafe saisafe changed the title Fix: Fix Mockito inline mock maker failing on JDK 21 Fix: Mockito inline mock maker failing on JDK 21 Apr 27, 2026
@wmontwe wmontwe added the report: exclude Exclude changes from user-facing reports (internal, minor, or not relevant to users). label Apr 29, 2026
@wmontwe wmontwe requested review from wmontwe and removed request for jbott-tbird April 29, 2026 15:49
@wmontwe wmontwe assigned wmontwe and unassigned jbott-tbird Apr 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

report: exclude Exclude changes from user-facing reports (internal, minor, or not relevant to users).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants