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

Two ModelRefs with key == null should be equal #20

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

krico
Copy link

@krico krico commented Dec 23, 2014

Fixes #19

@krico
Copy link
Author

krico commented Dec 23, 2014

To provide a little explanation why I think this is a problem, suppose you have the following Model

@Model
class Foo {
  private Key id;
  private String name;
  private ModelRef<Bar> barRef = new ModelRef<>();
  public boolean equals(Object o) {
    Foo f = (Foo) o;
    return id.equals(f.id) && name.equals(f.name) && barRef.equals(f.barRef);
  }
}

Foo foo = new Foo(id, name);
foo.equals(foo); //yields false

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

Successfully merging this pull request may close these issues.

ModelRef equals fails when key is null
1 participant