]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Fixed invalid comparisons which were identified by Eclipse IDE 2018-09 18/3218/1
authorTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Tue, 30 Oct 2018 11:01:34 +0000 (13:01 +0200)
committerReino Ruusu <reino.ruusu@semantum.fi>
Fri, 6 Sep 2019 09:39:07 +0000 (12:39 +0300)
gitlab #171

Change-Id: I357469f6cbef6c099e59d3a378ef531c0eca8e5f

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 a7e2ba740ea4ba1a435ca631c5a3a9642765329f..91b5346a3072e51ed5e09e4daa1daa53d7a38613 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 56e1e11f23a10893b0b2818c31845e5bbe7d1c48..8ac91998423974428483c45de3ab93a2f76150c7 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 a178f99b3c999974b8b60c953b509b06650bf6d0..356460e4bb6444b3caf77b19cff981947a23f99d 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 da98294284aba29e314ee056168004c91d92189b..462569451ac6363baed8a969b3ad48bc76cb2709 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 c056096aab67d9743ef93ad927de07b16da8d296..295e60e2f29796eb96ea7ce88a90c2610018efd0 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))