Summary: | cycle detection algorithm is O(pow(n - 1, n - 1)) | ||
---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Jed Anderson <jed.anderson> |
Component: | Core | Assignee: | Philipe Mulet <philippe_mulet> |
Status: | RESOLVED DUPLICATE | QA Contact: | |
Severity: | critical | ||
Priority: | P3 | ||
Version: | 2.0 | ||
Target Milestone: | 2.1 M1 | ||
Hardware: | All | ||
OS: | All | ||
Whiteboard: |
Description
Jed Anderson
2002-09-10 13:10:37 EDT
Actually, the code iterates over all projects, and determine the list of all projects inside cycles, so as to flag them with an appropriate marker. This is a duplicate of bug 22203, for which we have a fix already (backported to 2.0.1). Please, Jed, give it a try on your test case. A 2.0.1 patch is available at http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/jdt-core- home/patches/org.eclipse.jdt.core_2.0.1.zip FYI, the proposed new implementation is: /** * If a cycle is detected, then cycleParticipants contains all the project involved in this cycle (directly), * no cycle if the set is empty (and started empty) */ public void updateCycleParticipants(IClasspathEntry[] preferredClasspath, ArrayList visited, HashSet cycleParticipants, IWorkspaceRoot workspaceRoot){ int index = visited.indexOf(this); if (index >= 0){ // only consider direct participants inside the cycle for (int i = index, size = visited.size(); i < size; i++){ cycleParticipants.add(visited.get(i)); } return; } else { visited.add(this); } try { IClasspathEntry[] classpath; if (preferredClasspath == null) { classpath = getResolvedClasspath(true); } else { classpath = preferredClasspath; } for (int i = 0, length = classpath.length; i < length; i++) { IClasspathEntry entry = classpath[i]; if (entry.getEntryKind() == IClasspathEntry.CPE_PROJECT){ String projectName = entry.getPath ().lastSegment(); JavaProject project = (JavaProject) JavaCore.create(workspaceRoot.getProject(projectName)); if (!cycleParticipants.contains(this) || !cycleParticipants.contains(project)) // skip if both are already part of cycle project.updateCycleParticipants (null, visited, cycleParticipants, workspaceRoot); } } } catch(JavaModelException e){ } visited.remove(this); } *** This bug has been marked as a duplicate of 22203 *** Tried the test with the patch, and it works great! |