My favorites | Sign in
Google
                
New issue | Search
for
| Advanced search | Search tips
Issue 15: Make circular dependencies involving constructors more robust
2 people starred this issue and may be notified of changes. Back to list
Status:  Accepted
Owner:  crazyboblee
Type-Enhancement
Priority-Low


Sign in to add a comment
 
Reported by crazyboblee, Feb 14, 2007
Right now we can proxy the root object but not the nested object. This is
low priority. I don't know how I feel about using proxies to enable
circular dependencies anyway.

Comment 1 by bslesinsky, Apr 07, 2007
I wonder if that has anything to do with this error?

java.lang.RuntimeException: java.lang.IllegalAccessException: Class
com.google.inject.ConstructionContext$DelegatingInvocationHandler can not access a
member of class CyclesGuiceTest$Writable with modifiers "public abstract"
	at
com.google.inject.ConstructionContext$DelegatingInvocationHandler.invoke(ConstructionContext.java:114)
	at $Proxy5.write(Unknown Source)
	at CyclesGuiceTest$Node.write(CyclesGuiceTest.java:97)
	at CyclesGuiceTest$Node.write(CyclesGuiceTest.java:97)
	at CyclesGuiceTest.testWithGuice(CyclesGuiceTest.java:18)

I was checking to see what happened when I put in a cycle using only constructors.  I
assumed that at some point there would be an error saying "you can't do that" and I
would make backlinks into setters, and ran into this undocumented (?) proxy thing. 
Maybe the real error is that this is not a Helpful Error Message.

Comment 2 by crazyboblee, Apr 07, 2007
This appears to be a Sun bug related to inner classes:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4071957
Comment 3 by crazyboblee, Apr 07, 2007
We do need better error handling here though. There's actually a TODO in the code:
http://fisheye3.cenqua.com/browse/google-guice/trunk/src/com/google/inject/ConstructionContext.java?r=253
Comment 4 by bslesinsky, Apr 07, 2007
While cleaning up the test case, I found that adding "public" in a few places fixed
the problem. 

So, it's nothing really to do with cycles.  But I was surprised that when I moved
some dependencies from constructors to setters to break cycles, so that no proxy is
really necessary, they are still there.

Comment 5 by limpbizkit, Apr 26, 2009
 Issue 349  has been merged into this issue.
Sign in to add a comment