Skip to content

Conversation

@arukiidou
Copy link
Contributor

@arukiidou arukiidou commented Oct 31, 2025

Migrate ExtensionContext.Store.CloseableResource to AutoCloseable

background

ExtensionContext.Store.CloseableResource is deprecated since 5.13

see:
https://docs.junit.org/5.14.0/user-guide/#extensions-keeping-state

Resource management via AutoCloseable
An extension context store is bound to its extension context lifecycle. When an extension context lifecycle ends it closes its associated store. As of JUnit 5.13, all stored values that are instances of AutoCloseable are notified by an invocation of their close() method in the inverse order they were added in (unless the junit.jupiter.extensions.store.close.autocloseable.enabled configuration parameter is set to false). Older versions only supported CloseableResource, which is deprecated but still available for backward compatibility.

https://docs.junit.org/5.14.0/api/org.junit.jupiter.api/org/junit/jupiter/api/extension/ExtensionContext.Store.CloseableResource.html

Deprecated.
Please extend AutoCloseable directly.

Copy link
Member

@yury-s yury-s left a comment

Choose a reason for hiding this comment

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

Does it work with older versions of junit (<5.13)?

Playwright itself is currently using 5.13 and if we are going to break those on an older junit, it'd better be a good reason for that.

@yury-s
Copy link
Member

yury-s commented Nov 12, 2025

@uchagani what do you think about the change?

@yury-s
Copy link
Member

yury-s commented Nov 12, 2025

Oh, it's playwright dependency, should be fine then.

@yury-s yury-s merged commit 0f14588 into microsoft:main Nov 12, 2025
17 of 19 checks passed
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.

[Feature]: Replace ExtensionContext.Store.CloseableResource to AutoCloseable

2 participants