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

Recursive Datastructure detected even if there isn't one #18

Closed
GoogleCodeExporter opened this issue Mar 29, 2015 · 1 comment
Closed

Comments

@GoogleCodeExporter
Copy link

Assume the following class structure:

    A
   / \
  B   C
  |   |
  D   D

A,B,C,D are classes. A has two fields of type B and C. Both B and C have a
field of type D.

EqualsVerifier.forClass(A.class).verify();

throws the exception:

java.lang.AssertionError: Recursive datastructure. Add prefab values for
one of the following classes: [class test.A, class test.B, class test.D,
class test.C].

I'm not sure if this is intentional, but if it is, then the error message
is misleading.

The problem might have something to do with
Instantiator.recursiveCallStack, which is not really a stack since elements
are added but never removed. Also the same recursiveCallStack instance is
used for the complete tree, but prefabValues is cloned. Therefore on the
second leg, D is not in prefabValues but in recursiveCallStack.

Cloning recursiveCallStack within createPrefabValues() did the trick, but I
don't know if this has any side effects (at least it still passes all tests).

Instantiator i = new Instantiator(type, prefabValues, (LinkedHashSet)
recursiveCallStack.clone());

I added the A,B,C,D example as an attachement.

-Stefan

Original issue reported on code.google.com by smurn....@gmail.com on 12 Jan 2010 at 5:43

Attachments:

@GoogleCodeExporter
Copy link
Author

Original comment by jan.ouw...@gmail.com on 24 Jan 2010 at 4:51

  • Changed state: Fixed
  • Added labels: ****
  • Removed labels: ****

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