Skip to content

Commit 0988062

Browse files
committed
docs(#463): update docs to reference the use of kotlin AutoCloseable
1 parent 0da9928 commit 0988062

File tree

5 files changed

+11
-24
lines changed

5 files changed

+11
-24
lines changed

doc/modules/core/pages/using-environment.adoc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,11 @@ However, the purpose of a Scope is to handle the lifecycle of a long lived value
7979
Therefore, it is possible for a scoped Singleton or Multiton value to expire (most of the time because the scope itself expires).
8080
For example, in android's `ActivityRetainedScope`, scoped values will only live the duration of the activity.
8181

82-
If a value implements `ScopeCloseable`, it's `close` function will be called when the value is removed from the scope (or when the scope itself expires).
82+
If a value implements `AutoCloseable`, it's `close` function will be called when the value is removed from the scope (or when the scope itself expires).
8383

8484
[CAUTION]
8585
====
86-
The `ScopeCloseable.close` method will only be called:
86+
The `AutoCloseable.close` method will only be called:
8787
8888
- By scopes that explicitely *support* that feature (not all scopes do, all scopes provided by the _Kodein-DI_ Framework do *except WeakContextScope*).
8989
- If the value does *not* use `WeakRef` or `SoftRef` references. +
@@ -113,7 +113,7 @@ val di = DI {
113113
_Kodein-DI_ provides the `WeakContextScope` scope.
114114
This is a particular scope, as the context it holds on are weak references.
115115

116-
CAUTION: WeakContextScope is *NOT* compatible with `ScopeCloseable`.
116+
CAUTION: WeakContextScope is *NOT* compatible with `AutoCloseable`.
117117

118118
You can use this scope when it makes sense to have a scope on a context that is held by the system for the duration of its life cycle.
119119

@@ -262,9 +262,9 @@ In this example, we should provide, along with `sessionScope` a module providing
262262
=== Scope registry
263263

264264
The `ScopeRegistry` is responsible for holding value instances.
265-
It is also responsible for calling the `close` methods on object that are `ScopeCloseable` when they are removed from the registry.
265+
It is also responsible for calling the `close` methods on object that are `AutoCloseable` when they are removed from the registry.
266266

267-
IMPORTANT: To have your scope compatible with `ScopeCloseable` values, make sure to `clean` the registry when the scope expires.
267+
IMPORTANT: To have your scope compatible with `AutoCloseable` values, make sure to `clean` the registry when the scope expires.
268268

269269
There are two standard implementations of `ScopeRegistry`:
270270

doc/modules/framework/pages/android.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ val di = DI {
334334
----
335335
<1> `context` is of type `Activity` because we are using the `WeakContextScope.of<Activity>()`.
336336

337-
CAUTION: WeakContextScope is *NOT* compatible with `ScopeCloseable`.
337+
CAUTION: WeakContextScope is *NOT* compatible with `AutoCloseable`.
338338

339339

340340
=== Activity retained scope
@@ -353,7 +353,7 @@ val di = DI {
353353
}
354354
----
355355

356-
NOTE: This scope *IS* compatible with `ScopeCloseable`: xref:core:using-environment.adoc#scope-closeable[see documentation].
356+
NOTE: This scope *IS* compatible with `AutoCloseable`: xref:core:using-environment.adoc#scope-closeable[see documentation].
357357

358358

359359
=== Lifecycle scope
@@ -371,7 +371,7 @@ val di = DI {
371371

372372
NOTE: These lifecycles are *NOT* immune to activity restart due to configuration change.
373373

374-
NOTE: This scope *IS* compatible with `ScopeCloseable`: xref:core:using-environment.adoc#scope-closeable[see documentation].
374+
NOTE: This scope *IS* compatible with `AutoCloseable`: xref:core:using-environment.adoc#scope-closeable[see documentation].
375375

376376

377377
== Layered dependencies

kodein-di/src/commonTest/kotlin/org/kodein/di/Tests_13_Scope.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class Tests_13_Scope {
7373
}
7474

7575
@Test
76-
fun test_03_ScopeCloseableSingleton() {
76+
fun test_03_AutoCloseableSingleton() {
7777

7878
val myScope = UnboundedScope(SingleItemScopeRegistry())
7979

@@ -334,7 +334,7 @@ class Tests_13_Scope {
334334
}
335335

336336
@Test
337-
fun test_14_DirectBinding_ScopeCloseableSingleton() {
337+
fun test_14_DirectBinding_AutoCloseableSingleton() {
338338

339339
val myScope = UnboundedScope(SingleItemScopeRegistry())
340340

kodein-di/src/jvmTest/kotlin/org/kodein/di/GenericJvmTests_13_Scope.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class GenericJvmTests_13_Scope {
8686
}
8787

8888
@Test
89-
fun test_03_ScopeCloseableSingleton() {
89+
fun test_03_AutoCloseableSingleton() {
9090
val myScope = UnboundedScope(SingleItemScopeRegistry())
9191

9292
val kodein = DI {

test-utils/src/commonMain/kotlin/org/kodein/di/test/CloseableData.kt

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)