Skip to content

Conversation

@marcphilipp
Copy link
Member

Overview

Fixes #4417.


I hereby agree to the terms of the JUnit Contributor License Agreement.


Definition of Done

@marcphilipp marcphilipp self-assigned this Mar 23, 2025
// Ensure that the outer instance is resolved as the first parameter if
// the executable is a constructor for an inner class.
if (outerInstance.isPresent()) {
Preconditions.condition(parameters[0].isImplicit(), "First parameter must be implicit");
Copy link
Member

@sormuras sormuras Mar 23, 2025

Choose a reason for hiding this comment

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

Instead of deleting this check, wouldn't it be better to also apply the same isInnerClass(...) test?

Copy link
Member Author

Choose a reason for hiding this comment

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

That's basically what outerInstance.isPresent() does. I only recently added this check when working on parameterized classes.

private static Object resolveParameter(ParameterContext parameterContext, Executable executable,
ExtensionContextSupplier extensionContext, ExtensionRegistry extensionRegistry) {

Preconditions.condition(!parameterContext.getParameter().isImplicit(),
Copy link
Member

@sormuras sormuras Mar 23, 2025

Choose a reason for hiding this comment

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

Same here: replace test with isInnerClass(...) check applicable?

@marcphilipp marcphilipp merged commit 770098d into main Mar 24, 2025
13 checks passed
@marcphilipp marcphilipp deleted the marc/4417-fix-nested-constructor-parameter-resolution branch March 24, 2025 06:33
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.

Nested tests broken with 5.13.0-M1 on Java 17

3 participants