commit | f7bf8720d5887ee07fcc3c1cf392c51cd6b1c7f2 | [log] [tgz] |
---|---|---|
author | Vladimir Piskarev <pisv@1c.ru> | Tue Dec 09 16:07:22 2014 +0300 |
committer | Vladimir Piskarev <pisv@1c.ru> | Tue Dec 09 16:08:10 2014 +0300 |
tree | 343dd825ad10562f3cedec59633c1fd6352728b0 | |
parent | 5c1e8b13d770fc810aa102395cdd28a80d2edaae [diff] |
Bug 454552 - Extra fields in elements should be accounted for in both equals and hashCode FooDef #hashCode now takes into account the extra field `arity`. Also, FooModel #equals doesn't call super anymore to be consistent with #hashCode.
diff --git a/org.eclipse.handly.examples.basic.ui/src/org/eclipse/handly/internal/examples/basic/ui/model/FooDef.java b/org.eclipse.handly.examples.basic.ui/src/org/eclipse/handly/internal/examples/basic/ui/model/FooDef.java index e237462..aa91119 100644 --- a/org.eclipse.handly.examples.basic.ui/src/org/eclipse/handly/internal/examples/basic/ui/model/FooDef.java +++ b/org.eclipse.handly.examples.basic.ui/src/org/eclipse/handly/internal/examples/basic/ui/model/FooDef.java
@@ -74,6 +74,15 @@ } @Override + public int hashCode() + { + final int prime = 31; + int result = super.hashCode(); + result = prime * result + arity; + return result; + } + + @Override protected HandleManager getHandleManager() { return FooModelManager.INSTANCE.getHandleManager();
diff --git a/org.eclipse.handly.examples.basic.ui/src/org/eclipse/handly/internal/examples/basic/ui/model/FooModel.java b/org.eclipse.handly.examples.basic.ui/src/org/eclipse/handly/internal/examples/basic/ui/model/FooModel.java index 994a5f6..01b6033 100644 --- a/org.eclipse.handly.examples.basic.ui/src/org/eclipse/handly/internal/examples/basic/ui/model/FooModel.java +++ b/org.eclipse.handly.examples.basic.ui/src/org/eclipse/handly/internal/examples/basic/ui/model/FooModel.java
@@ -114,7 +114,7 @@ { if (this == obj) return true; - if (!super.equals(obj)) + if (obj == null) return false; if (getClass() != obj.getClass()) return false;