Fixed
Status Update
Comments
ha...@google.com <ha...@google.com> #2
there are some image for help
el...@google.com <el...@google.com>
ap...@google.com <ap...@google.com> #3
hello?
ap...@google.com <ap...@google.com> #4
Project: platform/frameworks/support
Branch: androidx-main
commit 7a31015b7909abb99cbe07f7c550930578093ced
Author: Elif Bilgin <elifbilgin@google.com>
Date: Fri Jun 25 14:12:09 2021
Supporting remaining multimap return types for JOIN statements in Room.
This CL focuses on supporting the multimaps of type Map<Key, Set<Value>> and Map<Key, Value>. The follow up CL will add support for Guava multimap types.
Bug: 187490856
Test: MultimapQueryTest.java
Change-Id: I4a3d7aadb7a4e39de750927005f1757503a9dfef
M room/integration-tests/testapp/src/androidTest/java/androidx/room/integration/testapp/dao/MusicDao.java
M room/integration-tests/testapp/src/androidTest/java/androidx/room/integration/testapp/test/MultimapQueryTest.java
M room/room-compiler/src/main/kotlin/androidx/room/solver/TypeAdapterStore.kt
M room/room-compiler/src/main/kotlin/androidx/room/solver/query/result/MapQueryResultAdapter.kt
M room/room-compiler/src/test/kotlin/androidx/room/processor/QueryMethodProcessorTest.kt
https://android-review.googlesource.com/1748316
Branch: androidx-main
commit 7a31015b7909abb99cbe07f7c550930578093ced
Author: Elif Bilgin <elifbilgin@google.com>
Date: Fri Jun 25 14:12:09 2021
Supporting remaining multimap return types for JOIN statements in Room.
This CL focuses on supporting the multimaps of type Map<Key, Set<Value>> and Map<Key, Value>. The follow up CL will add support for Guava multimap types.
Bug: 187490856
Test: MultimapQueryTest.java
Change-Id: I4a3d7aadb7a4e39de750927005f1757503a9dfef
M room/integration-tests/testapp/src/androidTest/java/androidx/room/integration/testapp/dao/MusicDao.java
M room/integration-tests/testapp/src/androidTest/java/androidx/room/integration/testapp/test/MultimapQueryTest.java
M room/room-compiler/src/main/kotlin/androidx/room/solver/TypeAdapterStore.kt
M room/room-compiler/src/main/kotlin/androidx/room/solver/query/result/MapQueryResultAdapter.kt
M room/room-compiler/src/test/kotlin/androidx/room/processor/QueryMethodProcessorTest.kt
ap...@google.com <ap...@google.com> #5
Project: platform/frameworks/support
Branch: androidx-main
commit 7e5ccc6fcb7298f00b0223273776aa26eca7fb1b
Author: Elif Bilgin <elifbilgin@google.com>
Date: Thu Jul 08 09:56:26 2021
Supporting ImmutableMap in Room.
This CL focuses on supporting the multimap of type ImmutableMap with the option to have an Object value, or a List / Set value collection type. The query result adapter for ImmutableMap wraps the MapQueryResultAdapter.
Bug: 187490856
Test: MultimapQueryTest.java
Change-Id: I7d79e7bde616d495ad8a5b05e7b5aeb3f030afaf
M room/integration-tests/testapp/src/androidTest/java/androidx/room/integration/testapp/dao/MusicDao.java
M room/integration-tests/testapp/src/androidTest/java/androidx/room/integration/testapp/test/MultimapQueryTest.java
M room/room-compiler/src/main/kotlin/androidx/room/solver/TypeAdapterStore.kt
A room/room-compiler/src/main/kotlin/androidx/room/solver/query/result/ImmutableMapQueryResultAdapter.kt
https://android-review.googlesource.com/1757279
Branch: androidx-main
commit 7e5ccc6fcb7298f00b0223273776aa26eca7fb1b
Author: Elif Bilgin <elifbilgin@google.com>
Date: Thu Jul 08 09:56:26 2021
Supporting ImmutableMap in Room.
This CL focuses on supporting the multimap of type ImmutableMap with the option to have an Object value, or a List / Set value collection type. The query result adapter for ImmutableMap wraps the MapQueryResultAdapter.
Bug: 187490856
Test: MultimapQueryTest.java
Change-Id: I7d79e7bde616d495ad8a5b05e7b5aeb3f030afaf
M room/integration-tests/testapp/src/androidTest/java/androidx/room/integration/testapp/dao/MusicDao.java
M room/integration-tests/testapp/src/androidTest/java/androidx/room/integration/testapp/test/MultimapQueryTest.java
M room/room-compiler/src/main/kotlin/androidx/room/solver/TypeAdapterStore.kt
A room/room-compiler/src/main/kotlin/androidx/room/solver/query/result/ImmutableMapQueryResultAdapter.kt
ap...@google.com <ap...@google.com> #6
Project: platform/frameworks/support
Branch: androidx-main
commit b650c572dd16da56e93b1d71fbdca1939eb96a9a
Author: Elif Bilgin <elifbilgin@google.com>
Date: Thu Jul 08 12:11:42 2021
Supporting guava ImmutableMultimap in Room.
This CL focuses on supporting the multimaps of type ImmutableListMultimap and ImmutableSetMultimap. The user is oly allowed these two types as opposed to the generic `ImmutableMultimap` to align with the practices on the official documentation which states: "Avoid direct usage of ImmutableMultimap as a type (as with Multimap itself). Prefer subtypes such as ImmutableSetMultimap or ImmutableListMultimap, which have well-defined equals(java.lang.Object) semantics, thus avoiding a common source of bugs and confusion."
If the user attempts to use the generic type, a warning will be displayed accordingly.
Bug: 187490856
Test: MultimapQueryTest.java
Change-Id: I08f4e71f55a1cee76d6d2bc09c2e69bb31811c1c
M room/integration-tests/testapp/src/androidTest/java/androidx/room/integration/testapp/dao/MusicDao.java
M room/integration-tests/testapp/src/androidTest/java/androidx/room/integration/testapp/test/MultimapQueryTest.java
M room/room-compiler/src/main/kotlin/androidx/room/processor/ProcessorErrors.kt
M room/room-compiler/src/main/kotlin/androidx/room/solver/TypeAdapterStore.kt
A room/room-compiler/src/main/kotlin/androidx/room/solver/query/result/GuavaImmutableMultimapQueryResultAdapter.kt
M room/room-compiler/src/test/kotlin/androidx/room/processor/QueryMethodProcessorTest.kt
https://android-review.googlesource.com/1757277
Branch: androidx-main
commit b650c572dd16da56e93b1d71fbdca1939eb96a9a
Author: Elif Bilgin <elifbilgin@google.com>
Date: Thu Jul 08 12:11:42 2021
Supporting guava ImmutableMultimap in Room.
This CL focuses on supporting the multimaps of type ImmutableListMultimap and ImmutableSetMultimap. The user is oly allowed these two types as opposed to the generic `ImmutableMultimap` to align with the practices on the official documentation which states: "Avoid direct usage of ImmutableMultimap as a type (as with Multimap itself). Prefer subtypes such as ImmutableSetMultimap or ImmutableListMultimap, which have well-defined equals(java.lang.Object) semantics, thus avoiding a common source of bugs and confusion."
If the user attempts to use the generic type, a warning will be displayed accordingly.
Bug: 187490856
Test: MultimapQueryTest.java
Change-Id: I08f4e71f55a1cee76d6d2bc09c2e69bb31811c1c
M room/integration-tests/testapp/src/androidTest/java/androidx/room/integration/testapp/dao/MusicDao.java
M room/integration-tests/testapp/src/androidTest/java/androidx/room/integration/testapp/test/MultimapQueryTest.java
M room/room-compiler/src/main/kotlin/androidx/room/processor/ProcessorErrors.kt
M room/room-compiler/src/main/kotlin/androidx/room/solver/TypeAdapterStore.kt
A room/room-compiler/src/main/kotlin/androidx/room/solver/query/result/GuavaImmutableMultimapQueryResultAdapter.kt
M room/room-compiler/src/test/kotlin/androidx/room/processor/QueryMethodProcessorTest.kt
ap...@google.com <ap...@google.com> #7
Project: platform/frameworks/support
Branch: androidx-main
commit eed75a3facc9c72eb5f3b983e5df6f14e27141c6
Author: Elif Bilgin <elifbilgin@google.com>
Date: Thu Jul 08 14:44:47 2021
Implementing a check for verifying that equals() and hashCode() are implemented by the key of a multimap query result.
The function implementsEqualsAndHashcode() takes in the XType representing the type argument of the map key, and recursively looks for the equals() and hashCode() methods among the declared methods of type element class. If they are not found at the current class level, the method recursively moves on to the super class level and continues to look for these declared methods until they are either found, or the method reaches the topmost level (the Object class) in which case the method returns false.
Bug: 187490856
Test: QueryMethodProcessorTest.kt
Relnote: Added a check for verifying that equals() and hashCode() are implemented by the key of a multimap query result.
Change-Id: I828b0612735f0d2702226b4e6238e857b3fbd7f0
M room/room-common/api/current.txt
M room/room-common/api/public_plus_experimental_current.txt
M room/room-common/api/restricted_current.txt
M room/room-common/src/main/java/androidx/room/RoomWarnings.java
M room/room-compiler/src/main/kotlin/androidx/room/ext/xtype_ext.kt
M room/room-compiler/src/main/kotlin/androidx/room/processor/ProcessorErrors.kt
M room/room-compiler/src/main/kotlin/androidx/room/solver/TypeAdapterStore.kt
M room/room-compiler/src/main/kotlin/androidx/room/vo/Warning.kt
M room/room-compiler/src/test/kotlin/androidx/room/processor/QueryMethodProcessorTest.kt
M room/room-compiler/src/test/kotlin/androidx/room/solver/TypeAdapterStoreTest.kt
https://android-review.googlesource.com/1748473
Branch: androidx-main
commit eed75a3facc9c72eb5f3b983e5df6f14e27141c6
Author: Elif Bilgin <elifbilgin@google.com>
Date: Thu Jul 08 14:44:47 2021
Implementing a check for verifying that equals() and hashCode() are implemented by the key of a multimap query result.
The function implementsEqualsAndHashcode() takes in the XType representing the type argument of the map key, and recursively looks for the equals() and hashCode() methods among the declared methods of type element class. If they are not found at the current class level, the method recursively moves on to the super class level and continues to look for these declared methods until they are either found, or the method reaches the topmost level (the Object class) in which case the method returns false.
Bug: 187490856
Test: QueryMethodProcessorTest.kt
Relnote: Added a check for verifying that equals() and hashCode() are implemented by the key of a multimap query result.
Change-Id: I828b0612735f0d2702226b4e6238e857b3fbd7f0
M room/room-common/api/current.txt
M room/room-common/api/public_plus_experimental_current.txt
M room/room-common/api/restricted_current.txt
M room/room-common/src/main/java/androidx/room/RoomWarnings.java
M room/room-compiler/src/main/kotlin/androidx/room/ext/xtype_ext.kt
M room/room-compiler/src/main/kotlin/androidx/room/processor/ProcessorErrors.kt
M room/room-compiler/src/main/kotlin/androidx/room/solver/TypeAdapterStore.kt
M room/room-compiler/src/main/kotlin/androidx/room/vo/Warning.kt
M room/room-compiler/src/test/kotlin/androidx/room/processor/QueryMethodProcessorTest.kt
M room/room-compiler/src/test/kotlin/androidx/room/solver/TypeAdapterStoreTest.kt
Description
Example:
@Query("SELECT * FROM customers" " JOIN orders " " ON orders.customer_id = customers.customer_id") public Map<Customer,Order> getCustomersJoinedOrders();
Motivation:
None of the existing mechanisms (@Relation, "result row classes") are convenient for "generic" joins.
Result row classes require an extra class for each "structural type" of join and a "manual" step to re-construct the map from the query result.
For @Relation, the query is fixed. It also seems to deviate from the rest of Room in leaning towards "ORM magic" -- opposed to just mapping generic queries in a minimal, convenient and straightforward way.
Remarks:
The "genralized" Java type equivalent for deep joins seems to be:
List<Pair<Entity1, List<Pair<Entity2, <List<Entity3>>>.
It may make sense to use a type Join<E, J> that corresponds to Pair<E, List<J>>. For the example, this would be:
List<Join<Entity1, Join<Entity2, Entity3>>>
Maps and multimaps could be supported at the top level via a post-processing convenience step.