Fixed
Status Update
Comments
du...@google.com <du...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-master-dev
commit b90079595f33f58fece04026a97faa0d243acdb1
Author: Yuichi Araki <yaraki@google.com>
Date: Wed Sep 18 16:55:49 2019
Change the way to detect mismatch between POJO and query
This fixes cursor mismatch warnings with expandProjection.
Bug: 140759491
Test: QueryMethodProcessorTest
Change-Id: I7659002e5e0d1ef60fc1af2a625c0c36da0664d8
M room/compiler/src/main/kotlin/androidx/room/processor/QueryMethodProcessor.kt
M room/compiler/src/main/kotlin/androidx/room/solver/TypeAdapterStore.kt
M room/compiler/src/main/kotlin/androidx/room/solver/query/result/PojoRowAdapter.kt
M room/compiler/src/test/kotlin/androidx/room/processor/QueryMethodProcessorTest.kt
M room/compiler/src/test/kotlin/androidx/room/testing/TestProcessor.kt
https://android-review.googlesource.com/1123258
https://goto.google.com/android-sha1/b90079595f33f58fece04026a97faa0d243acdb1
Branch: androidx-master-dev
commit b90079595f33f58fece04026a97faa0d243acdb1
Author: Yuichi Araki <yaraki@google.com>
Date: Wed Sep 18 16:55:49 2019
Change the way to detect mismatch between POJO and query
This fixes cursor mismatch warnings with expandProjection.
Bug: 140759491
Test: QueryMethodProcessorTest
Change-Id: I7659002e5e0d1ef60fc1af2a625c0c36da0664d8
M room/compiler/src/main/kotlin/androidx/room/processor/QueryMethodProcessor.kt
M room/compiler/src/main/kotlin/androidx/room/solver/TypeAdapterStore.kt
M room/compiler/src/main/kotlin/androidx/room/solver/query/result/PojoRowAdapter.kt
M room/compiler/src/test/kotlin/androidx/room/processor/QueryMethodProcessorTest.kt
M room/compiler/src/test/kotlin/androidx/room/testing/TestProcessor.kt
du...@google.com <du...@google.com> #3
ti...@chainels.com <ti...@chainels.com> #4
Project: platform/frameworks/support
Branch: androidx-master-dev
commit bdde5a1a970ddc9007b28de4aa29d60ffa588f08
Author: Yigit Boyar <yboyar@google.com>
Date: Thu Apr 16 16:47:05 2020
Re-factor how errors are dismissed when query is re-written
This CL changes how we handle errors/warnings if query is
re-written.
There was a bug in expandProjection where we would report warnings
for things that Room already fixes automatically ( b/140759491 ).
The solution to that problem (I7659002e5e0d1ef60fc1af2a625c0c36da0664d8)
solved it by deferring validating of columns until after re-write
decision is made. Unfortunately, this required changing PojoRowAdapter
to have a dummy mapping until it is validating, make it hard to use
as it does have a non-null mapping which is not useful.
This CL partially reverts that change and instead rely on the log
deferring logic we have in Context. This way, we don't need to break
the stability of PojoRowAdapter while still having the ability to
drop warnings that room fixes. This will also play nicer when we
have different query re-writing options that can use more information
about the query results.
Bug: 153387066
Bug: 140759491
Test: existing tests pass
Change-Id: I2ec967c763d33d7a3ff02c1a13c6953b460d1e5f
M room/compiler/src/main/kotlin/androidx/room/log/RLog.kt
M room/compiler/src/main/kotlin/androidx/room/processor/QueryMethodProcessor.kt
M room/compiler/src/main/kotlin/androidx/room/solver/TypeAdapterStore.kt
M room/compiler/src/main/kotlin/androidx/room/solver/query/result/PojoRowAdapter.kt
https://android-review.googlesource.com/1288456
Branch: androidx-master-dev
commit bdde5a1a970ddc9007b28de4aa29d60ffa588f08
Author: Yigit Boyar <yboyar@google.com>
Date: Thu Apr 16 16:47:05 2020
Re-factor how errors are dismissed when query is re-written
This CL changes how we handle errors/warnings if query is
re-written.
There was a bug in expandProjection where we would report warnings
for things that Room already fixes automatically (
The solution to that problem (I7659002e5e0d1ef60fc1af2a625c0c36da0664d8)
solved it by deferring validating of columns until after re-write
decision is made. Unfortunately, this required changing PojoRowAdapter
to have a dummy mapping until it is validating, make it hard to use
as it does have a non-null mapping which is not useful.
This CL partially reverts that change and instead rely on the log
deferring logic we have in Context. This way, we don't need to break
the stability of PojoRowAdapter while still having the ability to
drop warnings that room fixes. This will also play nicer when we
have different query re-writing options that can use more information
about the query results.
Bug: 153387066
Bug: 140759491
Test: existing tests pass
Change-Id: I2ec967c763d33d7a3ff02c1a13c6953b460d1e5f
M room/compiler/src/main/kotlin/androidx/room/log/RLog.kt
M room/compiler/src/main/kotlin/androidx/room/processor/QueryMethodProcessor.kt
M room/compiler/src/main/kotlin/androidx/room/solver/TypeAdapterStore.kt
M room/compiler/src/main/kotlin/androidx/room/solver/query/result/PojoRowAdapter.kt
du...@google.com <du...@google.com> #5
This fix is slated to be released with alpha07, which should be the next one.
du...@google.com <du...@google.com> #6
Spoke too soon, I had thought it had already merged, but looks like this will instead end up landing in alpha08
ap...@google.com <ap...@google.com> #7
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 0680b894e3f13d0a93415a3cc0d9543135e179c5
Author: Dustin Lam <dustinlam@google.com>
Date: Thu Sep 03 20:19:24 2020
Ensure kotlin invalidate callbacks are called by WrapperDataSources
Relnote: "The Kotlin / Java variants of DataSource.InvalidatedCallback
have been combined by enabling SAM-conversions in Kotlin via functional
interface (available in Kotlin 1.4). This also fixes a bug where the
kotlin variant of invalidate callbacks were not called after transformed
by .map or .mapByPage."
Fixes: 165313046
Test: ./gradlew paging:paging-common:test
Change-Id: I1f244498bd9f78bfed2744d9e6c9d5c1c1448971
M paging/common/api/current.txt
M paging/common/api/public_plus_experimental_current.txt
M paging/common/api/restricted_current.txt
M paging/common/src/main/kotlin/androidx/paging/DataSource.kt
M paging/common/src/main/kotlin/androidx/paging/WrapperPageKeyedDataSource.kt
M paging/common/src/main/kotlin/androidx/paging/WrapperPositionalDataSource.kt
M paging/common/src/test/kotlin/androidx/paging/LegacyPagingSourceTest.kt
M paging/common/src/test/kotlin/androidx/paging/PagedListTest.kt
A paging/common/src/test/kotlin/androidx/paging/WrappedItemKeyedDataSourceTest.kt
A paging/common/src/test/kotlin/androidx/paging/WrappedPageKeyedDataSourceTest.kt
A paging/common/src/test/kotlin/androidx/paging/WrappedPositionalDataSourceTest.kt
M paging/runtime/src/androidTest/java/androidx/paging/AsyncPagedListDifferTest.kt
M paging/rxjava2/src/test/java/androidx/paging/RxPagedListBuilderTest.kt
A testutils/testutils-paging/src/main/java/androidx/paging/TestItemKeyedDataSource.kt
A testutils/testutils-paging/src/main/java/androidx/paging/TestPageKeyedDataSource.kt
M testutils/testutils-paging/src/main/java/androidx/paging/TestPositionalDataSource.kt
https://android-review.googlesource.com/1419738
Branch: androidx-master-dev
commit 0680b894e3f13d0a93415a3cc0d9543135e179c5
Author: Dustin Lam <dustinlam@google.com>
Date: Thu Sep 03 20:19:24 2020
Ensure kotlin invalidate callbacks are called by WrapperDataSources
Relnote: "The Kotlin / Java variants of DataSource.InvalidatedCallback
have been combined by enabling SAM-conversions in Kotlin via functional
interface (available in Kotlin 1.4). This also fixes a bug where the
kotlin variant of invalidate callbacks were not called after transformed
by .map or .mapByPage."
Fixes: 165313046
Test: ./gradlew paging:paging-common:test
Change-Id: I1f244498bd9f78bfed2744d9e6c9d5c1c1448971
M paging/common/api/current.txt
M paging/common/api/public_plus_experimental_current.txt
M paging/common/api/restricted_current.txt
M paging/common/src/main/kotlin/androidx/paging/DataSource.kt
M paging/common/src/main/kotlin/androidx/paging/WrapperPageKeyedDataSource.kt
M paging/common/src/main/kotlin/androidx/paging/WrapperPositionalDataSource.kt
M paging/common/src/test/kotlin/androidx/paging/LegacyPagingSourceTest.kt
M paging/common/src/test/kotlin/androidx/paging/PagedListTest.kt
A paging/common/src/test/kotlin/androidx/paging/WrappedItemKeyedDataSourceTest.kt
A paging/common/src/test/kotlin/androidx/paging/WrappedPageKeyedDataSourceTest.kt
A paging/common/src/test/kotlin/androidx/paging/WrappedPositionalDataSourceTest.kt
M paging/runtime/src/androidTest/java/androidx/paging/AsyncPagedListDifferTest.kt
M paging/rxjava2/src/test/java/androidx/paging/RxPagedListBuilderTest.kt
A testutils/testutils-paging/src/main/java/androidx/paging/TestItemKeyedDataSource.kt
A testutils/testutils-paging/src/main/java/androidx/paging/TestPageKeyedDataSource.kt
M testutils/testutils-paging/src/main/java/androidx/paging/TestPositionalDataSource.kt
Description
Component used: Paging
Version used: 3.0 alpha-04
Devices/Android versions reproduced on: n/a
Today (after many hours of debugging) I seem to have found a bug in latest alpha version of the Paging library. In my app I still have various lists that are not yet migrated to the new v3 API's, but since the documentation states it's backward compatible I figured that was okay.
Those lists use the database + remote pattern. One such list displayed strange behavior, it seemed to call all the boundary callbacks correctly, do the API call, and insert the new items in the database, however the items in the RecyclerView did not change.
The only difference that I could find between that list and other lists that were functioning correctly, is that it used a
map
function on theDatasource.Factory
returned by RoomI think I found the underlying issue. The data source does not seem to be invalidated when using a map function.
DataSource
has two variants ofaddOnValidationCallback
. An open functionThe Kotlin version is actually called in
LegacyPagingSource
However when using a map/mapByPage function on the factory returned by room, the source is wrapped and in that class ( , but also
WrappedDataSource
WrapperPositionalDataSource
for example) only the non Kotlin version ofaddOnValidationCallback
is overridden, and thus if called with the Kotlin version,addOnValidationCallback
is never called on the source of the wrapper.I could see when debugging that indeed
onInvalidatedCallbacks
is empty.Hopefully this is actually the cause of the behavior I'm seeing. The Paging code is quite complex so I could be missing something else.