We now support wildcards in bindings! The wildcards can only be used as type parameters for other types, not for  top-level bindings on their own.

For example, we can bind these:
  List<Class<?>>
  List<? extends Runnable>
  List<? super Runnable>
  List<?>
  Map<String, ?>
But not these:
  ?
  ? extends String

Basically, everything that's bound needs a raw type. This makes sense! Since everything that's injected (fields and parameters) has a raw type (due to erasure)

One interesting thing discovered while writing the implementation... Java's WildcardType interface sucks. It allows for an arbitrary number of lower bounds, and an arbitrary number of lower bounds. But in practice, each wildcard has at most a single bound in total (plus Object.class as a the default upper bound). My implementation doesn't support the full range - if ever this becomes necessary (Ie. if the language changes or if I've missed something) we'll write it then. I don't want to write code that I can't test!

git-svn-id: https://google-guice.googlecode.com/svn/trunk@595 d779f126-a31b-0410-b53b-1d3aecad763e
7 files changed