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

Non-static inner class causes Recursive Datastructure error #21

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

Comments

@GoogleCodeExporter
Copy link

The following class triggers a Recursive Datastructure error in EqualsVerifier:

public class Outer {
    private Inner inner;

    private class Inner {
        int i;
    }
}

This happens because Inner gets an implicit reference to Outer (because
Inner isn't static).

EqualsVerifier probably shouldn't think of this as a recursive
datastructure, even though technically it is.

Original issue reported on code.google.com by [email protected] on 15 Apr 2010 at 3:57

@GoogleCodeExporter
Copy link
Author

The implicit reference that inner classes get to their enclosing outer classes, 
are
marked "synthetic" by the compiler. Since synthetic fields aren't supposed to 
be used
by programmers and can only be accessed by reflection, they can safely be 
ignored by
EqualsVerifier. Checking Field.isSynthetic() does the trick.

For more info, see
http://java.sun.com/docs/books/tutorial/reflect/member/fieldModifiers.html

Original comment by [email protected] on 15 May 2010 at 3:09

  • 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