From 940d1185390742fc0c6319acb09dba00303d1c9d Mon Sep 17 00:00:00 2001 From: Roman Andrushchenko Date: Wed, 1 Jul 2026 00:18:02 +0300 Subject: [PATCH] chore: Downgrade Kotlin to 2.2.21 to make the library compatible with older Android/Kotlin projects --- README.md | 2 +- .../subject/FlowDependencyStoreImpl.kt | 2 +- .../subject/LazyFlowSubjectExtensions.kt | 4 +- .../LazyFlowSubjectImplIntegrationTest.kt | 68 +++++++++---------- gradle-public.properties | 2 +- gradle/libs.versions.toml | 2 +- skills/container-store/README.md | 2 +- skills/container-store/SKILL.md | 4 +- store/README.md | 2 +- 9 files changed, 44 insertions(+), 44 deletions(-) diff --git a/README.md b/README.md index bf521c0..2454866 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ The full documentation is available [here](https://docs.uandcode.com/container). Add the following line to your `build.gradle` file: ``` -implementation "com.elveum:container:3.1.0" +implementation "com.elveum:container:3.1.1" ``` ## Core Concepts diff --git a/container/src/main/java/com/elveum/container/subject/FlowDependencyStoreImpl.kt b/container/src/main/java/com/elveum/container/subject/FlowDependencyStoreImpl.kt index 124280a..3d791ed 100644 --- a/container/src/main/java/com/elveum/container/subject/FlowDependencyStoreImpl.kt +++ b/container/src/main/java/com/elveum/container/subject/FlowDependencyStoreImpl.kt @@ -35,7 +35,7 @@ internal class FlowDependencyStoreImpl( ) : FlowDependencyStore { private var scope: CoroutineScope? = null - private var recomposeFunction: RecomposeFunction = {} + private var recomposeFunction: RecomposeFunction = RecomposeFunction {} private var debounceReloadJob: Job? = null private val debounceFlow = MutableSharedFlow( diff --git a/container/src/main/java/com/elveum/container/subject/LazyFlowSubjectExtensions.kt b/container/src/main/java/com/elveum/container/subject/LazyFlowSubjectExtensions.kt index a9c116f..41d692a 100644 --- a/container/src/main/java/com/elveum/container/subject/LazyFlowSubjectExtensions.kt +++ b/container/src/main/java/com/elveum/container/subject/LazyFlowSubjectExtensions.kt @@ -81,7 +81,7 @@ public suspend fun LazyFlowSubject.newSimpleLoad( metadata: ContainerMetadata = EmptyMetadata, valueLoader: SimpleValueLoader, ): T { - val multipleLoader: ValueLoader = { + val multipleLoader: ValueLoader = ValueLoader { emit(valueLoader(), metadata, isLastValue = true) } val flow = newLoad(config, valueLoader = multipleLoader) @@ -99,7 +99,7 @@ public fun LazyFlowSubject.newSimpleAsyncLoad( metadata: ContainerMetadata = EmptyMetadata, valueLoader: SimpleValueLoader ) { - val multipleLoader: ValueLoader = { + val multipleLoader: ValueLoader = ValueLoader { emit(valueLoader(), metadata, isLastValue = true) } newAsyncLoad(config, valueLoader = multipleLoader) diff --git a/container/src/test/java/com/elveum/container/subject/LazyFlowSubjectImplIntegrationTest.kt b/container/src/test/java/com/elveum/container/subject/LazyFlowSubjectImplIntegrationTest.kt index d5e5c50..f533890 100644 --- a/container/src/test/java/com/elveum/container/subject/LazyFlowSubjectImplIntegrationTest.kt +++ b/container/src/test/java/com/elveum/container/subject/LazyFlowSubjectImplIntegrationTest.kt @@ -129,7 +129,7 @@ class LazyFlowSubjectImplIntegrationTest { @Test fun listen_withinTimeout_holdsLatestLoadedValue() = runFlowTest { var index = 0 - val loader: ValueLoader = { + val loader: ValueLoader = ValueLoader { emit("v${++index}") } val spyLoader = spyk(loader) @@ -156,7 +156,7 @@ class LazyFlowSubjectImplIntegrationTest { @Test fun listen_afterTimeout_startsLoadingFromScratch() = runFlowTest { var index = 0 - val loader: ValueLoader = { + val loader: ValueLoader = ValueLoader { emit("v${++index}") } val spyLoader = spyk(loader) @@ -184,7 +184,7 @@ class LazyFlowSubjectImplIntegrationTest { fun listen_whichIsCalledTwice_startsLoadingOnlyOnce() = runFlowTest { var index = 0 var loaderCalls = 0 - val loader: ValueLoader = { + val loader: ValueLoader = ValueLoader { loaderCalls++ delay(100) emit("v${++index}") @@ -211,7 +211,7 @@ class LazyFlowSubjectImplIntegrationTest { fun listen_whichIsCalledTwiceOnSameInstance_startsLoadingOnlyOnce() = runFlowTest { var index = 0 var loaderCalls = 0 - val loader: ValueLoader = { + val loader: ValueLoader = ValueLoader { loaderCalls++ delay(100) emit("v${++index}") @@ -238,7 +238,7 @@ class LazyFlowSubjectImplIntegrationTest { @Test fun listen_withCancellationOfNotAllCollectors_holdsCachedValue() = runFlowTest { var index = 0 - val loader: ValueLoader = { + val loader: ValueLoader = ValueLoader { emit("v${++index}") } val spyLoader = spyk(loader) @@ -269,8 +269,8 @@ class LazyFlowSubjectImplIntegrationTest { @Test fun newLoad_startsNewLoadWithPendingStatus() = runFlowTest { - val loader1: ValueLoader = { emit("111") } - val loader2: ValueLoader = { + val loader1: ValueLoader = ValueLoader { emit("111") } + val loader2: ValueLoader = ValueLoader { delay(100) emit("222") } @@ -291,9 +291,9 @@ class LazyFlowSubjectImplIntegrationTest { @Test fun newLoad_loadsNewValue() = runFlowTest { - val loader1: ValueLoader = { emit("111") } + val loader1: ValueLoader = ValueLoader { emit("111") } var loader2Calls = 0 - val loader2: ValueLoader = { + val loader2: ValueLoader = ValueLoader { loader2Calls++ delay(100) emit("222") @@ -315,9 +315,9 @@ class LazyFlowSubjectImplIntegrationTest { @Test fun newLoad_withSilentMode_loadsNewValueWithoutPendingStatus() = runFlowTest { - val loader1: ValueLoader = { emit("111") } + val loader1: ValueLoader = ValueLoader { emit("111") } var loader2Calls = 0 - val loader2: ValueLoader = { + val loader2: ValueLoader = ValueLoader { loader2Calls++ delay(100) emit("222") @@ -339,11 +339,11 @@ class LazyFlowSubjectImplIntegrationTest { @Test fun newLoad_cancelsPreviousLoad() = runFlowTest { - val loader1: ValueLoader = { + val loader1: ValueLoader = ValueLoader { delay(100) emit("111") } - val loader2: ValueLoader = { + val loader2: ValueLoader = ValueLoader { delay(100) emit("222") } @@ -368,15 +368,15 @@ class LazyFlowSubjectImplIntegrationTest { @Test fun newLoad_returnsFlowThatEmitsAllValuesOfNewUpload() = runFlowTest { - val loader1: ValueLoader = { + val loader1: ValueLoader = ValueLoader { emit("11") emit("12") } - val loader2: ValueLoader = { + val loader2: ValueLoader = ValueLoader { emit("21") emit("22") } - val loader3: ValueLoader = { + val loader3: ValueLoader = ValueLoader { emit("31") emit("32") } @@ -397,15 +397,15 @@ class LazyFlowSubjectImplIntegrationTest { @Test fun newLoad_withCancelledLoad_returnsFlowThatFailsWithException() = runFlowTest { - val defaultLoader: ValueLoader = { + val defaultLoader: ValueLoader = ValueLoader { emit("1") } - val loader1: ValueLoader = { + val loader1: ValueLoader = ValueLoader { emit("21") delay(100) emit("22") } - val loader2: ValueLoader = { + val loader2: ValueLoader = ValueLoader { emit("3") } val subject = createLazyFlowSubject(defaultLoader) @@ -425,10 +425,10 @@ class LazyFlowSubjectImplIntegrationTest { @Test fun newLoad_withFailedLoad_returnsFlowThatAlsoFails() = runFlowTest { - val defaultLoader: ValueLoader = { + val defaultLoader: ValueLoader = ValueLoader { emit("1") } - val loader1: ValueLoader = { + val loader1: ValueLoader = ValueLoader { emit("2") throw IllegalArgumentException() } @@ -445,8 +445,8 @@ class LazyFlowSubjectImplIntegrationTest { @Test fun newLoad_withFailedLoad_emitsErrorToFlowReturnedByListenMethod() = runFlowTest { - val loader1: ValueLoader = { delay(100) } - val loader2: ValueLoader = { + val loader1: ValueLoader = ValueLoader { delay(100) } + val loader2: ValueLoader = ValueLoader { delay(10) emit("222") delay(10) @@ -470,11 +470,11 @@ class LazyFlowSubjectImplIntegrationTest { @Test fun newLoad_afterNewLoad_usesLastLoader() = runFlowTest { - val loader1: ValueLoader = { + val loader1: ValueLoader = ValueLoader { delay(10) emit("111") } - val loader2: ValueLoader = { + val loader2: ValueLoader = ValueLoader { delay(10) emit("222") } @@ -575,7 +575,7 @@ class LazyFlowSubjectImplIntegrationTest { @Test fun updateWith_cancelsLoadingAndEmitsNewValueImmediately() = runFlowTest { - val loader: ValueLoader = { + val loader: ValueLoader = ValueLoader { delay(10) emit("111") } @@ -594,7 +594,7 @@ class LazyFlowSubjectImplIntegrationTest { @Test fun updateWith_emitsNewValue() = runFlowTest { - val loader: ValueLoader = { + val loader: ValueLoader = ValueLoader { delay(10) emit("111") } @@ -613,7 +613,7 @@ class LazyFlowSubjectImplIntegrationTest { @Test fun updateWithMapper_cancelsLoadingAndEmitsNewValueImmediately() = runFlowTest { - val loader: ValueLoader = { + val loader: ValueLoader = ValueLoader { delay(10) emit("111") } @@ -632,7 +632,7 @@ class LazyFlowSubjectImplIntegrationTest { @Test fun updateWithMapper_emitsNewValue() = runFlowTest { - val loader: ValueLoader = { + val loader: ValueLoader = ValueLoader { delay(10) emit("111") } @@ -651,7 +651,7 @@ class LazyFlowSubjectImplIntegrationTest { @Test fun updateWithMapper_withReturningSameValue_doesNotReEmitIt() = runFlowTest { - val loader: ValueLoader = { + val loader: ValueLoader = ValueLoader { delay(10) emit("111") } @@ -717,7 +717,7 @@ class LazyFlowSubjectImplIntegrationTest { @Test fun activeCollectorsCount_with1ActiveCollectors_returns1() = runFlowTest { - val loader: ValueLoader = { emit("111") } + val loader: ValueLoader = ValueLoader { emit("111") } val subject = createLazyFlowSubject(loader) subject.listen().startCollecting() @@ -727,7 +727,7 @@ class LazyFlowSubjectImplIntegrationTest { @Test fun activeCollectorsCount_with2Collectors_returns2() = runFlowTest { - val loader: ValueLoader = { emit("111") } + val loader: ValueLoader = ValueLoader { emit("111") } val subject = createLazyFlowSubject(loader) subject.listen().startCollecting() @@ -738,7 +738,7 @@ class LazyFlowSubjectImplIntegrationTest { @Test fun activeCollectorsCount_with2CollectorsOnSameFlow_returns2() = runFlowTest { - val loader: ValueLoader = { emit("111") } + val loader: ValueLoader = ValueLoader { emit("111") } val subject = createLazyFlowSubject(loader) val flow = subject.listen() @@ -750,7 +750,7 @@ class LazyFlowSubjectImplIntegrationTest { @Test fun activeCollectorsCount_afterCancellation_decreasesNumberOfCollectors() = runFlowTest { - val loader: ValueLoader = { emit("111") } + val loader: ValueLoader = ValueLoader { emit("111") } val subject = createLazyFlowSubject(loader) val state1 = subject.listen().startCollecting() // 1 active collector diff --git a/gradle-public.properties b/gradle-public.properties index ae59fc7..82e2e84 100644 --- a/gradle-public.properties +++ b/gradle-public.properties @@ -6,7 +6,7 @@ android.nonTransitiveRClass=true # Maven Central publishing coordinates GROUP=com.elveum -VERSION_NAME=3.1.0 +VERSION_NAME=3.1.1 # POM metadata POM_DESCRIPTION=A library for simplifying state management and data loading in Android applications diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 7fe9bad..7c02c69 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,6 +1,6 @@ [versions] agp = "9.0.1" -kotlin = "2.3.10" +kotlin = "2.2.21" ksp = "2.3.5" dokka = "2.2.0" coroutines = "1.10.2" diff --git a/skills/container-store/README.md b/skills/container-store/README.md index 507b4f6..fd28f61 100644 --- a/skills/container-store/README.md +++ b/skills/container-store/README.md @@ -43,4 +43,4 @@ discovers skills (e.g. `~/.agents/skills/` for Codex), or paste | `references/api.md` | Every public import, `StoreResult` / `LoadRequest` semantics, typical operations | | `references/patterns.md` | Layer-by-layer patterns: data sources, repositories, ViewModels, Compose, DI, scoping | -The skill matches library version `3.1.0`. +The skill matches library version `3.1.1`. diff --git a/skills/container-store/SKILL.md b/skills/container-store/SKILL.md index 39f8aae..dbad752 100644 --- a/skills/container-store/SKILL.md +++ b/skills/container-store/SKILL.md @@ -22,13 +22,13 @@ directly — no decompilation or dependency tree inspection needed. ## Dependency Setup -Maven coordinates: `com.elveum:store:3.1.0` (transitively brings +Maven coordinates: `com.elveum:store:3.1.1` (transitively brings `com.elveum:container`, whose types are part of the public API). ```toml # gradle/libs.versions.toml [versions] -store = "3.1.0" +store = "3.1.1" [libraries] store = { module = "com.elveum:store", version.ref = "store" } ``` diff --git a/store/README.md b/store/README.md index de157be..eeeaba7 100644 --- a/store/README.md +++ b/store/README.md @@ -38,7 +38,7 @@ the hood. Add the following line to your `build.gradle` file: ``` -implementation "com.elveum:store:3.1.0" +implementation "com.elveum:store:3.1.1" ``` The `store` artifact depends on `com.elveum:container`, so the Container