Skip to content

Conversation

@denysgaievskyi
Copy link

@denysgaievskyi denysgaievskyi commented Dec 23, 2025

Context

Problem

Kotlin suspend functions include a synthetic Continuation parameter that is added by the compiler. When sendParameterEvent iterates through method parameters and tries to access corresponding arguments, it encounters an index mismatch because:

  • The parameters array includes the synthetic continuation parameter
  • The arguments list does not include the continuation (or has fewer elements)
  • This causes an IndexOutOfBoundsException when accessing arguments.get(argumentIndex)

Solution

Enhanced the parameter filtering logic in sendParameterEvent to skip synthetic parameters in addition to existing JUnit injectable checks. The method now:

  • Checks parameter.isSynthetic() to identify compiler-generated parameters
  • Validates argumentIndex >= arguments.size() before accessing the arguments list
  • Only increments argumentIndex for non-skipped parameters

Checklist

@CLAassistant
Copy link

CLAassistant commented Dec 23, 2025

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions bot added the theme:junit-platform JUnit 5 related issue label Dec 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

theme:junit-platform JUnit 5 related issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants