google / google/guice

Multibinder doesn't handler circular references

Open
#701 0 comments 0 reactions 0 assignees View on GitHub
imported
Dominant language
Java
Stars
12.7k
Forks
1.7k
Avg merge
11m
Merged PRs (30d)
2

Description

_From [eric.jain](https://code.google.com/u/102186567666012743407/) on April 13, 2012 15:32:36_

Shouldn't the attached test case work without having to use a Provider? I get this exception:

1) Error in custom provider, java.lang.IllegalStateException: This is a proxy used to support circular references involving constructors. The object we're proxying is not constructed yet. Please wait until after injection has completed to use this object.
  at MultibinderTest$1.configure(MultibinderTest.java:24)
  while locating java.util.Set<MultibinderTest$Processor>
    for parameter 0 at MultibinderTest$RecursiveProcessor.<init>(MultibinderTest.java:54)
  while locating MultibinderTest$RecursiveProcessor
  while locating MultibinderTest$Processor annotated with `@`com.google.inject.multibindings.Element(setName=,uniqueId=2)
  at MultibinderTest$1.configure(MultibinderTest.java:24)
  while locating java.util.Set<MultibinderTest$Processor>
    for parameter 0 at MultibinderTest$Foo.<init>(MultibinderTest.java:69)
  at MultibinderTest$1.configure(MultibinderTest.java:23)
  while locating MultibinderTest$Foo

**Attachment:** [gist](https://gist.github.com/f056c44a5dfc816a9cb2)
   _[MultibinderTest.java](https://gist.githubusercontent.com/gissuebot/f056c44a5dfc816a9cb2/raw/7977602eb48d41ed768dd400954aad1bc6c64666/MultibinderTest.java)_

_Original issue: http://code.google.com/p/google-guice/issues/detail?id=701_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.