Fixed
Status Update
Comments
sp...@gmail.com <sp...@gmail.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
se...@google.com <se...@google.com>
la...@gmail.com <la...@gmail.com> #3
ma...@gmail.com <ma...@gmail.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
sp...@gmail.com <sp...@gmail.com> #5
It already existed in 2.2.0.
[Deleted User] <[Deleted User]> #6
For me, this started to happen when I updated the libs to 2.3.0. If I downgrade them to 2.2.0, the error disappears.
ap...@google.com <ap...@google.com> #7
Project: platform/frameworks/support
Branch: androidx-main
commit d5adf6168357145df07976060f0ae88dfdb05fe8
Author: Jeremy Woods <jbwoods@google.com>
Date: Mon Mar 08 14:17:49 2021
Fix MutableLiveData lint rule false report
If using multiple MutableLiveData variables as fields and mixed the
nullability, the lint rule could falsely report that a livedata value
was improperly being made null. This is because as constructed, it
didn't match up the fields with the assignments.
This change maps the field variable names to the reference types to
ensure that when reporting, the rule knows how to match them.
This also cleans up the rule by changing it to using a UastScanner.
Relnote: "The `NonNullableMutableLiveData` lint rule can now properly
differentiate between field variables with different nullability."
Test: added nullLiterallFailMultipleFieldsDifferent
Bug: 169249668
Change-Id: Ieb0270de1b22f3a10641643438bc2b9f1f5d72e8
M lifecycle/lifecycle-livedata-core-ktx-lint/src/main/java/androidx/lifecycle/lint/NonNullableMutableLiveDataDetector.kt
M lifecycle/lifecycle-livedata-core-ktx-lint/src/test/java/androidx/lifecycle/lint/NonNullableMutableLiveDataDetectorTest.kt
https://android-review.googlesource.com/1532131
Branch: androidx-main
commit d5adf6168357145df07976060f0ae88dfdb05fe8
Author: Jeremy Woods <jbwoods@google.com>
Date: Mon Mar 08 14:17:49 2021
Fix MutableLiveData lint rule false report
If using multiple MutableLiveData variables as fields and mixed the
nullability, the lint rule could falsely report that a livedata value
was improperly being made null. This is because as constructed, it
didn't match up the fields with the assignments.
This change maps the field variable names to the reference types to
ensure that when reporting, the rule knows how to match them.
This also cleans up the rule by changing it to using a UastScanner.
Relnote: "The `NonNullableMutableLiveData` lint rule can now properly
differentiate between field variables with different nullability."
Test: added nullLiterallFailMultipleFieldsDifferent
Bug: 169249668
Change-Id: Ieb0270de1b22f3a10641643438bc2b9f1f5d72e8
M lifecycle/lifecycle-livedata-core-ktx-lint/src/main/java/androidx/lifecycle/lint/NonNullableMutableLiveDataDetector.kt
M lifecycle/lifecycle-livedata-core-ktx-lint/src/test/java/androidx/lifecycle/lint/NonNullableMutableLiveDataDetectorTest.kt
jb...@google.com <jb...@google.com> #8
This has been addressed internally and will be in the next lifecycle release.
You can follow the 7201697
with the lifecycle-livedata-core-ktx:2.4.0-SNAPSHOT
dependency to verify.
sp...@gmail.com <sp...@gmail.com> #9
Awesome! Thank you for fixing this.
jb...@google.com <jb...@google.com>
go...@gmail.com <go...@gmail.com> #10
#FLHY
n....@tinkoff.ru <n....@tinkoff.ru> #11
on 2.4.0-alpha01 androidx.lifecycle.lint.NonNullableMutableLiveDataDetector still doesn't work
Stack: ArrayIndexOutOfBoundsException:NonNullableMutableLiveDataDetector$createUastHandler$1.getFieldTypeReference(NonNullableMutableLiveDataDetector.kt:101)←NonNullableMutableLiveDataDetector$createUastHandler$1.visitClass(NonNullableMutableLiveDataDetector.kt:88)←UElementVisitor$DispatchPsiVisitor.visitClass(UElementVisitor.kt:602)←UElementVisitor$DelegatingPsiVisitor.visitClass(UElementVisitor.kt:1153)←AbstractKotlinUClass.accept(KotlinUClass.kt:63)←ImplementationUtilsKt.acceptList(implementationUtils.kt:23)←UFile$DefaultImpls.accept(UFile.kt:83)←KotlinUFile.accept(KotlinUFile.kt:30)
Stack: ArrayIndexOutOfBoundsException:NonNullableMutableLiveDataDetector$createUastHandler$1.getFieldTypeReference(NonNullableMutableLiveDataDetector.kt:101)←NonNullableMutableLiveDataDetector$createUastHandler$1.visitClass(NonNullableMutableLiveDataDetector.kt:88)←UElementVisitor$DispatchPsiVisitor.visitClass(UElementVisitor.kt:602)←UElementVisitor$DelegatingPsiVisitor.visitClass(UElementVisitor.kt:1153)←AbstractKotlinUClass.accept(KotlinUClass.kt:63)←ImplementationUtilsKt.acceptList(implementationUtils.kt:23)←UFile$DefaultImpls.accept(UFile.kt:83)←KotlinUFile.accept(KotlinUFile.kt:30)
an...@gmail.com <an...@gmail.com> #12
Please contact me
cu...@gmail.com <cu...@gmail.com> #13
2.4.0-alpha01 still give error:
val currentUserId = MutableLiveData<String>()
fun setUserID(userId: String?) {
if (userId == null) {
return
}
val check: String = userId // no error
currentUserId.value = userId // error: Expected non-nullable value
}
val currentUserId = MutableLiveData<String>()
fun setUserID(userId: String?) {
if (userId == null) {
return
}
val check: String = userId // no error
currentUserId.value = userId // error: Expected non-nullable value
}
cu...@gmail.com <cu...@gmail.com> #14
It seems fixed in 2.4.0-SNAPSHOT
jo...@gmail.com <jo...@gmail.com> #15
Is this fixed?
ya...@gmail.com <ya...@gmail.com> #16
It still seems present in 2.4.0-alpha02:
Error: Cannot set non-nullable LiveData value to null [NullSafeMutableLiveData from jetified-lifecycle-livedata-core-ktx-2.4.0-alpha02
iv...@gmail.com <iv...@gmail.com> #17
I've tested with the example above from: cu...@gmail.com<cu...@gmail.com> #13
There is a issue that is still happening on 2.4.0-alpha02 and in the snapshot version mentioned above.
There is a issue that is still happening on 2.4.0-alpha02 and in the snapshot version mentioned above.
js...@gmail.com <js...@gmail.com> #18
What exactly is this thread context for and why am I the target on the command prompt etc
sp...@gmail.com <sp...@gmail.com> #19
I think a new bug report should be created for
ad...@ade.se <ad...@ade.se> #20
Here's a separate issue for the problem in
Description
Component used:
Version used: 2.2.0 and 2.3.0-alpha07
Devices/Android versions reproduced on: N/A
ViewModels with more than one MutableLiveData get their nullability wrong.
Example:
This gives the error
Error: Cannot set non-nullable LiveData value to null [NullSafeMutableLiveData]