Add Scopes.isCircularProxy, for use by Scope implementations.  The basic problem is that somewhere along the line, Guice is breaking the type-safety of <T> in the scope(Key<T>, Provider<T>) method.  This happens when <T> is involved in a circular dependency, and the ConstructionContext creates a circular proxy for a given 'expectedType' of <T> (the type in the parameter where it's being injected).  Expected type is a superclass or superinterface of <T>, not a subclass or subinterface, so if a Scope caches the result of Key<T> -> Provider<T>.get(), and then tries to reuse it, it's possible that we return something that isn't compatible with <T>.  This results in either a ClassCastException (if cglib is involved) or IllegalArgumentException (java reflection) when trying to construct the object, because the parameters don't match the arguments.


Revision created by MOE tool push_codebase.
MOE_MIGRATION=3341


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