Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make circular dependencies involving constructors more robust #15

Closed
gissuebot opened this issue Jul 7, 2014 · 7 comments
Closed

Make circular dependencies involving constructors more robust #15

gissuebot opened this issue Jul 7, 2014 · 7 comments

Comments

@gissuebot
Copy link

From crazyboblee on February 14, 2007 17:25:17

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: http://code.google.com/p/google-guice/issues/detail?id=15

@gissuebot
Copy link
Author

From bslesinsky on April 07, 2007 19:43:38

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.

@gissuebot
Copy link
Author

From crazyboblee on April 07, 2007 20:55:54

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

@gissuebot
Copy link
Author

From crazyboblee on April 07, 2007 20:59:22

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

@gissuebot
Copy link
Author

From bslesinsky on April 07, 2007 21:16:17

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.

@gissuebot
Copy link
Author

From limpbizkit on April 26, 2009 14:04:45

Issue 349 has been merged into this issue.

@gissuebot
Copy link
Author

From christianedwardgruber on June 04, 2012 10:43:42

(No comment was entered for this change.)

Labels: Component-Core

@gissuebot
Copy link
Author

From cgruber@google.com on November 18, 2013 13:02:55

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.

Status: Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant