google / guice

Guice (pronounced 'juice') is a lightweight dependency injection framework for Java 11 and above, brought to you by Google.
https://github.com/google/guice
Apache License 2.0
12.46k stars 1.66k forks source link

LinkedBindingBuilder#toConstructor(Constructor, TypeLiteral) is not adequately documented #669

Open gissuebot opened 10 years ago

gissuebot commented 10 years ago

From mattmccutchen@google.com on November 15, 2011 22:01:04

The purpose of LinkedBindingBuilder#toConstructor(Constructor, TypeLiteral), and in particular the meaning of the second parameter, is not adequately documented.  The javadoc just says "See the EDSL examples at Binder", but there is no example there.

Reading the code, I see that the TypeLiteral supplies the type arguments for the object so that Guice can correctly compute the actual types of the object's dependencies and thereby choose the correct bindings to satisfy them.  That makes sense in retrospect, but it wasn't obvious.

Original issue: http://code.google.com/p/google-guice/issues/detail?id=669

gissuebot commented 10 years ago

From dhanji on November 27, 2011 14:53:23

It's actually a semi-experimental feature that allows you to remove the need for @Inject on types and to bind sealed classes without a provider.

It's a fair call that it's not well documented. Will try and look into it.

gissuebot commented 10 years ago

From sberlin on November 27, 2011 15:11:35

I'd say it's out of experimental stage at this point, being in the latest release.  Definitely under-documented, though.