Skip to content

Binder API should make ? extends Object binds easier #158

@jbee

Description

@jbee

When binding a supplier for ? extends Object (basically it says it can supply any type) the Binder API makes it hard to bind this to a Supplier as no such Supplier can be provided in a type-safe way since it would need to implement:

class GenericSupplier implements Supplier<? extends Object> { ... }

Such type argument is illegal. A way around is to make the implementing class itself have a type parameter:

class GenericSupplier<T> implements Supplier<T> { ... }

Now binding this is still problematic as it requires a extra method to introduce a type variable so that both the required and the provided type can be based on that variable. There should be a more elegant way to do this sort of thing.

Problem can be found in TestExampleConfigPropertyAnnotationBinds or TestExampleAutoStubbingInterfacesBinds.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions