DZ
Дано:
@Qualifier
@Retention(AnnotationRetention.RUNTIME)
annotation class Remote
@Qualifier
@Retention(AnnotationRetention.RUNTIME)
annotation class Local
@Provides
@Local
@Singleton
fun provideAuthLocalDataSource(
appPreferencesHandler: AppPreferencesHandler): AuthenticationDataSource {
return AuthenticationLocalDataSource(appPreferencesHandler)
}
@Provides
@Remote
@Singleton
fun provideAuthRemoteDataSource(): AuthenticationDataSource {
return AuthenticationRemoteDataSource()
}
@Provides
@Singleton
fun providesAuthenticationRepository(
@Remote remoteDataSource: AuthenticationDataSource,
@Local localDataSource: AuthenticationDataSource,
configurationFileDataSource: ConfigurationFileDataSource): AuthenticationRepository {
return AuthenticationRepository(remoteDataSource, localDataSource, configurationFileDataSource)
}
Ругается на
symbol: class AuthenticationDataSource
location: package com.myapp.repositoryC:\AndroidProjects\<myapp>\di\AppModule.java:59: error: cannot find symbol
com.myapp.repository.AuthenticationDataSource remoteDataSource, @org.jetbrains.annotations.NotNull()
^
symbol: class AuthenticationDataSource
location: package com.myapp.repositoryC:\AndroidProjects\<myapp>\di\AppModule.java:61: error: cannot find symbol
com.myapp.repository.AuthenticationDataSource localDataSource, @org.jetbrains.annotations.NotNull()
Заглянул в AppModule, а там вот так:
@org.jetbrains.annotations.NotNull()
@javax.inject.Singleton()
@com.myapp.di.AppModule.Local()
@dagger.Provides()
public final com.myapp.repository.AuthenticationDataSource provideAuthLocalDataSource(@org.jetbrains.annotations.NotNull()
com.myapp.model.AppPreferencesHandler appPreferencesHandler) {
return null;
}