Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make KoinWorkerFactory match androidx.work.WorkerFactory API #1018

Merged

Conversation

ak47ex
Copy link

@ak47ex ak47ex commented Feb 20, 2021

Origin androidx.work.WorkerFactory has @Nullable annotation on
abstract method createWorker. Inherited KoinWorkerFactory has
overriden return type of createWorker with non-null ListenableWorker.
In some edge cases that leads to
crash with org.koin.core.error.NoBeanDefFoundException.

Work Managers framework uses reflection to retrieve scheduled workers.
It stores worker fully qualified name in database. If your application
scheduled some work and you changed name or package of that work
in new version of application, WorkerFactory couldn't build scheduled
worker, because of not found stored worker name. Default implementation
will skip that case with null worker.

Origin `androidx.work.WorkerFactory` has `@Nullable` annotation on
abstract method `createWorker`. Inherited `KoinWorkerFactory` has
overriden return type of `createWorker` with non-null `ListenableWorker`.
In some edge cases that leads to
crash with `org.koin.core.error.NoBeanDefFoundException`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants