Fixed
Status Update
Comments
ra...@google.com <ra...@google.com>
ap...@google.com <ap...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 1fe449320a0ba425898fa3a60cf15ce8db79d9ce
Author: Rahul Ravikumar <rahulrav@google.com>
Date: Thu Oct 01 11:10:50 2020
Carry forward type information in setters for Builders.
Test: Added unit tests. Existing tests pass.
Fixes: b/169787349
Change-Id: I883ad37181cc32733c6f617009d4ab5903760452
Relnote: `TestListenableWorkerBuilder` and `TestWorkerBuilder` do not use raw types.
A work/workmanager-testing/api/current.ignore
M work/workmanager-testing/api/current.txt
M work/workmanager-testing/api/public_plus_experimental_current.txt
A work/workmanager-testing/api/restricted_current.ignore
M work/workmanager-testing/api/restricted_current.txt
M work/workmanager-testing/src/androidTest/java/androidx/work/testing/TestWorkerBuilderTest.kt
M work/workmanager-testing/src/main/java/androidx/work/testing/TestListenableWorkerBuilder.java
https://android-review.googlesource.com/1443299
Branch: androidx-master-dev
commit 1fe449320a0ba425898fa3a60cf15ce8db79d9ce
Author: Rahul Ravikumar <rahulrav@google.com>
Date: Thu Oct 01 11:10:50 2020
Carry forward type information in setters for Builders.
Test: Added unit tests. Existing tests pass.
Fixes:
Change-Id: I883ad37181cc32733c6f617009d4ab5903760452
Relnote: `TestListenableWorkerBuilder` and `TestWorkerBuilder` do not use raw types.
A work/workmanager-testing/api/current.ignore
M work/workmanager-testing/api/current.txt
M work/workmanager-testing/api/public_plus_experimental_current.txt
A work/workmanager-testing/api/restricted_current.ignore
M work/workmanager-testing/api/restricted_current.txt
M work/workmanager-testing/src/androidTest/java/androidx/work/testing/TestWorkerBuilderTest.kt
M work/workmanager-testing/src/main/java/androidx/work/testing/TestListenableWorkerBuilder.java
Description
Component used: WorkManager Testing
Version used: 2.4.0
Devices/Android versions reproduced on: N/A
TestListenableWorkerBuilder
extension:If using the Hilt Work integration, this code doesn't work. You need to add the
HiltWorkerFactory
to the builder. But since the extension function doesn't include the factory in it's parameters, you need to set it afterwards using the Builder's.setWorkerFactory()
method. At this point, the reified type parameter is lost, and you have to cast the result of thebuild()
method to your worker type, as in the following modified example:If we have to do this cast to use the rest of the builder methods not supported by the extension, it defeats the purpose of the extension function's reification.
Thus, please add the ability to set the worker factory to the extension function, so we can get rid of the cast.