Merge "Fixed invalid comparisons which were identified by Eclipse IDE 2018-09"
authorTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Tue, 30 Oct 2018 11:55:18 +0000 (11:55 +0000)
committerGerrit Code Review <gerrit2@simantics>
Tue, 30 Oct 2018 11:55:18 +0000 (11:55 +0000)
bundles/org.simantics.db.common/src/org/simantics/db/common/request/Queries.java
bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/util/Layer0Utils.java
bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/SessionMonitorSupportImpl.java
bundles/org.simantics.g2d/src/org/simantics/g2d/diagram/participant/pointertool/TerminalUtil.java
bundles/org.simantics.objmap2/src/org/simantics/objmap/structural/rules/domain/RelatedObjectAccessor.java

index a7e2ba7..91b5346 100644 (file)
@@ -207,7 +207,7 @@ class IsInstanceOfQuery2 implements Read<Boolean> {
             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);
     }
 
index 438c629..ee97fdb 100644 (file)
@@ -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);
 
     }
index a178f99..356460e 100644 (file)
@@ -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) {
index da98294..4625694 100644 (file)
@@ -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);
     }
 
     /**
index c056096..295e60e 100644 (file)
@@ -84,7 +84,7 @@ public class RelatedObjectAccessor implements IDomainAccessor<StructuralResource
                            g.claim(element, relation, value.getResource());
                            return true;
                        }
-                       else if(resource.equals(value))
+                       else if(resource.equals(value.getResource()))
                            return false;
                        else {
                                if (preventChange(selement))