Skip to content

Fix ScopedObject cleanup for JUnit 5.9.x compatibility#156

Merged
tsegismont merged 1 commit intoeclipse-vertx:masterfrom
tsegismont:issue/155
Mar 24, 2026
Merged

Fix ScopedObject cleanup for JUnit 5.9.x compatibility#156
tsegismont merged 1 commit intoeclipse-vertx:masterfrom
tsegismont:issue/155

Conversation

@tsegismont
Copy link
Copy Markdown
Member

See #155

ScopedObject must implement both ExtensionContext.Store.CloseableResource and AutoCloseable to ensure proper cleanup across all JUnit 5.x versions.

JUnit 5.9.x and earlier only recognize CloseableResource for automatic cleanup. Without it, ScopedObject.close() is never called, causing resources (Vertx instances, HTTP servers) to leak between test iterations.

JUnit 5.11+ added AutoCloseable support, but we need both interfaces for backward compatibility with users on older JUnit versions.

…#155)

See eclipse-vertx#155

ScopedObject must implement both ExtensionContext.Store.CloseableResource
and AutoCloseable to ensure proper cleanup across all JUnit 5.x versions.

JUnit 5.9.x and earlier only recognize CloseableResource for automatic
cleanup. Without it, ScopedObject.close() is never called, causing
resources (Vertx instances, HTTP servers) to leak between test iterations.

JUnit 5.11+ added AutoCloseable support, but we need both interfaces
for backward compatibility with users on older JUnit versions.

Signed-off-by: Thomas Segismont <[email protected]>
@tsegismont tsegismont added this to the 5.1.0 milestone Mar 24, 2026
@tsegismont tsegismont merged commit d972615 into eclipse-vertx:master Mar 24, 2026
4 checks passed
@tsegismont tsegismont deleted the issue/155 branch March 24, 2026 16:41
tsegismont added a commit to tsegismont/vertx-junit5 that referenced this pull request Mar 24, 2026
…#155) (eclipse-vertx#156)

See eclipse-vertx#155

ScopedObject must implement both ExtensionContext.Store.CloseableResource
and AutoCloseable to ensure proper cleanup across all JUnit 5.x versions.

JUnit 5.9.x and earlier only recognize CloseableResource for automatic
cleanup. Without it, ScopedObject.close() is never called, causing
resources (Vertx instances, HTTP servers) to leak between test iterations.

JUnit 5.11+ added AutoCloseable support, but we need both interfaces
for backward compatibility with users on older JUnit versions.

Signed-off-by: Thomas Segismont <[email protected]>
tsegismont added a commit that referenced this pull request Mar 24, 2026
…157)

See #155

ScopedObject must implement both ExtensionContext.Store.CloseableResource
and AutoCloseable to ensure proper cleanup across all JUnit 5.x versions.

JUnit 5.9.x and earlier only recognize CloseableResource for automatic
cleanup. Without it, ScopedObject.close() is never called, causing
resources (Vertx instances, HTTP servers) to leak between test iterations.

JUnit 5.11+ added AutoCloseable support, but we need both interfaces
for backward compatibility with users on older JUnit versions.

Signed-off-by: Thomas Segismont <[email protected]>
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.

1 participant