Skip to content

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

Merged
wmontwe merged 1 commit intothunderbird:mainfrom
saisafe:test-resolve
Apr 30, 2026
Merged

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

Conversation

@saisafe
Copy link
Copy Markdown
Contributor

@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
Copy link
Copy Markdown
Member

@wmontwe wmontwe left a comment

Choose a reason for hiding this comment

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

Thank you for the fix!

@wmontwe wmontwe merged commit f3da7a2 into thunderbird:main Apr 30, 2026
18 of 20 checks passed
@thunderbird-botmobile
Copy link
Copy Markdown
Contributor

Thanks for your contribution! Your pull request has been merged and will be part of Thunderbird 20. We appreciate the time and effort you put into improving Thunderbird. If you haven’t already, you’re welcome to join our Matrix chat for contributors. It’s where we discuss development and help each other out. https://matrix.to/#/#tb-android-dev:mozilla.org
Hope to see you there! 🚀📱🐦

@thunderbird-botmobile thunderbird-botmobile Bot added this to the Thunderbird 20 milestone Apr 30, 2026
@saisafe saisafe deleted the test-resolve branch April 30, 2026 09:25
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