square / dagger

A fast dependency injector for Android and Java.
https://square.github.io/dagger/
Apache License 2.0
7.31k stars 3.06k forks source link

Why do Singletons need an empty default constructor? #562

Closed Isabaellchen closed 5 years ago

Isabaellchen commented 5 years ago

Sorry for piling onto the empty default constructor debate, but this is something i do not understand.

I do understand that you want to make the code explicit as to where classes get initialized, but i do not understand why this has to be the case for classes that are annotated as Singletons, since there is only that one particular instance that i want to create. If it is not too much to ask maybe someone could give an explanation to this?

JakeWharton commented 5 years ago

I think you want google/dagger

Isabaellchen commented 5 years ago

Sorry