Fixed
Status Update
Comments
ra...@google.com <ra...@google.com>
ap...@google.com <ap...@google.com> #2
Tentatively, the annotation should be something use-case-specific like @OutlinedNewApi
that allows alternative build systems (e.g. not R8/D8) to make their own decisions. We'll provide a default Proguard configuration for R8, but it's not guaranteed this will work as intended -- outlining is automatic in newer versions, but it may be disabled.
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.