Skip to content
Snippets Groups Projects
Commit f6a5f71e authored by Sebastian Bergemann's avatar Sebastian Bergemann
Browse files

YELLOW

Issue-Ref: 4324
Issue-Url: af3#4324



Signed-off-by: default avatarSebastian Bergemann <bergemann@fortiss.org>
parent 53d52177
No related branches found
No related tags found
1 merge request!207Add exclusion from constraint checks possibility for certain types
Pipeline #39129 failed
CommandLineInterfaceService.java 6b5c94c52702f773c60b181eff52204ab379b248 GREEN
CommandStackService.java 957bda69b5feb91f002aed4d25ed334e92801e7e GREEN
ConnectionCompositorService.java 5a52f8a3e88c167ae6909c3d9eb3fb4706177e8b GREEN
ConstraintCheckerService.java 94f1c07c37520161065128d8faaab10ab0c041b0 RED
ConstraintCheckerService.java df7b4e8c99e8895e14ff45a96cc85ef8403a8658 YELLOW
DummyTopLevelElement.java 21807bbdafec2e0ef28f0ee9090218f90bd73aee GREEN
ElementCompositorService.java b1924b5b349118a70149cfac5b48544897d26e9e GREEN
LoggingService.java da784259f7b456b54bf75c41ec268f64919ce78d GREEN
......
......@@ -17,7 +17,7 @@ package org.fortiss.tooling.kernel.internal;
import static java.util.Collections.emptyList;
import static java.util.Collections.unmodifiableMap;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.getParentsWithType;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.getFirstParentWithType;
import java.util.ArrayList;
import java.util.Collections;
......@@ -132,14 +132,10 @@ public class ConstraintCheckerService extends EObjectAwareServiceBase<IConstrain
// Skip constraint checks if the given element itself is excluded from checks or if it
// exists within an excluded element.
// TODO (TM): Looking through all parents for each excluded type introduces quite an
// overhead. As the list of parents is never used, memory and runtime overhead can be
// reduced by using `getFirstParentWithType` or, even better, `isAncestor` instead.
for(Class<? extends EObject> excludedClass : constraintCheckExclusionTypes) {
List<? extends EObject> foundExcludedParents =
getParentsWithType(modelElement, excludedClass);
Object foundExcludedParent = getFirstParentWithType(modelElement, excludedClass);
Class<?> givenClass = modelElement.getClass();
if(givenClass.isAssignableFrom(excludedClass) || !foundExcludedParents.isEmpty()) {
if(givenClass.isAssignableFrom(excludedClass) || foundExcludedParent != null) {
return;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment