Skip to content

hilt-processor-ksp error: "'public' function exposes its 'internal' parameter type" if implementation is internal  #293

@n0vah

Description

@n0vah

I have multi module project and inside module I have public interface

public interface UserRepository {
  ...
}

and internal implementation of this interface

@Bound
internal class UserRepositoryImpl @Inject constructor(): UserRepository {
  ...
}

With kapt processor It works fine because it's Java and it doesn't know about "internal" modifier:

@Module
@InstallIn(SingletonComponent.class)
public interface UserRepository_SingletonComponent_BindingsModule {
  @Binds
  @Singleton
  @NonNull
  UserRepository bindUserRepositoryImpl(@NonNull UserRepositoryImpl implementation);
}

But with ksp processor I'm receiving an error 'public' function exposes its 'internal' parameter type UserRepositoryImpl:

@Module
@InstallIn(SingletonComponent::class)
public interface UserRepository_SingletonComponent_BindingsModule {
  @Binds
  public fun bindUserRepository(implementation: UserRepositoryImpl): UserRepository
}

Would be good if class that marked with annotation @Bound/@BoundTo has "internal" visibility modifier, than generated "*_BindingsModule" class would also have internal visibility modifier.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions