mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-05 23:35:48 +02:00
Bug 487663: Make the cache of PathEntryManager thread safe.
This commit is contained in:
parent
2ad68f7f80
commit
5edf224704
1 changed files with 73 additions and 52 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2015 QNX Software Systems and others.
|
* Copyright (c) 2000-2016 QNX Software Systems and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -97,7 +97,7 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
* pathentry containers pool accessing the Container is done synch with the
|
* pathentry containers pool accessing the Container is done synch with the
|
||||||
* class
|
* class
|
||||||
*/
|
*/
|
||||||
private static HashMap<ICProject, Map<IPath, IPathEntryContainer>> Containers = new HashMap<ICProject, Map<IPath, IPathEntryContainer>>(
|
private static HashMap<ICProject, Map<IPath, IPathEntryContainer>> Containers = new HashMap<>(
|
||||||
5);
|
5);
|
||||||
|
|
||||||
static final IPathEntry[] NO_PATHENTRIES = {};
|
static final IPathEntry[] NO_PATHENTRIES = {};
|
||||||
|
@ -113,16 +113,17 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
static final IPathEntryContainer[] NO_PATHENTRYCONTAINERS = {};
|
static final IPathEntryContainer[] NO_PATHENTRYCONTAINERS = {};
|
||||||
|
|
||||||
// Synchronized the access of the cache entries.
|
// Synchronized the access of the cache entries.
|
||||||
protected Map<ICProject, ArrayList<IPathEntry>> resolvedMap = new Hashtable<ICProject, ArrayList<IPathEntry>>();
|
private final Map<ICProject, Object> cacheComputationMarkers = new HashMap<>();
|
||||||
private Map<ICProject, PathEntryResolveInfo> resolvedInfoMap = new Hashtable<ICProject, PathEntryResolveInfo>();
|
protected Map<ICProject, ArrayList<IPathEntry>> resolvedMap = new Hashtable<>();
|
||||||
private ThreadLocalMap resolveInfoValidState = new ThreadLocalMap();
|
private final Map<ICProject, PathEntryResolveInfo> resolvedInfoMap = new Hashtable<>();
|
||||||
|
private final ThreadLocalMap resolveInfoValidState = new ThreadLocalMap();
|
||||||
|
|
||||||
// Accessing the map is synch with the class
|
// Accessing the map is synch with the class
|
||||||
private Map<IProject, IPathEntryStore> storeMap = new HashMap<IProject, IPathEntryStore>();
|
private final Map<IProject, IPathEntryStore> storeMap = new HashMap<>();
|
||||||
|
|
||||||
private static PathEntryManager pathEntryManager;
|
private static PathEntryManager pathEntryManager;
|
||||||
|
|
||||||
protected ConcurrentLinkedQueue<PathEntryProblem> markerProblems = new ConcurrentLinkedQueue<PathEntryProblem>();
|
protected ConcurrentLinkedQueue<PathEntryProblem> markerProblems = new ConcurrentLinkedQueue<>();
|
||||||
|
|
||||||
// Setting up a generate markers job, it does not get scheduled
|
// Setting up a generate markers job, it does not get scheduled
|
||||||
Job markerTask = new GenerateMarkersJob("PathEntry Marker Job"); //$NON-NLS-1$
|
Job markerTask = new GenerateMarkersJob("PathEntry Marker Job"); //$NON-NLS-1$
|
||||||
|
@ -185,12 +186,11 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
}
|
}
|
||||||
if (celement != null) {
|
if (celement != null) {
|
||||||
// Get project include file entries.
|
// Get project include file entries.
|
||||||
List<IPathEntry> entryList = new ArrayList<IPathEntry>();
|
List<IPathEntry> entryList = new ArrayList<>();
|
||||||
ICProject cproject = celement.getCProject();
|
ICProject cproject = celement.getCProject();
|
||||||
ArrayList<IPathEntry> resolvedListEntries = getResolvedPathEntries(cproject, false);
|
ArrayList<IPathEntry> resolvedListEntries = getResolvedPathEntries(cproject, false);
|
||||||
IPathEntry[] pathEntries = getCachedResolvedPathEntries(resolvedListEntries, cproject);
|
IPathEntry[] pathEntries = getCachedResolvedPathEntries(resolvedListEntries, cproject);
|
||||||
for (int i = 0; i < pathEntries.length; ++i) {
|
for (IPathEntry entry : pathEntries) {
|
||||||
IPathEntry entry = pathEntries[i];
|
|
||||||
if ((entry.getEntryKind() & IPathEntry.CDT_INCLUDE_FILE) != 0) {
|
if ((entry.getEntryKind() & IPathEntry.CDT_INCLUDE_FILE) != 0) {
|
||||||
entryList.add(entry);
|
entryList.add(entry);
|
||||||
}
|
}
|
||||||
|
@ -214,12 +214,11 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
}
|
}
|
||||||
if (celement != null) {
|
if (celement != null) {
|
||||||
// get project include entries
|
// get project include entries
|
||||||
List<IPathEntry> entryList = new ArrayList<IPathEntry>();
|
List<IPathEntry> entryList = new ArrayList<>();
|
||||||
ICProject cproject = celement.getCProject();
|
ICProject cproject = celement.getCProject();
|
||||||
ArrayList<IPathEntry> resolvedListEntries = getResolvedPathEntries(cproject, false);
|
ArrayList<IPathEntry> resolvedListEntries = getResolvedPathEntries(cproject, false);
|
||||||
IPathEntry[] pathEntries = getCachedResolvedPathEntries(resolvedListEntries, cproject);
|
IPathEntry[] pathEntries = getCachedResolvedPathEntries(resolvedListEntries, cproject);
|
||||||
for (int i = 0; i < pathEntries.length; ++i) {
|
for (IPathEntry entry : pathEntries) {
|
||||||
IPathEntry entry = pathEntries[i];
|
|
||||||
if ((entry.getEntryKind() & IPathEntry.CDT_INCLUDE) != 0) {
|
if ((entry.getEntryKind() & IPathEntry.CDT_INCLUDE) != 0) {
|
||||||
entryList.add(entry);
|
entryList.add(entry);
|
||||||
}
|
}
|
||||||
|
@ -243,12 +242,11 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
}
|
}
|
||||||
if (celement != null) {
|
if (celement != null) {
|
||||||
// get project macro entries
|
// get project macro entries
|
||||||
List<IPathEntry> entryList = new ArrayList<IPathEntry>();
|
List<IPathEntry> entryList = new ArrayList<>();
|
||||||
ICProject cproject = celement.getCProject();
|
ICProject cproject = celement.getCProject();
|
||||||
ArrayList<IPathEntry> resolvedListEntries = getResolvedPathEntries(cproject, false);
|
ArrayList<IPathEntry> resolvedListEntries = getResolvedPathEntries(cproject, false);
|
||||||
IPathEntry[] pathEntries = getCachedResolvedPathEntries(resolvedListEntries, cproject);
|
IPathEntry[] pathEntries = getCachedResolvedPathEntries(resolvedListEntries, cproject);
|
||||||
for (int i = 0; i < pathEntries.length; ++i) {
|
for (IPathEntry entry : pathEntries) {
|
||||||
IPathEntry entry = pathEntries[i];
|
|
||||||
if ((entry.getEntryKind() & IPathEntry.CDT_MACRO) != 0) {
|
if ((entry.getEntryKind() & IPathEntry.CDT_MACRO) != 0) {
|
||||||
entryList.add(entry);
|
entryList.add(entry);
|
||||||
}
|
}
|
||||||
|
@ -260,7 +258,7 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
}
|
}
|
||||||
|
|
||||||
private IMacroEntry[] getMacroEntries(ITranslationUnit cunit) throws CModelException {
|
private IMacroEntry[] getMacroEntries(ITranslationUnit cunit) throws CModelException {
|
||||||
ArrayList<IPathEntry> macroList = new ArrayList<IPathEntry>();
|
ArrayList<IPathEntry> macroList = new ArrayList<>();
|
||||||
ICProject cproject = cunit.getCProject();
|
ICProject cproject = cunit.getCProject();
|
||||||
IPath resPath = cunit.getPath();
|
IPath resPath = cunit.getPath();
|
||||||
// Do this first so the containers get inialized.
|
// Do this first so the containers get inialized.
|
||||||
|
@ -272,9 +270,9 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
IPathEntryContainer[] containers = getPathEntryContainers(cproject);
|
IPathEntryContainer[] containers = getPathEntryContainers(cproject);
|
||||||
for (int i = 0; i < containers.length; ++i) {
|
for (IPathEntryContainer container : containers) {
|
||||||
if (containers[i] instanceof IPathEntryContainerExtension) {
|
if (container instanceof IPathEntryContainerExtension) {
|
||||||
IPathEntryContainerExtension extension = (IPathEntryContainerExtension) containers[i];
|
IPathEntryContainerExtension extension = (IPathEntryContainerExtension) container;
|
||||||
IPathEntry[] incs = extension.getPathEntries(resPath, IPathEntry.CDT_MACRO);
|
IPathEntry[] incs = extension.getPathEntries(resPath, IPathEntry.CDT_MACRO);
|
||||||
macroList.addAll(Arrays.asList(incs));
|
macroList.addAll(Arrays.asList(incs));
|
||||||
}
|
}
|
||||||
|
@ -289,7 +287,7 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
//
|
//
|
||||||
// We will use NDEBUG=1 only
|
// We will use NDEBUG=1 only
|
||||||
int count = resPath.segmentCount();
|
int count = resPath.segmentCount();
|
||||||
Map<String, IMacroEntry> symbolMap = new HashMap<String, IMacroEntry>();
|
Map<String, IMacroEntry> symbolMap = new HashMap<>();
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
IPath newPath = resPath.removeLastSegments(i);
|
IPath newPath = resPath.removeLastSegments(i);
|
||||||
for (IMacroEntry macro : macros) {
|
for (IMacroEntry macro : macros) {
|
||||||
|
@ -346,7 +344,7 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<IPathEntry> getPathEntries(ITranslationUnit cunit, int type) throws CModelException {
|
private List<IPathEntry> getPathEntries(ITranslationUnit cunit, int type) throws CModelException {
|
||||||
ArrayList<IPathEntry> entryList = new ArrayList<IPathEntry>();
|
ArrayList<IPathEntry> entryList = new ArrayList<>();
|
||||||
ICProject cproject = cunit.getCProject();
|
ICProject cproject = cunit.getCProject();
|
||||||
IPath resPath = cunit.getPath();
|
IPath resPath = cunit.getPath();
|
||||||
// Do this first so the containers get inialized.
|
// Do this first so the containers get inialized.
|
||||||
|
@ -358,9 +356,9 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
IPathEntryContainer[] containers = getPathEntryContainers(cproject);
|
IPathEntryContainer[] containers = getPathEntryContainers(cproject);
|
||||||
for (int i = 0; i < containers.length; ++i) {
|
for (IPathEntryContainer container : containers) {
|
||||||
if (containers[i] instanceof IPathEntryContainerExtension) {
|
if (container instanceof IPathEntryContainerExtension) {
|
||||||
IPathEntryContainerExtension extension = (IPathEntryContainerExtension) containers[i];
|
IPathEntryContainerExtension extension = (IPathEntryContainerExtension) container;
|
||||||
IPathEntry[] incs = extension.getPathEntries(resPath, type);
|
IPathEntry[] incs = extension.getPathEntries(resPath, type);
|
||||||
entryList.addAll(Arrays.asList(incs));
|
entryList.addAll(Arrays.asList(incs));
|
||||||
}
|
}
|
||||||
|
@ -453,7 +451,13 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IPathEntry[] removeCachedResolvedPathEntries(ICProject cproject) {
|
protected IPathEntry[] removeCachedResolvedPathEntries(ICProject cproject) {
|
||||||
ArrayList<IPathEntry> resolvedListEntries = resolvedMap.remove(cproject);
|
ArrayList<IPathEntry> resolvedListEntries;
|
||||||
|
synchronized (cacheComputationMarkers) {
|
||||||
|
// Remove a potential marker, such that a result in progress is not
|
||||||
|
// written to the cache.
|
||||||
|
cacheComputationMarkers.remove(cproject);
|
||||||
|
resolvedListEntries = resolvedMap.remove(cproject);
|
||||||
|
}
|
||||||
resolvedInfoMap.remove(cproject);
|
resolvedInfoMap.remove(cproject);
|
||||||
if (resolvedListEntries != null) {
|
if (resolvedListEntries != null) {
|
||||||
try {
|
try {
|
||||||
|
@ -481,10 +485,10 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
}
|
}
|
||||||
if (hasContainerExtension) {
|
if (hasContainerExtension) {
|
||||||
IPath projectPath = cproject.getPath();
|
IPath projectPath = cproject.getPath();
|
||||||
ArrayList<IPathEntry> listEntries = new ArrayList<IPathEntry>(entries.length);
|
ArrayList<IPathEntry> listEntries = new ArrayList<>(entries.length);
|
||||||
for (int i = 0; i < entries.length; ++i) {
|
for (IPathEntry entrie : entries) {
|
||||||
if (entries[i].getEntryKind() == IPathEntry.CDT_CONTAINER) {
|
if (entrie.getEntryKind() == IPathEntry.CDT_CONTAINER) {
|
||||||
IContainerEntry centry = (IContainerEntry) entries[i];
|
IContainerEntry centry = (IContainerEntry) entrie;
|
||||||
IPathEntryContainer container = getPathEntryContainer(centry, cproject);
|
IPathEntryContainer container = getPathEntryContainer(centry, cproject);
|
||||||
if (container != null) {
|
if (container != null) {
|
||||||
IPathEntry[] containerEntries = container.getPathEntries();
|
IPathEntry[] containerEntries = container.getPathEntries();
|
||||||
|
@ -497,7 +501,7 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
listEntries.add(entries[i]);
|
listEntries.add(entrie);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
entries = listEntries.toArray(NO_PATHENTRIES);
|
entries = listEntries.toArray(NO_PATHENTRIES);
|
||||||
|
@ -524,8 +528,9 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
private ArrayList<IPathEntry> getResolvedPathEntries(ICProject cproject, boolean generateMarkers)
|
private ArrayList<IPathEntry> getResolvedPathEntries(ICProject cproject, boolean generateMarkers)
|
||||||
throws CModelException {
|
throws CModelException {
|
||||||
Object[] result = getResolvedPathEntries(cproject, generateMarkers, true);
|
Object[] result = getResolvedPathEntries(cproject, generateMarkers, true);
|
||||||
if (result != null)
|
if (result != null) {
|
||||||
return (ArrayList<IPathEntry>) result[0];
|
return (ArrayList<IPathEntry>) result[0];
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -538,10 +543,19 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
rInfo = resolvedInfoMap.get(cproject);
|
rInfo = resolvedInfoMap.get(cproject);
|
||||||
}
|
}
|
||||||
if (resolvedEntries == null) {
|
if (resolvedEntries == null) {
|
||||||
List<PathEntryResolveInfoElement> resolveInfoList = new ArrayList<PathEntryResolveInfoElement>();
|
Object marker = null;
|
||||||
|
if (useCache) {
|
||||||
|
// Mark the fact that we are computing a result for the cache
|
||||||
|
marker = new Object();
|
||||||
|
synchronized (cacheComputationMarkers) {
|
||||||
|
cacheComputationMarkers.put(cproject, marker);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
List<PathEntryResolveInfoElement> resolveInfoList = new ArrayList<>();
|
||||||
IPath projectPath = cproject.getPath();
|
IPath projectPath = cproject.getPath();
|
||||||
IPathEntry[] rawEntries = getRawPathEntries(cproject);
|
IPathEntry[] rawEntries = getRawPathEntries(cproject);
|
||||||
resolvedEntries = new ArrayList<IPathEntry>();
|
resolvedEntries = new ArrayList<>();
|
||||||
for (IPathEntry entry : rawEntries) {
|
for (IPathEntry entry : rawEntries) {
|
||||||
// Expand the containers.
|
// Expand the containers.
|
||||||
if (entry.getEntryKind() == IPathEntry.CDT_CONTAINER) {
|
if (entry.getEntryKind() == IPathEntry.CDT_CONTAINER) {
|
||||||
|
@ -553,7 +567,7 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
// are not IPathEntryContainerExtension.
|
// are not IPathEntryContainerExtension.
|
||||||
if (!(container instanceof IPathEntryContainerExtension)) {
|
if (!(container instanceof IPathEntryContainerExtension)) {
|
||||||
IPathEntry[] containerEntries = container.getPathEntries();
|
IPathEntry[] containerEntries = container.getPathEntries();
|
||||||
List<IPathEntry> resolvedList = new ArrayList<IPathEntry>();
|
List<IPathEntry> resolvedList = new ArrayList<>();
|
||||||
if (containerEntries != null) {
|
if (containerEntries != null) {
|
||||||
for (IPathEntry containerEntry : containerEntries) {
|
for (IPathEntry containerEntry : containerEntries) {
|
||||||
IPathEntry newEntry = PathEntryUtil.cloneEntryAndExpand(projectPath,
|
IPathEntry newEntry = PathEntryUtil.cloneEntryAndExpand(projectPath,
|
||||||
|
@ -582,7 +596,7 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
|
|
||||||
if (generateMarkers) {
|
if (generateMarkers) {
|
||||||
IPathEntry[] finalEntries = resolvedEntries.toArray(NO_PATHENTRIES);
|
IPathEntry[] finalEntries = resolvedEntries.toArray(NO_PATHENTRIES);
|
||||||
ArrayList<ICModelStatus> problemList = new ArrayList<ICModelStatus>();
|
ArrayList<ICModelStatus> problemList = new ArrayList<>();
|
||||||
ICModelStatus status = validatePathEntry(cproject, finalEntries);
|
ICModelStatus status = validatePathEntry(cproject, finalEntries);
|
||||||
if (!status.isOK()) {
|
if (!status.isOK()) {
|
||||||
problemList.add(status);
|
problemList.add(status);
|
||||||
|
@ -615,8 +629,15 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
|
|
||||||
rInfo = new PathEntryResolveInfo(resolveInfoList);
|
rInfo = new PathEntryResolveInfo(resolveInfoList);
|
||||||
if (useCache) {
|
if (useCache) {
|
||||||
resolvedMap.put(cproject, resolvedEntries);
|
synchronized (cacheComputationMarkers) {
|
||||||
resolvedInfoMap.put(cproject, rInfo);
|
// Only if our marker is still here we are allowed to cache the result
|
||||||
|
// Otherwise, the cache may have been cleared after we started our computation.
|
||||||
|
if (cacheComputationMarkers.get(cproject) == marker) {
|
||||||
|
cacheComputationMarkers.remove(cproject);
|
||||||
|
resolvedMap.put(cproject, resolvedEntries);
|
||||||
|
resolvedInfoMap.put(cproject, rInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new Object[] { resolvedEntries, rInfo };
|
return new Object[] { resolvedEntries, rInfo };
|
||||||
|
@ -823,7 +844,7 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
boolean bCreateLock) {
|
boolean bCreateLock) {
|
||||||
Map<IPath, IPathEntryContainer> projectContainers = Containers.get(cproject);
|
Map<IPath, IPathEntryContainer> projectContainers = Containers.get(cproject);
|
||||||
if (projectContainers == null) {
|
if (projectContainers == null) {
|
||||||
projectContainers = new HashMap<IPath, IPathEntryContainer>();
|
projectContainers = new HashMap<>();
|
||||||
Containers.put(cproject, projectContainers);
|
Containers.put(cproject, projectContainers);
|
||||||
}
|
}
|
||||||
IPathEntryContainer container = projectContainers.get(containerPath);
|
IPathEntryContainer container = projectContainers.get(containerPath);
|
||||||
|
@ -838,7 +859,7 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
synchronized void containerPut(ICProject cproject, IPath containerPath, IPathEntryContainer container) {
|
synchronized void containerPut(ICProject cproject, IPath containerPath, IPathEntryContainer container) {
|
||||||
Map<IPath, IPathEntryContainer> projectContainers = Containers.get(cproject);
|
Map<IPath, IPathEntryContainer> projectContainers = Containers.get(cproject);
|
||||||
if (projectContainers == null) {
|
if (projectContainers == null) {
|
||||||
projectContainers = new HashMap<IPath, IPathEntryContainer>();
|
projectContainers = new HashMap<>();
|
||||||
Containers.put(cproject, projectContainers);
|
Containers.put(cproject, projectContainers);
|
||||||
}
|
}
|
||||||
IPathEntryContainer oldContainer;
|
IPathEntryContainer oldContainer;
|
||||||
|
@ -870,7 +891,7 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
|
|
||||||
public String[] projectPrerequisites(IPathEntry[] entries) throws CModelException {
|
public String[] projectPrerequisites(IPathEntry[] entries) throws CModelException {
|
||||||
if (entries != null) {
|
if (entries != null) {
|
||||||
ArrayList<String> prerequisites = new ArrayList<String>();
|
ArrayList<String> prerequisites = new ArrayList<>();
|
||||||
for (IPathEntry entry : entries) {
|
for (IPathEntry entry : entries) {
|
||||||
if (entry.getEntryKind() == IPathEntry.CDT_PROJECT) {
|
if (entry.getEntryKind() == IPathEntry.CDT_PROJECT) {
|
||||||
IProjectEntry projectEntry = (IProjectEntry) entry;
|
IProjectEntry projectEntry = (IProjectEntry) entry;
|
||||||
|
@ -893,7 +914,7 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
entries = NO_PATHENTRIES;
|
entries = NO_PATHENTRIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayList<IPathEntry> list = new ArrayList<IPathEntry>(entries.length);
|
ArrayList<IPathEntry> list = new ArrayList<>(entries.length);
|
||||||
IPath projectPath = cproject.getPath();
|
IPath projectPath = cproject.getPath();
|
||||||
for (IPathEntry pathEntry : entries) {
|
for (IPathEntry pathEntry : entries) {
|
||||||
int kind = pathEntry.getEntryKind();
|
int kind = pathEntry.getEntryKind();
|
||||||
|
@ -1047,8 +1068,8 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
IProject project = problem.project;
|
IProject project = problem.project;
|
||||||
ICModelStatus[] problems = problem.problems;
|
ICModelStatus[] problems = problem.problems;
|
||||||
PathEntryUtil.flushPathEntryProblemMarkers(project);
|
PathEntryUtil.flushPathEntryProblemMarkers(project);
|
||||||
for (int i = 0; i < problems.length; ++i) {
|
for (ICModelStatus problem2 : problems) {
|
||||||
PathEntryUtil.createPathEntryProblemMarker(project, problems[i]);
|
PathEntryUtil.createPathEntryProblemMarker(project, problem2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Status.OK_STATUS;
|
return Status.OK_STATUS;
|
||||||
|
@ -1069,7 +1090,7 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
if (!needDelta(cproject))
|
if (!needDelta(cproject))
|
||||||
return new ICElementDelta[0];
|
return new ICElementDelta[0];
|
||||||
|
|
||||||
ArrayList<ICElementDelta> list = new ArrayList<ICElementDelta>();
|
ArrayList<ICElementDelta> list = new ArrayList<>();
|
||||||
|
|
||||||
// If nothing was known before do not generate any deltas.
|
// If nothing was known before do not generate any deltas.
|
||||||
if (oldEntries == null) {
|
if (oldEntries == null) {
|
||||||
|
@ -1221,7 +1242,7 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
if (core == null) {
|
if (core == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
ArrayList<String> containerIDList = new ArrayList<String>(5);
|
ArrayList<String> containerIDList = new ArrayList<>(5);
|
||||||
IExtensionPoint extension = Platform.getExtensionRegistry().getExtensionPoint(CCorePlugin.PLUGIN_ID,
|
IExtensionPoint extension = Platform.getExtensionRegistry().getExtensionPoint(CCorePlugin.PLUGIN_ID,
|
||||||
CONTAINER_INITIALIZER_EXTPOINT_ID);
|
CONTAINER_INITIALIZER_EXTPOINT_ID);
|
||||||
if (extension != null) {
|
if (extension != null) {
|
||||||
|
@ -1454,16 +1475,16 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
|
||||||
final ICProject cproject = sourceRoot.getCProject();
|
final ICProject cproject = sourceRoot.getCProject();
|
||||||
IPathEntry[] rawEntries = getRawPathEntries(cproject);
|
IPathEntry[] rawEntries = getRawPathEntries(cproject);
|
||||||
boolean change = false;
|
boolean change = false;
|
||||||
ArrayList<IPathEntry> list = new ArrayList<IPathEntry>(rawEntries.length);
|
ArrayList<IPathEntry> list = new ArrayList<>(rawEntries.length);
|
||||||
for (int i = 0; i < rawEntries.length; ++i) {
|
for (IPathEntry rawEntrie : rawEntries) {
|
||||||
if (rawEntries[i].getEntryKind() == IPathEntry.CDT_SOURCE) {
|
if (rawEntrie.getEntryKind() == IPathEntry.CDT_SOURCE) {
|
||||||
if (sourceRoot.getPath().equals(rawEntries[i].getPath())) {
|
if (sourceRoot.getPath().equals(rawEntrie.getPath())) {
|
||||||
change = true;
|
change = true;
|
||||||
} else {
|
} else {
|
||||||
list.add(rawEntries[i]);
|
list.add(rawEntrie);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
list.add(rawEntries[i]);
|
list.add(rawEntrie);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (change) {
|
if (change) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue