Source:
public static final boolean createSpecializedType(final StructuralFeature redefinedAttribute, final Classifier parent, final List<RedefinableElement> traveled, List<Classifier> visited, boolean isIndividual, boolean isRecursive) { if (!parent.isEditable()) { Application.getInstance().getGUILog().log(parent.getQualifiedName() + " is not editable. Skipping creating specialization."); return true; } if (!(redefinedAttribute.getType() instanceof DataType) && !(redefinedAttribute.getType() instanceof Property)) { boolean hasTraveled = false; if (traveled.contains(redefinedAttribute)) { hasTraveled = true; } else { for (final RedefinableElement redefinedProperty : redefinedAttribute.getRedefinedElement()) { if (traveled.contains(redefinedProperty)) { hasTraveled = true; break; } } } if (hasTraveled) { Application.getInstance().getGUILog().log("[WARNING] Detected circular reference at " + redefinedAttribute.getQualifiedName() + ". Stopping recursion."); return false; } traveled.add(redefinedAttribute); for (final RedefinableElement re : redefinedAttribute.getRedefinedElement()) { if (re instanceof RedefinableElement) { traveled.add(re); } } final Classifier general = (Classifier) redefinedAttribute.getType(); Type special = null; if (isIndividual || (isRecursive && getExistingSpecial(redefinedAttribute) == null)) { SpecializeStructureAction speca = new SpecializeStructureAction(general, false, "", isRecursive, isIndividual); special = speca.createSpecialClassifier(parent, new ArrayList<>(traveled), visited); } else if (getExistingSpecial(redefinedAttribute) != null) { special = getExistingSpecial(redefinedAttribute); } else if (visited.contains(general)) { Application.getInstance().getGUILog().log("[WARNING] Detected circular reference. Type " + general.getQualifiedName() + " referenced by " + redefinedAttribute.getQualifiedName() + " was already visited. Stopping recursion."); return false; } if (special == null) { return true; } redefinedAttribute.setType(special); } return true; }

Target:
public static final boolean createSpecializedType(final StructuralFeature redefinedAttribute, final Classifier parent, final List<RedefinableElement> traveled, List<Classifier> visited, boolean isIndividual, boolean isRecursive) { if (!parent.isEditable()) { Application.getInstance().getGUILog().log(parent.getQualifiedName() + " is not editable. Skipping creating specialization."); return true; } if (redefinedAttribute.getType() instanceof Classifier && !(redefinedAttribute.getType() instanceof Property)) { boolean hasTraveled = false; if (traveled.contains(redefinedAttribute)) { hasTraveled = true; } else { for (final RedefinableElement redefinedProperty : redefinedAttribute.getRedefinedElement()) { if (traveled.contains(redefinedProperty)) { hasTraveled = true; break; } } } if (hasTraveled) { Application.getInstance().getGUILog().log("[WARNING] Detected circular reference at " + redefinedAttribute.getQualifiedName() + ". Stopping recursion."); return false; } traveled.add(redefinedAttribute); for (final RedefinableElement re : redefinedAttribute.getRedefinedElement()) { if (re instanceof RedefinableElement) { traveled.add(re); } } final Classifier general = (Classifier) redefinedAttribute.getType(); Type special = null; if (isIndividual || (isRecursive && getExistingSpecial(redefinedAttribute) == null)) { SpecializeStructureAction speca = new SpecializeStructureAction(general, false, "", isRecursive, isIndividual); special = speca.createSpecialClassifier(parent, new ArrayList<>(traveled), visited); } else if (getExistingSpecial(redefinedAttribute) != null) { special = getExistingSpecial(redefinedAttribute); } else if (visited.contains(general)) { Application.getInstance().getGUILog().log("[WARNING] Detected circular reference. Type " + general.getQualifiedName() + " referenced by " + redefinedAttribute.getQualifiedName() + " was already visited. Stopping recursion."); return false; } if (special == null) { return true; } redefinedAttribute.setType(special); } return true; }