Emanuel Moecklin
05/02/2024, 6:34 PMZac Sweers
05/02/2024, 6:38 PMEmanuel Moecklin
05/02/2024, 7:15 PMZac Sweers
05/02/2024, 7:17 PMZac Sweers
05/02/2024, 7:17 PMZac Sweers
05/02/2024, 7:18 PMEmanuel Moecklin
05/02/2024, 7:51 PMZac Sweers
05/02/2024, 7:55 PMbindFeature
internal
but that adds basically no value since FeatureImpl must still be public anywayZac Sweers
05/02/2024, 7:57 PMFeatureImpl_Factory
that is public and exposes FeatureImpl
and all its dependencies in its public API. You can't make FeatureImpl
internal anyway, so visibility golfing a binds function isn't going to make any real difference for your goals of limiting access in user codeEmanuel Moecklin
05/02/2024, 7:57 PMFeatureImpl
can be internal or even private, that shows it's really not a Dagger limitationZac Sweers
05/02/2024, 7:57 PMZac Sweers
05/02/2024, 8:00 PMprovides()
somewhere rather than constructor injection, which we don't reasonably know for certain at compile-timeZac Sweers
05/02/2024, 8:02 PMEmanuel Moecklin
05/02/2024, 9:17 PM@Module
public object FeatureModule {
@Provides
public fun bindFeature(): Feature = FeatureImpl()
}
private class FeatureImpl @Inject constructor(): Feature {
factory is Java which doesn't check whether FeatureImpl
is private or not
public final class FeatureImpl_Factory implements Factory<FeatureImpl> {
If I do the binds in Java, Lint complains but the code compiles without issuesZac Sweers
05/02/2024, 9:18 PMZac Sweers
05/02/2024, 9:20 PMEmanuel Moecklin
05/02/2024, 9:30 PMgenerateDaggerFactories.set(false)
I can use a private implementation because Dagger creates Java code which doesn't have that limitation. Even if this isn't a solution, I at least understand now why the limitation exists. Thanks for your help!