From bd09da71c58353cd488834694a7c932883b1725b Mon Sep 17 00:00:00 2001 From: Chris Mitchell Date: Thu, 9 Sep 2021 08:21:23 -0700 Subject: [PATCH 1/2] Revert "Remove unnecessary FlowPreview & ExperimentalCoroutinesApi annotations. These are not needed with newer versions of Kotlin. (#289)" This reverts commit 61b8cb0633a18b29c60611e3aa2dcf101520b461. --- app/src/main/java/com/dropbox/android/sample/Graph.kt | 4 ++++ .../android/sample/ui/reddit/RedditViewModel.kt | 3 +++ .../dropbox/android/sample/ui/room/RoomFragment.kt | 6 ++++++ .../android/sample/ui/stream/StreamFragment.kt | 8 +++++++- .../com/dropbox/android/external/fs3/FSAllReader.kt | 2 ++ .../android/external/fs3/SourceAllPersister.kt | 2 ++ .../android/external/fs3/SourcePersisterFactory.kt | 2 ++ .../android/external/fs3/FSAllOperationTest.kt | 2 ++ .../com/dropbox/flow/multicast/ChannelManager.kt | 2 ++ .../kotlin/com/dropbox/flow/multicast/Multicaster.kt | 2 ++ .../com/dropbox/flow/multicast/ChannelManagerTest.kt | 2 ++ .../dropbox/flow/multicast/InfiniteMulticastTest.kt | 2 ++ .../com/dropbox/flow/multicast/MulticastTest.kt | 2 ++ .../dropbox/flow/multicast/SharedFlowProducerTest.kt | 2 ++ .../src/main/kotlin/com/dropbox/store/rx2/RxStore.kt | 2 ++ .../kotlin/com/dropbox/store/rx2/RxStoreBuilder.kt | 4 ++++ .../kotlin/com/dropbox/store/rx2/test/FlowTestExt.kt | 3 +++ .../dropbox/store/rx2/test/HotRxSingleStoreTest.kt | 4 ++++ .../com/dropbox/store/rx2/test/RxFlowableStoreTest.kt | 4 ++++ .../store/rx2/test/RxSingleStoreExtensionsTest.kt | 6 +++++- .../com/dropbox/store/rx2/test/RxSingleStoreTest.kt | 8 ++++++-- .../src/main/kotlin/com/dropbox/store/rx3/RxStore.kt | 2 ++ .../kotlin/com/dropbox/store/rx3/RxStoreBuilder.kt | 4 ++++ .../kotlin/com/dropbox/store/rx3/test/FlowTestExt.kt | 3 +++ .../dropbox/store/rx3/test/HotRxSingleStoreTest.kt | 4 ++++ .../com/dropbox/store/rx3/test/RxFlowableStoreTest.kt | 4 ++++ .../store/rx3/test/RxSingleStoreExtensionsTest.kt | 6 +++++- .../com/dropbox/store/rx3/test/RxSingleStoreTest.kt | 4 ++++ .../dropbox/android/external/store4/StoreBuilder.kt | 11 ++++++++--- .../android/external/store4/impl/FetcherController.kt | 4 ++++ .../dropbox/android/external/store4/impl/RealStore.kt | 4 ++++ .../external/store4/impl/SourceOfTruthWithBarrier.kt | 2 ++ .../external/store4/impl/operators/FlowMerge.kt | 2 ++ .../android/external/store3/DontCacheErrorsTest.kt | 9 ++++++--- .../dropbox/android/external/store3/NoNetworkTest.kt | 4 ++++ .../dropbox/android/external/store3/SequentialTest.kt | 6 ++++-- .../com/dropbox/android/external/store3/StoreTest.kt | 4 ++++ .../android/external/store3/StoreThrowOnNoItems.kt | 6 ++++-- .../android/external/store3/StreamOneKeyTest.kt | 4 ++++ .../android/external/store3/TestStoreBuilder.kt | 4 ++++ .../android/external/store4/FetcherControllerTest.kt | 4 ++++ .../external/store4/SourceOfTruthErrorsTest.kt | 4 ++-- .../external/store4/SourceOfTruthWithBarrierTest.kt | 4 ++++ .../android/external/store4/impl/ClearAllStoreTest.kt | 4 ++++ .../external/store4/impl/ClearStoreByKeyTest.kt | 4 ++++ .../external/store4/impl/FetcherResponseTest.kt | 4 ++++ .../android/external/store4/impl/FlowStoreTest.kt | 4 ++++ .../android/external/store4/impl/HotFlowStoreTest.kt | 4 ++++ .../android/external/store4/impl/KeyTrackerTest.kt | 2 ++ .../store4/impl/StoreWithInMemoryCacheTest.kt | 4 ++++ .../store4/impl/StreamWithoutSourceOfTruthTest.kt | 4 ++++ .../android/external/store4/impl/ValueFetcherTest.kt | 4 ++++ .../store4/impl/operators/MapIndexedKtTest.kt | 2 ++ .../external/store4/testutil/FlowSubjectTest.kt | 2 ++ .../android/external/store4/testutil/FlowTestExt.kt | 3 +++ .../store4/testutil/SimplePersisterAsFlowable.kt | 5 +++++ .../store4/testutil/SimplePersisterAsFlowableTest.kt | 2 ++ 57 files changed, 202 insertions(+), 17 deletions(-) diff --git a/app/src/main/java/com/dropbox/android/sample/Graph.kt b/app/src/main/java/com/dropbox/android/sample/Graph.kt index 8dd2f0db5..cc66ac99c 100644 --- a/app/src/main/java/com/dropbox/android/sample/Graph.kt +++ b/app/src/main/java/com/dropbox/android/sample/Graph.kt @@ -19,6 +19,8 @@ import com.dropbox.android.sample.data.model.RedditDb import com.dropbox.android.sample.data.remote.Api import com.squareup.moshi.Moshi import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.delay import kotlinx.coroutines.withContext import okio.Buffer @@ -31,6 +33,8 @@ import kotlin.time.ExperimentalTime import kotlin.time.seconds @OptIn( + FlowPreview::class, + ExperimentalCoroutinesApi::class, ExperimentalTime::class, ExperimentalStdlibApi::class ) diff --git a/app/src/main/java/com/dropbox/android/sample/ui/reddit/RedditViewModel.kt b/app/src/main/java/com/dropbox/android/sample/ui/reddit/RedditViewModel.kt index be7536202..eb888c6cf 100644 --- a/app/src/main/java/com/dropbox/android/sample/ui/reddit/RedditViewModel.kt +++ b/app/src/main/java/com/dropbox/android/sample/ui/reddit/RedditViewModel.kt @@ -9,8 +9,11 @@ import com.dropbox.android.external.store4.get import com.dropbox.android.sample.SampleApp import com.dropbox.android.sample.data.model.Post import com.dropbox.android.sample.utils.Lce +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.launch +@OptIn(FlowPreview::class, ExperimentalCoroutinesApi::class) class RedditViewModel( app: Application ) : AndroidViewModel(app) { diff --git a/app/src/main/java/com/dropbox/android/sample/ui/room/RoomFragment.kt b/app/src/main/java/com/dropbox/android/sample/ui/room/RoomFragment.kt index 9ce8f3c55..97be43110 100644 --- a/app/src/main/java/com/dropbox/android/sample/ui/room/RoomFragment.kt +++ b/app/src/main/java/com/dropbox/android/sample/ui/room/RoomFragment.kt @@ -16,6 +16,8 @@ import com.dropbox.android.sample.reddit.PostAdapter import com.google.android.material.snackbar.Snackbar import kotlinx.android.synthetic.main.activity_store.postRecyclerView import kotlinx.android.synthetic.main.fragment_room_store.* +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.flow.collect import kotlinx.coroutines.flow.consumeAsFlow @@ -24,6 +26,7 @@ import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.flow.transform import kotlinx.coroutines.launch +@FlowPreview class RoomFragment : Fragment() { override fun onCreateView( @@ -34,11 +37,13 @@ class RoomFragment : Fragment() { return inflater.inflate(R.layout.fragment_room_store, container, false) } + @ExperimentalCoroutinesApi override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) initUI() } + @ExperimentalCoroutinesApi private fun initUI() { val adapter = PostAdapter() // lazily set the adapter when we have data the first time so that RecyclerView can @@ -94,6 +99,7 @@ class RoomFragment : Fragment() { /** * This class should possibly be moved to a helper library but needs more API work before that. */ +@ExperimentalCoroutinesApi internal class StoreState( private val store: Store ) { diff --git a/app/src/main/java/com/dropbox/android/sample/ui/stream/StreamFragment.kt b/app/src/main/java/com/dropbox/android/sample/ui/stream/StreamFragment.kt index 04d4a025e..0bb83f719 100644 --- a/app/src/main/java/com/dropbox/android/sample/ui/stream/StreamFragment.kt +++ b/app/src/main/java/com/dropbox/android/sample/ui/stream/StreamFragment.kt @@ -15,6 +15,9 @@ import com.dropbox.android.sample.R import kotlinx.android.synthetic.main.fragment_stream.* import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.FlowPreview +import kotlinx.coroutines.InternalCoroutinesApi import kotlinx.coroutines.Job import kotlinx.coroutines.cancel import kotlinx.coroutines.delay @@ -26,7 +29,7 @@ import kotlin.coroutines.CoroutineContext import kotlin.time.ExperimentalTime import kotlin.time.seconds -@ExperimentalTime +@ExperimentalCoroutinesApi class StreamFragment : Fragment(), CoroutineScope { override val coroutineContext: CoroutineContext = Job() + Dispatchers.Main @@ -39,6 +42,9 @@ class StreamFragment : Fragment(), CoroutineScope { return inflater.inflate(R.layout.fragment_stream, container, false) } + @ExperimentalTime + @InternalCoroutinesApi + @FlowPreview override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) diff --git a/filesystem/src/main/java/com/dropbox/android/external/fs3/FSAllReader.kt b/filesystem/src/main/java/com/dropbox/android/external/fs3/FSAllReader.kt index 9b53f6dda..c27937c67 100644 --- a/filesystem/src/main/java/com/dropbox/android/external/fs3/FSAllReader.kt +++ b/filesystem/src/main/java/com/dropbox/android/external/fs3/FSAllReader.kt @@ -2,6 +2,7 @@ package com.dropbox.android.external.fs3 import com.dropbox.android.external.fs3.filesystem.FileSystem import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.channels.ReceiveChannel import kotlinx.coroutines.channels.produce import okio.BufferedSource @@ -13,6 +14,7 @@ import java.io.FileNotFoundException * Make sure to have keys containing same data resolve to same "path" * */ +@ExperimentalCoroutinesApi class FSAllReader(internal val fileSystem: FileSystem) : DiskAllRead { @Throws(FileNotFoundException::class) diff --git a/filesystem/src/main/java/com/dropbox/android/external/fs3/SourceAllPersister.kt b/filesystem/src/main/java/com/dropbox/android/external/fs3/SourceAllPersister.kt index 0cc5225c6..05b54452b 100644 --- a/filesystem/src/main/java/com/dropbox/android/external/fs3/SourceAllPersister.kt +++ b/filesystem/src/main/java/com/dropbox/android/external/fs3/SourceAllPersister.kt @@ -2,10 +2,12 @@ package com.dropbox.android.external.fs3 import com.dropbox.android.external.fs3.filesystem.FileSystem import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.channels.ReceiveChannel import okio.BufferedSource import java.io.FileNotFoundException +@ExperimentalCoroutinesApi class SourceAllPersister(fileSystem: FileSystem) : AllPersister> { internal val sourceFileAllReader: FSAllReader = FSAllReader(fileSystem) diff --git a/filesystem/src/main/java/com/dropbox/android/external/fs3/SourcePersisterFactory.kt b/filesystem/src/main/java/com/dropbox/android/external/fs3/SourcePersisterFactory.kt index 3be50052b..d69288080 100644 --- a/filesystem/src/main/java/com/dropbox/android/external/fs3/SourcePersisterFactory.kt +++ b/filesystem/src/main/java/com/dropbox/android/external/fs3/SourcePersisterFactory.kt @@ -2,6 +2,7 @@ package com.dropbox.android.external.fs3 import com.dropbox.android.external.fs3.filesystem.FileSystem import com.dropbox.android.external.fs3.filesystem.FileSystemFactory +import kotlinx.coroutines.ExperimentalCoroutinesApi import okio.BufferedSource import java.io.File import java.io.IOException @@ -12,6 +13,7 @@ import kotlin.time.ExperimentalTime * Factory for [SourcePersister] */ +@ExperimentalCoroutinesApi object SourcePersisterFactory { /** diff --git a/filesystem/src/test/java/com/dropbox/android/external/fs3/FSAllOperationTest.kt b/filesystem/src/test/java/com/dropbox/android/external/fs3/FSAllOperationTest.kt index 4d8545267..9e4df8439 100644 --- a/filesystem/src/test/java/com/dropbox/android/external/fs3/FSAllOperationTest.kt +++ b/filesystem/src/test/java/com/dropbox/android/external/fs3/FSAllOperationTest.kt @@ -4,6 +4,7 @@ import com.dropbox.android.external.fs3.filesystem.FileSystemFactory import com.google.common.base.Charsets.UTF_8 import com.google.common.io.Files.createTempDir import com.google.common.truth.Truth.assertThat +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.runBlocking import okio.BufferedSource import okio.buffer @@ -11,6 +12,7 @@ import okio.source import org.junit.Test import java.io.ByteArrayInputStream +@ExperimentalCoroutinesApi class FSAllOperationTest { @Test diff --git a/multicast/src/main/kotlin/com/dropbox/flow/multicast/ChannelManager.kt b/multicast/src/main/kotlin/com/dropbox/flow/multicast/ChannelManager.kt index ca1ffd263..e6a1818f8 100644 --- a/multicast/src/main/kotlin/com/dropbox/flow/multicast/ChannelManager.kt +++ b/multicast/src/main/kotlin/com/dropbox/flow/multicast/ChannelManager.kt @@ -19,6 +19,7 @@ package com.dropbox.flow.multicast import com.dropbox.flow.multicast.ChannelManager.Message import kotlinx.coroutines.CompletableDeferred import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.channels.SendChannel import kotlinx.coroutines.flow.Flow @@ -400,5 +401,6 @@ private class BufferImpl(private val limit: Int) : } } +@ExperimentalCoroutinesApi internal fun ChannelManager.Message.Dispatch.Value.markDelivered() = delivered.complete(Unit) diff --git a/multicast/src/main/kotlin/com/dropbox/flow/multicast/Multicaster.kt b/multicast/src/main/kotlin/com/dropbox/flow/multicast/Multicaster.kt index f93b55b2b..0ed7eba45 100644 --- a/multicast/src/main/kotlin/com/dropbox/flow/multicast/Multicaster.kt +++ b/multicast/src/main/kotlin/com/dropbox/flow/multicast/Multicaster.kt @@ -17,6 +17,7 @@ package com.dropbox.flow.multicast import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.channels.ClosedSendChannelException import kotlinx.coroutines.flow.Flow @@ -34,6 +35,7 @@ import kotlinx.coroutines.flow.transform * downstream value collects the latest dispatched value OR a new downstream is added while [buffer] * is empty. */ +@ExperimentalCoroutinesApi class Multicaster( /** * The [CoroutineScope] to use for upstream subscription diff --git a/multicast/src/test/kotlin/com/dropbox/flow/multicast/ChannelManagerTest.kt b/multicast/src/test/kotlin/com/dropbox/flow/multicast/ChannelManagerTest.kt index 152d6dd86..441fc5b36 100644 --- a/multicast/src/test/kotlin/com/dropbox/flow/multicast/ChannelManagerTest.kt +++ b/multicast/src/test/kotlin/com/dropbox/flow/multicast/ChannelManagerTest.kt @@ -16,6 +16,7 @@ package com.dropbox.flow.multicast import com.dropbox.flow.multicast.ChannelManager.Message.Dispatch +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.async import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.coroutineScope @@ -34,6 +35,7 @@ import kotlin.test.assertEquals import kotlin.test.assertTrue import kotlin.test.fail +@ExperimentalCoroutinesApi class ChannelManagerTest { private val scope = TestCoroutineScope() private val upstream: Channel = Channel(Channel.UNLIMITED) diff --git a/multicast/src/test/kotlin/com/dropbox/flow/multicast/InfiniteMulticastTest.kt b/multicast/src/test/kotlin/com/dropbox/flow/multicast/InfiniteMulticastTest.kt index 09019e4db..51966be4b 100644 --- a/multicast/src/test/kotlin/com/dropbox/flow/multicast/InfiniteMulticastTest.kt +++ b/multicast/src/test/kotlin/com/dropbox/flow/multicast/InfiniteMulticastTest.kt @@ -15,6 +15,7 @@ */ package com.dropbox.flow.multicast +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.async import kotlinx.coroutines.delay import kotlinx.coroutines.flow.Flow @@ -34,6 +35,7 @@ import kotlin.test.assertEquals * It basically waits until there is another reason to enable upstream and will receive those * values as well. */ +@ExperimentalCoroutinesApi class InfiniteMulticastTest { private val testScope = TestCoroutineScope() private val dispatchLog = mutableListOf() diff --git a/multicast/src/test/kotlin/com/dropbox/flow/multicast/MulticastTest.kt b/multicast/src/test/kotlin/com/dropbox/flow/multicast/MulticastTest.kt index f016796cd..26a8cca27 100644 --- a/multicast/src/test/kotlin/com/dropbox/flow/multicast/MulticastTest.kt +++ b/multicast/src/test/kotlin/com/dropbox/flow/multicast/MulticastTest.kt @@ -16,6 +16,7 @@ package com.dropbox.flow.multicast import kotlinx.coroutines.CompletableDeferred +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.async import kotlinx.coroutines.delay import kotlinx.coroutines.flow.Flow @@ -42,6 +43,7 @@ import kotlin.test.assertFailsWith import kotlin.test.assertFalse import kotlin.test.assertTrue +@ExperimentalCoroutinesApi class MulticastTest { private val testScope = TestCoroutineScope() diff --git a/multicast/src/test/kotlin/com/dropbox/flow/multicast/SharedFlowProducerTest.kt b/multicast/src/test/kotlin/com/dropbox/flow/multicast/SharedFlowProducerTest.kt index ba0706d21..39ab25752 100644 --- a/multicast/src/test/kotlin/com/dropbox/flow/multicast/SharedFlowProducerTest.kt +++ b/multicast/src/test/kotlin/com/dropbox/flow/multicast/SharedFlowProducerTest.kt @@ -15,6 +15,7 @@ */ package com.dropbox.flow.multicast +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.test.TestCoroutineScope @@ -22,6 +23,7 @@ import org.junit.Test import kotlin.test.assertEquals import kotlin.test.assertTrue +@ExperimentalCoroutinesApi class SharedFlowProducerTest { private val scope = TestCoroutineScope() private val upstreamMessages = mutableListOf() diff --git a/store-rx2/src/main/kotlin/com/dropbox/store/rx2/RxStore.kt b/store-rx2/src/main/kotlin/com/dropbox/store/rx2/RxStore.kt index d06ec29ab..0649b7e57 100644 --- a/store-rx2/src/main/kotlin/com/dropbox/store/rx2/RxStore.kt +++ b/store-rx2/src/main/kotlin/com/dropbox/store/rx2/RxStore.kt @@ -9,6 +9,7 @@ import com.dropbox.android.external.store4.fresh import com.dropbox.android.external.store4.get import io.reactivex.Completable import io.reactivex.Flowable +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.rx2.asFlowable import kotlinx.coroutines.rx2.rxCompletable import kotlinx.coroutines.rx2.rxSingle @@ -17,6 +18,7 @@ import kotlinx.coroutines.rx2.rxSingle * Return a [Flowable] for the given key * @param request - see [StoreRequest] for configurations */ +@ExperimentalCoroutinesApi fun Store.observe(request: StoreRequest): Flowable> = stream(request).asFlowable() diff --git a/store-rx2/src/main/kotlin/com/dropbox/store/rx2/RxStoreBuilder.kt b/store-rx2/src/main/kotlin/com/dropbox/store/rx2/RxStoreBuilder.kt index 7d54666a1..49347e24d 100644 --- a/store-rx2/src/main/kotlin/com/dropbox/store/rx2/RxStoreBuilder.kt +++ b/store-rx2/src/main/kotlin/com/dropbox/store/rx2/RxStoreBuilder.kt @@ -3,6 +3,8 @@ package com.dropbox.store.rx2 import com.dropbox.android.external.store4.StoreBuilder import io.reactivex.Scheduler import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.rx2.asCoroutineDispatcher @@ -10,6 +12,8 @@ import kotlinx.coroutines.rx2.asCoroutineDispatcher * Define what scheduler fetcher requests will be called on, * if a scheduler is not set Store will use [GlobalScope] */ +@FlowPreview +@ExperimentalCoroutinesApi fun StoreBuilder.withScheduler( scheduler: Scheduler ): StoreBuilder { diff --git a/store-rx2/src/test/kotlin/com/dropbox/store/rx2/test/FlowTestExt.kt b/store-rx2/src/test/kotlin/com/dropbox/store/rx2/test/FlowTestExt.kt index dbbbc1c60..bae714d88 100644 --- a/store-rx2/src/test/kotlin/com/dropbox/store/rx2/test/FlowTestExt.kt +++ b/store-rx2/src/test/kotlin/com/dropbox/store/rx2/test/FlowTestExt.kt @@ -19,16 +19,19 @@ import com.google.common.truth.FailureMetadata import com.google.common.truth.Subject import com.google.common.truth.Truth import com.google.common.truth.Truth.assertWithMessage +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.async import kotlinx.coroutines.cancelAndJoin import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.collect import kotlinx.coroutines.test.TestCoroutineScope +@OptIn(ExperimentalCoroutinesApi::class) internal fun TestCoroutineScope.assertThat(flow: Flow): FlowSubject { return Truth.assertAbout(FlowSubject.Factory(this)).that(flow) } +@OptIn(ExperimentalCoroutinesApi::class) internal class FlowSubject constructor( failureMetadata: FailureMetadata, private val testCoroutineScope: TestCoroutineScope, diff --git a/store-rx2/src/test/kotlin/com/dropbox/store/rx2/test/HotRxSingleStoreTest.kt b/store-rx2/src/test/kotlin/com/dropbox/store/rx2/test/HotRxSingleStoreTest.kt index 5df742ee3..5f5863816 100644 --- a/store-rx2/src/test/kotlin/com/dropbox/store/rx2/test/HotRxSingleStoreTest.kt +++ b/store-rx2/src/test/kotlin/com/dropbox/store/rx2/test/HotRxSingleStoreTest.kt @@ -9,6 +9,8 @@ import com.dropbox.android.external.store4.StoreResponse import com.dropbox.store.rx2.ofResultSingle import com.google.common.truth.Truth.assertThat import io.reactivex.Single +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.test.TestCoroutineScope import kotlinx.coroutines.test.runBlockingTest import org.junit.Test @@ -16,6 +18,8 @@ import org.junit.runner.RunWith import org.junit.runners.JUnit4 @RunWith(JUnit4::class) +@FlowPreview +@ExperimentalCoroutinesApi class HotRxSingleStoreTest { private val testScope = TestCoroutineScope() diff --git a/store-rx2/src/test/kotlin/com/dropbox/store/rx2/test/RxFlowableStoreTest.kt b/store-rx2/src/test/kotlin/com/dropbox/store/rx2/test/RxFlowableStoreTest.kt index 29595a128..cbbcb750f 100644 --- a/store-rx2/src/test/kotlin/com/dropbox/store/rx2/test/RxFlowableStoreTest.kt +++ b/store-rx2/src/test/kotlin/com/dropbox/store/rx2/test/RxFlowableStoreTest.kt @@ -15,12 +15,16 @@ import io.reactivex.BackpressureStrategy import io.reactivex.Completable import io.reactivex.Flowable import io.reactivex.schedulers.TestScheduler +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.FlowPreview import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.JUnit4 import java.util.concurrent.atomic.AtomicInteger @RunWith(JUnit4::class) +@FlowPreview +@ExperimentalCoroutinesApi class RxFlowableStoreTest { private val testScheduler = TestScheduler() private val atomicInteger = AtomicInteger(0) diff --git a/store-rx2/src/test/kotlin/com/dropbox/store/rx2/test/RxSingleStoreExtensionsTest.kt b/store-rx2/src/test/kotlin/com/dropbox/store/rx2/test/RxSingleStoreExtensionsTest.kt index 32da2e5dd..e99d5f94e 100644 --- a/store-rx2/src/test/kotlin/com/dropbox/store/rx2/test/RxSingleStoreExtensionsTest.kt +++ b/store-rx2/src/test/kotlin/com/dropbox/store/rx2/test/RxSingleStoreExtensionsTest.kt @@ -6,14 +6,16 @@ import com.dropbox.android.external.store4.FetcherResult import com.dropbox.android.external.store4.SourceOfTruth import com.dropbox.android.external.store4.StoreBuilder import com.dropbox.store.rx2.freshSingle -import com.dropbox.store.rx2.getSingle import com.dropbox.store.rx2.ofMaybe +import com.dropbox.store.rx2.getSingle import com.dropbox.store.rx2.ofResultSingle import com.dropbox.store.rx2.withScheduler import io.reactivex.Completable import io.reactivex.Maybe import io.reactivex.Single import io.reactivex.schedulers.Schedulers +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.FlowPreview import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.JUnit4 @@ -21,6 +23,8 @@ import java.util.concurrent.atomic.AtomicInteger @ExperimentalStoreApi @RunWith(JUnit4::class) +@FlowPreview +@ExperimentalCoroutinesApi class RxSingleStoreExtensionsTest { private val atomicInteger = AtomicInteger(0) private var fakeDisk = mutableMapOf() diff --git a/store-rx2/src/test/kotlin/com/dropbox/store/rx2/test/RxSingleStoreTest.kt b/store-rx2/src/test/kotlin/com/dropbox/store/rx2/test/RxSingleStoreTest.kt index 836bdf911..4c62d7c41 100644 --- a/store-rx2/src/test/kotlin/com/dropbox/store/rx2/test/RxSingleStoreTest.kt +++ b/store-rx2/src/test/kotlin/com/dropbox/store/rx2/test/RxSingleStoreTest.kt @@ -4,20 +4,22 @@ import com.dropbox.android.external.store4.ExperimentalStoreApi import com.dropbox.android.external.store4.Fetcher import com.dropbox.android.external.store4.FetcherResult import com.dropbox.android.external.store4.ResponseOrigin -import com.dropbox.android.external.store4.SourceOfTruth import com.dropbox.android.external.store4.StoreBuilder import com.dropbox.android.external.store4.StoreRequest import com.dropbox.android.external.store4.StoreResponse +import com.dropbox.android.external.store4.SourceOfTruth +import com.dropbox.store.rx2.ofMaybe import com.dropbox.store.rx2.observe import com.dropbox.store.rx2.observeClear import com.dropbox.store.rx2.observeClearAll -import com.dropbox.store.rx2.ofMaybe import com.dropbox.store.rx2.ofResultSingle import com.dropbox.store.rx2.withScheduler import io.reactivex.Completable import io.reactivex.Maybe import io.reactivex.Single import io.reactivex.schedulers.Schedulers +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.FlowPreview import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.JUnit4 @@ -25,6 +27,8 @@ import java.util.concurrent.atomic.AtomicInteger @ExperimentalStoreApi @RunWith(JUnit4::class) +@FlowPreview +@ExperimentalCoroutinesApi class RxSingleStoreTest { private val atomicInteger = AtomicInteger(0) private var fakeDisk = mutableMapOf() diff --git a/store-rx3/src/main/kotlin/com/dropbox/store/rx3/RxStore.kt b/store-rx3/src/main/kotlin/com/dropbox/store/rx3/RxStore.kt index 95ac1b730..8006473c4 100644 --- a/store-rx3/src/main/kotlin/com/dropbox/store/rx3/RxStore.kt +++ b/store-rx3/src/main/kotlin/com/dropbox/store/rx3/RxStore.kt @@ -9,6 +9,7 @@ import com.dropbox.android.external.store4.fresh import com.dropbox.android.external.store4.get import io.reactivex.rxjava3.core.Completable import io.reactivex.rxjava3.core.Flowable +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.rx3.asFlowable import kotlinx.coroutines.rx3.rxCompletable import kotlinx.coroutines.rx3.rxSingle @@ -17,6 +18,7 @@ import kotlinx.coroutines.rx3.rxSingle * Return a [Flowable] for the given key * @param request - see [StoreRequest] for configurations */ +@ExperimentalCoroutinesApi fun Store.observe(request: StoreRequest): Flowable> = stream(request).asFlowable() diff --git a/store-rx3/src/main/kotlin/com/dropbox/store/rx3/RxStoreBuilder.kt b/store-rx3/src/main/kotlin/com/dropbox/store/rx3/RxStoreBuilder.kt index c5279a699..dc79c70b9 100644 --- a/store-rx3/src/main/kotlin/com/dropbox/store/rx3/RxStoreBuilder.kt +++ b/store-rx3/src/main/kotlin/com/dropbox/store/rx3/RxStoreBuilder.kt @@ -3,6 +3,8 @@ package com.dropbox.store.rx3 import com.dropbox.android.external.store4.StoreBuilder import io.reactivex.rxjava3.core.Scheduler import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.rx3.asCoroutineDispatcher @@ -10,6 +12,8 @@ import kotlinx.coroutines.rx3.asCoroutineDispatcher * Define what scheduler fetcher requests will be called on, * if a scheduler is not set Store will use [GlobalScope] */ +@FlowPreview +@ExperimentalCoroutinesApi fun StoreBuilder.withScheduler( scheduler: Scheduler ): StoreBuilder { diff --git a/store-rx3/src/test/kotlin/com/dropbox/store/rx3/test/FlowTestExt.kt b/store-rx3/src/test/kotlin/com/dropbox/store/rx3/test/FlowTestExt.kt index 2e5304311..86dd0a597 100644 --- a/store-rx3/src/test/kotlin/com/dropbox/store/rx3/test/FlowTestExt.kt +++ b/store-rx3/src/test/kotlin/com/dropbox/store/rx3/test/FlowTestExt.kt @@ -19,12 +19,14 @@ import com.google.common.truth.FailureMetadata import com.google.common.truth.Subject import com.google.common.truth.Truth import com.google.common.truth.Truth.assertWithMessage +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.async import kotlinx.coroutines.cancelAndJoin import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.collect import kotlinx.coroutines.test.TestCoroutineScope +@OptIn(ExperimentalCoroutinesApi::class) internal fun TestCoroutineScope.assertThat(flow: Flow): FlowSubject { return Truth.assertAbout( FlowSubject.Factory( @@ -33,6 +35,7 @@ internal fun TestCoroutineScope.assertThat(flow: Flow): FlowSubject { ).that(flow) } +@OptIn(ExperimentalCoroutinesApi::class) internal class FlowSubject constructor( failureMetadata: FailureMetadata, private val testCoroutineScope: TestCoroutineScope, diff --git a/store-rx3/src/test/kotlin/com/dropbox/store/rx3/test/HotRxSingleStoreTest.kt b/store-rx3/src/test/kotlin/com/dropbox/store/rx3/test/HotRxSingleStoreTest.kt index a93d4341b..b35e751dc 100644 --- a/store-rx3/src/test/kotlin/com/dropbox/store/rx3/test/HotRxSingleStoreTest.kt +++ b/store-rx3/src/test/kotlin/com/dropbox/store/rx3/test/HotRxSingleStoreTest.kt @@ -9,6 +9,8 @@ import com.dropbox.android.external.store4.StoreResponse import com.dropbox.store.rx3.ofResultSingle import com.google.common.truth.Truth.assertThat import io.reactivex.rxjava3.core.Single +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.test.TestCoroutineScope import kotlinx.coroutines.test.runBlockingTest import org.junit.Test @@ -16,6 +18,8 @@ import org.junit.runner.RunWith import org.junit.runners.JUnit4 @RunWith(JUnit4::class) +@FlowPreview +@ExperimentalCoroutinesApi class HotRxSingleStoreTest { private val testScope = TestCoroutineScope() diff --git a/store-rx3/src/test/kotlin/com/dropbox/store/rx3/test/RxFlowableStoreTest.kt b/store-rx3/src/test/kotlin/com/dropbox/store/rx3/test/RxFlowableStoreTest.kt index 968be1533..7136c5e5f 100644 --- a/store-rx3/src/test/kotlin/com/dropbox/store/rx3/test/RxFlowableStoreTest.kt +++ b/store-rx3/src/test/kotlin/com/dropbox/store/rx3/test/RxFlowableStoreTest.kt @@ -15,12 +15,16 @@ import io.reactivex.rxjava3.core.BackpressureStrategy import io.reactivex.rxjava3.core.Completable import io.reactivex.rxjava3.core.Flowable import io.reactivex.rxjava3.schedulers.TestScheduler +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.FlowPreview import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.JUnit4 import java.util.concurrent.atomic.AtomicInteger @RunWith(JUnit4::class) +@FlowPreview +@ExperimentalCoroutinesApi class RxFlowableStoreTest { private val testScheduler = TestScheduler() private val atomicInteger = AtomicInteger(0) diff --git a/store-rx3/src/test/kotlin/com/dropbox/store/rx3/test/RxSingleStoreExtensionsTest.kt b/store-rx3/src/test/kotlin/com/dropbox/store/rx3/test/RxSingleStoreExtensionsTest.kt index 07573bbf5..62a15614c 100644 --- a/store-rx3/src/test/kotlin/com/dropbox/store/rx3/test/RxSingleStoreExtensionsTest.kt +++ b/store-rx3/src/test/kotlin/com/dropbox/store/rx3/test/RxSingleStoreExtensionsTest.kt @@ -6,14 +6,16 @@ import com.dropbox.android.external.store4.FetcherResult import com.dropbox.android.external.store4.SourceOfTruth import com.dropbox.android.external.store4.StoreBuilder import com.dropbox.store.rx3.freshSingle -import com.dropbox.store.rx3.getSingle import com.dropbox.store.rx3.ofMaybe +import com.dropbox.store.rx3.getSingle import com.dropbox.store.rx3.ofResultSingle import com.dropbox.store.rx3.withScheduler import io.reactivex.rxjava3.core.Completable import io.reactivex.rxjava3.core.Maybe import io.reactivex.rxjava3.core.Single import io.reactivex.rxjava3.schedulers.Schedulers +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.FlowPreview import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.JUnit4 @@ -21,6 +23,8 @@ import java.util.concurrent.atomic.AtomicInteger @ExperimentalStoreApi @RunWith(JUnit4::class) +@FlowPreview +@ExperimentalCoroutinesApi class RxSingleStoreExtensionsTest { private val atomicInteger = AtomicInteger(0) private var fakeDisk = mutableMapOf() diff --git a/store-rx3/src/test/kotlin/com/dropbox/store/rx3/test/RxSingleStoreTest.kt b/store-rx3/src/test/kotlin/com/dropbox/store/rx3/test/RxSingleStoreTest.kt index 3bffcab28..9a2cff01a 100644 --- a/store-rx3/src/test/kotlin/com/dropbox/store/rx3/test/RxSingleStoreTest.kt +++ b/store-rx3/src/test/kotlin/com/dropbox/store/rx3/test/RxSingleStoreTest.kt @@ -18,6 +18,8 @@ import io.reactivex.rxjava3.core.Completable import io.reactivex.rxjava3.core.Maybe import io.reactivex.rxjava3.core.Single import io.reactivex.rxjava3.schedulers.Schedulers +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.FlowPreview import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.JUnit4 @@ -25,6 +27,8 @@ import java.util.concurrent.atomic.AtomicInteger @ExperimentalStoreApi @RunWith(JUnit4::class) +@FlowPreview +@ExperimentalCoroutinesApi class RxSingleStoreTest { private val atomicInteger = AtomicInteger(0) private var fakeDisk = mutableMapOf() diff --git a/store/src/main/java/com/dropbox/android/external/store4/StoreBuilder.kt b/store/src/main/java/com/dropbox/android/external/store4/StoreBuilder.kt index e45d59368..e041f5efc 100644 --- a/store/src/main/java/com/dropbox/android/external/store4/StoreBuilder.kt +++ b/store/src/main/java/com/dropbox/android/external/store4/StoreBuilder.kt @@ -17,12 +17,16 @@ package com.dropbox.android.external.store4 import com.dropbox.android.external.store4.impl.RealStore import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.GlobalScope import kotlin.time.ExperimentalTime /** * Main entry point for creating a [Store]. */ +@FlowPreview +@ExperimentalCoroutinesApi interface StoreBuilder { fun build(): Store @@ -55,7 +59,7 @@ interface StoreBuilder { * * @param fetcher a [Fetcher] flow of network records. */ - @ExperimentalTime + @OptIn(ExperimentalTime::class) fun from( fetcher: Fetcher ): StoreBuilder = RealStoreBuilder(fetcher) @@ -66,7 +70,6 @@ interface StoreBuilder { * @param fetcher a function for fetching a flow of network records. * @param sourceOfTruth a [SourceOfTruth] for the store. */ - @ExperimentalTime fun from( fetcher: Fetcher, sourceOfTruth: SourceOfTruth @@ -77,7 +80,9 @@ interface StoreBuilder { } } -@ExperimentalTime +@FlowPreview +@OptIn(ExperimentalTime::class) +@ExperimentalCoroutinesApi private class RealStoreBuilder( private val fetcher: Fetcher, private val sourceOfTruth: SourceOfTruth? = null diff --git a/store/src/main/java/com/dropbox/android/external/store4/impl/FetcherController.kt b/store/src/main/java/com/dropbox/android/external/store4/impl/FetcherController.kt index 7a6cd0468..ba3cc3290 100644 --- a/store/src/main/java/com/dropbox/android/external/store4/impl/FetcherController.kt +++ b/store/src/main/java/com/dropbox/android/external/store4/impl/FetcherController.kt @@ -22,6 +22,8 @@ import com.dropbox.android.external.store4.SourceOfTruth import com.dropbox.android.external.store4.StoreResponse import com.dropbox.flow.multicast.Multicaster import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.async import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.emitAll @@ -37,6 +39,8 @@ import kotlinx.coroutines.flow.onEmpty * fetcher requests receives values dispatched by later requests even if they don't share the * request. */ +@FlowPreview +@ExperimentalCoroutinesApi internal class FetcherController( /** * The [CoroutineScope] to use when collecting from the fetcher diff --git a/store/src/main/java/com/dropbox/android/external/store4/impl/RealStore.kt b/store/src/main/java/com/dropbox/android/external/store4/impl/RealStore.kt index 62694dcc7..37863fdff 100644 --- a/store/src/main/java/com/dropbox/android/external/store4/impl/RealStore.kt +++ b/store/src/main/java/com/dropbox/android/external/store4/impl/RealStore.kt @@ -29,6 +29,8 @@ import com.dropbox.android.external.store4.impl.operators.merge import com.nytimes.android.external.cache3.CacheBuilder import kotlinx.coroutines.CompletableDeferred import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.emitAll import kotlinx.coroutines.flow.flow @@ -39,6 +41,8 @@ import java.util.concurrent.TimeUnit import kotlin.time.ExperimentalTime @ExperimentalTime +@ExperimentalCoroutinesApi +@FlowPreview internal class RealStore( scope: CoroutineScope, fetcher: Fetcher, diff --git a/store/src/main/java/com/dropbox/android/external/store4/impl/SourceOfTruthWithBarrier.kt b/store/src/main/java/com/dropbox/android/external/store4/impl/SourceOfTruthWithBarrier.kt index ed48d7a22..8fb2bdb7b 100644 --- a/store/src/main/java/com/dropbox/android/external/store4/impl/SourceOfTruthWithBarrier.kt +++ b/store/src/main/java/com/dropbox/android/external/store4/impl/SourceOfTruthWithBarrier.kt @@ -21,6 +21,7 @@ import com.dropbox.android.external.store4.StoreResponse import com.dropbox.android.external.store4.impl.operators.mapIndexed import kotlinx.coroutines.CancellationException import kotlinx.coroutines.CompletableDeferred +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.catch @@ -37,6 +38,7 @@ import java.util.concurrent.atomic.AtomicLong * Used in the [com.dropbox.android.external.store4.impl.RealStore] implementation to avoid * dispatching values to downstream while a write is in progress. */ +@OptIn(ExperimentalCoroutinesApi::class) internal class SourceOfTruthWithBarrier( private val delegate: SourceOfTruth ) { diff --git a/store/src/main/java/com/dropbox/android/external/store4/impl/operators/FlowMerge.kt b/store/src/main/java/com/dropbox/android/external/store4/impl/operators/FlowMerge.kt index dcd5af884..4b0d9f62a 100644 --- a/store/src/main/java/com/dropbox/android/external/store4/impl/operators/FlowMerge.kt +++ b/store/src/main/java/com/dropbox/android/external/store4/impl/operators/FlowMerge.kt @@ -15,6 +15,7 @@ */ package com.dropbox.android.external.store4.impl.operators +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.buffer @@ -25,6 +26,7 @@ import kotlinx.coroutines.launch /** * Merge implementation tells downstream what the source is and also uses a rendezvous channel */ +@ExperimentalCoroutinesApi internal fun Flow.merge(other: Flow): Flow> { return channelFlow> { launch { diff --git a/store/src/test/java/com/dropbox/android/external/store3/DontCacheErrorsTest.kt b/store/src/test/java/com/dropbox/android/external/store3/DontCacheErrorsTest.kt index 91d45a6f4..5c7e35d2d 100644 --- a/store/src/test/java/com/dropbox/android/external/store3/DontCacheErrorsTest.kt +++ b/store/src/test/java/com/dropbox/android/external/store3/DontCacheErrorsTest.kt @@ -1,16 +1,19 @@ package com.dropbox.android.external.store3 -import com.dropbox.android.external.store4.Fetcher import com.dropbox.android.external.store4.get +import com.dropbox.android.external.store4.Fetcher + +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.test.TestCoroutineScope import kotlinx.coroutines.test.runBlockingTest import org.junit.Assert.fail import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.Parameterized -import kotlin.time.ExperimentalTime -@ExperimentalTime +@FlowPreview +@ExperimentalCoroutinesApi @RunWith(Parameterized::class) class DontCacheErrorsTest( storeType: TestStoreType diff --git a/store/src/test/java/com/dropbox/android/external/store3/NoNetworkTest.kt b/store/src/test/java/com/dropbox/android/external/store3/NoNetworkTest.kt index 165657430..5c80d9bc7 100644 --- a/store/src/test/java/com/dropbox/android/external/store3/NoNetworkTest.kt +++ b/store/src/test/java/com/dropbox/android/external/store3/NoNetworkTest.kt @@ -4,6 +4,8 @@ import com.dropbox.android.external.store4.Fetcher import com.dropbox.android.external.store4.Store import com.dropbox.android.external.store4.get import com.google.common.truth.Truth.assertThat +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.test.TestCoroutineScope import kotlinx.coroutines.test.runBlockingTest import org.junit.Assert.fail @@ -11,6 +13,8 @@ import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.Parameterized +@FlowPreview +@ExperimentalCoroutinesApi @RunWith(Parameterized::class) class NoNetworkTest( storeType: TestStoreType diff --git a/store/src/test/java/com/dropbox/android/external/store3/SequentialTest.kt b/store/src/test/java/com/dropbox/android/external/store3/SequentialTest.kt index 8fb27762a..07b838229 100644 --- a/store/src/test/java/com/dropbox/android/external/store3/SequentialTest.kt +++ b/store/src/test/java/com/dropbox/android/external/store3/SequentialTest.kt @@ -3,15 +3,17 @@ package com.dropbox.android.external.store3 import com.dropbox.android.external.store4.Fetcher import com.dropbox.android.external.store4.get import com.google.common.truth.Truth.assertThat +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.async import kotlinx.coroutines.test.TestCoroutineScope import kotlinx.coroutines.test.runBlockingTest import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.Parameterized -import kotlin.time.ExperimentalTime -@ExperimentalTime +@FlowPreview +@ExperimentalCoroutinesApi @RunWith(Parameterized::class) class SequentialTest( storeType: TestStoreType diff --git a/store/src/test/java/com/dropbox/android/external/store3/StoreTest.kt b/store/src/test/java/com/dropbox/android/external/store3/StoreTest.kt index c0a5f823f..360e93991 100644 --- a/store/src/test/java/com/dropbox/android/external/store3/StoreTest.kt +++ b/store/src/test/java/com/dropbox/android/external/store3/StoreTest.kt @@ -13,6 +13,8 @@ import com.nhaarman.mockitokotlin2.never import com.nhaarman.mockitokotlin2.times import com.nhaarman.mockitokotlin2.verify import com.nhaarman.mockitokotlin2.whenever +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.async import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.test.TestCoroutineScope @@ -26,6 +28,8 @@ import java.util.concurrent.atomic.AtomicInteger import kotlin.time.ExperimentalTime @ExperimentalTime +@FlowPreview +@ExperimentalCoroutinesApi @RunWith(Parameterized::class) class StoreTest( private val storeType: TestStoreType diff --git a/store/src/test/java/com/dropbox/android/external/store3/StoreThrowOnNoItems.kt b/store/src/test/java/com/dropbox/android/external/store3/StoreThrowOnNoItems.kt index 55d6db387..94b09f7d3 100644 --- a/store/src/test/java/com/dropbox/android/external/store3/StoreThrowOnNoItems.kt +++ b/store/src/test/java/com/dropbox/android/external/store3/StoreThrowOnNoItems.kt @@ -4,6 +4,8 @@ import com.dropbox.android.external.store4.Fetcher import com.dropbox.android.external.store4.get import com.nhaarman.mockitokotlin2.mock import com.nhaarman.mockitokotlin2.whenever +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.test.TestCoroutineScope import kotlinx.coroutines.test.runBlockingTest import com.google.common.truth.Truth.assertThat @@ -12,9 +14,9 @@ import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.Parameterized import java.util.concurrent.atomic.AtomicInteger -import kotlin.time.ExperimentalTime -@ExperimentalTime +@FlowPreview +@ExperimentalCoroutinesApi @RunWith(Parameterized::class) class StoreThrowOnNoItems( private val storeType: TestStoreType diff --git a/store/src/test/java/com/dropbox/android/external/store3/StreamOneKeyTest.kt b/store/src/test/java/com/dropbox/android/external/store3/StreamOneKeyTest.kt index 110ecff7f..e4e9a4ea5 100644 --- a/store/src/test/java/com/dropbox/android/external/store3/StreamOneKeyTest.kt +++ b/store/src/test/java/com/dropbox/android/external/store3/StreamOneKeyTest.kt @@ -8,6 +8,8 @@ import com.dropbox.android.external.store4.testutil.FakeFetcher import com.google.common.truth.Truth.assertThat import com.nhaarman.mockitokotlin2.mock import com.nhaarman.mockitokotlin2.whenever +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.flow.stateIn import kotlinx.coroutines.flow.transform import kotlinx.coroutines.test.TestCoroutineScope @@ -17,6 +19,8 @@ import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.Parameterized +@FlowPreview +@ExperimentalCoroutinesApi @RunWith(Parameterized::class) class StreamOneKeyTest( storeType: TestStoreType diff --git a/store/src/test/java/com/dropbox/android/external/store3/TestStoreBuilder.kt b/store/src/test/java/com/dropbox/android/external/store3/TestStoreBuilder.kt index da1bc4a4a..1eb9b55ae 100644 --- a/store/src/test/java/com/dropbox/android/external/store3/TestStoreBuilder.kt +++ b/store/src/test/java/com/dropbox/android/external/store3/TestStoreBuilder.kt @@ -22,9 +22,13 @@ import com.dropbox.android.external.store4.Store import com.dropbox.android.external.store4.StoreBuilder import com.dropbox.android.external.store4.impl.PersistentSourceOfTruth import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.flow.flow import kotlin.time.ExperimentalTime +@FlowPreview +@ExperimentalCoroutinesApi data class TestStoreBuilder( private val buildStore: () -> Store ) { diff --git a/store/src/test/java/com/dropbox/android/external/store4/FetcherControllerTest.kt b/store/src/test/java/com/dropbox/android/external/store4/FetcherControllerTest.kt index c5d0daa2f..820b6f7f4 100644 --- a/store/src/test/java/com/dropbox/android/external/store4/FetcherControllerTest.kt +++ b/store/src/test/java/com/dropbox/android/external/store4/FetcherControllerTest.kt @@ -18,6 +18,8 @@ package com.dropbox.android.external.store4 import com.dropbox.android.external.store4.StoreResponse.Data import com.dropbox.android.external.store4.impl.FetcherController import com.google.common.truth.Truth.assertThat +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.async import kotlinx.coroutines.delay import kotlinx.coroutines.flow.first @@ -29,6 +31,8 @@ import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.JUnit4 +@ExperimentalCoroutinesApi +@FlowPreview @RunWith(JUnit4::class) class FetcherControllerTest { private val testScope = TestCoroutineScope() diff --git a/store/src/test/java/com/dropbox/android/external/store4/SourceOfTruthErrorsTest.kt b/store/src/test/java/com/dropbox/android/external/store4/SourceOfTruthErrorsTest.kt index 93a8c57a2..4bfd43dab 100644 --- a/store/src/test/java/com/dropbox/android/external/store4/SourceOfTruthErrorsTest.kt +++ b/store/src/test/java/com/dropbox/android/external/store4/SourceOfTruthErrorsTest.kt @@ -21,6 +21,7 @@ import com.dropbox.android.external.store4.testutil.FakeFetcher import com.dropbox.android.external.store4.testutil.InMemoryPersister import com.dropbox.android.external.store4.testutil.asSourceOfTruth import com.dropbox.android.external.store4.testutil.assertThat +import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.cancelAndJoin import kotlinx.coroutines.delay import kotlinx.coroutines.flow.flow @@ -32,9 +33,8 @@ import kotlinx.coroutines.test.runBlockingTest import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.JUnit4 -import kotlin.time.ExperimentalTime -@ExperimentalTime +@FlowPreview @RunWith(JUnit4::class) class SourceOfTruthErrorsTest { private val testScope = TestCoroutineScope() diff --git a/store/src/test/java/com/dropbox/android/external/store4/SourceOfTruthWithBarrierTest.kt b/store/src/test/java/com/dropbox/android/external/store4/SourceOfTruthWithBarrierTest.kt index 65658b13c..fbc44d2dc 100644 --- a/store/src/test/java/com/dropbox/android/external/store4/SourceOfTruthWithBarrierTest.kt +++ b/store/src/test/java/com/dropbox/android/external/store4/SourceOfTruthWithBarrierTest.kt @@ -23,6 +23,8 @@ import com.dropbox.android.external.store4.testutil.InMemoryPersister import com.dropbox.android.external.store4.testutil.assertThat import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.CompletableDeferred +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.async import kotlinx.coroutines.cancelAndJoin import kotlinx.coroutines.flow.collect @@ -33,6 +35,8 @@ import kotlinx.coroutines.test.TestCoroutineScope import kotlinx.coroutines.test.runBlockingTest import org.junit.Test +@FlowPreview +@ExperimentalCoroutinesApi class SourceOfTruthWithBarrierTest { private val testScope = TestCoroutineScope() private val persister = InMemoryPersister() diff --git a/store/src/test/java/com/dropbox/android/external/store4/impl/ClearAllStoreTest.kt b/store/src/test/java/com/dropbox/android/external/store4/impl/ClearAllStoreTest.kt index b28cf5d95..00c376bfc 100644 --- a/store/src/test/java/com/dropbox/android/external/store4/impl/ClearAllStoreTest.kt +++ b/store/src/test/java/com/dropbox/android/external/store4/impl/ClearAllStoreTest.kt @@ -9,12 +9,16 @@ import com.dropbox.android.external.store4.testutil.InMemoryPersister import com.dropbox.android.external.store4.testutil.asSourceOfTruth import com.dropbox.android.external.store4.testutil.getData import com.google.common.truth.Truth.assertThat +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.test.TestCoroutineScope import kotlinx.coroutines.test.runBlockingTest import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.JUnit4 +@FlowPreview +@ExperimentalCoroutinesApi @ExperimentalStoreApi @RunWith(JUnit4::class) class ClearAllStoreTest { diff --git a/store/src/test/java/com/dropbox/android/external/store4/impl/ClearStoreByKeyTest.kt b/store/src/test/java/com/dropbox/android/external/store4/impl/ClearStoreByKeyTest.kt index 7ea48d4e7..5d170cb5f 100644 --- a/store/src/test/java/com/dropbox/android/external/store4/impl/ClearStoreByKeyTest.kt +++ b/store/src/test/java/com/dropbox/android/external/store4/impl/ClearStoreByKeyTest.kt @@ -8,12 +8,16 @@ import com.dropbox.android.external.store4.testutil.InMemoryPersister import com.dropbox.android.external.store4.testutil.asSourceOfTruth import com.dropbox.android.external.store4.testutil.getData import com.google.common.truth.Truth.assertThat +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.test.TestCoroutineScope import kotlinx.coroutines.test.runBlockingTest import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.JUnit4 +@FlowPreview +@ExperimentalCoroutinesApi @RunWith(JUnit4::class) class ClearStoreByKeyTest { diff --git a/store/src/test/java/com/dropbox/android/external/store4/impl/FetcherResponseTest.kt b/store/src/test/java/com/dropbox/android/external/store4/impl/FetcherResponseTest.kt index c94b0378e..7e032426b 100644 --- a/store/src/test/java/com/dropbox/android/external/store4/impl/FetcherResponseTest.kt +++ b/store/src/test/java/com/dropbox/android/external/store4/impl/FetcherResponseTest.kt @@ -8,6 +8,8 @@ import com.dropbox.android.external.store4.StoreRequest import com.dropbox.android.external.store4.StoreResponse import com.dropbox.android.external.store4.testutil.assertThat import com.google.common.truth.Truth +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.toList @@ -15,6 +17,8 @@ import kotlinx.coroutines.test.TestCoroutineScope import kotlinx.coroutines.test.runBlockingTest import org.junit.Test +@ExperimentalCoroutinesApi +@FlowPreview class FetcherResponseTest { private val testScope = TestCoroutineScope() diff --git a/store/src/test/java/com/dropbox/android/external/store4/impl/FlowStoreTest.kt b/store/src/test/java/com/dropbox/android/external/store4/impl/FlowStoreTest.kt index c7df62771..b8089ef7e 100644 --- a/store/src/test/java/com/dropbox/android/external/store4/impl/FlowStoreTest.kt +++ b/store/src/test/java/com/dropbox/android/external/store4/impl/FlowStoreTest.kt @@ -31,6 +31,8 @@ import com.dropbox.android.external.store4.testutil.asFlowable import com.dropbox.android.external.store4.testutil.asSourceOfTruth import com.dropbox.android.external.store4.testutil.assertThat import com.google.common.truth.Truth.assertThat +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.async import kotlinx.coroutines.cancelAndJoin import kotlinx.coroutines.delay @@ -46,6 +48,8 @@ import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.JUnit4 +@FlowPreview +@ExperimentalCoroutinesApi @RunWith(JUnit4::class) class FlowStoreTest { private val testScope = TestCoroutineScope() diff --git a/store/src/test/java/com/dropbox/android/external/store4/impl/HotFlowStoreTest.kt b/store/src/test/java/com/dropbox/android/external/store4/impl/HotFlowStoreTest.kt index ac55a0531..7cb366f05 100644 --- a/store/src/test/java/com/dropbox/android/external/store4/impl/HotFlowStoreTest.kt +++ b/store/src/test/java/com/dropbox/android/external/store4/impl/HotFlowStoreTest.kt @@ -8,6 +8,8 @@ import com.dropbox.android.external.store4.StoreRequest import com.dropbox.android.external.store4.StoreResponse import com.dropbox.android.external.store4.testutil.assertThat import com.google.common.truth.Truth.assertThat +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.test.TestCoroutineScope @@ -16,6 +18,8 @@ import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.JUnit4 +@ExperimentalCoroutinesApi +@FlowPreview @RunWith(JUnit4::class) class HotFlowStoreTest { private val testScope = TestCoroutineScope() diff --git a/store/src/test/java/com/dropbox/android/external/store4/impl/KeyTrackerTest.kt b/store/src/test/java/com/dropbox/android/external/store4/impl/KeyTrackerTest.kt index e81944c78..c7c30f758 100644 --- a/store/src/test/java/com/dropbox/android/external/store4/impl/KeyTrackerTest.kt +++ b/store/src/test/java/com/dropbox/android/external/store4/impl/KeyTrackerTest.kt @@ -17,6 +17,7 @@ package com.dropbox.android.external.store4.impl import com.dropbox.android.external.store4.testutil.KeyTracker import com.google.common.truth.Truth.assertThat +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.async import kotlinx.coroutines.cancelAndJoin import kotlinx.coroutines.flow.take @@ -28,6 +29,7 @@ import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.JUnit4 +@ExperimentalCoroutinesApi @RunWith(JUnit4::class) class KeyTrackerTest { private val scope1 = TestCoroutineScope() diff --git a/store/src/test/java/com/dropbox/android/external/store4/impl/StoreWithInMemoryCacheTest.kt b/store/src/test/java/com/dropbox/android/external/store4/impl/StoreWithInMemoryCacheTest.kt index 22122ecba..7407ddedc 100644 --- a/store/src/test/java/com/dropbox/android/external/store4/impl/StoreWithInMemoryCacheTest.kt +++ b/store/src/test/java/com/dropbox/android/external/store4/impl/StoreWithInMemoryCacheTest.kt @@ -4,6 +4,8 @@ import com.dropbox.android.external.store4.Fetcher import com.dropbox.android.external.store4.MemoryPolicy import com.dropbox.android.external.store4.StoreBuilder import com.dropbox.android.external.store4.get +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.runBlocking import org.junit.Test import org.junit.runner.RunWith @@ -11,7 +13,9 @@ import org.junit.runners.JUnit4 import kotlin.time.ExperimentalTime import kotlin.time.minutes +@FlowPreview @ExperimentalTime +@ExperimentalCoroutinesApi @RunWith(JUnit4::class) class StoreWithInMemoryCacheTest { diff --git a/store/src/test/java/com/dropbox/android/external/store4/impl/StreamWithoutSourceOfTruthTest.kt b/store/src/test/java/com/dropbox/android/external/store4/impl/StreamWithoutSourceOfTruthTest.kt index d35656069..7bcf70b76 100644 --- a/store/src/test/java/com/dropbox/android/external/store4/impl/StreamWithoutSourceOfTruthTest.kt +++ b/store/src/test/java/com/dropbox/android/external/store4/impl/StreamWithoutSourceOfTruthTest.kt @@ -22,6 +22,8 @@ import com.dropbox.android.external.store4.StoreResponse import com.dropbox.android.external.store4.testutil.FakeFetcher import com.dropbox.android.external.store4.testutil.assertThat import com.google.common.truth.Truth.assertThat +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.async import kotlinx.coroutines.delay import kotlinx.coroutines.flow.take @@ -32,6 +34,8 @@ import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.Parameterized +@FlowPreview +@ExperimentalCoroutinesApi @RunWith(Parameterized::class) class StreamWithoutSourceOfTruthTest( private val enableCache: Boolean diff --git a/store/src/test/java/com/dropbox/android/external/store4/impl/ValueFetcherTest.kt b/store/src/test/java/com/dropbox/android/external/store4/impl/ValueFetcherTest.kt index 03939a887..b8373d5e4 100644 --- a/store/src/test/java/com/dropbox/android/external/store4/impl/ValueFetcherTest.kt +++ b/store/src/test/java/com/dropbox/android/external/store4/impl/ValueFetcherTest.kt @@ -3,12 +3,16 @@ package com.dropbox.android.external.store4.impl import com.dropbox.android.external.store4.Fetcher import com.dropbox.android.external.store4.FetcherResult import com.dropbox.android.external.store4.testutil.assertThat +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.flow.flow import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.test.TestCoroutineScope import kotlinx.coroutines.test.runBlockingTest import org.junit.Test +@ExperimentalCoroutinesApi +@FlowPreview class ValueFetcherTest { private val testScope = TestCoroutineScope() diff --git a/store/src/test/java/com/dropbox/android/external/store4/impl/operators/MapIndexedKtTest.kt b/store/src/test/java/com/dropbox/android/external/store4/impl/operators/MapIndexedKtTest.kt index b7efd1198..ba98981ab 100644 --- a/store/src/test/java/com/dropbox/android/external/store4/impl/operators/MapIndexedKtTest.kt +++ b/store/src/test/java/com/dropbox/android/external/store4/impl/operators/MapIndexedKtTest.kt @@ -1,11 +1,13 @@ package com.dropbox.android.external.store4.impl.operators import com.dropbox.android.external.store4.testutil.assertThat +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.test.TestCoroutineScope import kotlinx.coroutines.test.runBlockingTest import org.junit.Test +@OptIn(ExperimentalCoroutinesApi::class) class MapIndexedKtTest { val scope = TestCoroutineScope() @Test diff --git a/store/src/test/java/com/dropbox/android/external/store4/testutil/FlowSubjectTest.kt b/store/src/test/java/com/dropbox/android/external/store4/testutil/FlowSubjectTest.kt index bb5b71189..718f911c0 100644 --- a/store/src/test/java/com/dropbox/android/external/store4/testutil/FlowSubjectTest.kt +++ b/store/src/test/java/com/dropbox/android/external/store4/testutil/FlowSubjectTest.kt @@ -17,6 +17,7 @@ package com.dropbox.android.external.store4.testutil import com.google.common.truth.Truth.assertThat +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.emitAll import kotlinx.coroutines.flow.flow import kotlinx.coroutines.flow.flowOf @@ -28,6 +29,7 @@ import org.junit.runner.RunWith import org.junit.runners.JUnit4 @RunWith(JUnit4::class) +@OptIn(ExperimentalCoroutinesApi::class) class FlowSubjectTest { // Can't use ExpectFailure in these tests because it is not a suspend function. private val testScope = TestCoroutineScope() diff --git a/store/src/test/java/com/dropbox/android/external/store4/testutil/FlowTestExt.kt b/store/src/test/java/com/dropbox/android/external/store4/testutil/FlowTestExt.kt index a330d12d1..a56ee679c 100644 --- a/store/src/test/java/com/dropbox/android/external/store4/testutil/FlowTestExt.kt +++ b/store/src/test/java/com/dropbox/android/external/store4/testutil/FlowTestExt.kt @@ -19,16 +19,19 @@ import com.google.common.truth.FailureMetadata import com.google.common.truth.Subject import com.google.common.truth.Truth import com.google.common.truth.Truth.assertWithMessage +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.async import kotlinx.coroutines.cancelAndJoin import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.collect import kotlinx.coroutines.test.TestCoroutineScope +@OptIn(ExperimentalCoroutinesApi::class) internal fun TestCoroutineScope.assertThat(flow: Flow): FlowSubject { return Truth.assertAbout(FlowSubject.Factory(this)).that(flow) } +@OptIn(ExperimentalCoroutinesApi::class) internal class FlowSubject constructor( failureMetadata: FailureMetadata, private val testCoroutineScope: TestCoroutineScope, diff --git a/store/src/test/java/com/dropbox/android/external/store4/testutil/SimplePersisterAsFlowable.kt b/store/src/test/java/com/dropbox/android/external/store4/testutil/SimplePersisterAsFlowable.kt index 23eaa0c9a..e80a77a3f 100644 --- a/store/src/test/java/com/dropbox/android/external/store4/testutil/SimplePersisterAsFlowable.kt +++ b/store/src/test/java/com/dropbox/android/external/store4/testutil/SimplePersisterAsFlowable.kt @@ -16,6 +16,7 @@ package com.dropbox.android.external.store4.testutil import com.dropbox.android.external.store4.SourceOfTruth +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.channels.BroadcastChannel import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.flow.Flow @@ -28,6 +29,7 @@ import kotlinx.coroutines.sync.withLock /** * Only used in FlowStoreTest. We should get rid of it eventually. */ +@ExperimentalCoroutinesApi class SimplePersisterAsFlowable( private val reader: suspend (Key) -> Output?, private val writer: suspend (Key, Input) -> Unit, @@ -58,6 +60,7 @@ class SimplePersisterAsFlowable( } } +@ExperimentalCoroutinesApi fun SimplePersisterAsFlowable.asSourceOfTruth() = SourceOfTruth.of( reader = ::flowReader, @@ -68,6 +71,7 @@ fun SimplePersisterAsFlowable { private val lock = Mutex() // list of open key channels @@ -140,6 +144,7 @@ internal class KeyTracker { } } +@ExperimentalCoroutinesApi fun InMemoryPersister.asFlowable() = SimplePersisterAsFlowable( reader = this::read, diff --git a/store/src/test/java/com/dropbox/android/external/store4/testutil/SimplePersisterAsFlowableTest.kt b/store/src/test/java/com/dropbox/android/external/store4/testutil/SimplePersisterAsFlowableTest.kt index dd76c28b0..01c8df472 100644 --- a/store/src/test/java/com/dropbox/android/external/store4/testutil/SimplePersisterAsFlowableTest.kt +++ b/store/src/test/java/com/dropbox/android/external/store4/testutil/SimplePersisterAsFlowableTest.kt @@ -17,6 +17,7 @@ package com.dropbox.android.external.store4.testutil import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.CompletableDeferred +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.collect import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.flow.take @@ -27,6 +28,7 @@ import kotlinx.coroutines.test.TestCoroutineScope import kotlinx.coroutines.test.runBlockingTest import org.junit.Test +@ExperimentalCoroutinesApi class SimplePersisterAsFlowableTest { private val testScope = TestCoroutineScope() private val otherScope = TestCoroutineScope() From 3cf66e24a63ee9fa4f4098a5ef3040c6eb7e70c6 Mon Sep 17 00:00:00 2001 From: Chris Mitchell Date: Thu, 9 Sep 2021 08:28:25 -0700 Subject: [PATCH 2/2] Fix missing experimental annotations --- app/src/main/java/com/dropbox/android/sample/Graph.kt | 4 ---- .../dropbox/android/sample/ui/reddit/RedditViewModel.kt | 3 --- .../com/dropbox/android/sample/ui/room/RoomFragment.kt | 6 ------ .../dropbox/android/sample/ui/stream/StreamFragment.kt | 8 +------- .../java/com/dropbox/android/external/fs3/FSAllReader.kt | 2 -- .../dropbox/android/external/fs3/SourceAllPersister.kt | 2 -- .../android/external/fs3/SourcePersisterFactory.kt | 2 -- .../kotlin/com/dropbox/flow/multicast/ChannelManager.kt | 2 -- .../main/kotlin/com/dropbox/flow/multicast/Multicaster.kt | 2 -- .../src/main/kotlin/com/dropbox/store/rx2/RxStore.kt | 2 -- .../main/kotlin/com/dropbox/store/rx2/RxStoreBuilder.kt | 4 ---- .../src/main/kotlin/com/dropbox/store/rx3/RxStore.kt | 2 -- .../main/kotlin/com/dropbox/store/rx3/RxStoreBuilder.kt | 4 ---- .../com/dropbox/android/external/store4/StoreBuilder.kt | 7 +------ .../android/external/store4/impl/FetcherController.kt | 4 ---- .../com/dropbox/android/external/store4/impl/RealStore.kt | 4 ---- .../external/store4/impl/SourceOfTruthWithBarrier.kt | 2 -- .../android/external/store4/impl/operators/FlowMerge.kt | 2 -- .../android/external/store3/StoreThrowOnNoItems.kt | 6 ++---- .../dropbox/android/external/store3/TestStoreBuilder.kt | 4 ---- .../external/store4/testutil/SimplePersisterAsFlowable.kt | 5 ----- 21 files changed, 4 insertions(+), 73 deletions(-) diff --git a/app/src/main/java/com/dropbox/android/sample/Graph.kt b/app/src/main/java/com/dropbox/android/sample/Graph.kt index cc66ac99c..8dd2f0db5 100644 --- a/app/src/main/java/com/dropbox/android/sample/Graph.kt +++ b/app/src/main/java/com/dropbox/android/sample/Graph.kt @@ -19,8 +19,6 @@ import com.dropbox.android.sample.data.model.RedditDb import com.dropbox.android.sample.data.remote.Api import com.squareup.moshi.Moshi import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.ExperimentalCoroutinesApi -import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.delay import kotlinx.coroutines.withContext import okio.Buffer @@ -33,8 +31,6 @@ import kotlin.time.ExperimentalTime import kotlin.time.seconds @OptIn( - FlowPreview::class, - ExperimentalCoroutinesApi::class, ExperimentalTime::class, ExperimentalStdlibApi::class ) diff --git a/app/src/main/java/com/dropbox/android/sample/ui/reddit/RedditViewModel.kt b/app/src/main/java/com/dropbox/android/sample/ui/reddit/RedditViewModel.kt index eb888c6cf..be7536202 100644 --- a/app/src/main/java/com/dropbox/android/sample/ui/reddit/RedditViewModel.kt +++ b/app/src/main/java/com/dropbox/android/sample/ui/reddit/RedditViewModel.kt @@ -9,11 +9,8 @@ import com.dropbox.android.external.store4.get import com.dropbox.android.sample.SampleApp import com.dropbox.android.sample.data.model.Post import com.dropbox.android.sample.utils.Lce -import kotlinx.coroutines.ExperimentalCoroutinesApi -import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.launch -@OptIn(FlowPreview::class, ExperimentalCoroutinesApi::class) class RedditViewModel( app: Application ) : AndroidViewModel(app) { diff --git a/app/src/main/java/com/dropbox/android/sample/ui/room/RoomFragment.kt b/app/src/main/java/com/dropbox/android/sample/ui/room/RoomFragment.kt index 97be43110..9ce8f3c55 100644 --- a/app/src/main/java/com/dropbox/android/sample/ui/room/RoomFragment.kt +++ b/app/src/main/java/com/dropbox/android/sample/ui/room/RoomFragment.kt @@ -16,8 +16,6 @@ import com.dropbox.android.sample.reddit.PostAdapter import com.google.android.material.snackbar.Snackbar import kotlinx.android.synthetic.main.activity_store.postRecyclerView import kotlinx.android.synthetic.main.fragment_room_store.* -import kotlinx.coroutines.ExperimentalCoroutinesApi -import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.flow.collect import kotlinx.coroutines.flow.consumeAsFlow @@ -26,7 +24,6 @@ import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.flow.transform import kotlinx.coroutines.launch -@FlowPreview class RoomFragment : Fragment() { override fun onCreateView( @@ -37,13 +34,11 @@ class RoomFragment : Fragment() { return inflater.inflate(R.layout.fragment_room_store, container, false) } - @ExperimentalCoroutinesApi override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) initUI() } - @ExperimentalCoroutinesApi private fun initUI() { val adapter = PostAdapter() // lazily set the adapter when we have data the first time so that RecyclerView can @@ -99,7 +94,6 @@ class RoomFragment : Fragment() { /** * This class should possibly be moved to a helper library but needs more API work before that. */ -@ExperimentalCoroutinesApi internal class StoreState( private val store: Store ) { diff --git a/app/src/main/java/com/dropbox/android/sample/ui/stream/StreamFragment.kt b/app/src/main/java/com/dropbox/android/sample/ui/stream/StreamFragment.kt index 0bb83f719..04d4a025e 100644 --- a/app/src/main/java/com/dropbox/android/sample/ui/stream/StreamFragment.kt +++ b/app/src/main/java/com/dropbox/android/sample/ui/stream/StreamFragment.kt @@ -15,9 +15,6 @@ import com.dropbox.android.sample.R import kotlinx.android.synthetic.main.fragment_stream.* import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.ExperimentalCoroutinesApi -import kotlinx.coroutines.FlowPreview -import kotlinx.coroutines.InternalCoroutinesApi import kotlinx.coroutines.Job import kotlinx.coroutines.cancel import kotlinx.coroutines.delay @@ -29,7 +26,7 @@ import kotlin.coroutines.CoroutineContext import kotlin.time.ExperimentalTime import kotlin.time.seconds -@ExperimentalCoroutinesApi +@ExperimentalTime class StreamFragment : Fragment(), CoroutineScope { override val coroutineContext: CoroutineContext = Job() + Dispatchers.Main @@ -42,9 +39,6 @@ class StreamFragment : Fragment(), CoroutineScope { return inflater.inflate(R.layout.fragment_stream, container, false) } - @ExperimentalTime - @InternalCoroutinesApi - @FlowPreview override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) diff --git a/filesystem/src/main/java/com/dropbox/android/external/fs3/FSAllReader.kt b/filesystem/src/main/java/com/dropbox/android/external/fs3/FSAllReader.kt index c27937c67..9b53f6dda 100644 --- a/filesystem/src/main/java/com/dropbox/android/external/fs3/FSAllReader.kt +++ b/filesystem/src/main/java/com/dropbox/android/external/fs3/FSAllReader.kt @@ -2,7 +2,6 @@ package com.dropbox.android.external.fs3 import com.dropbox.android.external.fs3.filesystem.FileSystem import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.channels.ReceiveChannel import kotlinx.coroutines.channels.produce import okio.BufferedSource @@ -14,7 +13,6 @@ import java.io.FileNotFoundException * Make sure to have keys containing same data resolve to same "path" * */ -@ExperimentalCoroutinesApi class FSAllReader(internal val fileSystem: FileSystem) : DiskAllRead { @Throws(FileNotFoundException::class) diff --git a/filesystem/src/main/java/com/dropbox/android/external/fs3/SourceAllPersister.kt b/filesystem/src/main/java/com/dropbox/android/external/fs3/SourceAllPersister.kt index 05b54452b..0cc5225c6 100644 --- a/filesystem/src/main/java/com/dropbox/android/external/fs3/SourceAllPersister.kt +++ b/filesystem/src/main/java/com/dropbox/android/external/fs3/SourceAllPersister.kt @@ -2,12 +2,10 @@ package com.dropbox.android.external.fs3 import com.dropbox.android.external.fs3.filesystem.FileSystem import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.channels.ReceiveChannel import okio.BufferedSource import java.io.FileNotFoundException -@ExperimentalCoroutinesApi class SourceAllPersister(fileSystem: FileSystem) : AllPersister> { internal val sourceFileAllReader: FSAllReader = FSAllReader(fileSystem) diff --git a/filesystem/src/main/java/com/dropbox/android/external/fs3/SourcePersisterFactory.kt b/filesystem/src/main/java/com/dropbox/android/external/fs3/SourcePersisterFactory.kt index d69288080..3be50052b 100644 --- a/filesystem/src/main/java/com/dropbox/android/external/fs3/SourcePersisterFactory.kt +++ b/filesystem/src/main/java/com/dropbox/android/external/fs3/SourcePersisterFactory.kt @@ -2,7 +2,6 @@ package com.dropbox.android.external.fs3 import com.dropbox.android.external.fs3.filesystem.FileSystem import com.dropbox.android.external.fs3.filesystem.FileSystemFactory -import kotlinx.coroutines.ExperimentalCoroutinesApi import okio.BufferedSource import java.io.File import java.io.IOException @@ -13,7 +12,6 @@ import kotlin.time.ExperimentalTime * Factory for [SourcePersister] */ -@ExperimentalCoroutinesApi object SourcePersisterFactory { /** diff --git a/multicast/src/main/kotlin/com/dropbox/flow/multicast/ChannelManager.kt b/multicast/src/main/kotlin/com/dropbox/flow/multicast/ChannelManager.kt index e6a1818f8..ca1ffd263 100644 --- a/multicast/src/main/kotlin/com/dropbox/flow/multicast/ChannelManager.kt +++ b/multicast/src/main/kotlin/com/dropbox/flow/multicast/ChannelManager.kt @@ -19,7 +19,6 @@ package com.dropbox.flow.multicast import com.dropbox.flow.multicast.ChannelManager.Message import kotlinx.coroutines.CompletableDeferred import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.channels.SendChannel import kotlinx.coroutines.flow.Flow @@ -401,6 +400,5 @@ private class BufferImpl(private val limit: Int) : } } -@ExperimentalCoroutinesApi internal fun ChannelManager.Message.Dispatch.Value.markDelivered() = delivered.complete(Unit) diff --git a/multicast/src/main/kotlin/com/dropbox/flow/multicast/Multicaster.kt b/multicast/src/main/kotlin/com/dropbox/flow/multicast/Multicaster.kt index 0ed7eba45..f93b55b2b 100644 --- a/multicast/src/main/kotlin/com/dropbox/flow/multicast/Multicaster.kt +++ b/multicast/src/main/kotlin/com/dropbox/flow/multicast/Multicaster.kt @@ -17,7 +17,6 @@ package com.dropbox.flow.multicast import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.channels.ClosedSendChannelException import kotlinx.coroutines.flow.Flow @@ -35,7 +34,6 @@ import kotlinx.coroutines.flow.transform * downstream value collects the latest dispatched value OR a new downstream is added while [buffer] * is empty. */ -@ExperimentalCoroutinesApi class Multicaster( /** * The [CoroutineScope] to use for upstream subscription diff --git a/store-rx2/src/main/kotlin/com/dropbox/store/rx2/RxStore.kt b/store-rx2/src/main/kotlin/com/dropbox/store/rx2/RxStore.kt index 0649b7e57..d06ec29ab 100644 --- a/store-rx2/src/main/kotlin/com/dropbox/store/rx2/RxStore.kt +++ b/store-rx2/src/main/kotlin/com/dropbox/store/rx2/RxStore.kt @@ -9,7 +9,6 @@ import com.dropbox.android.external.store4.fresh import com.dropbox.android.external.store4.get import io.reactivex.Completable import io.reactivex.Flowable -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.rx2.asFlowable import kotlinx.coroutines.rx2.rxCompletable import kotlinx.coroutines.rx2.rxSingle @@ -18,7 +17,6 @@ import kotlinx.coroutines.rx2.rxSingle * Return a [Flowable] for the given key * @param request - see [StoreRequest] for configurations */ -@ExperimentalCoroutinesApi fun Store.observe(request: StoreRequest): Flowable> = stream(request).asFlowable() diff --git a/store-rx2/src/main/kotlin/com/dropbox/store/rx2/RxStoreBuilder.kt b/store-rx2/src/main/kotlin/com/dropbox/store/rx2/RxStoreBuilder.kt index 49347e24d..7d54666a1 100644 --- a/store-rx2/src/main/kotlin/com/dropbox/store/rx2/RxStoreBuilder.kt +++ b/store-rx2/src/main/kotlin/com/dropbox/store/rx2/RxStoreBuilder.kt @@ -3,8 +3,6 @@ package com.dropbox.store.rx2 import com.dropbox.android.external.store4.StoreBuilder import io.reactivex.Scheduler import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.ExperimentalCoroutinesApi -import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.rx2.asCoroutineDispatcher @@ -12,8 +10,6 @@ import kotlinx.coroutines.rx2.asCoroutineDispatcher * Define what scheduler fetcher requests will be called on, * if a scheduler is not set Store will use [GlobalScope] */ -@FlowPreview -@ExperimentalCoroutinesApi fun StoreBuilder.withScheduler( scheduler: Scheduler ): StoreBuilder { diff --git a/store-rx3/src/main/kotlin/com/dropbox/store/rx3/RxStore.kt b/store-rx3/src/main/kotlin/com/dropbox/store/rx3/RxStore.kt index 8006473c4..95ac1b730 100644 --- a/store-rx3/src/main/kotlin/com/dropbox/store/rx3/RxStore.kt +++ b/store-rx3/src/main/kotlin/com/dropbox/store/rx3/RxStore.kt @@ -9,7 +9,6 @@ import com.dropbox.android.external.store4.fresh import com.dropbox.android.external.store4.get import io.reactivex.rxjava3.core.Completable import io.reactivex.rxjava3.core.Flowable -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.rx3.asFlowable import kotlinx.coroutines.rx3.rxCompletable import kotlinx.coroutines.rx3.rxSingle @@ -18,7 +17,6 @@ import kotlinx.coroutines.rx3.rxSingle * Return a [Flowable] for the given key * @param request - see [StoreRequest] for configurations */ -@ExperimentalCoroutinesApi fun Store.observe(request: StoreRequest): Flowable> = stream(request).asFlowable() diff --git a/store-rx3/src/main/kotlin/com/dropbox/store/rx3/RxStoreBuilder.kt b/store-rx3/src/main/kotlin/com/dropbox/store/rx3/RxStoreBuilder.kt index dc79c70b9..c5279a699 100644 --- a/store-rx3/src/main/kotlin/com/dropbox/store/rx3/RxStoreBuilder.kt +++ b/store-rx3/src/main/kotlin/com/dropbox/store/rx3/RxStoreBuilder.kt @@ -3,8 +3,6 @@ package com.dropbox.store.rx3 import com.dropbox.android.external.store4.StoreBuilder import io.reactivex.rxjava3.core.Scheduler import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.ExperimentalCoroutinesApi -import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.rx3.asCoroutineDispatcher @@ -12,8 +10,6 @@ import kotlinx.coroutines.rx3.asCoroutineDispatcher * Define what scheduler fetcher requests will be called on, * if a scheduler is not set Store will use [GlobalScope] */ -@FlowPreview -@ExperimentalCoroutinesApi fun StoreBuilder.withScheduler( scheduler: Scheduler ): StoreBuilder { diff --git a/store/src/main/java/com/dropbox/android/external/store4/StoreBuilder.kt b/store/src/main/java/com/dropbox/android/external/store4/StoreBuilder.kt index e041f5efc..755cca902 100644 --- a/store/src/main/java/com/dropbox/android/external/store4/StoreBuilder.kt +++ b/store/src/main/java/com/dropbox/android/external/store4/StoreBuilder.kt @@ -17,16 +17,12 @@ package com.dropbox.android.external.store4 import com.dropbox.android.external.store4.impl.RealStore import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.ExperimentalCoroutinesApi -import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.GlobalScope import kotlin.time.ExperimentalTime /** * Main entry point for creating a [Store]. */ -@FlowPreview -@ExperimentalCoroutinesApi interface StoreBuilder { fun build(): Store @@ -70,6 +66,7 @@ interface StoreBuilder { * @param fetcher a function for fetching a flow of network records. * @param sourceOfTruth a [SourceOfTruth] for the store. */ + @OptIn(ExperimentalTime::class) fun from( fetcher: Fetcher, sourceOfTruth: SourceOfTruth @@ -80,9 +77,7 @@ interface StoreBuilder { } } -@FlowPreview @OptIn(ExperimentalTime::class) -@ExperimentalCoroutinesApi private class RealStoreBuilder( private val fetcher: Fetcher, private val sourceOfTruth: SourceOfTruth? = null diff --git a/store/src/main/java/com/dropbox/android/external/store4/impl/FetcherController.kt b/store/src/main/java/com/dropbox/android/external/store4/impl/FetcherController.kt index ba3cc3290..7a6cd0468 100644 --- a/store/src/main/java/com/dropbox/android/external/store4/impl/FetcherController.kt +++ b/store/src/main/java/com/dropbox/android/external/store4/impl/FetcherController.kt @@ -22,8 +22,6 @@ import com.dropbox.android.external.store4.SourceOfTruth import com.dropbox.android.external.store4.StoreResponse import com.dropbox.flow.multicast.Multicaster import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.ExperimentalCoroutinesApi -import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.async import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.emitAll @@ -39,8 +37,6 @@ import kotlinx.coroutines.flow.onEmpty * fetcher requests receives values dispatched by later requests even if they don't share the * request. */ -@FlowPreview -@ExperimentalCoroutinesApi internal class FetcherController( /** * The [CoroutineScope] to use when collecting from the fetcher diff --git a/store/src/main/java/com/dropbox/android/external/store4/impl/RealStore.kt b/store/src/main/java/com/dropbox/android/external/store4/impl/RealStore.kt index 37863fdff..62694dcc7 100644 --- a/store/src/main/java/com/dropbox/android/external/store4/impl/RealStore.kt +++ b/store/src/main/java/com/dropbox/android/external/store4/impl/RealStore.kt @@ -29,8 +29,6 @@ import com.dropbox.android.external.store4.impl.operators.merge import com.nytimes.android.external.cache3.CacheBuilder import kotlinx.coroutines.CompletableDeferred import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.ExperimentalCoroutinesApi -import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.emitAll import kotlinx.coroutines.flow.flow @@ -41,8 +39,6 @@ import java.util.concurrent.TimeUnit import kotlin.time.ExperimentalTime @ExperimentalTime -@ExperimentalCoroutinesApi -@FlowPreview internal class RealStore( scope: CoroutineScope, fetcher: Fetcher, diff --git a/store/src/main/java/com/dropbox/android/external/store4/impl/SourceOfTruthWithBarrier.kt b/store/src/main/java/com/dropbox/android/external/store4/impl/SourceOfTruthWithBarrier.kt index 8fb2bdb7b..ed48d7a22 100644 --- a/store/src/main/java/com/dropbox/android/external/store4/impl/SourceOfTruthWithBarrier.kt +++ b/store/src/main/java/com/dropbox/android/external/store4/impl/SourceOfTruthWithBarrier.kt @@ -21,7 +21,6 @@ import com.dropbox.android.external.store4.StoreResponse import com.dropbox.android.external.store4.impl.operators.mapIndexed import kotlinx.coroutines.CancellationException import kotlinx.coroutines.CompletableDeferred -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.catch @@ -38,7 +37,6 @@ import java.util.concurrent.atomic.AtomicLong * Used in the [com.dropbox.android.external.store4.impl.RealStore] implementation to avoid * dispatching values to downstream while a write is in progress. */ -@OptIn(ExperimentalCoroutinesApi::class) internal class SourceOfTruthWithBarrier( private val delegate: SourceOfTruth ) { diff --git a/store/src/main/java/com/dropbox/android/external/store4/impl/operators/FlowMerge.kt b/store/src/main/java/com/dropbox/android/external/store4/impl/operators/FlowMerge.kt index 4b0d9f62a..dcd5af884 100644 --- a/store/src/main/java/com/dropbox/android/external/store4/impl/operators/FlowMerge.kt +++ b/store/src/main/java/com/dropbox/android/external/store4/impl/operators/FlowMerge.kt @@ -15,7 +15,6 @@ */ package com.dropbox.android.external.store4.impl.operators -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.buffer @@ -26,7 +25,6 @@ import kotlinx.coroutines.launch /** * Merge implementation tells downstream what the source is and also uses a rendezvous channel */ -@ExperimentalCoroutinesApi internal fun Flow.merge(other: Flow): Flow> { return channelFlow> { launch { diff --git a/store/src/test/java/com/dropbox/android/external/store3/StoreThrowOnNoItems.kt b/store/src/test/java/com/dropbox/android/external/store3/StoreThrowOnNoItems.kt index 94b09f7d3..55d6db387 100644 --- a/store/src/test/java/com/dropbox/android/external/store3/StoreThrowOnNoItems.kt +++ b/store/src/test/java/com/dropbox/android/external/store3/StoreThrowOnNoItems.kt @@ -4,8 +4,6 @@ import com.dropbox.android.external.store4.Fetcher import com.dropbox.android.external.store4.get import com.nhaarman.mockitokotlin2.mock import com.nhaarman.mockitokotlin2.whenever -import kotlinx.coroutines.ExperimentalCoroutinesApi -import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.test.TestCoroutineScope import kotlinx.coroutines.test.runBlockingTest import com.google.common.truth.Truth.assertThat @@ -14,9 +12,9 @@ import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.Parameterized import java.util.concurrent.atomic.AtomicInteger +import kotlin.time.ExperimentalTime -@FlowPreview -@ExperimentalCoroutinesApi +@ExperimentalTime @RunWith(Parameterized::class) class StoreThrowOnNoItems( private val storeType: TestStoreType diff --git a/store/src/test/java/com/dropbox/android/external/store3/TestStoreBuilder.kt b/store/src/test/java/com/dropbox/android/external/store3/TestStoreBuilder.kt index 1eb9b55ae..da1bc4a4a 100644 --- a/store/src/test/java/com/dropbox/android/external/store3/TestStoreBuilder.kt +++ b/store/src/test/java/com/dropbox/android/external/store3/TestStoreBuilder.kt @@ -22,13 +22,9 @@ import com.dropbox.android.external.store4.Store import com.dropbox.android.external.store4.StoreBuilder import com.dropbox.android.external.store4.impl.PersistentSourceOfTruth import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.ExperimentalCoroutinesApi -import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.flow.flow import kotlin.time.ExperimentalTime -@FlowPreview -@ExperimentalCoroutinesApi data class TestStoreBuilder( private val buildStore: () -> Store ) { diff --git a/store/src/test/java/com/dropbox/android/external/store4/testutil/SimplePersisterAsFlowable.kt b/store/src/test/java/com/dropbox/android/external/store4/testutil/SimplePersisterAsFlowable.kt index e80a77a3f..23eaa0c9a 100644 --- a/store/src/test/java/com/dropbox/android/external/store4/testutil/SimplePersisterAsFlowable.kt +++ b/store/src/test/java/com/dropbox/android/external/store4/testutil/SimplePersisterAsFlowable.kt @@ -16,7 +16,6 @@ package com.dropbox.android.external.store4.testutil import com.dropbox.android.external.store4.SourceOfTruth -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.channels.BroadcastChannel import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.flow.Flow @@ -29,7 +28,6 @@ import kotlinx.coroutines.sync.withLock /** * Only used in FlowStoreTest. We should get rid of it eventually. */ -@ExperimentalCoroutinesApi class SimplePersisterAsFlowable( private val reader: suspend (Key) -> Output?, private val writer: suspend (Key, Input) -> Unit, @@ -60,7 +58,6 @@ class SimplePersisterAsFlowable( } } -@ExperimentalCoroutinesApi fun SimplePersisterAsFlowable.asSourceOfTruth() = SourceOfTruth.of( reader = ::flowReader, @@ -71,7 +68,6 @@ fun SimplePersisterAsFlowable { private val lock = Mutex() // list of open key channels @@ -144,7 +140,6 @@ internal class KeyTracker { } } -@ExperimentalCoroutinesApi fun InMemoryPersister.asFlowable() = SimplePersisterAsFlowable( reader = this::read,