From 39508c529ed6dce08d4ca505c9518e3e82fd6efa Mon Sep 17 00:00:00 2001 From: Jussi Koskela Date: Wed, 11 Apr 2018 14:14:38 +0300 Subject: [PATCH] Test equality of ObjectVariants using Objects.equals refs #7865 Change-Id: I331d7696662709cdabaa9808d07071b079fc853e --- .../databoard/binding/impl/ObjectVariantBinding.java | 6 ++++++ .../src/org/simantics/databoard/util/DataValueUtil.java | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/bundles/org.simantics.databoard/src/org/simantics/databoard/binding/impl/ObjectVariantBinding.java b/bundles/org.simantics.databoard/src/org/simantics/databoard/binding/impl/ObjectVariantBinding.java index edea4d360..45f3ae8f0 100644 --- a/bundles/org.simantics.databoard/src/org/simantics/databoard/binding/impl/ObjectVariantBinding.java +++ b/bundles/org.simantics.databoard/src/org/simantics/databoard/binding/impl/ObjectVariantBinding.java @@ -11,6 +11,7 @@ *******************************************************************************/ package org.simantics.databoard.binding.impl; +import java.util.Objects; import java.util.Set; import org.simantics.databoard.adapter.AdaptException; @@ -191,4 +192,9 @@ public class ObjectVariantBinding extends VariantBinding { ObjectVariantBinding o = (ObjectVariantBinding)obj; return super.baseEquals( obj ) && o.adapterFactory == adapterFactory && o.bindingFactory == bindingFactory; } + + @Override + public boolean equals(Object o1, Object o2) { + return Objects.equals(o1, o2); + } } diff --git a/bundles/org.simantics.databoard/src/org/simantics/databoard/util/DataValueUtil.java b/bundles/org.simantics.databoard/src/org/simantics/databoard/util/DataValueUtil.java index c4e41c6da..89b167ad9 100644 --- a/bundles/org.simantics.databoard/src/org/simantics/databoard/util/DataValueUtil.java +++ b/bundles/org.simantics.databoard/src/org/simantics/databoard/util/DataValueUtil.java @@ -110,7 +110,7 @@ public class DataValueUtil { // Not implemented yet if (b1 == b2) { try { - return b1.compare(o1, o2) == 0; + return b1.equals(o1, o2); } catch (RuntimeBindingException e) { throw e.getCause(); } -- 2.47.1