Description
Currently, only instances of CloseableResource
that are stored in an ExtensionContext.Store
are closed automatically when the ExtensionContext
is closed. However, items stored in the session-/request-level stores only need to implement AutoCloseable
. To address this confusing difference in behavior, we should introduce a configuration parameter that allows to treat AutoCloseable
like CloseableResource
in Jupiter's stores. It should be "on" by default in 5.13.
Deliverables
- Introduce configuration parameter for enabling auto-closing
AutoCloseable
objects (true
by default) - Deprecate
CloseableResource
MakeDoesn't work becauseCloseableResource
extendAutoCloseable
so existing implementations would keep workingCloseableResource#close
is allowed to throwThrowable
, not justException
- Log warning if an object is
put intoencountered while closing theStore
that implementsCloseableResource
but notAutoCloseable
(if the feature is on) - Document migration path for external extensions (implement both
CloseableResource
andAutoCloseable
should they need to support pre-5.13 versions)