Status Update
Comments
cc...@google.com <cc...@google.com> #2
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
ch...@google.com <ch...@google.com> #4
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
cc...@google.com <cc...@google.com> #5
Confirm that adding proguard-android-optimize.txt
or those rules directly works around the issue.
I was missing it since I generally try to avoid proguard-android-optimize.txt
since it is too inclusive in some cases.
Why are standard rules for enums necessary?
ze...@google.com <ze...@google.com> #6
The Java standard library has implemented various parts of the enum by use of reflection within the runtime, so maintaining that behavior has required these rules in both Proguard and R8.
cc...@google.com <cc...@google.com> #7
Is it possible for R8 to figure out which enum classes are potentially fed to such stl methods? If so, and the stl behavior is consistent (and stl using values to implement class.enumConstants seems reasonable), it would be nice to avoid this necessary configuration (even if studio gives it to you by default in the very stale proguard-android-optimize
list).
Either that, or could make enum value/valueOf minification opt-in.
ze...@google.com <ze...@google.com> #8
Unfortunately, we have not been able to come up with a safe/sound analysis that can determine when the rules are not needed. Conversely, we have no way of safely keeping the enums that is less conservative than the rules. There are clients that do not have these rules as they manually ensure that they have no usages of enums that would break. Thus we can't make the rules part of the compiler and we can't safely determine when they are needed. We are not happy with that situation, but we currently have no better alternatives.
cc...@google.com <cc...@google.com> #9
Fair enough, feel free to close as WAI. Understand that the cost to migrate the default is non-zero, with minimal benefit.
ch...@google.com <ch...@google.com>
pr...@google.com <pr...@google.com> #10
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.benchmark:benchmark-junit4:1.3.0-alpha05
Description
In tweaking proguard rules in androidx microbenchmarks, I noticed that some of our generated moshi code references to a values array are failing to resolve, and crashing at runtime:
Repro AndroidX CL, which just enables R8 in a trivial sample benchmark, and tweaks proguard rules to get it (almost) running:https://android-review.git.corp.google.com/c/platform/frameworks/support/+/3073538