diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/index/IIndexManager.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/index/IIndexManager.java index 2522fc3dad0..76231c16ef8 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/index/IIndexManager.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/index/IIndexManager.java @@ -184,6 +184,7 @@ public interface IIndexManager extends IPDOMManager { /** * Returns the index for the given project. + * * @param project the project to get the index for * @return an index for the project * @throws CoreException @@ -192,6 +193,7 @@ public interface IIndexManager extends IPDOMManager { /** * Returns the index for the given projects. + * * @param projects the projects to get the index for * @return an index for the projects * @throws CoreException @@ -203,7 +205,7 @@ public interface IIndexManager extends IPDOMManager { * projects. * * @param project the project to get the index for - * @param options 0 or a combination of {@link #ADD_DEPENDENCIES} and + * @param options {@code 0} or a combination of {@link #ADD_DEPENDENCIES} and * {@link #ADD_DEPENDENT}. * @return an index for the project * @throws CoreException @@ -213,8 +215,9 @@ public interface IIndexManager extends IPDOMManager { /** * Returns the index for the given projects. You can specify to add dependencies or dependent * projects. + * * @param projects the projects to get the index for - * @param options 0 or a combination of {@link #ADD_DEPENDENCIES} and + * @param options {@code 0} or a combination of {@link #ADD_DEPENDENCIES} and * {@link #ADD_DEPENDENT}. * @return an index for the projects * @throws CoreException @@ -223,6 +226,7 @@ public interface IIndexManager extends IPDOMManager { /** * Registers a listener that will be notified whenever the indexer go idle. + * * @param listener the listener to register. */ void addIndexChangeListener(IIndexChangeListener listener); @@ -235,12 +239,14 @@ public interface IIndexManager extends IPDOMManager { /** * Registers a listener that will be notified whenever the indexer changes its state. + * * @param listener the listener to register. */ void addIndexerStateListener(IIndexerStateListener listener); /** * Removes a previously registered indexer state listener. + * * @param listener the listener to unregister. */ void removeIndexerStateListener(IIndexerStateListener listener); @@ -249,15 +255,17 @@ public interface IIndexManager extends IPDOMManager { * Joins the indexer and reports progress. * @param waitMaxMillis time limit in milliseconds after which the method returns with * {@code false}, or {@link #FOREVER}. + * * @param monitor a monitor to report progress. - * @return true, if the indexer went idle in the given time. + * @return {@code true}, if the indexer went idle in the given time. */ boolean joinIndexer(int waitMaxMillis, IProgressMonitor monitor); /** - * Checks whether the indexer is currently idle. The indexer is idle, when there is currently no request - * to update files of an index and no initialization for a project is performed. However, the indexer becomes - * idle, when the setup of a project is postponed (check with {@link #isIndexerSetupPostponed(ICProject)}). + * Checks whether the indexer is currently idle. The indexer is idle, when there is currently + * no request to update files of an index and no initialization for a project is performed. + * However, the indexer becomes idle, when the setup of a project is postponed + * (check with {@link #isIndexerSetupPostponed(ICProject)}). */ boolean isIndexerIdle(); @@ -268,8 +276,10 @@ public interface IIndexManager extends IPDOMManager { boolean isProjectIndexed(ICProject proj); /** - * Return whether the indexer-setup for a project is currently postponed. Note, - * that a postponed setup does not prevent the indexer from becoming idle ({@link #isIndexerIdle()}. + * Returns whether the indexer-setup for a project is currently postponed. Note, + * that a postponed setup does not prevent the indexer from becoming idle + * ({@link #isIndexerIdle()}. + *

* The fact that the indexer-setup for a project is no longer postponed, will be reported using * {@link IndexerSetupParticipant#onIndexerSetup(ICProject)}. */ @@ -296,20 +306,22 @@ public interface IIndexManager extends IPDOMManager { public void reindex(ICProject project); /** - * Updates the index for the given selection of translation units considering - * the options supplied. The selection is defined by an array of translation - * units, containers and projects. For containers and projects all recursively - * nested translation units are considered. + * Updates the index for the given selection of translation units considering the options + * supplied. The selection is defined by an array of translation units, containers and projects. + * For containers and projects all recursively nested translation units are considered. + * * @param tuSelection the translation units to update. * @param options one of {@link #UPDATE_ALL} or {@link #UPDATE_CHECK_TIMESTAMPS} optionally - * combined with {@link #UPDATE_EXTERNAL_FILES_FOR_PROJECT} and {@link #UPDATE_CHECK_CONTENTS_HASH}. + * combined with {@link #UPDATE_EXTERNAL_FILES_FOR_PROJECT} and + * {@link #UPDATE_CHECK_CONTENTS_HASH}. * @throws CoreException * @since 4.0 */ public void update(ICElement[] tuSelection, int options) throws CoreException; /** - * Export index for usage within a team. + * Exports index for usage within a team. + * * @param project a project for which the PDOM is to be exported. * @param location the target location for the database. * @param options currently none are supported. diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/AbstractIndexerTask.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/AbstractIndexerTask.java index 394b428f23c..8f452b75221 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/AbstractIndexerTask.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/AbstractIndexerTask.java @@ -651,7 +651,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter { final boolean regularContent = isRequiredInIndex(tu, ifl, isSourceUnit); final boolean indexedUnconditionally = fResolver.isIndexedUnconditionally(ifl); if (regularContent || indexedUnconditionally) { - // Headers or sources required with a specific linkage + // Headers or sources required with a specific linkage. final UpdateKind updateKind = isSourceUnit ? UpdateKind.REQUIRED_SOURCE : regularContent && both ? UpdateKind.REQUIRED_HEADER : UpdateKind.ONE_LINKAGE_HEADER; if (regularContent || indexFiles.length == 0) { diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/AtomicMultiSet.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/AtomicMultiSet.java index 340ac2b3d6d..17d7e6693f0 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/AtomicMultiSet.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/AtomicMultiSet.java @@ -18,7 +18,7 @@ import java.util.HashMap; * @param Type of the objects contained in the set. */ public class AtomicMultiSet { - private final HashMap map = new HashMap(); + private final HashMap map = new HashMap<>(); /** * Adds object to the set if it was not present, or increments its reference count otherwise. diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMManager.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMManager.java index 51f9a4340dd..271cf56c77a 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMManager.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMManager.java @@ -145,26 +145,26 @@ public class PDOMManager implements IWritableIndexManager, IListener { ILinkage.C_LINKAGE_ID, ILinkage.CPP_LINKAGE_ID, ILinkage.FORTRAN_LINKAGE_ID }; - private final ArrayDeque fProjectQueue= new ArrayDeque(); + private final ArrayDeque fProjectQueue= new ArrayDeque<>(); private final PDOMSetupJob fSetupJob; /** * Protects fIndexerJob, fCurrentTask and fTaskQueue. */ - private final ArrayDeque fTaskQueue = new ArrayDeque(); + private final ArrayDeque fTaskQueue = new ArrayDeque<>(); private final PDOMIndexerJob fIndexerJob; private IPDOMIndexerTask fCurrentTask; private int fSourceCount, fHeaderCount, fTickCount; - private final ArrayDeque fChangeEvents= new ArrayDeque(); + private final ArrayDeque fChangeEvents= new ArrayDeque<>(); private final Job fNotificationJob; - private final AtomicMultiSet fFilesIndexedUnconditionlly= new AtomicMultiSet(); + private final AtomicMultiSet fFilesIndexedUnconditionlly= new AtomicMultiSet<>(); /** * Stores mapping from pdom to project, used to serialize creation of new pdoms. */ - private Map fProjectToPDOM= new HashMap(); - private Map fFileToProject= new HashMap(); + private Map fProjectToPDOM= new HashMap<>(); + private Map fFileToProject= new HashMap<>(); private ListenerList fChangeListeners= new ListenerList(); private ListenerList fStateListeners= new ListenerList(); @@ -185,12 +185,12 @@ public class PDOMManager implements IWritableIndexManager, IListener { * Serializes creation of new indexer, when acquiring the lock you are * not allowed to hold a lock on fPDOMs. */ - private Map fUpdatePolicies= new HashMap(); - private Set fClosingProjects= new HashSet(); + private Map fUpdatePolicies= new HashMap<>(); + private Set fClosingProjects= new HashSet<>(); - private Map fPrefListeners= new HashMap(); - private List fSetupParticipants= new ArrayList(); - private Set fPostponedProjects= new HashSet(); + private Map fPrefListeners= new HashMap<>(); + private List fSetupParticipants= new ArrayList<>(); + private Set fPostponedProjects= new HashSet<>(); private int fLastNotifiedState= IndexerStateEvent.STATE_IDLE; private boolean fInShutDown; @@ -1210,7 +1210,7 @@ public class PDOMManager implements IWritableIndexManager, IListener { @Override public IIndex getIndex(ICProject project) throws CoreException { - return fIndexFactory.getIndex(new ICProject[] {project}, 0); + return fIndexFactory.getIndex(new ICProject[] { project }, 0); } @Override @@ -1220,7 +1220,7 @@ public class PDOMManager implements IWritableIndexManager, IListener { @Override public IIndex getIndex(ICProject project, int options) throws CoreException { - return fIndexFactory.getIndex(new ICProject[] {project}, options); + return fIndexFactory.getIndex(new ICProject[] { project }, options); } @Override @@ -1245,8 +1245,7 @@ public class PDOMManager implements IWritableIndexManager, IListener { boolean deleted= targetLocation.delete(); if (!deleted) { throw new IllegalArgumentException( - MessageFormat.format(Messages.PDOMManager_ExistingFileCollides, - targetLocation )); + MessageFormat.format(Messages.PDOMManager_ExistingFileCollides, targetLocation)); } } try { @@ -1383,17 +1382,17 @@ public class PDOMManager implements IWritableIndexManager, IListener { * set of folders and files specifying the selection. */ private Map> splitSelection(ICElement[] tuSelection) { - HashMap> result= new HashMap>(); + HashMap> result= new HashMap<>(); allElements: for (int i = 0; i < tuSelection.length; i++) { ICElement element = tuSelection[i]; if (element instanceof ICProject || element instanceof ICContainer || element instanceof ITranslationUnit) { ICProject project= element.getCProject(); List set= result.get(project); if (set == null) { - set= new ArrayList(); + set= new ArrayList<>(); result.put(project, set); } - for (int j= 0; j sources= new HashSet(); + Set sources= new HashSet<>(); cproject.accept(new TranslationUnitCollector(sources, null, new NullProgressMonitor())); IStatus syncStatus = null;