Fixed
Status Update
Comments
ga...@google.com <ga...@google.com>
ga...@google.com <ga...@google.com> #2
+1, but Deferred does not solve the Observer problem that Rx and LiveData do, so I guess Google should implement Channels instead of LiveData which is actually a Kotlin Coroutine counterpart. Looking forward to this as I've decided not to use RxJava in most of future projects due to Kotlin Coroutines..
pa...@google.com <pa...@google.com>
ga...@google.com <ga...@google.com> #3
Project: platform/frameworks/support
Branch: androidx-master-dev
commit e78cceffeac28f0028342990c1391c640edf453c
Author: Daniel Santiago Rivera <danysantiago@google.com>
Date: Wed Nov 28 12:40:24 2018
Room Support for Coroutines
This change allows users to define suspend functions in DAOs with
@Query, @Insert, @Update and @Delete. The new artifact room-coroutine
defines a helper classes for supporting the feature.
Bug: 69474692
Test: ./gradlew room:integration-tests:kotlintestapp:cC
Change-Id: Id73a6b845df3f21f99d14cb6980130dcf3885c81
M buildSrc/src/main/kotlin/androidx/build/PublishDocsRules.kt
A room/compiler/src/main/kotlin/androidx/room/ext/KotlinMetadataElement.kt
D room/compiler/src/main/kotlin/androidx/room/ext/KotlinMetadataProcessor.kt
M room/compiler/src/main/kotlin/androidx/room/ext/element_ext.kt
M room/compiler/src/main/kotlin/androidx/room/ext/javapoet_ext.kt
M room/compiler/src/main/kotlin/androidx/room/processor/DeletionMethodProcessor.kt
M room/compiler/src/main/kotlin/androidx/room/processor/InsertionMethodProcessor.kt
A room/compiler/src/main/kotlin/androidx/room/processor/MethodProcessorDelegate.kt
M room/compiler/src/main/kotlin/androidx/room/processor/PojoProcessor.kt
M room/compiler/src/main/kotlin/androidx/room/processor/ProcessorErrors.kt
M room/compiler/src/main/kotlin/androidx/room/processor/QueryMethodProcessor.kt
M room/compiler/src/main/kotlin/androidx/room/processor/RawQueryMethodProcessor.kt
M room/compiler/src/main/kotlin/androidx/room/processor/ShortcutMethodProcessor.kt
M room/compiler/src/main/kotlin/androidx/room/processor/UpdateMethodProcessor.kt
A room/compiler/src/main/kotlin/androidx/room/solver/query/result/CoroutineResultBinder.kt
M room/compiler/src/main/kotlin/androidx/room/solver/query/result/PojoRowAdapter.kt
A room/compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/CoroutineDeleteOrUpdateMethodBinder.kt
A room/compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/CoroutineInsertMethodBinder.kt
M room/compiler/src/main/kotlin/androidx/room/solver/shortcut/result/DeleteOrUpdateMethodAdapter.kt
M room/compiler/src/main/kotlin/androidx/room/solver/shortcut/result/InsertMethodAdapter.kt
M room/compiler/src/main/kotlin/androidx/room/vo/RelationCollector.kt
M room/compiler/src/test/kotlin/androidx/room/processor/QueryMethodProcessorTest.kt
A room/coroutines/build.gradle
A room/coroutines/src/main/AndroidManifest.xml
A room/coroutines/src/main/java/androidx/room/CoroutinesRoom.kt
M room/integration-tests/kotlintestapp/build.gradle
M room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/dao/BooksDao.kt
M room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/BooksDaoTest.kt
A room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/SuspendRoomDispatcherTest.kt
M settings.gradle
https://android-review.googlesource.com/833705
https://goto.google.com/android-sha1/e78cceffeac28f0028342990c1391c640edf453c
Branch: androidx-master-dev
commit e78cceffeac28f0028342990c1391c640edf453c
Author: Daniel Santiago Rivera <danysantiago@google.com>
Date: Wed Nov 28 12:40:24 2018
Room Support for Coroutines
This change allows users to define suspend functions in DAOs with
@Query, @Insert, @Update and @Delete. The new artifact room-coroutine
defines a helper classes for supporting the feature.
Bug: 69474692
Test: ./gradlew room:integration-tests:kotlintestapp:cC
Change-Id: Id73a6b845df3f21f99d14cb6980130dcf3885c81
M buildSrc/src/main/kotlin/androidx/build/PublishDocsRules.kt
A room/compiler/src/main/kotlin/androidx/room/ext/KotlinMetadataElement.kt
D room/compiler/src/main/kotlin/androidx/room/ext/KotlinMetadataProcessor.kt
M room/compiler/src/main/kotlin/androidx/room/ext/element_ext.kt
M room/compiler/src/main/kotlin/androidx/room/ext/javapoet_ext.kt
M room/compiler/src/main/kotlin/androidx/room/processor/DeletionMethodProcessor.kt
M room/compiler/src/main/kotlin/androidx/room/processor/InsertionMethodProcessor.kt
A room/compiler/src/main/kotlin/androidx/room/processor/MethodProcessorDelegate.kt
M room/compiler/src/main/kotlin/androidx/room/processor/PojoProcessor.kt
M room/compiler/src/main/kotlin/androidx/room/processor/ProcessorErrors.kt
M room/compiler/src/main/kotlin/androidx/room/processor/QueryMethodProcessor.kt
M room/compiler/src/main/kotlin/androidx/room/processor/RawQueryMethodProcessor.kt
M room/compiler/src/main/kotlin/androidx/room/processor/ShortcutMethodProcessor.kt
M room/compiler/src/main/kotlin/androidx/room/processor/UpdateMethodProcessor.kt
A room/compiler/src/main/kotlin/androidx/room/solver/query/result/CoroutineResultBinder.kt
M room/compiler/src/main/kotlin/androidx/room/solver/query/result/PojoRowAdapter.kt
A room/compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/CoroutineDeleteOrUpdateMethodBinder.kt
A room/compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/CoroutineInsertMethodBinder.kt
M room/compiler/src/main/kotlin/androidx/room/solver/shortcut/result/DeleteOrUpdateMethodAdapter.kt
M room/compiler/src/main/kotlin/androidx/room/solver/shortcut/result/InsertMethodAdapter.kt
M room/compiler/src/main/kotlin/androidx/room/vo/RelationCollector.kt
M room/compiler/src/test/kotlin/androidx/room/processor/QueryMethodProcessorTest.kt
A room/coroutines/build.gradle
A room/coroutines/src/main/AndroidManifest.xml
A room/coroutines/src/main/java/androidx/room/CoroutinesRoom.kt
M room/integration-tests/kotlintestapp/build.gradle
M room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/dao/BooksDao.kt
M room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/BooksDaoTest.kt
A room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/SuspendRoomDispatcherTest.kt
M settings.gradle
ch...@gmail.com <ch...@gmail.com> #4
So do you support any Coroutine "observables" like channels? Or these are just one-off suspending calls?
pa...@google.com <pa...@google.com> #5
For now we'll be just supporting one-off suspend functions in Room 2.1.0-alpha03. Coroutines stream functionality with channels is still a work in progress.
mi...@aexp.com <mi...@aexp.com> #6
Relating to the original request, how about allowing a return type of Deferred<LiveData<T>> which suspends until LiveData<T>'s value has been set the first time?
pa...@google.com <pa...@google.com> #7
I just tested out Room 2.1.0-alpha03 and added suspend to all of my functions.... there appears to be an issue with functions that use @Query() and UPDATE and DELETE queries. Examples:
Code Example 1:
@Query("DELETE FROM individual")
suspend fun deleteAll()
Error:
Deletion methods must either return void or return int (the number of deleted rows).
Code Example 2:
@Query("UPDATE individual SET firstName = :firstName WHERE id = :id")
suspend fun updateFirstName(id: Long, firstName: String)
Error:
Not sure how to convert a Cursor to this method's return type (kotlin.Unit).
Code Example 1:
@Query("DELETE FROM individual")
suspend fun deleteAll()
Error:
Deletion methods must either return void or return int (the number of deleted rows).
Code Example 2:
@Query("UPDATE individual SET firstName = :firstName WHERE id = :id")
suspend fun updateFirstName(id: Long, firstName: String)
Error:
Not sure how to convert a Cursor to this method's return type (kotlin.Unit).
hu...@google.com <hu...@google.com> #8
Async return types with @Query that perform UPDATE, DELETE or INSERT are not yet supported. This also applies to coroutines. We are actively working on adding this for the next alpha of 2.1.0. Subscribe to the bug for updates: https://issuetracker.google.com/issues/120227284
Description
Log:
java.lang.SecurityException: SHA1 digest error for org/bouncycastle/jce/provider/BouncyCastleProvider.class
at sun.security.util.ManifestEntryVerifier.verify(ManifestEntryVerifier.java:223)
at java.util.jar.JarVerifier.processEntry(JarVerifier.java:243)
at java.util.jar.JarVerifier.update(JarVerifier.java:230)
at java.util.jar.JarVerifier$VerifierStream.read(JarVerifier.java:484)
at java.io.FilterInputStream.read(FilterInputStream.java:133)
at java.io.FilterInputStream.read(FilterInputStream.java:107)
at org.robolectric.util.Util.copy(Util.java:46)
at org.robolectric.util.Util.readBytes(Util.java:63)
at org.robolectric.internal.bytecode.SandboxClassLoader.getByteCode(SandboxClassLoader.java:167)
at org.robolectric.internal.bytecode.SandboxClassLoader.maybeInstrumentClass(SandboxClassLoader.java:119)
at org.robolectric.internal.bytecode.SandboxClassLoader.lambda$findClass$0(SandboxClassLoader.java:112)
at org.robolectric.util.PerfStatsCollector.measure(PerfStatsCollector.java:53)
at org.robolectric.internal.bytecode.SandboxClassLoader.findClass(SandboxClassLoader.java:111)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671)
at java.lang.Class.getConstructors(Class.java:1651)
at org.robolectric.util.inject.Injector.findConstructor(Injector.java:249)
at org.robolectric.util.inject.Injector.inject(Injector.java:232)
at org.robolectric.util.inject.Injector.lambda$new$0(Injector.java:115)
at org.robolectric.util.inject.Injector$MemoizingProvider.get(Injector.java:485)
at org.robolectric.util.inject.Injector.getInstanceInternal(Injector.java:213)
at org.robolectric.util.inject.Injector.getInstance(Injector.java:197)
at org.robolectric.util.inject.Injector.getInstance(Injector.java:191)
at org.robolectric.internal.AndroidSandbox.lambda$new$0(AndroidSandbox.java:51)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Repro:
git clone -b cb/agb-3.6.0-beta01
cd tivi
./gradlew testDebug