google-code-export / google-guice

Automatically exported from code.google.com/p/google-guice
Apache License 2.0
2 stars 1 forks source link

Make circular dependencies involving constructors more robust #15

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
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.

Original issue reported on code.google.com by crazybob...@gmail.com on 14 Feb 2007 at 10:25

GoogleCodeExporter commented 9 years ago
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(Constru
ctionContext.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.

Original comment by bslesinsky on 8 Apr 2007 at 2:43

GoogleCodeExporter commented 9 years ago
This appears to be a Sun bug related to inner classes:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4071957

Original comment by crazybob...@gmail.com on 8 Apr 2007 at 3:55

GoogleCodeExporter commented 9 years ago
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/Const
ructionContext.java?r=253

Original comment by crazybob...@gmail.com on 8 Apr 2007 at 3:59

GoogleCodeExporter commented 9 years ago
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.

Original comment by bslesinsky on 8 Apr 2007 at 4:16

GoogleCodeExporter commented 9 years ago
Issue 349 has been merged into this issue.

Original comment by limpbizkit on 26 Apr 2009 at 9:04

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago

Original comment by christia...@gmail.com on 4 Jun 2012 at 5:43

GoogleCodeExporter commented 9 years ago
Several changes have gone in to this - and without doing seriously invasive 
change, this is about as good as we're going to get it. 

Original comment by cgruber@google.com on 18 Nov 2013 at 9:02