From d4ae453f1f2e85de5650d75c03180fe776d1c914 Mon Sep 17 00:00:00 2001 From: Tuukka Lehtonen Date: Tue, 30 Oct 2018 13:01:34 +0200 Subject: [PATCH] Fixed invalid comparisons which were identified by Eclipse IDE 2018-09 gitlab #171 Change-Id: I357469f6cbef6c099e59d3a378ef531c0eca8e5f --- .../src/org/simantics/db/common/request/Queries.java | 2 +- .../src/org/simantics/db/layer0/util/Layer0Utils.java | 3 ++- .../simantics/procore/internal/SessionMonitorSupportImpl.java | 2 +- .../g2d/diagram/participant/pointertool/TerminalUtil.java | 2 +- .../objmap/structural/rules/domain/RelatedObjectAccessor.java | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/bundles/org.simantics.db.common/src/org/simantics/db/common/request/Queries.java b/bundles/org.simantics.db.common/src/org/simantics/db/common/request/Queries.java index a7e2ba740..91b5346a3 100644 --- a/bundles/org.simantics.db.common/src/org/simantics/db/common/request/Queries.java +++ b/bundles/org.simantics.db.common/src/org/simantics/db/common/request/Queries.java @@ -207,7 +207,7 @@ class IsInstanceOfQuery2 implements Read { return false; else if (getClass() != object.getClass()) return false; - IsInstanceOfQuery other = (IsInstanceOfQuery) object; + IsInstanceOfQuery2 other = (IsInstanceOfQuery2) object; return resource.equals(other.resource) && type.equals(other.type); } diff --git a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/util/Layer0Utils.java b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/util/Layer0Utils.java index 56e1e11f2..8ac919984 100644 --- a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/util/Layer0Utils.java +++ b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/util/Layer0Utils.java @@ -1157,7 +1157,8 @@ public class Layer0Utils { Resource indexRoot = graph.syncRequest(new PossibleVariableIndexRoot(variable)); if(indexRoot == null) return false; - if(variable.equals(indexRoot)) return false; + Resource represents = variable.getPossibleRepresents(graph); + if(represents != null && represents.equals(indexRoot)) return false; return isPublished(graph, indexRoot); } diff --git a/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/SessionMonitorSupportImpl.java b/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/SessionMonitorSupportImpl.java index a178f99b3..356460e4b 100644 --- a/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/SessionMonitorSupportImpl.java +++ b/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/SessionMonitorSupportImpl.java @@ -50,7 +50,7 @@ public class SessionMonitorSupportImpl implements SessionMonitorSupport { return; int i = 0; for (i = 0; i < session.monitorHandlers.length; i++) { - if (h.equals(session.monitorHandlers)) + if (h.equals(session.monitorHandlers[i])) break; } if (i < session.monitorHandlers.length) { diff --git a/bundles/org.simantics.g2d/src/org/simantics/g2d/diagram/participant/pointertool/TerminalUtil.java b/bundles/org.simantics.g2d/src/org/simantics/g2d/diagram/participant/pointertool/TerminalUtil.java index da9829428..462569451 100644 --- a/bundles/org.simantics.g2d/src/org/simantics/g2d/diagram/participant/pointertool/TerminalUtil.java +++ b/bundles/org.simantics.g2d/src/org/simantics/g2d/diagram/participant/pointertool/TerminalUtil.java @@ -414,7 +414,7 @@ public class TerminalUtil { public static boolean isSameTerminal(TerminalInfo t1, TerminalInfo t2) { if (t1 == null || t2 == null) return false; - return t1.e.equals(t2.e) && t1.t.equals(t2.e); + return t1.e.equals(t2.e) && t1.t.equals(t2.t); } /** diff --git a/bundles/org.simantics.objmap2/src/org/simantics/objmap/structural/rules/domain/RelatedObjectAccessor.java b/bundles/org.simantics.objmap2/src/org/simantics/objmap/structural/rules/domain/RelatedObjectAccessor.java index c056096aa..295e60e2f 100644 --- a/bundles/org.simantics.objmap2/src/org/simantics/objmap/structural/rules/domain/RelatedObjectAccessor.java +++ b/bundles/org.simantics.objmap2/src/org/simantics/objmap/structural/rules/domain/RelatedObjectAccessor.java @@ -84,7 +84,7 @@ public class RelatedObjectAccessor implements IDomainAccessor