Skip to content

Conversation

@marcphilipp
Copy link
Member

The @TempDir annotation on a constructor parameter is copied to the
generated final instance field. This caused it top be picked up by
TempDirectory for instance field injection which then failed because
the field was final. This change now checks if a test class is an
instance of a record type and skips instance field injection. Since
records cannot have any instance fields besides the ones generated from
their constructor, there's no need to inject values into any of them.

The `@TempDir` annotation on a constructor parameter is copied to the
generated `final` instance field. This caused it top be picked up by
`TempDirectory` for instance field injection which then failed because
the field was `final`. This change now checks if a test class is an
instance of a record type and skips instance field injection. Since
records cannot have any instance fields besides the ones generated from
their constructor, there's no need to inject values into any of them.
@marcphilipp marcphilipp force-pushed the marc/tempdir-record-constructor-injection branch from 651802b to 98c7154 Compare January 27, 2025 08:40
@marcphilipp marcphilipp requested a review from sbrannen January 27, 2025 09:54
@marcphilipp marcphilipp enabled auto-merge (squash) January 27, 2025 10:12
@marcphilipp marcphilipp disabled auto-merge January 27, 2025 10:12
@marcphilipp marcphilipp merged commit f93b1fc into main Jan 27, 2025
15 checks passed
@marcphilipp marcphilipp deleted the marc/tempdir-record-constructor-injection branch January 27, 2025 10:12
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.

3 participants