diff options
| author | Andrey Loskutov | 2019-01-26 18:27:20 +0000 |
|---|---|---|
| committer | Andrey Loskutov | 2019-01-26 18:30:23 +0000 |
| commit | 682eeb2d2dff0189910750b64b3956c25da92ddb (patch) | |
| tree | 0a26627a9301b709ae560fdbf8ef4f4d52f1d739 | |
| parent | daf7fb70f33aa29ef831772534496a18291165d6 (diff) | |
| download | eclipse.platform.resources-682eeb2d2dff0189910750b64b3956c25da92ddb.tar.gz eclipse.platform.resources-682eeb2d2dff0189910750b64b3956c25da92ddb.tar.xz eclipse.platform.resources-682eeb2d2dff0189910750b64b3956c25da92ddb.zip | |
Bug 543776 - reverted fix which caused regressionsI20190127-1800I20190126-1800
Reverted changes in resources plugin and disabled one from two added
tests until the root cause is understood.
Did not revert commit daf7fb70f33aa29ef831772534496a18291165d6 because
it would decrement bundle version.
Change-Id: Ifad0caa23fdd3c95015558db4d7170d04aec7bfd
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
4 files changed, 17 insertions, 15 deletions
diff --git a/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Project.java b/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Project.java index 0fbf98d19..c4e20cc51 100644 --- a/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Project.java +++ b/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Project.java @@ -470,7 +470,7 @@ public class Project extends Container implements IProject { //if the project is currently in the middle of being created, the description might not be available yet if (description == null) checkAccessible(NULL_FLAG); - return description.getAllReferences(this, true); + return description.getAllReferences(true); } @Override @@ -499,7 +499,7 @@ public class Project extends Container implements IProject { ProjectDescription description = project.internalGetDescription(); if (description == null) continue; - IProject[] references = description.getAllReferences(this, false); + IProject[] references = description.getAllReferences(false); for (IProject reference : references) if (reference.equals(this)) { result.add(project); @@ -792,7 +792,7 @@ public class Project extends Container implements IProject { */ public IBuildConfiguration[] internalGetReferencedBuildConfigs(String configName, boolean includeMissing) { ProjectDescription description = internalGetDescription(); - IBuildConfiguration[] refs = description.getAllBuildConfigReferences(this, configName, false); + IBuildConfiguration[] refs = description.getAllBuildConfigReferences(configName, false); Collection<IBuildConfiguration> configs = new LinkedHashSet<>(refs.length); for (IBuildConfiguration ref : refs) { try { @@ -890,8 +890,8 @@ public class Project extends Container implements IProject { // get the children via the workspace since we know that this // resource exists (it is local). IResource[] children = getChildren(IResource.NONE); - for (IResource element : children) - if (!element.isLocal(depth)) + for (int i = 0; i < children.length; i++) + if (!children[i].isLocal(depth)) return false; return true; } diff --git a/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/ProjectDescription.java b/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/ProjectDescription.java index bd81623bd..cea29da02 100644 --- a/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/ProjectDescription.java +++ b/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/ProjectDescription.java @@ -205,9 +205,9 @@ public class ProjectDescription extends ModelObject implements IProjectDescripti * Returns the union of the description's static and dynamic project references, * with duplicates omitted. The calculation is optimized by caching the result * Call the configuration based implementation. - * @see #getAllBuildConfigReferences(IProject, String, boolean) + * @see #getAllBuildConfigReferences(String, boolean) */ - public IProject[] getAllReferences(IProject project, boolean makeCopy) { + public IProject[] getAllReferences(boolean makeCopy) { int dirtyCount; IProject[] projRefs; @@ -221,12 +221,12 @@ public class ProjectDescription extends ModelObject implements IProjectDescripti while (projRefs == null) { IBuildConfiguration[] refs; if (hasBuildConfig(activeConfiguration)) - refs = getAllBuildConfigReferences(project, activeConfiguration, false); + refs = getAllBuildConfigReferences(activeConfiguration, false); else if (configNames.length > 0) - refs = getAllBuildConfigReferences(project, configNames[0], false); + refs = getAllBuildConfigReferences(configNames[0], false); else // No build configuration => fall-back to default - refs = getAllBuildConfigReferences(project, IBuildConfiguration.DEFAULT_CONFIG_NAME, false); + refs = getAllBuildConfigReferences(IBuildConfiguration.DEFAULT_CONFIG_NAME, false); Collection<IProject> l = getProjectsFromBuildConfigRefs(refs); synchronized (cachedRefsMutex) { @@ -254,13 +254,14 @@ public class ProjectDescription extends ModelObject implements IProjectDescripti * be resolved using {@link BuildConfiguration#getBuildConfig()} before use. * Returns an empty array if the given configName does not exist in the description. */ - public IBuildConfiguration[] getAllBuildConfigReferences(IProject project, String configName, boolean makeCopy) { + public IBuildConfiguration[] getAllBuildConfigReferences(String configName, boolean makeCopy) { if (!hasBuildConfig(configName)) return EMPTY_BUILD_CONFIG_REFERENCE_ARRAY; IBuildConfiguration[] refs = cachedConfigRefs.get(configName); if (refs == null) { Set<IBuildConfiguration> references = new LinkedHashSet<>(); IBuildConfiguration[] dynamicBuildConfigs = dynamicConfigRefs.containsKey(configName) ? dynamicConfigRefs.get(configName) : EMPTY_BUILD_CONFIG_REFERENCE_ARRAY; + IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(getName()); Collection<BuildConfiguration> dynamic; try { IBuildConfiguration buildConfig = project.getBuildConfig(configName); diff --git a/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Workspace.java b/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Workspace.java index f4c88453b..c76cb3af3 100644 --- a/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Workspace.java +++ b/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Workspace.java @@ -676,7 +676,7 @@ public class Workspace extends PlatformObject implements IWorkspace, ICoreConsta if (desc == null) continue; //obtain both static and dynamic project references - IProject[] refs = desc.getAllReferences(project, false); + IProject[] refs = desc.getAllReferences(false); allAccessibleProjects.add(project); for (IProject ref : refs) { // ignore self references and references to projects that are not accessible @@ -1636,8 +1636,8 @@ public class Workspace extends PlatformObject implements IWorkspace, ICoreConsta for (IProject project : projects) { if (!project.isAccessible()) { continue; - } - IProject[] refs = ((Project) project).internalGetDescription().getReferencedProjects(false); + } + IProject[] refs = ((Project)project).internalGetDescription().getReferencedProjects(false); List<IProject> dangling = new ArrayList<>(refs.length); for (IProject ref : refs) { if (!ref.exists()) { diff --git a/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/resources/ProjectDynamicReferencesTest.java b/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/resources/ProjectDynamicReferencesTest.java index d9da71401..12bfa4a6a 100644 --- a/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/resources/ProjectDynamicReferencesTest.java +++ b/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/resources/ProjectDynamicReferencesTest.java @@ -115,7 +115,8 @@ public class ProjectDynamicReferencesTest extends ResourceTest { assertEquals("Project2 must not have referenced projects", EMPTY_PROJECTS, project2.getReferencedProjects()); } - public void testBug543776() throws CoreException { + // Temporarily disabled, see bug 543776 comment 7 + public void XXXtestBug543776() throws CoreException { IFile projectFile = project0.getFile(IProjectDescription.DESCRIPTION_FILE_NAME); String projectDescription = readStringInFileSystem(projectFile); projectDescription = projectDescription.replace(PROJECT_0_NAME, "anotherName"); |
