Skip to content
This repository was archived by the owner on Aug 20, 2025. It is now read-only.
This repository was archived by the owner on Aug 20, 2025. It is now read-only.

Component with generic parameter inheritance #201

@Dkhusainov

Description

@Dkhusainov

dagger-reflect: 0.3.0

code:

fun main() {
  dagger.Dagger
    .create(MyComponent::class.java)
// DaggerMyComponent.create()
    .getS()
}

abstract class MyClass
interface GenericComponent<S: MyClass> {
  fun getS(): S
}

class MyClassImpl @javax.inject.Inject constructor(): MyClass()
@dagger.Component
interface MyComponent : GenericComponent<MyClassImpl>

error:

Exception in thread "main" java.lang.IllegalArgumentException: No provider available for S
	at dagger.reflect.Scope.getBinding(Scope.java:48)
	at dagger.reflect.ComponentInvocationHandler.createMethodInvocationHandler(ComponentInvocationHandler.java:99)

Dagger works as expected - function return an instance of MyClassImpl

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions