Add cycle detection at compile-time using the problem detector, plus test.

Enable cycle detection at compile-time.  Uses the problem detector called in ObjectGraph.validate() but directly.