diff --git a/plugins/org.eclipse.n4js.xtext/src/org/eclipse/n4js/xtext/workspace/BuildOrderIterator.java b/plugins/org.eclipse.n4js.xtext/src/org/eclipse/n4js/xtext/workspace/BuildOrderIterator.java index f66ba94174..f3f1fb1d25 100644 --- a/plugins/org.eclipse.n4js.xtext/src/org/eclipse/n4js/xtext/workspace/BuildOrderIterator.java +++ b/plugins/org.eclipse.n4js.xtext/src/org/eclipse/n4js/xtext/workspace/BuildOrderIterator.java @@ -52,16 +52,14 @@ public BuildOrderIterator visit(Collection proj for (ProjectConfigSnapshot pc : projectConfigs) { String projectID = pc.getName(); - if (!visitedAlready.contains(pc) - && boi.sortedProjects.indexOf(pc) < boi.sortedProjects.indexOf(lastVisited)) { - String currentProjectID = current().getName(); - throw new IllegalStateException("Dependency-inverse visit order not supported: from " - + currentProjectID + " to " + projectID); - } + if (boi.sortedProjects.indexOf(pc) < boi.sortedProjects.indexOf(lastVisited)) { + // Dependency-inverse visit order not supported. Happens in dependency cycles + } else { - visitProjectIDs.add(projectID); - iteratorIndex = boi.sortedProjects.indexOf(lastVisited); - moveNext(); + visitProjectIDs.add(projectID); + iteratorIndex = boi.sortedProjects.indexOf(lastVisited); + moveNext(); + } } return this; } diff --git a/plugins/org.eclipse.n4js/src/org/eclipse/n4js/scoping/utils/ProjectImportEnablingScope.java b/plugins/org.eclipse.n4js/src/org/eclipse/n4js/scoping/utils/ProjectImportEnablingScope.java index 36266696a0..812844271a 100644 --- a/plugins/org.eclipse.n4js/src/org/eclipse/n4js/scoping/utils/ProjectImportEnablingScope.java +++ b/plugins/org.eclipse.n4js/src/org/eclipse/n4js/scoping/utils/ProjectImportEnablingScope.java @@ -195,14 +195,17 @@ public IEObjectDescription getSingleElement(QualifiedName name) { // main case IEObjectDescription objDescr = result.get(0); - // references within a dependency cycle not suppored + // references within a dependency cycle not supported if (workspaceConfigSnapshot.isInDependencyCycle(contextProject.getName())) { URI uri = objDescr.getEObjectURI(); N4JSProjectConfigSnapshot n4jsdProject = workspaceConfigSnapshot.findProjectContaining(uri); - workspaceConfigSnapshot.isInDependencyCycle(n4jsdProject.getName()); if (workspaceConfigSnapshot.isInDependencyCycle(n4jsdProject.getName())) { - return null; + if (Objects.equals(n4jsdProject.getName(), contextProject.getName())) { + // allow references within the same project + } else { + return null; + } } } return objDescr;