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.

IllegalArgumentException: No provider available for V when injecting a field in a generic subclass #168

@amatkovsky

Description

@amatkovsky

Consider the following code:

class ThingImpl extends Thing<String, Integer> {}

abstract class Thing<V, T> {
    @Inject Provider<V> vProvider;

    @Inject Provider<T> tProvider;

    @Inject V value;

    @Inject T t;
  }

...
component.inject(thingImpl);
...

When ReflectiveMembersInjector goes through the @Inject-annotated fields it tries to look
V and T bindings. Obviously, there are no such bindings since the actual bindings provide a String and an Integer. This leads to an error: IllegalArgumentException: No provider available for V.

See related pr with a test case: #167

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