Skip to content

Comments

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

Open
krico wants to merge 2 commits intoSlim3:masterfrom
krico:slim3-19
Open

Two ModelRefs with key == null should be equal#20
krico wants to merge 2 commits intoSlim3:masterfrom
krico:slim3-19

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