Fixed
Status Update
Comments
ja...@google.com <ja...@google.com>
ra...@google.com <ra...@google.com>
ap...@google.com <ap...@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
ap...@google.com <ap...@google.com> #3
ap...@google.com <ap...@google.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
ap...@google.com <ap...@google.com> #5
Project: platform/frameworks/support
Branch: androidx-main
commit a3b689ca0f671d79fb555a4bcf56ebc025333433
Author: Sergey Vasilinets <sergeyv@google.com>
Date: Wed Jan 05 17:52:33 2022
Remove ContentUriTriggers
In order to add public constructor to Constraints
that has default values (see b/137568653 ), it should be possible to pass
content uri triggers to it. As a result either ContentUriTriggers
should have become public API or completely removed. Given ContentUriTriggers
didn't provide any value over simple Set, it was removed.
bug: 137568653
Test: refactoring. test passes
Change-Id: I15ed1db4ff85f784445de67d8574c1999ef8f1e0
M work/work-runtime/src/androidTest/java/androidx/work/impl/WorkManagerImplTest.java
M work/work-runtime/src/main/java/androidx/work/impl/background/systemjob/SystemJobInfoConverter.java
M work/work-runtime/src/main/java/androidx/work/Constraints.kt
M work/work-runtime/src/main/java/androidx/work/impl/model/WorkTypeConverters.kt
M work/work-multiprocess/src/main/java/androidx/work/multiprocess/parcelable/ParcelableConstraints.java
D work/work-runtime/src/main/java/androidx/work/ContentUriTriggers.java
M work/work-runtime/src/androidTest/java/androidx/work/WorkDatabaseMigrationTest.java
https://android-review.googlesource.com/1938781
Branch: androidx-main
commit a3b689ca0f671d79fb555a4bcf56ebc025333433
Author: Sergey Vasilinets <sergeyv@google.com>
Date: Wed Jan 05 17:52:33 2022
Remove ContentUriTriggers
In order to add public constructor to Constraints
that has default values (see
content uri triggers to it. As a result either ContentUriTriggers
should have become public API or completely removed. Given ContentUriTriggers
didn't provide any value over simple Set, it was removed.
bug: 137568653
Test: refactoring. test passes
Change-Id: I15ed1db4ff85f784445de67d8574c1999ef8f1e0
M work/work-runtime/src/androidTest/java/androidx/work/impl/WorkManagerImplTest.java
M work/work-runtime/src/main/java/androidx/work/impl/background/systemjob/SystemJobInfoConverter.java
M work/work-runtime/src/main/java/androidx/work/Constraints.kt
M work/work-runtime/src/main/java/androidx/work/impl/model/WorkTypeConverters.kt
M work/work-multiprocess/src/main/java/androidx/work/multiprocess/parcelable/ParcelableConstraints.java
D work/work-runtime/src/main/java/androidx/work/ContentUriTriggers.java
M work/work-runtime/src/androidTest/java/androidx/work/WorkDatabaseMigrationTest.java
ap...@google.com <ap...@google.com> #6
Project: platform/frameworks/support
Branch: androidx-main
commit 904f805c02027504863d752097635509139d49a5
Author: Sergey Vasilinets <sergeyv@google.com>
Date: Fri Jan 07 14:17:07 2022
Expose constructor and missing getters in Constraints
For kotlin, it is more natural to use constructor and named parameters
rather than builder and chain setter calls, so corresponding constructor
was made public.
Constraints were missing getters for some of the properties,
which is against api guidelines, so they were added as a drive-by
Relnote: "Constraints can now be directly constructed rather than
using Builder, which is convenient for Kotlin users."
bug: 137568653
Test: NA
Change-Id: Idc3900488dcaae5ca6c52b706723a752425875d9
M work/work-runtime/api/restricted_current.txt
M work/work-runtime/src/main/java/androidx/work/impl/background/systemjob/SystemJobInfoConverter.java
M work/work-runtime/src/main/java/androidx/work/Constraints.kt
M work/work-runtime/src/main/java/androidx/work/impl/model/WorkTypeConverters.kt
M work/work-runtime/api/public_plus_experimental_current.txt
M work/work-multiprocess/src/main/java/androidx/work/multiprocess/parcelable/ParcelableConstraints.java
M work/work-runtime/api/current.txt
https://android-review.googlesource.com/1940975
Branch: androidx-main
commit 904f805c02027504863d752097635509139d49a5
Author: Sergey Vasilinets <sergeyv@google.com>
Date: Fri Jan 07 14:17:07 2022
Expose constructor and missing getters in Constraints
For kotlin, it is more natural to use constructor and named parameters
rather than builder and chain setter calls, so corresponding constructor
was made public.
Constraints were missing getters for some of the properties,
which is against api guidelines, so they were added as a drive-by
Relnote: "Constraints can now be directly constructed rather than
using Builder, which is convenient for Kotlin users."
bug: 137568653
Test: NA
Change-Id: Idc3900488dcaae5ca6c52b706723a752425875d9
M work/work-runtime/api/restricted_current.txt
M work/work-runtime/src/main/java/androidx/work/impl/background/systemjob/SystemJobInfoConverter.java
M work/work-runtime/src/main/java/androidx/work/Constraints.kt
M work/work-runtime/src/main/java/androidx/work/impl/model/WorkTypeConverters.kt
M work/work-runtime/api/public_plus_experimental_current.txt
M work/work-multiprocess/src/main/java/androidx/work/multiprocess/parcelable/ParcelableConstraints.java
M work/work-runtime/api/current.txt
Description
val constraints = Constraints.Builder()
.setRequiresCharging(true)
.setRequiredNetworkType(NetworkType.CONNECTED)
.build()
The default parameters approach is trivial using a data class and named parameters could be used when being constructed.
data class Constraints(
val requiredNetworkType: NetworkType = NetworkType.NOT_REQUIRED,
val requiresCharging: Boolean = false
)
val constraints = Constraints(requiredNetworkType = NetworkType.METERED)
For converting the builder from java to a more idiomatic Kotlin, we could also write a function that uses a method with a receiver on the builder.
inline fun constraints(builder: Constraints.Builder.() -> Unit): Constraints {
return Constraints.Builder().apply { builder() }.build()
}
val constraints = constraints {
setRequiredNetworkType(NetworkType.CONNECTED)
setRequiresCharging(true)
}
The naming of these could probably be renamed, just a nicer way to write builder like classes in kotlin.