1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 17:56:01 +02:00

Bug 540373: Cleanup: Remove redundant type arguments

This was done by selecting all projects in Eclipse then
Source -> Clean Up... -> choosing:
- Remove redundant type arguments
and completing the wizard

Change-Id: Iaecc7010f097b4b1fabd29ccaa34ccb23a716fbf
This commit is contained in:
Jonah Graham 2018-11-20 16:20:42 +00:00
parent 8844a8f9f2
commit caf2292768
1432 changed files with 4538 additions and 4538 deletions

View file

@ -28,8 +28,8 @@ import org.eclipse.cdt.make.internal.core.scannerconfig.util.CCommandDSC;
@SuppressWarnings({ "rawtypes", "unchecked" }) @SuppressWarnings({ "rawtypes", "unchecked" })
final class TestScannerInfoCollector implements IScannerInfoCollector { final class TestScannerInfoCollector implements IScannerInfoCollector {
private HashMap<ScannerInfoTypes, List> fInfoMap = new HashMap<ScannerInfoTypes, List>(); private HashMap<ScannerInfoTypes, List> fInfoMap = new HashMap<>();
private HashMap<Object, Map<ScannerInfoTypes, List>> fResourceToInfoMap = new HashMap<Object, Map<ScannerInfoTypes, List>>(); private HashMap<Object, Map<ScannerInfoTypes, List>> fResourceToInfoMap = new HashMap<>();
@Override @Override
public void contributeToScannerConfig(Object resource, Map scannerInfo0) { public void contributeToScannerConfig(Object resource, Map scannerInfo0) {
@ -57,7 +57,7 @@ final class TestScannerInfoCollector implements IScannerInfoCollector {
private void addTo(ScannerInfoTypes type, List<String> col) { private void addTo(ScannerInfoTypes type, List<String> col) {
List<String> target = fInfoMap.get(type); List<String> target = fInfoMap.get(type);
if (target == null) { if (target == null) {
target = new ArrayList<String>(); target = new ArrayList<>();
fInfoMap.put(type, target); fInfoMap.put(type, target);
} }
target.addAll(col); target.addAll(col);

View file

@ -199,7 +199,7 @@ public class MakeBuilder extends ACBuilder {
String[] errorParsers = info.getErrorParsers(); String[] errorParsers = info.getErrorParsers();
ErrorParserManager epm = new ErrorParserManager(getProject(), workingDirectoryURI, this, errorParsers); ErrorParserManager epm = new ErrorParserManager(getProject(), workingDirectoryURI, this, errorParsers);
List<IConsoleParser> parsers = new ArrayList<IConsoleParser>(); List<IConsoleParser> parsers = new ArrayList<>();
if (!isOnlyClean) { if (!isOnlyClean) {
ICProjectDescription prjDescription = CoreModel.getDefault().getProjectDescription(project); ICProjectDescription prjDescription = CoreModel.getDefault().getProjectDescription(project);
if (prjDescription != null) { if (prjDescription != null) {
@ -249,7 +249,7 @@ public class MakeBuilder extends ACBuilder {
private HashMap<String, String> getEnvironment(ICommandLauncher launcher, IMakeBuilderInfo info) private HashMap<String, String> getEnvironment(ICommandLauncher launcher, IMakeBuilderInfo info)
throws CoreException { throws CoreException {
HashMap<String, String> envMap = new HashMap<String, String>(); HashMap<String, String> envMap = new HashMap<>();
if (info.appendEnvironment()) { if (info.appendEnvironment()) {
@SuppressWarnings({ "unchecked", "rawtypes" }) @SuppressWarnings({ "unchecked", "rawtypes" })
Map<String, String> env = (Map) launcher.getEnvironment(); Map<String, String> env = (Map) launcher.getEnvironment();

View file

@ -183,7 +183,7 @@ public class MakeCorePlugin extends Plugin {
public String[] getMakefileDirs() { public String[] getMakefileDirs() {
String stringList = getPluginPreferences().getString(MAKEFILE_DIRS); String stringList = getPluginPreferences().getString(MAKEFILE_DIRS);
StringTokenizer st = new StringTokenizer(stringList, File.pathSeparator + "\n\r");//$NON-NLS-1$ StringTokenizer st = new StringTokenizer(stringList, File.pathSeparator + "\n\r");//$NON-NLS-1$
ArrayList<String> v = new ArrayList<String>(); ArrayList<String> v = new ArrayList<>();
while (st.hasMoreElements()) { while (st.hasMoreElements()) {
v.add(st.nextToken()); v.add(st.nextToken());
} }
@ -198,7 +198,7 @@ public class MakeCorePlugin extends Plugin {
IMakefile makefile; IMakefile makefile;
if (isGnuStyle) { if (isGnuStyle) {
GNUMakefile gnu = new GNUMakefile(); GNUMakefile gnu = new GNUMakefile();
ArrayList<String> includeList = new ArrayList<String>(); ArrayList<String> includeList = new ArrayList<>();
includeList.add(new Path(file.getAbsolutePath()).removeLastSegments(1).toOSString()); includeList.add(new Path(file.getAbsolutePath()).removeLastSegments(1).toOSString());
includeList.addAll(Arrays.asList(gnu.getIncludeDirectories())); includeList.addAll(Arrays.asList(gnu.getIncludeDirectories()));
includeList.addAll(Arrays.asList(makefileDirs)); includeList.addAll(Arrays.asList(makefileDirs));
@ -246,7 +246,7 @@ public class MakeCorePlugin extends Plugin {
IMakefile makefile; IMakefile makefile;
if (isGnuStyle) { if (isGnuStyle) {
GNUMakefile gnu = new GNUMakefile(); GNUMakefile gnu = new GNUMakefile();
ArrayList<String> includeList = new ArrayList<String>(); ArrayList<String> includeList = new ArrayList<>();
includeList.add(new Path(fileURI.getPath()).removeLastSegments(1).toString()); includeList.add(new Path(fileURI.getPath()).removeLastSegments(1).toString());
includeList.addAll(Arrays.asList(gnu.getIncludeDirectories())); includeList.addAll(Arrays.asList(gnu.getIncludeDirectories()));
includeList.addAll(Arrays.asList(makefileDirs)); includeList.addAll(Arrays.asList(makefileDirs));
@ -372,7 +372,7 @@ public class MakeCorePlugin extends Plugin {
SI_CONSOLE_PARSER_SIMPLE_ID); SI_CONSOLE_PARSER_SIMPLE_ID);
if (extension != null) { if (extension != null) {
IExtension[] extensions = extension.getExtensions(); IExtension[] extensions = extension.getExtensions();
List<String> parserIds = new ArrayList<String>(extensions.length); List<String> parserIds = new ArrayList<>(extensions.length);
for (int i = 0; i < extensions.length; i++) { for (int i = 0; i < extensions.length; i++) {
String parserId = extensions[i].getUniqueIdentifier(); String parserId = extensions[i].getUniqueIdentifier();
if (parserId != null) { if (parserId != null) {

View file

@ -89,7 +89,7 @@ public class MakeScannerInfo implements IScannerInfo {
@Override @Override
public synchronized Map<String, String> getDefinedSymbols() { public synchronized Map<String, String> getDefinedSymbols() {
// Return the defined symbols for the default configuration // Return the defined symbols for the default configuration
HashMap<String, String> symbols = new HashMap<String, String>(); HashMap<String, String> symbols = new HashMap<>();
String[] symbolList = getPreprocessorSymbols(); String[] symbolList = getPreprocessorSymbols();
for (int i = 0; i < symbolList.length; ++i) { for (int i = 0; i < symbolList.length; ++i) {
String symbol = symbolList[i]; String symbol = symbolList[i];
@ -112,7 +112,7 @@ public class MakeScannerInfo implements IScannerInfo {
protected List<String> getPathList() { protected List<String> getPathList() {
if (pathList == null) { if (pathList == null) {
pathList = new ArrayList<String>(); pathList = new ArrayList<>();
} }
return pathList; return pathList;
} }
@ -123,7 +123,7 @@ public class MakeScannerInfo implements IScannerInfo {
protected List<String> getSymbolList() { protected List<String> getSymbolList() {
if (symbolList == null) { if (symbolList == null) {
symbolList = new ArrayList<String>(); symbolList = new ArrayList<>();
} }
return symbolList; return symbolList;
} }

View file

@ -123,8 +123,8 @@ public class MakeScannerProvider extends ScannerProvider {
ICDescriptor descriptor = CCorePlugin.getDefault().getCProjectDescription(project); ICDescriptor descriptor = CCorePlugin.getDefault().getCProjectDescription(project);
ICStorageElement storage = descriptor.getProjectStorageElement(CDESCRIPTOR_ID); ICStorageElement storage = descriptor.getProjectStorageElement(CDESCRIPTOR_ID);
ArrayList<String> includes = new ArrayList<String>(); ArrayList<String> includes = new ArrayList<>();
ArrayList<String> symbols = new ArrayList<String>(); ArrayList<String> symbols = new ArrayList<>();
for (ICStorageElement child : storage.getChildren()) { for (ICStorageElement child : storage.getChildren()) {
if (child.getName().equals(INCLUDE_PATH)) { if (child.getName().equals(INCLUDE_PATH)) {
// Add the path to the property list // Add the path to the property list
@ -145,7 +145,7 @@ public class MakeScannerProvider extends ScannerProvider {
String[] includes = info.getIncludePaths(); String[] includes = info.getIncludePaths();
ICProject cProject = CoreModel.getDefault().create(info.getProject()); ICProject cProject = CoreModel.getDefault().create(info.getProject());
IPathEntry[] entries = cProject.getRawPathEntries(); IPathEntry[] entries = cProject.getRawPathEntries();
List<IPathEntry> cPaths = new ArrayList<IPathEntry>(Arrays.asList(entries)); List<IPathEntry> cPaths = new ArrayList<>(Arrays.asList(entries));
Iterator<IPathEntry> cpIter = cPaths.iterator(); Iterator<IPathEntry> cpIter = cPaths.iterator();
while (cpIter.hasNext()) { while (cpIter.hasNext()) {

View file

@ -87,13 +87,13 @@ public class DiscoveredScannerInfo implements IScannerInfo {
public LinkedHashMap<String, Boolean> getDiscoveredIncludePaths() { public LinkedHashMap<String, Boolean> getDiscoveredIncludePaths() {
if (discoveredPaths == null) { if (discoveredPaths == null) {
return new LinkedHashMap<String, Boolean>(); return new LinkedHashMap<>();
} }
return new LinkedHashMap<String, Boolean>(discoveredPaths); return new LinkedHashMap<>(discoveredPaths);
} }
public synchronized void setDiscoveredIncludePaths(LinkedHashMap<String, Boolean> paths) { public synchronized void setDiscoveredIncludePaths(LinkedHashMap<String, Boolean> paths) {
discoveredPaths = new LinkedHashMap<String, Boolean>(paths); discoveredPaths = new LinkedHashMap<>(paths);
createPathLists(); createPathLists();
} }
@ -119,13 +119,13 @@ public class DiscoveredScannerInfo implements IScannerInfo {
public LinkedHashMap<String, SymbolEntry> getDiscoveredSymbolDefinitions() { public LinkedHashMap<String, SymbolEntry> getDiscoveredSymbolDefinitions() {
if (discoveredSymbols == null) { if (discoveredSymbols == null) {
return new LinkedHashMap<String, SymbolEntry>(); return new LinkedHashMap<>();
} }
return new LinkedHashMap<String, SymbolEntry>(discoveredSymbols); return new LinkedHashMap<>(discoveredSymbols);
} }
public synchronized void setDiscoveredSymbolDefinitions(LinkedHashMap<String, SymbolEntry> symbols) { public synchronized void setDiscoveredSymbolDefinitions(LinkedHashMap<String, SymbolEntry> symbols) {
discoveredSymbols = new LinkedHashMap<String, SymbolEntry>(symbols); discoveredSymbols = new LinkedHashMap<>(symbols);
createSymbolsLists(); createSymbolsLists();
} }
@ -184,28 +184,28 @@ public class DiscoveredScannerInfo implements IScannerInfo {
private List<String> getActivePathList() { private List<String> getActivePathList() {
if (activePaths == null) { if (activePaths == null) {
activePaths = new ArrayList<String>(); activePaths = new ArrayList<>();
} }
return activePaths; return activePaths;
} }
private List<String> getRemovedPathList() { private List<String> getRemovedPathList() {
if (removedPaths == null) { if (removedPaths == null) {
removedPaths = new ArrayList<String>(); removedPaths = new ArrayList<>();
} }
return removedPaths; return removedPaths;
} }
private List<String> getActiveSymbolsList() { private List<String> getActiveSymbolsList() {
if (activeSymbols == null) { if (activeSymbols == null) {
activeSymbols = new ArrayList<String>(); activeSymbols = new ArrayList<>();
} }
return activeSymbols; return activeSymbols;
} }
private List<String> getRemovedSymbolsList() { private List<String> getRemovedSymbolsList() {
if (removedSymbols == null) { if (removedSymbols == null) {
removedSymbols = new ArrayList<String>(); removedSymbols = new ArrayList<>();
} }
return removedSymbols; return removedSymbols;
} }

View file

@ -117,7 +117,7 @@ public class DiscoveredScannerInfoProvider extends ScannerProvider {
ICProject cProject = CoreModel.getDefault().create(project); ICProject cProject = CoreModel.getDefault().create(project);
if (cProject != null) { if (cProject != null) {
IPathEntry[] entries = cProject.getRawPathEntries(); IPathEntry[] entries = cProject.getRawPathEntries();
List<IPathEntry> newEntries = new ArrayList<IPathEntry>(Arrays.asList(entries)); List<IPathEntry> newEntries = new ArrayList<>(Arrays.asList(entries));
if (!newEntries.contains(container)) { if (!newEntries.contains(container)) {
newEntries.add(container); newEntries.add(container);
cProject.setRawPathEntries(newEntries.toArray(new IPathEntry[newEntries.size()]), null); cProject.setRawPathEntries(newEntries.toArray(new IPathEntry[newEntries.size()]), null);

View file

@ -46,7 +46,7 @@ public final class PathInfo {
? (IPath[]) quoteIncludePaths.clone() ? (IPath[]) quoteIncludePaths.clone()
: EMPTY_PATH_ARRAY; : EMPTY_PATH_ARRAY;
fSymbols = symbols != null && symbols.size() != 0 ? getInternedHashMap(symbols) fSymbols = symbols != null && symbols.size() != 0 ? getInternedHashMap(symbols)
: new HashMap<String, String>(0); : new HashMap<>(0);
fIncludeFiles = includeFiles != null && includeFiles.length != 0 ? (IPath[]) includeFiles.clone() fIncludeFiles = includeFiles != null && includeFiles.length != 0 ? (IPath[]) includeFiles.clone()
: EMPTY_PATH_ARRAY; : EMPTY_PATH_ARRAY;
fMacroFiles = macroFiles != null && macroFiles.length != 0 ? (IPath[]) macroFiles.clone() : EMPTY_PATH_ARRAY; fMacroFiles = macroFiles != null && macroFiles.length != 0 ? (IPath[]) macroFiles.clone() : EMPTY_PATH_ARRAY;
@ -63,9 +63,9 @@ public final class PathInfo {
return null; return null;
if (oldMap.isEmpty()) if (oldMap.isEmpty())
return new HashMap<String, String>(oldMap); return new HashMap<>(oldMap);
HashMap<String, String> newMap = new HashMap<String, String>(oldMap.size()); HashMap<String, String> newMap = new HashMap<>(oldMap.size());
for (String key : oldMap.keySet()) { for (String key : oldMap.keySet()) {
newMap.put(SafeStringInterner.safeIntern(key), SafeStringInterner.safeIntern(oldMap.get(key))); newMap.put(SafeStringInterner.safeIntern(key), SafeStringInterner.safeIntern(oldMap.get(key)));
} }

View file

@ -114,7 +114,7 @@ public class BuildInfoFactory {
@Override @Override
public Map<String, String> getExpandedEnvironment() { public Map<String, String> getExpandedEnvironment() {
Map<String, String> env = getEnvironment(); Map<String, String> env = getEnvironment();
HashMap<String, String> envMap = new HashMap<String, String>(env.entrySet().size()); HashMap<String, String> envMap = new HashMap<>(env.entrySet().size());
boolean win32 = Platform.getOS().equals(Constants.OS_WIN32); boolean win32 = Platform.getOS().equals(Constants.OS_WIN32);
for (Map.Entry<String, String> entry : env.entrySet()) { for (Map.Entry<String, String> entry : env.entrySet()) {
String key = entry.getKey(); String key = entry.getKey();

View file

@ -73,7 +73,7 @@ public class MakeProject implements ICOwner {
private String[] parseStringToArray(String syms) { private String[] parseStringToArray(String syms) {
if (syms != null && syms.length() > 0) { if (syms != null && syms.length() > 0) {
StringTokenizer tok = new StringTokenizer(syms, ";"); //$NON-NLS-1$ StringTokenizer tok = new StringTokenizer(syms, ";"); //$NON-NLS-1$
ArrayList<String> list = new ArrayList<String>(tok.countTokens()); ArrayList<String> list = new ArrayList<>(tok.countTokens());
while (tok.hasMoreElements()) { while (tok.hasMoreElements()) {
list.add(tok.nextToken()); list.add(tok.nextToken());
} }

View file

@ -51,9 +51,9 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis
private static String TARGETS_EXT = "targets"; //$NON-NLS-1$ private static String TARGETS_EXT = "targets"; //$NON-NLS-1$
private final ListenerList listeners = new ListenerList(); private final ListenerList listeners = new ListenerList();
private final Map<IProject, ProjectTargets> projectMap = new HashMap<IProject, ProjectTargets>(); private final Map<IProject, ProjectTargets> projectMap = new HashMap<>();
private HashMap<String, String> builderMap; private HashMap<String, String> builderMap;
protected Vector<IProject> fProjects = new Vector<IProject>(); protected Vector<IProject> fProjects = new Vector<>();
public MakeTargetManager() { public MakeTargetManager() {
} }
@ -181,7 +181,7 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis
public String[] getTargetBuilders(IProject project) { public String[] getTargetBuilders(IProject project) {
if (fProjects.contains(project) || hasTargetBuilder(project)) { if (fProjects.contains(project) || hasTargetBuilder(project)) {
try { try {
Vector<String> ids = new Vector<String>(); Vector<String> ids = new Vector<>();
IProjectDescription description = project.getDescription(); IProjectDescription description = project.getDescription();
ICommand commands[] = description.getBuildSpec(); ICommand commands[] = description.getBuildSpec();
for (ICommand command : commands) { for (ICommand command : commands) {
@ -334,7 +334,7 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis
} }
protected void initializeBuilders() { protected void initializeBuilders() {
builderMap = new HashMap<String, String>(); builderMap = new HashMap<>();
IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(MakeCorePlugin.PLUGIN_ID, IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(MakeCorePlugin.PLUGIN_ID,
MakeTargetManager.TARGET_BUILD_EXT); MakeTargetManager.TARGET_BUILD_EXT);
IExtension[] extensions = point.getExtensions(); IExtension[] extensions = point.getExtensions();

View file

@ -59,7 +59,7 @@ public class ProjectTargets {
private static final String BAD_TARGET = "buidlTarget"; //$NON-NLS-1$ private static final String BAD_TARGET = "buidlTarget"; //$NON-NLS-1$
private static final String TARGET = "buildTarget"; //$NON-NLS-1$ private static final String TARGET = "buildTarget"; //$NON-NLS-1$
private HashMap<IContainer, List<IMakeTarget>> targetMap = new HashMap<IContainer, List<IMakeTarget>>(); private HashMap<IContainer, List<IMakeTarget>> targetMap = new HashMap<>();
private IProject project; private IProject project;
@ -111,7 +111,7 @@ public class ProjectTargets {
} }
public void set(IContainer container, IMakeTarget[] targets) throws CoreException { public void set(IContainer container, IMakeTarget[] targets) throws CoreException {
List<IMakeTarget> newList = new ArrayList<IMakeTarget>(); List<IMakeTarget> newList = new ArrayList<>();
for (IMakeTarget target : targets) { for (IMakeTarget target : targets) {
target.setContainer(container); target.setContainer(container);
if (newList.contains(target)) { if (newList.contains(target)) {
@ -142,7 +142,7 @@ public class ProjectTargets {
MakeMessages.getString("MakeTargetManager.target_exists"), null)); //$NON-NLS-1$ MakeMessages.getString("MakeTargetManager.target_exists"), null)); //$NON-NLS-1$
} }
if (list == null) { if (list == null) {
list = new ArrayList<IMakeTarget>(); list = new ArrayList<>();
targetMap.put(target.getContainer(), list); targetMap.put(target.getContainer(), list);
} }
list.add(target); list.add(target);

View file

@ -61,7 +61,7 @@ public abstract class AbstractMakefile extends Parent implements IMakefile {
@Override @Override
public IRule[] getRules() { public IRule[] getRules() {
IDirective[] stmts = getDirectives(true); IDirective[] stmts = getDirectives(true);
List<IDirective> array = new ArrayList<IDirective>(stmts.length); List<IDirective> array = new ArrayList<>(stmts.length);
for (IDirective stmt : stmts) { for (IDirective stmt : stmts) {
if (stmt instanceof IRule) { if (stmt instanceof IRule) {
array.add(stmt); array.add(stmt);
@ -73,7 +73,7 @@ public abstract class AbstractMakefile extends Parent implements IMakefile {
@Override @Override
public IRule[] getRules(String target) { public IRule[] getRules(String target) {
IRule[] rules = getRules(); IRule[] rules = getRules();
List<IRule> array = new ArrayList<IRule>(rules.length); List<IRule> array = new ArrayList<>(rules.length);
for (IRule rule : rules) { for (IRule rule : rules) {
if (rule.getTarget().equals(target)) { if (rule.getTarget().equals(target)) {
array.add(rule); array.add(rule);
@ -85,7 +85,7 @@ public abstract class AbstractMakefile extends Parent implements IMakefile {
@Override @Override
public IInferenceRule[] getInferenceRules() { public IInferenceRule[] getInferenceRules() {
IRule[] rules = getRules(); IRule[] rules = getRules();
List<IRule> array = new ArrayList<IRule>(rules.length); List<IRule> array = new ArrayList<>(rules.length);
for (IRule rule : rules) { for (IRule rule : rules) {
if (rule instanceof IInferenceRule) { if (rule instanceof IInferenceRule) {
array.add(rule); array.add(rule);
@ -97,7 +97,7 @@ public abstract class AbstractMakefile extends Parent implements IMakefile {
@Override @Override
public IInferenceRule[] getInferenceRules(String target) { public IInferenceRule[] getInferenceRules(String target) {
IInferenceRule[] irules = getInferenceRules(); IInferenceRule[] irules = getInferenceRules();
List<IInferenceRule> array = new ArrayList<IInferenceRule>(irules.length); List<IInferenceRule> array = new ArrayList<>(irules.length);
for (IInferenceRule irule : irules) { for (IInferenceRule irule : irules) {
if (irule.getTarget().equals(target)) { if (irule.getTarget().equals(target)) {
array.add(irule); array.add(irule);
@ -109,7 +109,7 @@ public abstract class AbstractMakefile extends Parent implements IMakefile {
@Override @Override
public ITargetRule[] getTargetRules() { public ITargetRule[] getTargetRules() {
IRule[] trules = getRules(); IRule[] trules = getRules();
List<IRule> array = new ArrayList<IRule>(trules.length); List<IRule> array = new ArrayList<>(trules.length);
for (IRule trule : trules) { for (IRule trule : trules) {
if (trule instanceof ITargetRule) { if (trule instanceof ITargetRule) {
array.add(trule); array.add(trule);
@ -121,7 +121,7 @@ public abstract class AbstractMakefile extends Parent implements IMakefile {
@Override @Override
public ITargetRule[] getTargetRules(String target) { public ITargetRule[] getTargetRules(String target) {
ITargetRule[] trules = getTargetRules(); ITargetRule[] trules = getTargetRules();
List<ITargetRule> array = new ArrayList<ITargetRule>(trules.length); List<ITargetRule> array = new ArrayList<>(trules.length);
for (ITargetRule trule : trules) { for (ITargetRule trule : trules) {
if (trule.getTarget().equals(target)) { if (trule.getTarget().equals(target)) {
array.add(trule); array.add(trule);
@ -133,7 +133,7 @@ public abstract class AbstractMakefile extends Parent implements IMakefile {
@Override @Override
public IMacroDefinition[] getMacroDefinitions() { public IMacroDefinition[] getMacroDefinitions() {
IDirective[] stmts = getDirectives(true); IDirective[] stmts = getDirectives(true);
List<IDirective> array = new ArrayList<IDirective>(stmts.length); List<IDirective> array = new ArrayList<>(stmts.length);
for (IDirective stmt : stmts) { for (IDirective stmt : stmts) {
if (stmt instanceof IMacroDefinition) { if (stmt instanceof IMacroDefinition) {
array.add(stmt); array.add(stmt);
@ -145,7 +145,7 @@ public abstract class AbstractMakefile extends Parent implements IMakefile {
@Override @Override
public IMacroDefinition[] getMacroDefinitions(String name) { public IMacroDefinition[] getMacroDefinitions(String name) {
IMacroDefinition[] variables = getMacroDefinitions(); IMacroDefinition[] variables = getMacroDefinitions();
List<IMacroDefinition> array = new ArrayList<IMacroDefinition>(variables.length); List<IMacroDefinition> array = new ArrayList<>(variables.length);
for (IMacroDefinition variable : variables) { for (IMacroDefinition variable : variables) {
if (variable.getName().equals(name)) { if (variable.getName().equals(name)) {
array.add(variable); array.add(variable);
@ -157,7 +157,7 @@ public abstract class AbstractMakefile extends Parent implements IMakefile {
@Override @Override
public IMacroDefinition[] getBuiltinMacroDefinitions() { public IMacroDefinition[] getBuiltinMacroDefinitions() {
IDirective[] stmts = getBuiltins(); IDirective[] stmts = getBuiltins();
List<IDirective> array = new ArrayList<IDirective>(stmts.length); List<IDirective> array = new ArrayList<>(stmts.length);
for (IDirective stmt : stmts) { for (IDirective stmt : stmts) {
if (stmt instanceof IMacroDefinition) { if (stmt instanceof IMacroDefinition) {
array.add(stmt); array.add(stmt);
@ -169,7 +169,7 @@ public abstract class AbstractMakefile extends Parent implements IMakefile {
@Override @Override
public IMacroDefinition[] getBuiltinMacroDefinitions(String name) { public IMacroDefinition[] getBuiltinMacroDefinitions(String name) {
IMacroDefinition[] variables = getBuiltinMacroDefinitions(); IMacroDefinition[] variables = getBuiltinMacroDefinitions();
List<IMacroDefinition> array = new ArrayList<IMacroDefinition>(variables.length); List<IMacroDefinition> array = new ArrayList<>(variables.length);
for (IMacroDefinition variable : variables) { for (IMacroDefinition variable : variables) {
if (variable.getName().equals(name)) { if (variable.getName().equals(name)) {
array.add(variable); array.add(variable);
@ -180,7 +180,7 @@ public abstract class AbstractMakefile extends Parent implements IMakefile {
public IInferenceRule[] getBuiltinInferenceRules() { public IInferenceRule[] getBuiltinInferenceRules() {
IDirective[] stmts = getBuiltins(); IDirective[] stmts = getBuiltins();
List<IDirective> array = new ArrayList<IDirective>(stmts.length); List<IDirective> array = new ArrayList<>(stmts.length);
for (IDirective stmt : stmts) { for (IDirective stmt : stmts) {
if (stmt instanceof IInferenceRule) { if (stmt instanceof IInferenceRule) {
array.add(stmt); array.add(stmt);
@ -191,7 +191,7 @@ public abstract class AbstractMakefile extends Parent implements IMakefile {
public IInferenceRule[] getBuiltinInferenceRules(String target) { public IInferenceRule[] getBuiltinInferenceRules(String target) {
IInferenceRule[] irules = getBuiltinInferenceRules(); IInferenceRule[] irules = getBuiltinInferenceRules();
List<IInferenceRule> array = new ArrayList<IInferenceRule>(irules.length); List<IInferenceRule> array = new ArrayList<>(irules.length);
for (IInferenceRule irule : irules) { for (IInferenceRule irule : irules) {
if (irule.getTarget().equals(target)) { if (irule.getTarget().equals(target)) {
array.add(irule); array.add(irule);

View file

@ -26,7 +26,7 @@ import org.eclipse.cdt.make.core.makefile.IParent;
public abstract class Parent extends Directive implements IParent { public abstract class Parent extends Directive implements IParent {
ArrayList<Directive> children = new ArrayList<Directive>(); ArrayList<Directive> children = new ArrayList<>();
public Parent(Directive parent) { public Parent(Directive parent) {
super(parent); super(parent);
@ -34,7 +34,7 @@ public abstract class Parent extends Directive implements IParent {
public IDirective[] getDirectives(boolean expand) { public IDirective[] getDirectives(boolean expand) {
if (expand) { if (expand) {
List<IDirective> directives = new ArrayList<IDirective>(); List<IDirective> directives = new ArrayList<>();
getDirectives(); // populates children for class Include getDirectives(); // populates children for class Include
for (IDirective directive : children) { for (IDirective directive : children) {
directives.add(directive); directives.add(directive);

View file

@ -37,7 +37,7 @@ public abstract class Rule extends Parent implements IRule {
@Override @Override
public ICommand[] getCommands() { public ICommand[] getCommands() {
IDirective[] directives = getDirectives(); IDirective[] directives = getDirectives();
ArrayList<IDirective> cmds = new ArrayList<IDirective>(directives.length); ArrayList<IDirective> cmds = new ArrayList<>(directives.length);
for (int i = 0; i < directives.length; i++) { for (int i = 0; i < directives.length; i++) {
if (directives[i] instanceof ICommand) { if (directives[i] instanceof ICommand) {
cmds.add(directives[i]); cmds.add(directives[i]);

View file

@ -169,8 +169,8 @@ public class GNUMakefile extends AbstractMakefile implements IGNUMakefile {
protected void parse(URI fileURI, MakefileReader reader) throws IOException { protected void parse(URI fileURI, MakefileReader reader) throws IOException {
String line; String line;
Rule[] rules = null; Rule[] rules = null;
Stack<Directive> conditions = new Stack<Directive>(); Stack<Directive> conditions = new Stack<>();
Stack<VariableDefinition> defines = new Stack<VariableDefinition>(); Stack<VariableDefinition> defines = new Stack<>();
int startLine = 0; int startLine = 0;
int endLine = 0; int endLine = 0;
@ -585,7 +585,7 @@ public class GNUMakefile extends AbstractMakefile implements IGNUMakefile {
String[] directories; String[] directories;
StringTokenizer st = new StringTokenizer(line); StringTokenizer st = new StringTokenizer(line);
int count = st.countTokens(); int count = st.countTokens();
List<String> dirs = new ArrayList<String>(count); List<String> dirs = new ArrayList<>(count);
if (count > 0) { if (count > 0) {
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
if (count == 0) { if (count == 0) {

View file

@ -61,7 +61,7 @@ public class GNUMakefileChecker extends ACBuilder {
} }
} }
protected Map<IProject, IMakefileValidator> validatorMap = new HashMap<IProject, IMakefileValidator>(); protected Map<IProject, IMakefileValidator> validatorMap = new HashMap<>();
public GNUMakefileChecker() { public GNUMakefileChecker() {
} }

View file

@ -28,7 +28,7 @@ public class PosixMakefileUtil {
} }
public static String[] findTargets(String line) { public static String[] findTargets(String line) {
List<String> aList = new ArrayList<String>(); List<String> aList = new ArrayList<>();
int space; int space;
// Trim away trailing and prepending spaces. // Trim away trailing and prepending spaces.
line = line.trim(); line = line.trim();

View file

@ -100,7 +100,7 @@ public class CDataDiscoveredInfoCalculator {
void add(ILangSettingInfo info) { void add(ILangSettingInfo info) {
if (fLangInfoList == null) if (fLangInfoList == null)
fLangInfoList = new ArrayList<ILangSettingInfo>(); fLangInfoList = new ArrayList<>();
fLangInfoList.add(info); fLangInfoList.add(info);
} }
} }
@ -140,9 +140,9 @@ public class CDataDiscoveredInfoCalculator {
} }
public void add(int index, PathFilePathInfo value) { public void add(int index, PathFilePathInfo value) {
List<PathFilePathInfo> list = checkResize(index) ? new ArrayList<PathFilePathInfo>() : fStore[index]; List<PathFilePathInfo> list = checkResize(index) ? new ArrayList<>() : fStore[index];
if (list == null) { if (list == null) {
list = new ArrayList<PathFilePathInfo>(); list = new ArrayList<>();
fStore[index] = list; fStore[index] = list;
} }
@ -168,7 +168,7 @@ public class CDataDiscoveredInfoCalculator {
public List<PathFilePathInfo>[] getLists() { public List<PathFilePathInfo>[] getLists() {
int size = fMaxIndex + 1; int size = fMaxIndex + 1;
List<List<PathFilePathInfo>> list = new ArrayList<List<PathFilePathInfo>>(size); List<List<PathFilePathInfo>> list = new ArrayList<>(size);
List<PathFilePathInfo> l; List<PathFilePathInfo> l;
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
l = fStore[i]; l = fStore[i];
@ -222,13 +222,13 @@ public class CDataDiscoveredInfoCalculator {
public void add(PathFilePathInfo pInfo) { public void add(PathFilePathInfo pInfo) {
if (fPathFilePathInfoMap == null) if (fPathFilePathInfoMap == null)
fPathFilePathInfoMap = new HashMap<PathInfo, List<PathFilePathInfo>>(3); fPathFilePathInfoMap = new HashMap<>(3);
PathInfo fileInfo = pInfo.fInfo; PathInfo fileInfo = pInfo.fInfo;
List<PathFilePathInfo> list = fileInfo == fMaxMatchInfo ? fMaxMatchInfoList List<PathFilePathInfo> list = fileInfo == fMaxMatchInfo ? fMaxMatchInfoList
: fPathFilePathInfoMap.get(fileInfo); : fPathFilePathInfoMap.get(fileInfo);
if (list == null) { if (list == null) {
list = new ArrayList<PathFilePathInfo>(); list = new ArrayList<>();
fPathFilePathInfoMap.put(fileInfo, list); fPathFilePathInfoMap.put(fileInfo, list);
if (fMaxMatchInfo == null) { if (fMaxMatchInfo == null) {
fMaxMatchInfo = fileInfo; fMaxMatchInfo = fileInfo;
@ -342,7 +342,7 @@ public class CDataDiscoveredInfoCalculator {
private HashSet<String> calcExtsSet() { private HashSet<String> calcExtsSet() {
if (fExtsSet == null) if (fExtsSet == null)
fExtsSet = new HashSet<String>(Arrays.asList(fExts)); fExtsSet = new HashSet<>(Arrays.asList(fExts));
return fExtsSet; return fExtsSet;
} }
@ -468,7 +468,7 @@ public class CDataDiscoveredInfoCalculator {
void internalAdd(ExtsSetSettings setting) { void internalAdd(ExtsSetSettings setting) {
if (fExtsSetToExtsSetSettingsMap == null) { if (fExtsSetToExtsSetSettingsMap == null) {
fExtsSetToExtsSetSettingsMap = new HashMap<ExtsSet, ExtsSetSettings>(); fExtsSetToExtsSetSettingsMap = new HashMap<>();
} }
ExtsSetSettings cur = fExtsSetToExtsSetSettingsMap.get(setting.fExtsSet); ExtsSetSettings cur = fExtsSetToExtsSetSettingsMap.get(setting.fExtsSet);
@ -497,7 +497,7 @@ public class CDataDiscoveredInfoCalculator {
} }
public RcSetSettings[] getChildren(final boolean includeCurrent) { public RcSetSettings[] getChildren(final boolean includeCurrent) {
final List<Object> list = new ArrayList<Object>(); final List<Object> list = new ArrayList<>();
fContainer.accept(new IPathSettingsContainerVisitor() { fContainer.accept(new IPathSettingsContainerVisitor() {
@Override @Override
@ -561,7 +561,7 @@ public class CDataDiscoveredInfoCalculator {
String[] exts = setting.fExtsSet.fExts; String[] exts = setting.fExtsSet.fExts;
String ext; String ext;
if (map == null) { if (map == null) {
map = new HashMap<String, ExtsSetSettings>(); map = new HashMap<>();
forceAdd = true; forceAdd = true;
} }
@ -600,7 +600,7 @@ public class CDataDiscoveredInfoCalculator {
path = rcData.getPath(); path = rcData.getPath();
curRcSet = rcSet.createChild(path, rcData, false); curRcSet = rcSet.createChild(path, rcData, false);
if (rcData.getType() == ICSettingBase.SETTING_FILE) { if (rcData.getType() == ICSettingBase.SETTING_FILE) {
fileMap = new HashMap<ExtsSet, ExtsSetSettings>(1); fileMap = new HashMap<>(1);
fileSetting = createExtsSetSettings(path, (CFileData) rcData); fileSetting = createExtsSetSettings(path, (CFileData) rcData);
fileMap.put(fileSetting.fExtsSet, fileSetting); fileMap.put(fileSetting.fExtsSet, fileSetting);
curRcSet.internalSetSettingsMap(fileMap); curRcSet.internalSetSettingsMap(fileMap);
@ -672,7 +672,7 @@ public class CDataDiscoveredInfoCalculator {
private static void addLanguageInfos(RcSettingInfo rcInfo, CLanguageData[] lDatas, PathInfo info) { private static void addLanguageInfos(RcSettingInfo rcInfo, CLanguageData[] lDatas, PathInfo info) {
ArrayList<ILangSettingInfo> list = rcInfo.fLangInfoList; ArrayList<ILangSettingInfo> list = rcInfo.fLangInfoList;
if (list == null) { if (list == null) {
list = new ArrayList<ILangSettingInfo>(lDatas.length); list = new ArrayList<>(lDatas.length);
rcInfo.fLangInfoList = list; rcInfo.fLangInfoList = list;
} else { } else {
list.ensureCapacity(lDatas.length); list.ensureCapacity(lDatas.length);
@ -690,7 +690,7 @@ public class CDataDiscoveredInfoCalculator {
IPath projRelPath; IPath projRelPath;
CResourceData rcData; CResourceData rcData;
// RcSetSettings dataSetting; // RcSetSettings dataSetting;
List<RcSettingInfo> list = new ArrayList<RcSettingInfo>(pfpis.length); List<RcSettingInfo> list = new ArrayList<>(pfpis.length);
RcSettingInfo rcInfo; RcSettingInfo rcInfo;
ILangSettingInfo lInfo; ILangSettingInfo lInfo;
CLanguageData lData; CLanguageData lData;
@ -731,7 +731,7 @@ public class CDataDiscoveredInfoCalculator {
if (rcInfo == null) { if (rcInfo == null) {
rcInfo = new RcSettingInfo(rootData); rcInfo = new RcSettingInfo(rootData);
tmpList = new ArrayList<ILangSettingInfo>(lDatas.length - k); tmpList = new ArrayList<>(lDatas.length - k);
rcInfo.fLangInfoList = tmpList; rcInfo.fLangInfoList = tmpList;
} }
@ -785,7 +785,7 @@ public class CDataDiscoveredInfoCalculator {
if (lData != null) { if (lData != null) {
rcInfo = new RcSettingInfo(rcData); rcInfo = new RcSettingInfo(rcData);
lInfo = new LangSettingInfo(lData, pInfo); lInfo = new LangSettingInfo(lData, pInfo);
tmpList = new ArrayList<ILangSettingInfo>(1); tmpList = new ArrayList<>(1);
tmpList.add(lInfo); tmpList.add(lInfo);
rcInfo.fLangInfoList = tmpList; rcInfo.fLangInfoList = tmpList;
list.add(rcInfo); list.add(rcInfo);
@ -814,7 +814,7 @@ public class CDataDiscoveredInfoCalculator {
RcSetSettings settings[] = rootSetting.getChildren(true); RcSetSettings settings[] = rootSetting.getChildren(true);
RcSetSettings setting; RcSetSettings setting;
CResourceData rcData; CResourceData rcData;
List<IRcSettingInfo> resultList = new ArrayList<IRcSettingInfo>(); List<IRcSettingInfo> resultList = new ArrayList<>();
LangSettingInfo langInfo; LangSettingInfo langInfo;
RcSettingInfo rcInfo; RcSettingInfo rcInfo;
PathInfo pathInfo; PathInfo pathInfo;
@ -846,7 +846,7 @@ public class CDataDiscoveredInfoCalculator {
if (pathInfo != null) { if (pathInfo != null) {
langInfo = new LangSettingInfo(extSetting.fBaseLangData, pathInfo); langInfo = new LangSettingInfo(extSetting.fBaseLangData, pathInfo);
rcInfo = new RcSettingInfo(rcData); rcInfo = new RcSettingInfo(rcData);
rcInfo.fLangInfoList = new ArrayList<ILangSettingInfo>(1); rcInfo.fLangInfoList = new ArrayList<>(1);
rcInfo.fLangInfoList.add(langInfo); rcInfo.fLangInfoList.add(langInfo);
resultList.add(rcInfo); resultList.add(rcInfo);
} }
@ -854,7 +854,7 @@ public class CDataDiscoveredInfoCalculator {
} else { } else {
if (setting.fExtsSetToExtsSetSettingsMap.size() != 0) { if (setting.fExtsSetToExtsSetSettingsMap.size() != 0) {
rcInfo = new RcSettingInfo(rcData); rcInfo = new RcSettingInfo(rcData);
rcInfo.fLangInfoList = new ArrayList<ILangSettingInfo>(setting.fExtsSetToExtsSetSettingsMap.size()); rcInfo.fLangInfoList = new ArrayList<>(setting.fExtsSetToExtsSetSettingsMap.size());
resultList.add(rcInfo); resultList.add(rcInfo);
Collection<ExtsSetSettings> extSettings = setting.fExtsSetToExtsSetSettingsMap.values(); Collection<ExtsSetSettings> extSettings = setting.fExtsSetToExtsSetSettingsMap.values();
@ -1015,7 +1015,7 @@ public class CDataDiscoveredInfoCalculator {
private static HashMap<ExtsSet, ExtsSetSettings> createExtsSetSettingsMap(CFolderData data) { private static HashMap<ExtsSet, ExtsSetSettings> createExtsSetSettingsMap(CFolderData data) {
CLanguageData[] lDatas = data.getLanguageDatas(); CLanguageData[] lDatas = data.getLanguageDatas();
HashMap<ExtsSet, ExtsSetSettings> map = new HashMap<ExtsSet, ExtsSetSettings>(lDatas.length); HashMap<ExtsSet, ExtsSetSettings> map = new HashMap<>(lDatas.length);
ExtsSetSettings settings; ExtsSetSettings settings;
if (lDatas.length != 0) { if (lDatas.length != 0) {
@ -1032,7 +1032,7 @@ public class CDataDiscoveredInfoCalculator {
private static PathFilePathInfo[] createOrderedInfo(Map<IResource, PathInfo> map) { private static PathFilePathInfo[] createOrderedInfo(Map<IResource, PathInfo> map) {
ListIndexStore store = new ListIndexStore(10); ListIndexStore store = new ListIndexStore(10);
HashMap<PathInfo, PathInfo> infoMap = new HashMap<PathInfo, PathInfo>(); HashMap<PathInfo, PathInfo> infoMap = new HashMap<>();
// LinkedHashMap result; // LinkedHashMap result;
Set<Entry<IResource, PathInfo>> entries = map.entrySet(); Set<Entry<IResource, PathInfo>> entries = map.entrySet();

View file

@ -79,7 +79,7 @@ public class DiscoveredPathContainer implements IPathEntryContainer {
IDiscoveredPathInfo info = MakeCorePlugin.getDefault().getDiscoveryManager().getDiscoveredInfo(fProject); IDiscoveredPathInfo info = MakeCorePlugin.getDefault().getDiscoveryManager().getDiscoveredInfo(fProject);
IPath[] includes = info.getIncludePaths(); IPath[] includes = info.getIncludePaths();
Map<String, String> syms = info.getSymbols(); Map<String, String> syms = info.getSymbols();
List<IPathEntry> entries = new ArrayList<IPathEntry>(includes.length + syms.size()); List<IPathEntry> entries = new ArrayList<>(includes.length + syms.size());
for (IPath inc : includes) { for (IPath inc : includes) {
entries.add(CoreModel.newIncludeEntry(Path.EMPTY, Path.EMPTY, inc, true)); entries.add(CoreModel.newIncludeEntry(Path.EMPTY, Path.EMPTY, inc, true));
} }

View file

@ -49,8 +49,8 @@ public class DiscoveredPathInfo implements IPerProjectDiscoveredPathInfo, IDisco
public DiscoveredPathInfo(IProject project) { public DiscoveredPathInfo(IProject project) {
this.project = project; this.project = project;
discoveredPaths = new LinkedHashMap<String, Boolean>(); discoveredPaths = new LinkedHashMap<>();
discoveredSymbols = new LinkedHashMap<String, SymbolEntry>(); discoveredSymbols = new LinkedHashMap<>();
} }
@Override @Override
@ -77,12 +77,12 @@ public class DiscoveredPathInfo implements IPerProjectDiscoveredPathInfo, IDisco
@Override @Override
public LinkedHashMap<String, Boolean> getIncludeMap() { public LinkedHashMap<String, Boolean> getIncludeMap() {
return new LinkedHashMap<String, Boolean>(discoveredPaths); return new LinkedHashMap<>(discoveredPaths);
} }
@Override @Override
public synchronized void setIncludeMap(LinkedHashMap<String, Boolean> paths) { public synchronized void setIncludeMap(LinkedHashMap<String, Boolean> paths) {
discoveredPaths = SafeStringInterner.safeIntern(new LinkedHashMap<String, Boolean>(paths)); discoveredPaths = SafeStringInterner.safeIntern(new LinkedHashMap<>(paths));
activePaths = null; activePaths = null;
} }
@ -104,12 +104,12 @@ public class DiscoveredPathInfo implements IPerProjectDiscoveredPathInfo, IDisco
@Override @Override
public LinkedHashMap<String, SymbolEntry> getSymbolMap() { public LinkedHashMap<String, SymbolEntry> getSymbolMap() {
return new LinkedHashMap<String, SymbolEntry>(discoveredSymbols); return new LinkedHashMap<>(discoveredSymbols);
} }
@Override @Override
public synchronized void setSymbolMap(LinkedHashMap<String, SymbolEntry> symbols) { public synchronized void setSymbolMap(LinkedHashMap<String, SymbolEntry> symbols) {
discoveredSymbols = SafeStringInterner.safeIntern(new LinkedHashMap<String, SymbolEntry>(symbols)); discoveredSymbols = SafeStringInterner.safeIntern(new LinkedHashMap<>(symbols));
activeSymbols = null; activeSymbols = null;
} }
@ -125,14 +125,14 @@ public class DiscoveredPathInfo implements IPerProjectDiscoveredPathInfo, IDisco
private List<Path> getActivePathList() { private List<Path> getActivePathList() {
if (activePaths == null) { if (activePaths == null) {
activePaths = new ArrayList<Path>(); activePaths = new ArrayList<>();
} }
return activePaths; return activePaths;
} }
private Map<String, String> getActiveSymbolsMap() { private Map<String, String> getActiveSymbolsMap() {
if (activeSymbols == null) { if (activeSymbols == null) {
activeSymbols = new HashMap<String, String>(); activeSymbols = new HashMap<>();
} }
return activeSymbols; return activeSymbols;
} }

View file

@ -52,7 +52,7 @@ import org.eclipse.core.runtime.Status;
public class DiscoveredPathManager implements IDiscoveredPathManager, IResourceChangeListener { public class DiscoveredPathManager implements IDiscoveredPathManager, IResourceChangeListener {
private Map<IProject, DiscoveredInfoHolder> fDiscoveredInfoHolderMap = new HashMap<IProject, DiscoveredInfoHolder>(); private Map<IProject, DiscoveredInfoHolder> fDiscoveredInfoHolderMap = new HashMap<>();
private List<IDiscoveredInfoListener> listeners = Collections private List<IDiscoveredInfoListener> listeners = Collections
.synchronizedList(new ArrayList<IDiscoveredInfoListener>()); .synchronizedList(new ArrayList<IDiscoveredInfoListener>());
@ -60,7 +60,7 @@ public class DiscoveredPathManager implements IDiscoveredPathManager, IResourceC
private static final int INFO_REMOVED = 2; private static final int INFO_REMOVED = 2;
private static class DiscoveredInfoHolder { private static class DiscoveredInfoHolder {
Map<InfoContext, IDiscoveredPathInfo> fInfoMap = new HashMap<InfoContext, IDiscoveredPathInfo>(); Map<InfoContext, IDiscoveredPathInfo> fInfoMap = new HashMap<>();
// PathSettingsContainer fContainer = PathSettingsContainer.createRootContainer(); // PathSettingsContainer fContainer = PathSettingsContainer.createRootContainer();
public IDiscoveredPathInfo getInfo(InfoContext context) { public IDiscoveredPathInfo getInfo(InfoContext context) {
@ -339,7 +339,7 @@ public class DiscoveredPathManager implements IDiscoveredPathManager, IResourceC
PerFileDiscoveredPathContainer container = new PerFileDiscoveredPathContainer(project); PerFileDiscoveredPathContainer container = new PerFileDiscoveredPathContainer(project);
CoreModel.setPathEntryContainer(new ICProject[] { cProject }, container, null); CoreModel.setPathEntryContainer(new ICProject[] { cProject }, container, null);
if (changedResources != null) { if (changedResources != null) {
List<PathEntryContainerChanged> changeDelta = new ArrayList<PathEntryContainerChanged>( List<PathEntryContainerChanged> changeDelta = new ArrayList<>(
changedResources.size()); changedResources.size());
for (IResource resource : changedResources) { for (IResource resource : changedResources) {
IPath path = resource.getFullPath(); IPath path = resource.getFullPath();

View file

@ -76,7 +76,7 @@ public final class DiscoveredScannerInfoStore {
/** /**
* Caches scanner config XML Documents per project using soft references. * Caches scanner config XML Documents per project using soft references.
*/ */
private final Map<IProject, Reference<Document>> fDocumentCache = new HashMap<IProject, Reference<Document>>(); private final Map<IProject, Reference<Document>> fDocumentCache = new HashMap<>();
public static DiscoveredScannerInfoStore getInstance() { public static DiscoveredScannerInfoStore getInstance() {
if (instance == null) { if (instance == null) {
@ -179,7 +179,7 @@ public final class DiscoveredScannerInfoStore {
rootElement.setAttribute(ID_ATTR, CDESCRIPTOR_ID); rootElement.setAttribute(ID_ATTR, CDESCRIPTOR_ID);
document.appendChild(rootElement); document.appendChild(rootElement);
} }
fDocumentCache.put(project, new SoftReference<Document>(document)); fDocumentCache.put(project, new SoftReference<>(document));
} catch (IOException e) { } catch (IOException e) {
MakeCorePlugin.log(e); MakeCorePlugin.log(e);
throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), -1, throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), -1,

View file

@ -37,7 +37,7 @@ public class PerFileDiscoveredPathContainer extends DiscoveredPathContainer impl
@Override @Override
public IPathEntry[] getPathEntries(IPath path, int mask) { public IPathEntry[] getPathEntries(IPath path, int mask) {
ArrayList<IPathEntry> entries = new ArrayList<IPathEntry>(); ArrayList<IPathEntry> entries = new ArrayList<>();
try { try {
IDiscoveredPathInfo info = MakeCorePlugin.getDefault().getDiscoveryManager().getDiscoveredInfo(fProject); IDiscoveredPathInfo info = MakeCorePlugin.getDefault().getDiscoveryManager().getDiscoveredInfo(fProject);
if (info instanceof IPerFileDiscoveredPathInfo) { if (info instanceof IPerFileDiscoveredPathInfo) {

View file

@ -66,7 +66,7 @@ public final class ScannerConfigUtil {
*/ */
public static List<String> scSymbolsSymbolEntryMap2List(Map<String, SymbolEntry> sumSymbols, boolean active) { public static List<String> scSymbolsSymbolEntryMap2List(Map<String, SymbolEntry> sumSymbols, boolean active) {
Set<Entry<String, SymbolEntry>> symbols = sumSymbols.entrySet(); Set<Entry<String, SymbolEntry>> symbols = sumSymbols.entrySet();
List<String> rv = new ArrayList<String>(symbols.size()); List<String> rv = new ArrayList<>(symbols.size());
for (Entry<String, SymbolEntry> symbol : symbols) { for (Entry<String, SymbolEntry> symbol : symbols) {
SymbolEntry sEntry = symbol.getValue(); SymbolEntry sEntry = symbol.getValue();
if (active) { if (active) {
@ -85,7 +85,7 @@ public final class ScannerConfigUtil {
* @return - active symbols as a plain Map * @return - active symbols as a plain Map
*/ */
public static Map<String, String> scSymbolEntryMap2Map(Map<String, SymbolEntry> sumSymbols) { public static Map<String, String> scSymbolEntryMap2Map(Map<String, SymbolEntry> sumSymbols) {
Map<String, String> rv = new HashMap<String, String>(); Map<String, String> rv = new HashMap<>();
Set<String> keys = sumSymbols.keySet(); Set<String> keys = sumSymbols.keySet();
for (String key : keys) { for (String key : keys) {
SymbolEntry entries = sumSymbols.get(key); SymbolEntry entries = sumSymbols.get(key);
@ -216,13 +216,13 @@ public final class ScannerConfigUtil {
if (index1 == index2 || !(index1 >= 0 && index1 < size && index2 >= 0 && index2 < size)) { if (index1 == index2 || !(index1 >= 0 && index1 < size && index2 >= 0 && index2 < size)) {
return sumPaths; return sumPaths;
} }
ArrayList<String> pathKeyList = new ArrayList<String>(sumPaths.keySet()); ArrayList<String> pathKeyList = new ArrayList<>(sumPaths.keySet());
String temp1 = pathKeyList.get(index1); String temp1 = pathKeyList.get(index1);
String temp2 = pathKeyList.get(index2); String temp2 = pathKeyList.get(index2);
pathKeyList.set(index1, temp2); pathKeyList.set(index1, temp2);
pathKeyList.set(index2, temp1); pathKeyList.set(index2, temp1);
LinkedHashMap<String, SymbolEntry> newSumPaths = new LinkedHashMap<String, SymbolEntry>(sumPaths.size()); LinkedHashMap<String, SymbolEntry> newSumPaths = new LinkedHashMap<>(sumPaths.size());
for (String key : pathKeyList) { for (String key : pathKeyList) {
newSumPaths.put(key, sumPaths.get(key)); newSumPaths.put(key, sumPaths.get(key));
} }
@ -233,7 +233,7 @@ public final class ScannerConfigUtil {
* Tokenizes string with quotes * Tokenizes string with quotes
*/ */
public static String[] tokenizeStringWithQuotes(String line, String quoteStyle) { public static String[] tokenizeStringWithQuotes(String line, String quoteStyle) {
ArrayList<String> allTokens = new ArrayList<String>(); ArrayList<String> allTokens = new ArrayList<>();
String[] tokens = line.split(quoteStyle); String[] tokens = line.split(quoteStyle);
for (int i = 0; i < tokens.length; ++i) { for (int i = 0; i < tokens.length; ++i) {
if (i % 2 == 0) { // even tokens need further tokenization if (i % 2 == 0) { // even tokens need further tokenization

View file

@ -187,8 +187,8 @@ public abstract class AbstractGCCBOPConsoleParser implements IScannerInfoConsole
* @return array of commands * @return array of commands
*/ */
protected String[][] tokenize(String line, boolean escapeInsideDoubleQuotes) { protected String[][] tokenize(String line, boolean escapeInsideDoubleQuotes) {
ArrayList<String[]> commands = new ArrayList<String[]>(); ArrayList<String[]> commands = new ArrayList<>();
ArrayList<String> tokens = new ArrayList<String>(); ArrayList<String> tokens = new ArrayList<>();
StringBuilder token = new StringBuilder(); StringBuilder token = new StringBuilder();
final char[] input = line.toCharArray(); final char[] input = line.toCharArray();

View file

@ -42,8 +42,8 @@ public abstract class AbstractGCCBOPConsoleParserUtility {
*/ */
public AbstractGCCBOPConsoleParserUtility(IProject project, IPath workingDirectory, public AbstractGCCBOPConsoleParserUtility(IProject project, IPath workingDirectory,
IMarkerGenerator markerGenerator) { IMarkerGenerator markerGenerator) {
fDirectoryStack = new Vector<IPath>(); fDirectoryStack = new Vector<>();
fErrors = new ArrayList<Problem>(); fErrors = new ArrayList<>();
this.project = project; this.project = project;
fBaseDirectory = new Path(EFSExtensionManager.getDefault().getPathFromURI(project.getLocationURI())); fBaseDirectory = new Path(EFSExtensionManager.getDefault().getPathFromURI(project.getLocationURI()));
if (workingDirectory != null) { if (workingDirectory != null) {

View file

@ -138,9 +138,9 @@ public class GCCPerFileBOPConsoleParser extends AbstractGCCBOPConsoleParser {
} }
if (file != null) { if (file != null) {
CCommandDSC cmd = fUtil.getNewCCommandDSC(tokens, compilerInvocationIndex, extensionsIndex > 0); CCommandDSC cmd = fUtil.getNewCCommandDSC(tokens, compilerInvocationIndex, extensionsIndex > 0);
List<CCommandDSC> cmdList = new CopyOnWriteArrayList<CCommandDSC>(); List<CCommandDSC> cmdList = new CopyOnWriteArrayList<>();
cmdList.add(cmd); cmdList.add(cmd);
Map<ScannerInfoTypes, List<CCommandDSC>> sc = new HashMap<ScannerInfoTypes, List<CCommandDSC>>(1); Map<ScannerInfoTypes, List<CCommandDSC>> sc = new HashMap<>(1);
sc.put(ScannerInfoTypes.COMPILER_COMMAND, cmdList); sc.put(ScannerInfoTypes.COMPILER_COMMAND, cmdList);
getCollector().contributeToScannerConfig(file, sc); getCollector().contributeToScannerConfig(file, sc);
} else } else

View file

@ -61,7 +61,7 @@ public class GCCPerFileBOPConsoleParserUtility extends AbstractGCCBOPConsolePars
String workingDir = getWorkingDirectory().toString(); String workingDir = getWorkingDirectory().toString();
List<Map<String, List<String>>> directoryCommandList = directoryCommandListMap.get(workingDir); List<Map<String, List<String>>> directoryCommandList = directoryCommandListMap.get(workingDir);
if (directoryCommandList == null) { if (directoryCommandList == null) {
directoryCommandList = new CopyOnWriteArrayList<Map<String, List<String>>>(); directoryCommandList = new CopyOnWriteArrayList<>();
directoryCommandListMap.put(workingDir, directoryCommandList); directoryCommandListMap.put(workingDir, directoryCommandList);
++workingDirsN; ++workingDirsN;
} }
@ -77,10 +77,10 @@ public class GCCPerFileBOPConsoleParserUtility extends AbstractGCCBOPConsolePars
return; return;
} }
} }
command21FileListMap = new HashMap<String, List<String>>(1); command21FileListMap = new HashMap<>(1);
directoryCommandList.add(command21FileListMap); directoryCommandList.add(command21FileListMap);
++commandsN; ++commandsN;
List<String> fileList = new CopyOnWriteArrayList<String>(); List<String> fileList = new CopyOnWriteArrayList<>();
command21FileListMap.put(genericCommand, fileList); command21FileListMap.put(genericCommand, fileList);
fileList.add(longFileName); fileList.add(longFileName);
++filesN; ++filesN;
@ -123,8 +123,8 @@ public class GCCPerFileBOPConsoleParserUtility extends AbstractGCCBOPConsolePars
* @return CCommandDSC compile command description * @return CCommandDSC compile command description
*/ */
public CCommandDSC getNewCCommandDSC(String[] tokens, final int idxOfCompilerCommand, boolean cppFileType) { public CCommandDSC getNewCCommandDSC(String[] tokens, final int idxOfCompilerCommand, boolean cppFileType) {
CopyOnWriteArrayList<KVStringPair> dirafter = new CopyOnWriteArrayList<KVStringPair>(); CopyOnWriteArrayList<KVStringPair> dirafter = new CopyOnWriteArrayList<>();
CopyOnWriteArrayList<String> includes = new CopyOnWriteArrayList<String>(); CopyOnWriteArrayList<String> includes = new CopyOnWriteArrayList<>();
CCommandDSC command = new CCommandDSC(cppFileType, getProject()); CCommandDSC command = new CCommandDSC(cppFileType, getProject());
command.addSCOption(new KVStringPair(SCDOptionsEnum.COMMAND.toString(), tokens[idxOfCompilerCommand])); command.addSCOption(new KVStringPair(SCDOptionsEnum.COMMAND.toString(), tokens[idxOfCompilerCommand]));
for (int i = idxOfCompilerCommand + 1; i < tokens.length; ++i) { for (int i = idxOfCompilerCommand + 1; i < tokens.length; ++i) {
@ -161,7 +161,7 @@ public class GCCPerFileBOPConsoleParserUtility extends AbstractGCCBOPConsolePars
KVStringPair pair = new KVStringPair(SCDOptionsEnum.IQUOTE.toString(), option); KVStringPair pair = new KVStringPair(SCDOptionsEnum.IQUOTE.toString(), option);
command.addSCOption(pair); command.addSCOption(pair);
} }
includes = new CopyOnWriteArrayList<String>(); includes = new CopyOnWriteArrayList<>();
// -I- has no parameter // -I- has no parameter
} else { } else {
// ex. -I /dir // ex. -I /dir
@ -279,7 +279,7 @@ public class GCCPerFileBOPConsoleParserUtility extends AbstractGCCBOPConsolePars
* @return List of CCommandDSC * @return List of CCommandDSC
*/ */
public List<CCommandDSC> getCCommandDSCList() { public List<CCommandDSC> getCCommandDSCList() {
return new CopyOnWriteArrayList<CCommandDSC>(commandsList2); return new CopyOnWriteArrayList<>(commandsList2);
} }
} }

View file

@ -71,11 +71,11 @@ public class GCCPerFileSIPConsoleParser implements IScannerInfoConsoleParser {
if (line.startsWith(COMMAND_ID_BEGIN)) { if (line.startsWith(COMMAND_ID_BEGIN)) {
commandId = Integer.parseInt(line.substring(COMMAND_ID_BEGIN.length())); commandId = Integer.parseInt(line.substring(COMMAND_ID_BEGIN.length()));
symbols = new ArrayList<String>(); symbols = new ArrayList<>();
includes = new ArrayList<String>(); includes = new ArrayList<>();
quoteIncludes = new ArrayList<String>(); quoteIncludes = new ArrayList<>();
} else if (line.startsWith(COMMAND_ID_END)) { } else if (line.startsWith(COMMAND_ID_END)) {
Map<ScannerInfoTypes, List<String>> scannerInfo = new HashMap<ScannerInfoTypes, List<String>>(); Map<ScannerInfoTypes, List<String>> scannerInfo = new HashMap<>();
scannerInfo.put(ScannerInfoTypes.INCLUDE_PATHS, includes); scannerInfo.put(ScannerInfoTypes.INCLUDE_PATHS, includes);
scannerInfo.put(ScannerInfoTypes.QUOTE_INCLUDE_PATHS, quoteIncludes); scannerInfo.put(ScannerInfoTypes.QUOTE_INCLUDE_PATHS, quoteIncludes);
scannerInfo.put(ScannerInfoTypes.SYMBOL_DEFINITIONS, symbols); scannerInfo.put(ScannerInfoTypes.SYMBOL_DEFINITIONS, symbols);

View file

@ -74,9 +74,9 @@ public class GCCScannerInfoConsoleParser extends AbstractGCCBOPConsoleParser {
} }
// Recognized gcc or g++ compiler invocation // Recognized gcc or g++ compiler invocation
List<String> includes = new CopyOnWriteArrayList<String>(); List<String> includes = new CopyOnWriteArrayList<>();
List<String> symbols = new CopyOnWriteArrayList<String>(); List<String> symbols = new CopyOnWriteArrayList<>();
List<String> targetSpecificOptions = new CopyOnWriteArrayList<String>(); List<String> targetSpecificOptions = new CopyOnWriteArrayList<>();
String fileName = null; String fileName = null;
for (int j = compilerInvocationIdx + 1; j < tokens.length; j++) { for (int j = compilerInvocationIdx + 1; j < tokens.length; j++) {
@ -165,7 +165,7 @@ public class GCCScannerInfoConsoleParser extends AbstractGCCBOPConsoleParser {
IProject project = getProject(); IProject project = getProject();
IFile file = null; IFile file = null;
List<String> translatedIncludes = new LinkedList<String>(); List<String> translatedIncludes = new LinkedList<>();
translatedIncludes.addAll(includes); translatedIncludes.addAll(includes);
if (includes.size() > 0) { if (includes.size() > 0) {
if (fUtil != null) { if (fUtil != null) {
@ -188,11 +188,11 @@ public class GCCScannerInfoConsoleParser extends AbstractGCCBOPConsoleParser {
} }
} }
CopyOnWriteArrayList<String> translatedIncludesToPut = new CopyOnWriteArrayList<String>(translatedIncludes); CopyOnWriteArrayList<String> translatedIncludesToPut = new CopyOnWriteArrayList<>(translatedIncludes);
// Contribute discovered includes and symbols to the ScannerInfoCollector // Contribute discovered includes and symbols to the ScannerInfoCollector
if (translatedIncludesToPut.size() > 0 || symbols.size() > 0) { if (translatedIncludesToPut.size() > 0 || symbols.size() > 0) {
Map<ScannerInfoTypes, List<String>> scannerInfo = new HashMap<ScannerInfoTypes, List<String>>(); Map<ScannerInfoTypes, List<String>> scannerInfo = new HashMap<>();
scannerInfo.put(ScannerInfoTypes.INCLUDE_PATHS, translatedIncludesToPut); scannerInfo.put(ScannerInfoTypes.INCLUDE_PATHS, translatedIncludesToPut);
scannerInfo.put(ScannerInfoTypes.SYMBOL_DEFINITIONS, symbols); scannerInfo.put(ScannerInfoTypes.SYMBOL_DEFINITIONS, symbols);
scannerInfo.put(ScannerInfoTypes.TARGET_SPECIFIC_OPTION, targetSpecificOptions); scannerInfo.put(ScannerInfoTypes.TARGET_SPECIFIC_OPTION, targetSpecificOptions);

View file

@ -44,8 +44,8 @@ public class GCCSpecsConsoleParser implements IScannerInfoConsoleParser {
protected IScannerInfoCollector fCollector = null; protected IScannerInfoCollector fCollector = null;
private boolean expectingIncludes = false; private boolean expectingIncludes = false;
protected List<String> symbols = new ArrayList<String>(); protected List<String> symbols = new ArrayList<>();
protected List<String> includes = new ArrayList<String>(); protected List<String> includes = new ArrayList<>();
@Override @Override
public void startup(IProject project, IPath workingDirectory, IScannerInfoCollector collector, public void startup(IProject project, IPath workingDirectory, IScannerInfoCollector collector,
@ -120,7 +120,7 @@ public class GCCSpecsConsoleParser implements IScannerInfoConsoleParser {
*/ */
@Override @Override
public void shutdown() { public void shutdown() {
Map<ScannerInfoTypes, List<String>> scannerInfo = new HashMap<ScannerInfoTypes, List<String>>(); Map<ScannerInfoTypes, List<String>> scannerInfo = new HashMap<>();
scannerInfo.put(ScannerInfoTypes.INCLUDE_PATHS, includes); scannerInfo.put(ScannerInfoTypes.INCLUDE_PATHS, includes);
scannerInfo.put(ScannerInfoTypes.SYMBOL_DEFINITIONS, symbols); scannerInfo.put(ScannerInfoTypes.SYMBOL_DEFINITIONS, symbols);
if (fCollector != null) { if (fCollector != null) {

View file

@ -53,9 +53,9 @@ public class ScannerInfoConsoleParserUtility extends AbstractGCCBOPConsoleParser
public ScannerInfoConsoleParserUtility(IProject project, IPath workingDirectory, IMarkerGenerator markerGenerator) { public ScannerInfoConsoleParserUtility(IProject project, IPath workingDirectory, IMarkerGenerator markerGenerator) {
super(project, workingDirectory, markerGenerator); super(project, workingDirectory, markerGenerator);
fFilesInProject = new HashMap<String, IFile>(); fFilesInProject = new HashMap<>();
fCollectedFiles = new ArrayList<IResource>(); fCollectedFiles = new ArrayList<>();
fNameConflicts = new ArrayList<String>(); fNameConflicts = new ArrayList<>();
collectFiles(getProject(), fCollectedFiles); collectFiles(getProject(), fCollectedFiles);
@ -188,7 +188,7 @@ public class ScannerInfoConsoleParserUtility extends AbstractGCCBOPConsoleParser
} }
public List<String> translateRelativePaths(IFile file, String fileName, List<String> includes) { public List<String> translateRelativePaths(IFile file, String fileName, List<String> includes) {
List<String> translatedIncludes = new ArrayList<String>(includes.size()); List<String> translatedIncludes = new ArrayList<>(includes.size());
for (String include : includes) { for (String include : includes) {
IPath includePath = new Path(include); IPath includePath = new Path(include);
if (includePath.isUNC()) { if (includePath.isUNC()) {

View file

@ -63,13 +63,13 @@ public class CCommandDSC {
} }
public CCommandDSC(boolean cppFileType, IProject project) { public CCommandDSC(boolean cppFileType, IProject project) {
compilerCommand = new ArrayList<KVStringPair>(); compilerCommand = new ArrayList<>();
discovered = false; discovered = false;
this.cppFileType = cppFileType; this.cppFileType = cppFileType;
symbols = new ArrayList<String>(); symbols = new ArrayList<>();
includes = new ArrayList<String>(); includes = new ArrayList<>();
quoteIncludes = new ArrayList<String>(); quoteIncludes = new ArrayList<>();
this.project = project; this.project = project;
} }
@ -181,7 +181,7 @@ public class CCommandDSC {
* @return list of strings * @return list of strings
*/ */
public List<String> getImacrosFile() { public List<String> getImacrosFile() {
List<String> imacrosFiles = new ArrayList<String>(); List<String> imacrosFiles = new ArrayList<>();
for (Iterator<KVStringPair> i = compilerCommand.iterator(); i.hasNext();) { for (Iterator<KVStringPair> i = compilerCommand.iterator(); i.hasNext();) {
KVStringPair optionPair = i.next(); KVStringPair optionPair = i.next();
if (optionPair.getKey().equals(SCDOptionsEnum.IMACROS_FILE.toString())) { if (optionPair.getKey().equals(SCDOptionsEnum.IMACROS_FILE.toString())) {
@ -195,7 +195,7 @@ public class CCommandDSC {
* @return list of strings * @return list of strings
*/ */
public List<String> getIncludeFile() { public List<String> getIncludeFile() {
List<String> includeFiles = new ArrayList<String>(); List<String> includeFiles = new ArrayList<>();
for (Iterator<KVStringPair> i = compilerCommand.iterator(); i.hasNext();) { for (Iterator<KVStringPair> i = compilerCommand.iterator(); i.hasNext();) {
KVStringPair optionPair = i.next(); KVStringPair optionPair = i.next();
if (optionPair.getKey().equals(SCDOptionsEnum.INCLUDE_FILE.toString())) { if (optionPair.getKey().equals(SCDOptionsEnum.INCLUDE_FILE.toString())) {
@ -362,9 +362,9 @@ public class CCommandDSC {
public void resolveOptions(IProject project) { public void resolveOptions(IProject project) {
if (!isDiscovered()) { if (!isDiscovered()) {
// that's wrong for sure, options cannot be resolved fron the optionPairs?? // that's wrong for sure, options cannot be resolved fron the optionPairs??
ArrayList<String> symbols = new ArrayList<String>(); ArrayList<String> symbols = new ArrayList<>();
ArrayList<String> includes = new ArrayList<String>(); ArrayList<String> includes = new ArrayList<>();
ArrayList<String> quoteincludes = new ArrayList<String>(); ArrayList<String> quoteincludes = new ArrayList<>();
for (Iterator<KVStringPair> options = compilerCommand.iterator(); options.hasNext();) { for (Iterator<KVStringPair> options = compilerCommand.iterator(); options.hasNext();) {
KVStringPair optionPair = options.next(); KVStringPair optionPair = options.next();
String key = optionPair.getKey(); String key = optionPair.getKey();
@ -410,7 +410,7 @@ public class CCommandDSC {
} }
public static List<String> makeRelative(IProject project, List<String> paths) { public static List<String> makeRelative(IProject project, List<String> paths) {
List<String> list = new ArrayList<String>(paths.size()); List<String> list = new ArrayList<>(paths.size());
for (Iterator<String> iter = paths.iterator(); iter.hasNext();) { for (Iterator<String> iter = paths.iterator(); iter.hasNext();) {
String path = iter.next(); String path = iter.next();
path = makeRelative(project, new Path(path)).toOSString(); path = makeRelative(project, new Path(path)).toOSString();
@ -439,7 +439,7 @@ public class CCommandDSC {
} }
public static List<String> makeAbsolute(IProject project, List<String> paths) { public static List<String> makeAbsolute(IProject project, List<String> paths) {
List<String> list = new ArrayList<String>(paths.size()); List<String> list = new ArrayList<>(paths.size());
for (Iterator<String> iter = paths.iterator(); iter.hasNext();) { for (Iterator<String> iter = paths.iterator(); iter.hasNext();) {
String path = iter.next(); String path = iter.next();
path = makeAbsolute(project, path); path = makeAbsolute(project, path);

View file

@ -111,7 +111,7 @@ public class CygpathTranslator {
useCygwinFromPath = Cygwin.isAvailable(envPath); useCygwinFromPath = Cygwin.isAvailable(envPath);
} }
List<String> translatedIncludePaths = new ArrayList<String>(); List<String> translatedIncludePaths = new ArrayList<>();
for (Iterator<String> i = sumIncludes.iterator(); i.hasNext();) { for (Iterator<String> i = sumIncludes.iterator(); i.hasNext();) {
String includePath = i.next(); String includePath = i.next();
IPath realPath = new Path(includePath); IPath realPath = new Path(includePath);

View file

@ -37,7 +37,7 @@ public class SymbolEntry {
public SymbolEntry(String name, String value, boolean active) { public SymbolEntry(String name, String value, boolean active) {
this.name = SafeStringInterner.safeIntern(name); this.name = SafeStringInterner.safeIntern(name);
if (values == null) { if (values == null) {
values = new LinkedHashMap<String, Boolean>(1); values = new LinkedHashMap<>(1);
} }
values.put(SafeStringInterner.safeIntern(value), Boolean.valueOf(active)); values.put(SafeStringInterner.safeIntern(value), Boolean.valueOf(active));
} }
@ -88,7 +88,7 @@ public class SymbolEntry {
* @return List * @return List
*/ */
private List<String> get(boolean format, boolean subset, boolean active) { private List<String> get(boolean format, boolean subset, boolean active) {
List<String> rv = new ArrayList<String>(values.size()); List<String> rv = new ArrayList<>(values.size());
for (String val : values.keySet()) { for (String val : values.keySet()) {
if (subset && (values.get(val)).booleanValue() != active) if (subset && (values.get(val)).booleanValue() != active)
continue; continue;
@ -106,7 +106,7 @@ public class SymbolEntry {
* @return List * @return List
*/ */
public List<String> getValuesOnly(boolean active) { public List<String> getValuesOnly(boolean active) {
List<String> rv = new ArrayList<String>(values.size()); List<String> rv = new ArrayList<>(values.size());
for (Object element : values.keySet()) { for (Object element : values.keySet()) {
String val = (String) element; String val = (String) element;
if ((values.get(val)).booleanValue() == active) { if ((values.get(val)).booleanValue() == active) {

View file

@ -131,7 +131,7 @@ public class DefaultRunSIProvider implements IExternalScannerInfoProvider {
ErrorParserManager epm = new ErrorParserManager(project, markerGenerator, ErrorParserManager epm = new ErrorParserManager(project, markerGenerator,
new String[] { GMAKE_ERROR_PARSER_ID }); new String[] { GMAKE_ERROR_PARSER_ID });
List<IConsoleParser> parsers = new ArrayList<IConsoleParser>(); List<IConsoleParser> parsers = new ArrayList<>();
IConsoleParser parser = ScannerInfoConsoleParserFactory.getESIConsoleParser(project, context, IConsoleParser parser = ScannerInfoConsoleParserFactory.getESIConsoleParser(project, context,
providerId, buildInfo, collector, markerGenerator); providerId, buildInfo, collector, markerGenerator);
if (parser != null) { if (parser != null) {
@ -229,7 +229,7 @@ public class DefaultRunSIProvider implements IExternalScannerInfoProvider {
protected String[] setEnvironment(ICommandLauncher launcher, Properties initialEnv) { protected String[] setEnvironment(ICommandLauncher launcher, Properties initialEnv) {
Properties props = getEnvMap(launcher, initialEnv); Properties props = getEnvMap(launcher, initialEnv);
String[] env = null; String[] env = null;
ArrayList<String> envList = new ArrayList<String>(); ArrayList<String> envList = new ArrayList<>();
Enumeration<?> names = props.propertyNames(); Enumeration<?> names = props.propertyNames();
if (names != null) { if (names != null) {
while (names.hasMoreElements()) { while (names.hasMoreElements()) {

View file

@ -75,9 +75,9 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
protected final Map<Integer, CCommandDSC> commandIdCommandMap; // map of all commands protected final Map<Integer, CCommandDSC> commandIdCommandMap; // map of all commands
public ScannerInfoData() { public ScannerInfoData() {
commandIdCommandMap = new LinkedHashMap<Integer, CCommandDSC>(); // [commandId, command] commandIdCommandMap = new LinkedHashMap<>(); // [commandId, command]
fileToCommandIdMap = new HashMap<IFile, Integer>(); // [file, commandId] fileToCommandIdMap = new HashMap<>(); // [file, commandId]
commandIdToFilesMap = new HashMap<Integer, Set<IFile>>(); // [commandId, set of files] commandIdToFilesMap = new HashMap<>(); // [commandId, set of files]
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -88,7 +88,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
synchronized (PerFileSICollector.this.fLock) { synchronized (PerFileSICollector.this.fLock) {
Document doc = collectorElem.getOwnerDocument(); Document doc = collectorElem.getOwnerDocument();
List<Integer> commandIds = new ArrayList<Integer>(commandIdCommandMap.keySet()); List<Integer> commandIds = new ArrayList<>(commandIdCommandMap.keySet());
Collections.sort(commandIds); Collections.sort(commandIds);
for (Integer commandId : commandIds) { for (Integer commandId : commandIds) {
CCommandDSC command = commandIdCommandMap.get(commandId); CCommandDSC command = commandIdCommandMap.get(commandId);
@ -201,10 +201,10 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
sid = new ScannerInfoData(); sid = new ScannerInfoData();
// siChangedForFileList = new ArrayList(); // siChangedForFileList = new ArrayList();
siChangedForFileMap = new HashMap<IFile, Integer>(); siChangedForFileMap = new HashMap<>();
siChangedForCommandIdList = new ArrayList<Integer>(); siChangedForCommandIdList = new ArrayList<>();
freeCommandIdPool = new TreeSet<Integer>(); freeCommandIdPool = new TreeSet<>();
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -300,7 +300,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
protected void addCompilerCommand(IFile file, CCommandDSC cmd) { protected void addCompilerCommand(IFile file, CCommandDSC cmd) {
assert Thread.holdsLock(fLock); assert Thread.holdsLock(fLock);
List<CCommandDSC> existingCommands = new ArrayList<CCommandDSC>(sid.commandIdCommandMap.values()); List<CCommandDSC> existingCommands = new ArrayList<>(sid.commandIdCommandMap.values());
int index = existingCommands.indexOf(cmd); int index = existingCommands.indexOf(cmd);
if (index != -1) { if (index != -1) {
cmd = existingCommands.get(index); cmd = existingCommands.get(index);
@ -344,7 +344,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
// update sid.commandIdToFilesMap // update sid.commandIdToFilesMap
Set<IFile> fileSet = sid.commandIdToFilesMap.get(commandId); Set<IFile> fileSet = sid.commandIdToFilesMap.get(commandId);
if (fileSet == null) { if (fileSet == null) {
fileSet = new HashSet<IFile>(); fileSet = new HashSet<>();
sid.commandIdToFilesMap.put(commandId, fileSet); sid.commandIdToFilesMap.put(commandId, fileSet);
CCommandDSC cmd = sid.commandIdCommandMap.get(commandId); CCommandDSC cmd = sid.commandIdCommandMap.get(commandId);
if (cmd != null) { if (cmd != null) {
@ -435,7 +435,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
if (scannerInfoChanged()) { if (scannerInfoChanged()) {
applyFileDeltas(); applyFileDeltas();
removeUnusedCommands(); removeUnusedCommands();
changedResources = new ArrayList<IResource>(siChangedForFileMap.keySet()); changedResources = new ArrayList<>(siChangedForFileMap.keySet());
siChangedForFileMap.clear(); siChangedForFileMap.clear();
} }
siChangedForCommandIdList.clear(); siChangedForCommandIdList.clear();
@ -480,7 +480,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
*/ */
@Override @Override
public List<CCommandDSC> getCollectedScannerInfo(Object resource, ScannerInfoTypes type) { public List<CCommandDSC> getCollectedScannerInfo(Object resource, ScannerInfoTypes type) {
List<CCommandDSC> rv = new ArrayList<CCommandDSC>(); List<CCommandDSC> rv = new ArrayList<>();
// check the resource // check the resource
String errorMessage = null; String errorMessage = null;
if (resource == null) { if (resource == null) {
@ -628,7 +628,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
if (includepaths == null || includepaths.length == 0) { if (includepaths == null || includepaths.length == 0) {
return quotepaths; return quotepaths;
} }
ArrayList<IPath> result = new ArrayList<IPath>(includepaths.length + quotepaths.length); ArrayList<IPath> result = new ArrayList<>(includepaths.length + quotepaths.length);
result.addAll(Arrays.asList(includepaths)); result.addAll(Arrays.asList(includepaths));
result.addAll(Arrays.asList(quotepaths)); result.addAll(Arrays.asList(quotepaths));
return result.toArray(new IPath[result.size()]); return result.toArray(new IPath[result.size()]);
@ -693,7 +693,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
CCommandDSC cmd = getCommand(path); CCommandDSC cmd = getCommand(path);
if (cmd != null && cmd.isDiscovered()) { if (cmd != null && cmd.isDiscovered()) {
List<String> symbols = cmd.getSymbols(); List<String> symbols = cmd.getSymbols();
Map<String, String> definedSymbols = new HashMap<String, String>(symbols.size()); Map<String, String> definedSymbols = new HashMap<>(symbols.size());
for (String symbol : symbols) { for (String symbol : symbols) {
String key = SafeStringInterner.safeIntern(ScannerConfigUtil.getSymbolKey(symbol)); String key = SafeStringInterner.safeIntern(ScannerConfigUtil.getSymbolKey(symbol));
String value = SafeStringInterner.safeIntern(ScannerConfigUtil.getSymbolValue(symbol)); String value = SafeStringInterner.safeIntern(ScannerConfigUtil.getSymbolValue(symbol));
@ -789,7 +789,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
protected Map<IResource, PathInfo> calculatePathInfoMap() { protected Map<IResource, PathInfo> calculatePathInfoMap() {
assert Thread.holdsLock(fLock); assert Thread.holdsLock(fLock);
Map<IResource, PathInfo> map = new HashMap<IResource, PathInfo>(sid.fileToCommandIdMap.size() + 1); Map<IResource, PathInfo> map = new HashMap<>(sid.fileToCommandIdMap.size() + 1);
Set<Entry<IFile, Integer>> entrySet = sid.fileToCommandIdMap.entrySet(); Set<Entry<IFile, Integer>> entrySet = sid.fileToCommandIdMap.entrySet();
for (Entry<IFile, Integer> entry : entrySet) { for (Entry<IFile, Integer> entry : entrySet) {
IFile file = entry.getKey(); IFile file = entry.getKey();
@ -821,7 +821,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
IPath[] incFiles = stringListToPathArray(cmd.getIncludeFile()); IPath[] incFiles = stringListToPathArray(cmd.getIncludeFile());
IPath[] macroFiles = stringListToPathArray(cmd.getImacrosFile()); IPath[] macroFiles = stringListToPathArray(cmd.getImacrosFile());
List<String> symbols = cmd.getSymbols(); List<String> symbols = cmd.getSymbols();
Map<String, String> definedSymbols = new HashMap<String, String>(symbols.size()); Map<String, String> definedSymbols = new HashMap<>(symbols.size());
for (String symbol : symbols) { for (String symbol : symbols) {
String key = ScannerConfigUtil.getSymbolKey(symbol); String key = ScannerConfigUtil.getSymbolKey(symbol);
String value = ScannerConfigUtil.getSymbolValue(symbol); String value = ScannerConfigUtil.getSymbolValue(symbol);
@ -862,7 +862,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
* @return list of IPath(s). * @return list of IPath(s).
*/ */
protected IPath[] getAllIncludePaths(int type) { protected IPath[] getAllIncludePaths(int type) {
List<String> allIncludes = new ArrayList<String>(); List<String> allIncludes = new ArrayList<>();
Set<Integer> cmdIds = sid.commandIdCommandMap.keySet(); Set<Integer> cmdIds = sid.commandIdCommandMap.keySet();
for (Integer cmdId : cmdIds) { for (Integer cmdId : cmdIds) {
CCommandDSC cmd = sid.commandIdCommandMap.get(cmdId); CCommandDSC cmd = sid.commandIdCommandMap.get(cmdId);
@ -882,7 +882,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
discovered = cmd.getImacrosFile(); discovered = cmd.getImacrosFile();
break; break;
default: default:
discovered = new ArrayList<String>(0); discovered = new ArrayList<>(0);
} }
for (String include : discovered) { for (String include : discovered) {
// the following line degrades perfomance // the following line degrades perfomance
@ -899,7 +899,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
} }
protected static IPath[] stringListToPathArray(List<String> discovered) { protected static IPath[] stringListToPathArray(List<String> discovered) {
List<Path> allIncludes = new ArrayList<Path>(discovered.size()); List<Path> allIncludes = new ArrayList<>(discovered.size());
for (String include : discovered) { for (String include : discovered) {
if (!allIncludes.contains(include)) { if (!allIncludes.contains(include)) {
allIncludes.add(new Path(include)); allIncludes.add(new Path(include));
@ -910,7 +910,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
protected Map<String, String> getAllSymbols() { protected Map<String, String> getAllSymbols() {
assert Thread.holdsLock(fLock); assert Thread.holdsLock(fLock);
Map<String, String> symbols = new HashMap<String, String>(); Map<String, String> symbols = new HashMap<>();
Set<Integer> cmdIds = sid.commandIdCommandMap.keySet(); Set<Integer> cmdIds = sid.commandIdCommandMap.keySet();
for (Integer cmdId : cmdIds) { for (Integer cmdId : cmdIds) {
CCommandDSC cmd = sid.commandIdCommandMap.get(cmdId); CCommandDSC cmd = sid.commandIdCommandMap.get(cmdId);

View file

@ -85,13 +85,13 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
protected boolean scPersisted = false; protected boolean scPersisted = false;
public PerProjectSICollector() { public PerProjectSICollector() {
discoveredSI = new HashMap<ScannerInfoTypes, List<String>>(); discoveredSI = new HashMap<>();
// discoveredIncludes = new ArrayList(); // discoveredIncludes = new ArrayList();
// discoveredSymbols = new ArrayList(); // discoveredSymbols = new ArrayList();
// discoveredTSO = new ArrayList(); // discoveredTSO = new ArrayList();
// //
sumDiscoveredIncludes = new ArrayList<String>(); sumDiscoveredIncludes = new ArrayList<>();
sumDiscoveredSymbols = new LinkedHashMap<String, SymbolEntry>(); sumDiscoveredSymbols = new LinkedHashMap<>();
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -151,7 +151,7 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
List<String> discovered = discoveredSI.get(siType); List<String> discovered = discoveredSI.get(siType);
if (discovered == null) { if (discovered == null) {
discovered = new ArrayList<String>(delta); discovered = new ArrayList<>(delta);
discoveredSI.put(siType, discovered); discoveredSI.put(siType, discovered);
} else { } else {
final boolean addSorted = !isBuiltinConfig && siType.equals(ScannerInfoTypes.INCLUDE_PATHS); final boolean addSorted = !isBuiltinConfig && siType.equals(ScannerInfoTypes.INCLUDE_PATHS);
@ -224,7 +224,7 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
monitor.subTask(MakeMessages.getString("ScannerInfoCollector.Updating") + project.getName()); //$NON-NLS-1$ monitor.subTask(MakeMessages.getString("ScannerInfoCollector.Updating") + project.getName()); //$NON-NLS-1$
try { try {
// update scanner configuration // update scanner configuration
List<IResource> resourceDelta = new ArrayList<IResource>(1); List<IResource> resourceDelta = new ArrayList<>(1);
resourceDelta.add(project); resourceDelta.add(project);
MakeCorePlugin.getDefault().getDiscoveryManager().updateDiscoveredInfo(context, pathInfo, MakeCorePlugin.getDefault().getDiscoveryManager().updateDiscoveredInfo(context, pathInfo,
context.isDefaultContext(), resourceDelta); context.isDefaultContext(), resourceDelta);
@ -275,12 +275,12 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
// Step 3. Merge scanner config from steps 1 and 2 // Step 3. Merge scanner config from steps 1 and 2
// order is important, use list to preserve it // order is important, use list to preserve it
ArrayList<String> persistedKeyList = new ArrayList<String>(persistedIncludes.keySet()); ArrayList<String> persistedKeyList = new ArrayList<>(persistedIncludes.keySet());
addedIncludes = addItemsWithOrder(persistedKeyList, finalSumIncludes, true); addedIncludes = addItemsWithOrder(persistedKeyList, finalSumIncludes, true);
LinkedHashMap<String, Boolean> newPersistedIncludes; LinkedHashMap<String, Boolean> newPersistedIncludes;
if (addedIncludes) { if (addedIncludes) {
newPersistedIncludes = new LinkedHashMap<String, Boolean>(persistedKeyList.size()); newPersistedIncludes = new LinkedHashMap<>(persistedKeyList.size());
for (String include : persistedKeyList) { for (String include : persistedKeyList) {
if (persistedIncludes.containsKey(include)) { if (persistedIncludes.containsKey(include)) {
newPersistedIncludes.put(include, persistedIncludes.get(include)); newPersistedIncludes.put(include, persistedIncludes.get(include));
@ -338,7 +338,7 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
LinkedHashMap<String, SymbolEntry> persistedSymbols = discPathInfo.getSymbolMap(); LinkedHashMap<String, SymbolEntry> persistedSymbols = discPathInfo.getSymbolMap();
// Step 3. Merge scanner config from steps 1 and 2 // Step 3. Merge scanner config from steps 1 and 2
LinkedHashMap<String, SymbolEntry> candidateSymbols = new LinkedHashMap<String, SymbolEntry>( LinkedHashMap<String, SymbolEntry> candidateSymbols = new LinkedHashMap<>(
persistedSymbols); persistedSymbols);
addedSymbols |= ScannerConfigUtil.scAddSymbolEntryMap2SymbolEntryMap(candidateSymbols, addedSymbols |= ScannerConfigUtil.scAddSymbolEntryMap2SymbolEntryMap(candidateSymbols,
sumDiscoveredSymbols); sumDiscoveredSymbols);
@ -519,7 +519,7 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
ICProject cProject = CoreModel.getDefault().create(project); ICProject cProject = CoreModel.getDefault().create(project);
if (cProject != null) { if (cProject != null) {
IPathEntry[] entries = cProject.getRawPathEntries(); IPathEntry[] entries = cProject.getRawPathEntries();
List<IPathEntry> newEntries = new ArrayList<IPathEntry>(Arrays.asList(entries)); List<IPathEntry> newEntries = new ArrayList<>(Arrays.asList(entries));
if (!newEntries.contains(container)) { if (!newEntries.contains(container)) {
newEntries.add(container); newEntries.add(container);
cProject.setRawPathEntries(newEntries.toArray(new IPathEntry[newEntries.size()]), monitor); cProject.setRawPathEntries(newEntries.toArray(new IPathEntry[newEntries.size()]), monitor);

View file

@ -122,7 +122,7 @@ public class SCMarkerGenerator implements IMarkerGenerator {
try { try {
IMarker[] markers = file.findMarkers(ICModelMarker.C_MODEL_PROBLEM_MARKER, false, IResource.DEPTH_ONE); IMarker[] markers = file.findMarkers(ICModelMarker.C_MODEL_PROBLEM_MARKER, false, IResource.DEPTH_ONE);
if (markers != null) { if (markers != null) {
List<IMarker> exactMarkers = new ArrayList<IMarker>(); List<IMarker> exactMarkers = new ArrayList<>();
for (int i = 0; i < markers.length; i++) { for (int i = 0; i < markers.length; i++) {
IMarker marker = markers[i]; IMarker marker = markers[i];
int location = ((Integer) marker.getAttribute(IMarker.LINE_NUMBER)).intValue(); int location = ((Integer) marker.getAttribute(IMarker.LINE_NUMBER)).intValue();

View file

@ -218,7 +218,7 @@ public class ScannerConfigInfoFactory2 {
public void save() throws CoreException { public void save() throws CoreException {
if (isDirty()) { if (isDirty()) {
Set<String> idSet = new HashSet<String>(fMap.size() - 1); Set<String> idSet = new HashSet<>(fMap.size() - 1);
Preference pref = (Preference) fMap.get(new InfoContext(null)); Preference pref = (Preference) fMap.get(new InfoContext(null));
pref.store(); pref.store();
@ -278,7 +278,7 @@ public class ScannerConfigInfoFactory2 {
} }
private static abstract class StoreSet implements IScannerConfigBuilderInfo2Set { private static abstract class StoreSet implements IScannerConfigBuilderInfo2Set {
protected HashMap<InfoContext, IScannerConfigBuilderInfo2> fMap = new HashMap<InfoContext, IScannerConfigBuilderInfo2>(); protected HashMap<InfoContext, IScannerConfigBuilderInfo2> fMap = new HashMap<>();
protected boolean fIsDirty; protected boolean fIsDirty;
StoreSet() { StoreSet() {
@ -363,9 +363,9 @@ public class ScannerConfigInfoFactory2 {
protected String selectedProfile = EMPTY_STRING; protected String selectedProfile = EMPTY_STRING;
/** Map from profile ID -> default ProfileOptions /** Map from profile ID -> default ProfileOptions
* allows us to avoid storing options to .cproject when they are default .*/ * allows us to avoid storing options to .cproject when they are default .*/
protected static Map<String, ProfileOptions> defaultProfiles = new ConcurrentHashMap<String, ProfileOptions>(); protected static Map<String, ProfileOptions> defaultProfiles = new ConcurrentHashMap<>();
/** Map from profile ID -> ProfileOptions */ /** Map from profile ID -> ProfileOptions */
protected Map<String, ProfileOptions> profileOptionsMap = new LinkedHashMap<String, ProfileOptions>(); protected Map<String, ProfileOptions> profileOptionsMap = new LinkedHashMap<>();
static class ProfileOptions implements Cloneable { static class ProfileOptions implements Cloneable {
protected boolean buildOutputFileActionEnabled; protected boolean buildOutputFileActionEnabled;
@ -457,7 +457,7 @@ public class ScannerConfigInfoFactory2 {
this.buildOutputFileActionEnabled = base.buildOutputFileActionEnabled; this.buildOutputFileActionEnabled = base.buildOutputFileActionEnabled;
this.buildOutputFilePath = base.buildOutputFilePath; this.buildOutputFilePath = base.buildOutputFilePath;
this.buildOutputParserEnabled = base.buildOutputParserEnabled; this.buildOutputParserEnabled = base.buildOutputParserEnabled;
this.providerOptionsMap = new LinkedHashMap<String, ProviderOptions>(base.providerOptionsMap); this.providerOptionsMap = new LinkedHashMap<>(base.providerOptionsMap);
for (Map.Entry<String, ProviderOptions> entry : providerOptionsMap.entrySet()) { for (Map.Entry<String, ProviderOptions> entry : providerOptionsMap.entrySet()) {
ProviderOptions basePo = entry.getValue(); ProviderOptions basePo = entry.getValue();
entry.setValue(new ProviderOptions(basePo)); entry.setValue(new ProviderOptions(basePo));
@ -506,7 +506,7 @@ public class ScannerConfigInfoFactory2 {
try { try {
ProfileOptions newProfOpts = (ProfileOptions) super.clone(); ProfileOptions newProfOpts = (ProfileOptions) super.clone();
if (providerOptionsMap != null) { if (providerOptionsMap != null) {
newProfOpts.providerOptionsMap = new LinkedHashMap<String, ProviderOptions>(); newProfOpts.providerOptionsMap = new LinkedHashMap<>();
for (Map.Entry<String, ProviderOptions> e : providerOptionsMap.entrySet()) for (Map.Entry<String, ProviderOptions> e : providerOptionsMap.entrySet())
newProfOpts.providerOptionsMap.put(e.getKey(), e.getValue().clone()); newProfOpts.providerOptionsMap.put(e.getKey(), e.getValue().clone());
} }
@ -597,7 +597,7 @@ public class ScannerConfigInfoFactory2 {
*/ */
@Override @Override
public List<String> getProfileIdList() { public List<String> getProfileIdList() {
return new ArrayList<String>(profileOptionsMap.keySet()); return new ArrayList<>(profileOptionsMap.keySet());
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -666,7 +666,7 @@ public class ScannerConfigInfoFactory2 {
@Override @Override
public List<String> getProviderIdList() { public List<String> getProviderIdList() {
ProfileOptions po = profileOptionsMap.get(selectedProfile); ProfileOptions po = profileOptionsMap.get(selectedProfile);
return (po != null) ? new ArrayList<String>(po.providerOptionsMap.keySet()) : new ArrayList<String>(0); return (po != null) ? new ArrayList<>(po.providerOptionsMap.keySet()) : new ArrayList<>(0);
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -856,7 +856,7 @@ public class ScannerConfigInfoFactory2 {
} }
} }
po.providerOptionsMap = new LinkedHashMap<String, ProfileOptions.ProviderOptions>(); po.providerOptionsMap = new LinkedHashMap<>();
for (String providerId : configuredProfile.getSIProviderIds()) { for (String providerId : configuredProfile.getSIProviderIds()) {
ProfileOptions.ProviderOptions ppo = new ProfileOptions.ProviderOptions(); ProfileOptions.ProviderOptions ppo = new ProfileOptions.ProviderOptions();
ScannerInfoProvider configuredProvider = configuredProfile.getScannerInfoProviderElement(providerId); ScannerInfoProvider configuredProvider = configuredProfile.getScannerInfoProviderElement(providerId);
@ -987,10 +987,10 @@ public class ScannerConfigInfoFactory2 {
.getSCProfileConfiguration(selectedProfile); .getSCProfileConfiguration(selectedProfile);
// get the one and only provider id // get the one and only provider id
String providerId = configuredProfile.getSIProviderIds().get(0); String providerId = configuredProfile.getSIProviderIds().get(0);
po.providerOptionsMap = new LinkedHashMap<String, ProfileOptions.ProviderOptions>(1); po.providerOptionsMap = new LinkedHashMap<>(1);
po.providerOptionsMap.put(providerId, ppo); po.providerOptionsMap.put(providerId, ppo);
profileOptionsMap = new LinkedHashMap<String, ProfileOptions>(1); profileOptionsMap = new LinkedHashMap<>(1);
profileOptionsMap.put(profileId, po); profileOptionsMap.put(profileId, po);
// store migrated data // store migrated data
@ -1012,7 +1012,7 @@ public class ScannerConfigInfoFactory2 {
.getSCProfileConfiguration(profileId); .getSCProfileConfiguration(profileId);
List<String> providerIds = configuredProfile.getSIProviderIds(); List<String> providerIds = configuredProfile.getSIProviderIds();
int providerCounter = 0; int providerCounter = 0;
po.providerOptionsMap = new LinkedHashMap<String, ProfileOptions.ProviderOptions>(providerIds.size()); po.providerOptionsMap = new LinkedHashMap<>(providerIds.size());
for (ICStorageElement child : profile.getChildren()) { for (ICStorageElement child : profile.getChildren()) {
// buildOutputProvider element // buildOutputProvider element
@ -1106,7 +1106,7 @@ public class ScannerConfigInfoFactory2 {
// ScannerConfigProfile configuredProfile = ScannerConfigProfileManager.getInstance(). // ScannerConfigProfile configuredProfile = ScannerConfigProfileManager.getInstance().
// getSCProfileConfiguration(selectedProfile); // getSCProfileConfiguration(selectedProfile);
// List providerIds = configuredProfile.getSIProviderIds(); // List providerIds = configuredProfile.getSIProviderIds();
List<String> providerIds = new ArrayList<String>(po.providerOptionsMap.keySet()); List<String> providerIds = new ArrayList<>(po.providerOptionsMap.keySet());
for (int i = 0; i < providerIds.size(); ++i) { for (int i = 0; i < providerIds.size(); ++i) {
String providerId = providerIds.get(i); String providerId = providerIds.get(i);
ProfileOptions.ProviderOptions ppo = po.providerOptionsMap.get(providerId); ProfileOptions.ProviderOptions ppo = po.providerOptionsMap.get(providerId);
@ -1221,7 +1221,7 @@ public class ScannerConfigInfoFactory2 {
.safeIntern(prefs.getDefaultString(prefix + SCANNER_CONFIG_SELECTED_PROFILE_ID_SUFFIX)); .safeIntern(prefs.getDefaultString(prefix + SCANNER_CONFIG_SELECTED_PROFILE_ID_SUFFIX));
} }
List<String> profileIds = ScannerConfigProfileManager.getInstance().getProfileIds(context); List<String> profileIds = ScannerConfigProfileManager.getInstance().getProfileIds(context);
profileOptionsMap = new LinkedHashMap<String, ProfileOptions>(profileIds.size()); profileOptionsMap = new LinkedHashMap<>(profileIds.size());
for (String profileId : profileIds) { for (String profileId : profileIds) {
ProfileOptions po = new ProfileOptions(); ProfileOptions po = new ProfileOptions();
profileOptionsMap.put(profileId, po); profileOptionsMap.put(profileId, po);
@ -1240,7 +1240,7 @@ public class ScannerConfigInfoFactory2 {
ScannerConfigProfile configuredProfile = ScannerConfigProfileManager.getInstance() ScannerConfigProfile configuredProfile = ScannerConfigProfileManager.getInstance()
.getSCProfileConfiguration(profileId); .getSCProfileConfiguration(profileId);
List<String> providerIds = configuredProfile.getSIProviderIds(); List<String> providerIds = configuredProfile.getSIProviderIds();
po.providerOptionsMap = new LinkedHashMap<String, ProfileOptions.ProviderOptions>(providerIds.size()); po.providerOptionsMap = new LinkedHashMap<>(providerIds.size());
for (String providerId : providerIds) { for (String providerId : providerIds) {
ProfileOptions.ProviderOptions ppo = new ProfileOptions.ProviderOptions(); ProfileOptions.ProviderOptions ppo = new ProfileOptions.ProviderOptions();
po.providerOptionsMap.put(providerId, ppo); po.providerOptionsMap.put(providerId, ppo);

View file

@ -243,7 +243,7 @@ public class ScannerConfigProfile {
private ScannerInfoCollector scannerInfoCollector; private ScannerInfoCollector scannerInfoCollector;
private BuildOutputProvider buildOutputProvider; private BuildOutputProvider buildOutputProvider;
private Map<String, ScannerInfoProvider> scannerInfoProviders = new LinkedHashMap<String, ScannerInfoProvider>(); private Map<String, ScannerInfoProvider> scannerInfoProviders = new LinkedHashMap<>();
private Boolean supportsContext; private Boolean supportsContext;
@ -296,7 +296,7 @@ public class ScannerConfigProfile {
* @return Returns the list of providerIds * @return Returns the list of providerIds
*/ */
public List<String> getSIProviderIds() { public List<String> getSIProviderIds() {
return new ArrayList<String>(scannerInfoProviders.keySet()); return new ArrayList<>(scannerInfoProviders.keySet());
} }
/** /**

View file

@ -52,7 +52,7 @@ public final class ScannerConfigProfileManager {
* Singleton pattern * Singleton pattern
*/ */
private ScannerConfigProfileManager() { private ScannerConfigProfileManager() {
projectToProfileInstanceMap = new HashMap<IProject, Map<InfoContext, Object>>(); projectToProfileInstanceMap = new HashMap<>();
} }
private static final ScannerConfigProfileManager instance = new ScannerConfigProfileManager(); private static final ScannerConfigProfileManager instance = new ScannerConfigProfileManager();
@ -92,7 +92,7 @@ public final class ScannerConfigProfileManager {
synchronized (fLock) { synchronized (fLock) {
Map<InfoContext, Object> map = projectToProfileInstanceMap.get(project); Map<InfoContext, Object> map = projectToProfileInstanceMap.get(project);
if (map == null && create) { if (map == null && create) {
map = new HashMap<InfoContext, Object>(); map = new HashMap<>();
projectToProfileInstanceMap.put(project, map); projectToProfileInstanceMap.put(project, map);
} }
return Collections.synchronizedMap(map); return Collections.synchronizedMap(map);
@ -129,7 +129,7 @@ public final class ScannerConfigProfileManager {
if (profileInstance == null || !profileInstance.getProfile().getId().equals(profileId)) { if (profileInstance == null || !profileInstance.getProfile().getId().equals(profileId)) {
profileInstance = new SCProfileInstance(project, context, getSCProfileConfiguration(profileId)); profileInstance = new SCProfileInstance(project, context, getSCProfileConfiguration(profileId));
map.put(context, new SoftReference<SCProfileInstance>(profileInstance)); map.put(context, new SoftReference<>(profileInstance));
} }
return profileInstance; return profileInstance;
} }
@ -158,7 +158,7 @@ public final class ScannerConfigProfileManager {
public List<String> getProfileIds() { public List<String> getProfileIds() {
synchronized (fLock) { synchronized (fLock) {
if (profileIds == null) { if (profileIds == null) {
profileIds = new ArrayList<String>(); profileIds = new ArrayList<>();
IExtensionPoint extension = Platform.getExtensionRegistry().getExtensionPoint(MakeCorePlugin.PLUGIN_ID, IExtensionPoint extension = Platform.getExtensionRegistry().getExtensionPoint(MakeCorePlugin.PLUGIN_ID,
ScannerConfigProfileManager.SI_PROFILE_SIMPLE_ID); ScannerConfigProfileManager.SI_PROFILE_SIMPLE_ID);
if (extension != null) { if (extension != null) {
@ -182,7 +182,7 @@ public final class ScannerConfigProfileManager {
synchronized (fLock) { synchronized (fLock) {
if (contextAwareProfileIds == null) { if (contextAwareProfileIds == null) {
contextAwareProfileIds = new ArrayList<String>(); contextAwareProfileIds = new ArrayList<>();
List<String> all = getProfileIds(); List<String> all = getProfileIds();
for (int i = 0; i < all.size(); i++) { for (int i = 0; i < all.size(); i++) {

View file

@ -311,7 +311,7 @@ public class MakeEnvironmentBlock extends AbstractCOptionPage {
// Convert the table's items into a Map so that this can be saved in the // Convert the table's items into a Map so that this can be saved in the
// configuration's attributes. // configuration's attributes.
TableItem[] items = environmentTable.getTable().getItems(); TableItem[] items = environmentTable.getTable().getItems();
Map<String, String> map = new HashMap<String, String>(items.length); Map<String, String> map = new HashMap<>(items.length);
for (int i = 0; i < items.length; i++) { for (int i = 0; i < items.length; i++) {
EnvironmentVariable var = (EnvironmentVariable) items[i].getData(); EnvironmentVariable var = (EnvironmentVariable) items[i].getData();
map.put(var.getName(), var.getValue()); map.put(var.getName(), var.getValue());
@ -607,7 +607,7 @@ public class MakeEnvironmentBlock extends AbstractCOptionPage {
private Map<String, EnvironmentVariable> getNativeEnvironment() { private Map<String, EnvironmentVariable> getNativeEnvironment() {
@SuppressWarnings({ "unchecked", "rawtypes" }) @SuppressWarnings({ "unchecked", "rawtypes" })
Map<String, String> stringVars = (Hashtable) EnvironmentReader.getEnvVars(); Map<String, String> stringVars = (Hashtable) EnvironmentReader.getEnvVars();
HashMap<String, EnvironmentVariable> vars = new HashMap<String, EnvironmentVariable>(); HashMap<String, EnvironmentVariable> vars = new HashMap<>();
for (Iterator<String> i = stringVars.keySet().iterator(); i.hasNext();) { for (Iterator<String> i = stringVars.keySet().iterator(); i.hasNext();) {
String key = i.next(); String key = i.next();
String value = stringVars.get(key); String value = stringVars.get(key);
@ -713,7 +713,7 @@ public class MakeEnvironmentBlock extends AbstractCOptionPage {
} }
}; };
TreeMap<String, EnvironmentVariable> envVars = new TreeMap<String, EnvironmentVariable>(comparator); TreeMap<String, EnvironmentVariable> envVars = new TreeMap<>(comparator);
envVars.putAll((Map<String, EnvironmentVariable>) inputElement); envVars.putAll((Map<String, EnvironmentVariable>) inputElement);
elements = new EnvironmentVariable[envVars.size()]; elements = new EnvironmentVariable[envVars.size()];
int index = 0; int index = 0;

View file

@ -51,10 +51,10 @@ public class MultipleInputDialog extends Dialog {
protected Composite panel; protected Composite panel;
protected List<FieldSummary> fieldList = new ArrayList<FieldSummary>(); protected List<FieldSummary> fieldList = new ArrayList<>();
protected List<Text> controlList = new ArrayList<Text>(); protected List<Text> controlList = new ArrayList<>();
protected List<Validator> validators = new ArrayList<Validator>(); protected List<Validator> validators = new ArrayList<>();
protected Map<Object, String> valueMap = new HashMap<Object, String>(); protected Map<Object, String> valueMap = new HashMap<>();
private String title; private String title;

View file

@ -117,7 +117,7 @@ public class FileTransferDropTargetListener extends AbstractContainerAreaDropAda
*/ */
private static IMakeTarget[] prepareMakeTargetsFromFiles(String[] filenames, IContainer dropContainer, private static IMakeTarget[] prepareMakeTargetsFromFiles(String[] filenames, IContainer dropContainer,
Shell shell) { Shell shell) {
List<IMakeTarget> makeTargetsList = new ArrayList<IMakeTarget>(filenames.length); List<IMakeTarget> makeTargetsList = new ArrayList<>(filenames.length);
int errorCount = 0; int errorCount = 0;
int nonFileCount = 0; int nonFileCount = 0;

View file

@ -206,7 +206,7 @@ public class LocalTransferDropTargetListener extends AbstractContainerAreaDropAd
private static IMakeTarget[] prepareMakeTargetsFromSelection(IStructuredSelection selection, private static IMakeTarget[] prepareMakeTargetsFromSelection(IStructuredSelection selection,
IContainer dropContainer) { IContainer dropContainer) {
List<?> elements = selection.toList(); List<?> elements = selection.toList();
List<IMakeTarget> makeTargetsList = new ArrayList<IMakeTarget>(elements.size()); List<IMakeTarget> makeTargetsList = new ArrayList<>(elements.size());
for (Object element : elements) { for (Object element : elements) {
if (element instanceof IMakeTarget) { if (element instanceof IMakeTarget) {
makeTargetsList.add((IMakeTarget) element); makeTargetsList.add((IMakeTarget) element);

View file

@ -100,7 +100,7 @@ public class MakeTargetDndUtil {
return false; return false;
} }
List<String> names = new ArrayList<String>(selectedElements.size()); List<String> names = new ArrayList<>(selectedElements.size());
for (Object element : selectedElements) { for (Object element : selectedElements) {
if (!(element instanceof IMakeTarget)) { if (!(element instanceof IMakeTarget)) {
return false; return false;

View file

@ -127,7 +127,7 @@ public class MakeTargetTransferData {
* *
*/ */
public MakeTargetTransferData() { public MakeTargetTransferData() {
makeTargetData = new ArrayList<MakeTargetData>(); makeTargetData = new ArrayList<>();
} }
/** /**
@ -175,7 +175,7 @@ public class MakeTargetTransferData {
*/ */
public IMakeTarget[] createMakeTargets(IProject project) { public IMakeTarget[] createMakeTargets(IProject project) {
IMakeTargetManager makeTargetManager = MakeCorePlugin.getDefault().getTargetManager(); IMakeTargetManager makeTargetManager = MakeCorePlugin.getDefault().getTargetManager();
ArrayList<IMakeTarget> makeTargets = new ArrayList<IMakeTarget>(makeTargetData.size()); ArrayList<IMakeTarget> makeTargets = new ArrayList<>(makeTargetData.size());
String[] ids = makeTargetManager.getTargetBuilders(project); String[] ids = makeTargetManager.getTargetBuilders(project);
String builderId = ids[0]; String builderId = ids[0];

View file

@ -113,7 +113,7 @@ public class TextTransferDropTargetListener extends AbstractContainerAreaDropAda
private static IMakeTarget[] prepareMakeTargetsFromString(String multilineText, IContainer container) { private static IMakeTarget[] prepareMakeTargetsFromString(String multilineText, IContainer container) {
if (container != null) { if (container != null) {
String[] lines = multilineText.split("[\n\r]"); //$NON-NLS-1$ String[] lines = multilineText.split("[\n\r]"); //$NON-NLS-1$
List<IMakeTarget> makeTargets = new ArrayList<IMakeTarget>(lines.length); List<IMakeTarget> makeTargets = new ArrayList<>(lines.length);
for (String command : lines) { for (String command : lines) {
command = command.trim(); command = command.trim();
if (command.length() > 0) { if (command.length() > 0) {

View file

@ -142,7 +142,7 @@ public class AddBuildTargetAction extends Action {
if (!sel.isEmpty() && sel instanceof IStructuredSelection) { if (!sel.isEmpty() && sel instanceof IStructuredSelection) {
List<?> list = ((IStructuredSelection) sel).toList(); List<?> list = ((IStructuredSelection) sel).toList();
if (list.size() > 0) { if (list.size() > 0) {
List<ITargetRule> targets = new ArrayList<ITargetRule>(list.size()); List<ITargetRule> targets = new ArrayList<>(list.size());
Object[] elements = list.toArray(); Object[] elements = list.toArray();
for (Object element : elements) { for (Object element : elements) {
if (element instanceof ITargetRule) { if (element instanceof ITargetRule) {

View file

@ -120,7 +120,7 @@ public class MakefileContentOutlinePage extends ContentOutlinePage {
} else { } else {
directives = new IDirective[0]; directives = new IDirective[0];
} }
List<IDirective> list = new ArrayList<IDirective>(directives.length); List<IDirective> list = new ArrayList<>(directives.length);
for (IDirective directive : directives) { for (IDirective directive : directives) {
if (showMacroDefinition && directive instanceof IMacroDefinition) { if (showMacroDefinition && directive instanceof IMacroDefinition) {
list.add(directive); list.add(directive);

View file

@ -335,7 +335,7 @@ public final class MakefileToggleCommentAction extends TextEditorAction {
fPrefixesMap = null; fPrefixesMap = null;
String[] types = configuration.getConfiguredContentTypes(sourceViewer); String[] types = configuration.getConfiguredContentTypes(sourceViewer);
Map<String, String[]> prefixesMap = new HashMap<String, String[]>(types.length); Map<String, String[]> prefixesMap = new HashMap<>(types.length);
for (String type : types) { for (String type : types) {
String[] prefixes = configuration.getDefaultPrefixes(sourceViewer, type); String[] prefixes = configuration.getDefaultPrefixes(sourceViewer, type);
if (prefixes != null && prefixes.length > 0) { if (prefixes != null && prefixes.length > 0) {

View file

@ -24,7 +24,7 @@ import org.eclipse.jface.text.reconciler.MonoReconciler;
* NotifyingReconciler * NotifyingReconciler
*/ */
public class NotifyingReconciler extends MonoReconciler { public class NotifyingReconciler extends MonoReconciler {
private ArrayList<IReconcilingParticipant> fReconcilingParticipants = new ArrayList<IReconcilingParticipant>(); private ArrayList<IReconcilingParticipant> fReconcilingParticipants = new ArrayList<>();
/** /**
* Constructor for NotifyingReconciler. * Constructor for NotifyingReconciler.

View file

@ -106,7 +106,7 @@ public class OpenIncludeAction extends Action {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
List<Object> list = ((IStructuredSelection) sel).toList(); List<Object> list = ((IStructuredSelection) sel).toList();
if (list.size() > 0) { if (list.size() > 0) {
List<IInclude> includes = new ArrayList<IInclude>(list.size()); List<IInclude> includes = new ArrayList<>(list.size());
for (Object element : list) { for (Object element : list) {
if (element instanceof IInclude) { if (element instanceof IInclude) {
includes.add((IInclude) element); includes.add((IInclude) element);

View file

@ -169,7 +169,7 @@ public class ProjectionMakefileUpdater implements IProjectionListener {
} }
private Map<MakefileProjectionAnnotation, Position> computeAdditions(IParent parent) { private Map<MakefileProjectionAnnotation, Position> computeAdditions(IParent parent) {
Map<MakefileProjectionAnnotation, Position> map = new HashMap<MakefileProjectionAnnotation, Position>(); Map<MakefileProjectionAnnotation, Position> map = new HashMap<>();
computeAdditions(parent.getDirectives(), map); computeAdditions(parent.getDirectives(), map);
return map; return map;
} }
@ -242,9 +242,9 @@ public class ProjectionMakefileUpdater implements IProjectionListener {
fCachedDocument = provider.getDocument(fEditor.getEditorInput()); fCachedDocument = provider.getDocument(fEditor.getEditorInput());
fAllowCollapsing = false; fAllowCollapsing = false;
Map<MakefileProjectionAnnotation, Position> additions = new HashMap<MakefileProjectionAnnotation, Position>(); Map<MakefileProjectionAnnotation, Position> additions = new HashMap<>();
List<MakefileProjectionAnnotation> deletions = new ArrayList<MakefileProjectionAnnotation>(); List<MakefileProjectionAnnotation> deletions = new ArrayList<>();
List<MakefileProjectionAnnotation> updates = new ArrayList<MakefileProjectionAnnotation>(); List<MakefileProjectionAnnotation> updates = new ArrayList<>();
Map<MakefileProjectionAnnotation, Position> updated = computeAdditions((IParent) fInput); Map<MakefileProjectionAnnotation, Position> updated = computeAdditions((IParent) fInput);
Map<IDirective, List<MakefileProjectionAnnotation>> previous = createAnnotationMap(model); Map<IDirective, List<MakefileProjectionAnnotation>> previous = createAnnotationMap(model);
@ -306,8 +306,8 @@ public class ProjectionMakefileUpdater implements IProjectionListener {
return; return;
} }
List<MakefileProjectionAnnotation> newDeletions = new ArrayList<MakefileProjectionAnnotation>(); List<MakefileProjectionAnnotation> newDeletions = new ArrayList<>();
List<MakefileProjectionAnnotation> newChanges = new ArrayList<MakefileProjectionAnnotation>(); List<MakefileProjectionAnnotation> newChanges = new ArrayList<>();
Iterator<MakefileProjectionAnnotation> deletionIterator = deletions.iterator(); Iterator<MakefileProjectionAnnotation> deletionIterator = deletions.iterator();
outer: while (deletionIterator.hasNext()) { outer: while (deletionIterator.hasNext()) {
@ -369,7 +369,7 @@ public class ProjectionMakefileUpdater implements IProjectionListener {
} }
private Map<IDirective, List<MakefileProjectionAnnotation>> createAnnotationMap(IAnnotationModel model) { private Map<IDirective, List<MakefileProjectionAnnotation>> createAnnotationMap(IAnnotationModel model) {
Map<IDirective, List<MakefileProjectionAnnotation>> map = new HashMap<IDirective, List<MakefileProjectionAnnotation>>(); Map<IDirective, List<MakefileProjectionAnnotation>> map = new HashMap<>();
Iterator<?> e = model.getAnnotationIterator(); Iterator<?> e = model.getAnnotationIterator();
while (e.hasNext()) { while (e.hasNext()) {
Object annotation = e.next(); Object annotation = e.next();
@ -377,7 +377,7 @@ public class ProjectionMakefileUpdater implements IProjectionListener {
MakefileProjectionAnnotation directive = (MakefileProjectionAnnotation) annotation; MakefileProjectionAnnotation directive = (MakefileProjectionAnnotation) annotation;
List<MakefileProjectionAnnotation> list = map.get(directive.getElement()); List<MakefileProjectionAnnotation> list = map.get(directive.getElement());
if (list == null) { if (list == null) {
list = new ArrayList<MakefileProjectionAnnotation>(2); list = new ArrayList<>(2);
map.put(directive.getElement(), list); map.put(directive.getElement(), list);
} }
list.add(directive); list.add(directive);

View file

@ -80,7 +80,7 @@ public class WorkingCopyManager implements IWorkingCopyManager, IWorkingCopyMana
public void setWorkingCopy(IEditorInput input, IMakefile workingCopy) { public void setWorkingCopy(IEditorInput input, IMakefile workingCopy) {
if (fDocumentProvider.getDocument(input) != null) { if (fDocumentProvider.getDocument(input) != null) {
if (fMap == null) { if (fMap == null) {
fMap = new HashMap<IEditorInput, IMakefile>(); fMap = new HashMap<>();
} }
fMap.put(input, workingCopy); fMap.put(input, workingCopy);
} }

View file

@ -50,7 +50,7 @@ import com.ibm.icu.text.MessageFormat;
public abstract class AbstractMakefileEditorPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { public abstract class AbstractMakefileEditorPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
OverlayPreferenceStore fOverlayStore; OverlayPreferenceStore fOverlayStore;
Map<Control, String> fCheckBoxes = new HashMap<Control, String>(); Map<Control, String> fCheckBoxes = new HashMap<>();
private SelectionListener fCheckBoxListener = new SelectionListener() { private SelectionListener fCheckBoxListener = new SelectionListener() {
@Override @Override
public void widgetDefaultSelected(SelectionEvent e) { public void widgetDefaultSelected(SelectionEvent e) {
@ -63,7 +63,7 @@ public abstract class AbstractMakefileEditorPreferencePage extends PreferencePag
} }
}; };
Map<Control, String> fTextFields = new HashMap<Control, String>(); Map<Control, String> fTextFields = new HashMap<>();
private ModifyListener fTextFieldListener = new ModifyListener() { private ModifyListener fTextFieldListener = new ModifyListener() {
@Override @Override
public void modifyText(ModifyEvent e) { public void modifyText(ModifyEvent e) {
@ -72,7 +72,7 @@ public abstract class AbstractMakefileEditorPreferencePage extends PreferencePag
} }
}; };
private Map<Text, String[]> fNumberFields = new HashMap<Text, String[]>(); private Map<Text, String[]> fNumberFields = new HashMap<>();
private ModifyListener fNumberFieldListener = new ModifyListener() { private ModifyListener fNumberFieldListener = new ModifyListener() {
@Override @Override
public void modifyText(ModifyEvent e) { public void modifyText(ModifyEvent e) {

View file

@ -60,7 +60,7 @@ public class MakefileEditorPreferencePage extends AbstractMakefileEditorPreferen
private String[][] fSyntaxColorListModel; private String[][] fSyntaxColorListModel;
private TableViewer fHighlightingColorListViewer; private TableViewer fHighlightingColorListViewer;
private final List<HighlightingColorListItem> fHighlightingColorList = new ArrayList<HighlightingColorListItem>(7); private final List<HighlightingColorListItem> fHighlightingColorList = new ArrayList<>(7);
Button fAppearanceColorDefault; Button fAppearanceColorDefault;
ColorSelector fSyntaxForegroundColorEditor; ColorSelector fSyntaxForegroundColorEditor;
@ -208,7 +208,7 @@ public class MakefileEditorPreferencePage extends AbstractMakefileEditorPreferen
ColorManager.MAKE_MATCHING_BRACKETS_COLOR, null }, ColorManager.MAKE_MATCHING_BRACKETS_COLOR, null },
{ MakefilePreferencesMessages.getString("MakefileEditorPreferencePage.makefile_editor_default"), //$NON-NLS-1$ { MakefilePreferencesMessages.getString("MakefileEditorPreferencePage.makefile_editor_default"), //$NON-NLS-1$
ColorManager.MAKE_DEFAULT_COLOR, null }, }; ColorManager.MAKE_DEFAULT_COLOR, null }, };
ArrayList<OverlayKey> overlayKeys = new ArrayList<OverlayKey>(); ArrayList<OverlayKey> overlayKeys = new ArrayList<>();
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
MakefileEditorPreferenceConstants.EDITOR_FOLDING_ENABLED)); MakefileEditorPreferenceConstants.EDITOR_FOLDING_ENABLED));

View file

@ -43,7 +43,7 @@ public class DiscoveredElement {
private String fEntry; private String fEntry;
private int fEntryKind; private int fEntryKind;
private boolean fRemoved; private boolean fRemoved;
private ArrayList<DiscoveredElement> fChildren = new ArrayList<DiscoveredElement>(); private ArrayList<DiscoveredElement> fChildren = new ArrayList<>();
private DiscoveredElement fParent; private DiscoveredElement fParent;
public DiscoveredElement(IProject project, String entry, int kind, boolean removed, boolean system) { public DiscoveredElement(IProject project, String entry, int kind, boolean removed, boolean system) {
@ -196,7 +196,7 @@ public class DiscoveredElement {
} }
public void setChildren(DiscoveredElement[] children) { public void setChildren(DiscoveredElement[] children) {
fChildren = new ArrayList<DiscoveredElement>(Arrays.asList(children)); fChildren = new ArrayList<>(Arrays.asList(children));
} }
public boolean delete() { public boolean delete() {

View file

@ -51,7 +51,7 @@ public class ColorManager implements ISharedTextColors {
return fgColorManager; return fgColorManager;
} }
protected Map<RGB, Color> fColorTable = new HashMap<RGB, Color>(10); protected Map<RGB, Color> fColorTable = new HashMap<>(10);
@Override @Override
public void dispose() { public void dispose() {

View file

@ -37,7 +37,7 @@ import org.eclipse.swt.graphics.RGB;
*/ */
public abstract class AbstractMakefileCodeScanner extends RuleBasedScanner { public abstract class AbstractMakefileCodeScanner extends RuleBasedScanner {
private Map<String, Token> fTokenMap = new HashMap<String, Token>(); private Map<String, Token> fTokenMap = new HashMap<>();
private String[] fPropertyNamesColor; private String[] fPropertyNamesColor;
/** /**
* Preference keys for boolean preferences which are <code>true</code>, * Preference keys for boolean preferences which are <code>true</code>,

View file

@ -89,7 +89,7 @@ public class MakefileCodeScanner extends AbstractMakefileCodeScanner {
IToken macroDefToken = getToken(ColorManager.MAKE_MACRO_DEF_COLOR); IToken macroDefToken = getToken(ColorManager.MAKE_MACRO_DEF_COLOR);
IToken defaultToken = getToken(ColorManager.MAKE_DEFAULT_COLOR); IToken defaultToken = getToken(ColorManager.MAKE_DEFAULT_COLOR);
List<IRule> rules = new ArrayList<IRule>(); List<IRule> rules = new ArrayList<>();
// Add generic whitespace rule. // Add generic whitespace rule.
rules.add(new WhitespaceRule(new IWhitespaceDetector() { rules.add(new WhitespaceRule(new IWhitespaceDetector() {

View file

@ -107,7 +107,7 @@ public class MakefileCompletionProcessor implements IContentAssistProcessor {
@Override @Override
public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int documentOffset) { public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int documentOffset) {
List<ICompletionProposal> proposalList = new ArrayList<ICompletionProposal>(); List<ICompletionProposal> proposalList = new ArrayList<>();
IMakefile makefile = fManager.getWorkingCopy(fEditor.getEditorInput()); IMakefile makefile = fManager.getWorkingCopy(fEditor.getEditorInput());
WordPartDetector wordPart = new WordPartDetector(viewer.getDocument(), documentOffset); WordPartDetector wordPart = new WordPartDetector(viewer.getDocument(), documentOffset);
if (wordPart.isMacro()) { if (wordPart.isMacro()) {
@ -139,7 +139,7 @@ public class MakefileCompletionProcessor implements IContentAssistProcessor {
private ArrayList<ICompletionProposal> createCompletionProposals(WordPartDetector wordPart, private ArrayList<ICompletionProposal> createCompletionProposals(WordPartDetector wordPart,
IAutomaticVariable[] autoVars) { IAutomaticVariable[] autoVars) {
ArrayList<ICompletionProposal> proposalList = new ArrayList<ICompletionProposal>(autoVars.length); ArrayList<ICompletionProposal> proposalList = new ArrayList<>(autoVars.length);
String wordPartName = wordPart.getName(); String wordPartName = wordPart.getName();
BracketHandler bracket = new BracketHandler(wordPartName); BracketHandler bracket = new BracketHandler(wordPartName);
String partialName = bracket.followingText; String partialName = bracket.followingText;
@ -165,7 +165,7 @@ public class MakefileCompletionProcessor implements IContentAssistProcessor {
private ArrayList<ICompletionProposal> createCompletionProposals(WordPartDetector wordPart, private ArrayList<ICompletionProposal> createCompletionProposals(WordPartDetector wordPart,
IMacroDefinition[] macros) { IMacroDefinition[] macros) {
ArrayList<ICompletionProposal> proposalList = new ArrayList<ICompletionProposal>(macros.length); ArrayList<ICompletionProposal> proposalList = new ArrayList<>(macros.length);
String wordPartName = wordPart.getName(); String wordPartName = wordPart.getName();
BracketHandler bracket = new BracketHandler(wordPartName); BracketHandler bracket = new BracketHandler(wordPartName);
@ -192,7 +192,7 @@ public class MakefileCompletionProcessor implements IContentAssistProcessor {
private ArrayList<ICompletionProposal> createCompletionProposals(WordPartDetector wordPart, private ArrayList<ICompletionProposal> createCompletionProposals(WordPartDetector wordPart,
IBuiltinFunction[] builtinFuns) { IBuiltinFunction[] builtinFuns) {
ArrayList<ICompletionProposal> proposalList = new ArrayList<ICompletionProposal>(builtinFuns.length); ArrayList<ICompletionProposal> proposalList = new ArrayList<>(builtinFuns.length);
String wordPartName = wordPart.getName(); String wordPartName = wordPart.getName();
BracketHandler bracket = new BracketHandler(wordPartName); BracketHandler bracket = new BracketHandler(wordPartName);
@ -219,7 +219,7 @@ public class MakefileCompletionProcessor implements IContentAssistProcessor {
} }
private ArrayList<ICompletionProposal> createCompletionProposals(WordPartDetector wordPart, ITargetRule[] targets) { private ArrayList<ICompletionProposal> createCompletionProposals(WordPartDetector wordPart, ITargetRule[] targets) {
ArrayList<ICompletionProposal> proposalList = new ArrayList<ICompletionProposal>(targets.length); ArrayList<ICompletionProposal> proposalList = new ArrayList<>(targets.length);
String partialName = wordPart.getName(); String partialName = wordPart.getName();
for (ITargetRule target : targets) { for (ITargetRule target : targets) {
@ -238,8 +238,8 @@ public class MakefileCompletionProcessor implements IContentAssistProcessor {
public IContextInformation[] computeContextInformation(ITextViewer viewer, int documentOffset) { public IContextInformation[] computeContextInformation(ITextViewer viewer, int documentOffset) {
WordPartDetector wordPart = new WordPartDetector(viewer.getDocument(), documentOffset); WordPartDetector wordPart = new WordPartDetector(viewer.getDocument(), documentOffset);
IMakefile makefile = fManager.getWorkingCopy(fEditor.getEditorInput()); IMakefile makefile = fManager.getWorkingCopy(fEditor.getEditorInput());
ArrayList<String> contextList = new ArrayList<String>(); ArrayList<String> contextList = new ArrayList<>();
ArrayList<IContextInformation> contextInformationList = new ArrayList<IContextInformation>(); ArrayList<IContextInformation> contextInformationList = new ArrayList<>();
if (wordPart.isMacro()) { if (wordPart.isMacro()) {
IDirective[] statements = makefile.getMacroDefinitions(); IDirective[] statements = makefile.getMacroDefinitions();
for (IDirective statement : statements) { for (IDirective statement : statements) {

View file

@ -43,7 +43,7 @@ public class MakefilePartitionScanner extends RuleBasedPartitionScanner {
IToken tComment = new Token(MAKEFILE_COMMENT_PARTITION); IToken tComment = new Token(MAKEFILE_COMMENT_PARTITION);
List<EndOfLineRule> rules = new ArrayList<EndOfLineRule>(); List<EndOfLineRule> rules = new ArrayList<>();
// Add rule for single line comments. // Add rule for single line comments.

View file

@ -95,7 +95,7 @@ public class MakeContentProvider implements ITreeContentProvider, IMakeTargetLis
} }
} else if (obj instanceof IContainer) { } else if (obj instanceof IContainer) {
IContainer container = (IContainer) obj; IContainer container = (IContainer) obj;
ArrayList<Object> children = new ArrayList<Object>(); ArrayList<Object> children = new ArrayList<>();
boolean isAddingSourceRoots = !bFlatten && (container instanceof IProject) boolean isAddingSourceRoots = !bFlatten && (container instanceof IProject)
&& CCorePlugin.showSourceRootsAtTopOfProject(); && CCorePlugin.showSourceRootsAtTopOfProject();
@ -135,7 +135,7 @@ public class MakeContentProvider implements ITreeContentProvider, IMakeTargetLis
return children.toArray(); return children.toArray();
} else if (obj instanceof TargetSourceContainer) { } else if (obj instanceof TargetSourceContainer) {
ArrayList<Object> children = new ArrayList<Object>(); ArrayList<Object> children = new ArrayList<>();
try { try {
IContainer container = ((TargetSourceContainer) obj).getContainer(); IContainer container = ((TargetSourceContainer) obj).getContainer();
IResource[] resources = container.members(); IResource[] resources = container.members();
@ -177,7 +177,7 @@ public class MakeContentProvider implements ITreeContentProvider, IMakeTargetLis
@Override @Override
public Object[] getElements(Object obj) { public Object[] getElements(Object obj) {
if (bFlatten) { if (bFlatten) {
List<Object> list = new ArrayList<Object>(); List<Object> list = new ArrayList<>();
Object[] children = getChildren(obj); Object[] children = getChildren(obj);
for (int i = 0; i < children.length; i++) { for (int i = 0; i < children.length; i++) {
list.add(children[i]); list.add(children[i]);
@ -313,7 +313,7 @@ public class MakeContentProvider implements ITreeContentProvider, IMakeTargetLis
return; return;
} }
Set<IProject> affectedProjects = new HashSet<IProject>(); Set<IProject> affectedProjects = new HashSet<>();
for (IMakeTarget target : event.getTargets()) { for (IMakeTarget target : event.getTargets()) {
IContainer container = target.getContainer(); IContainer container = target.getContainer();
affectedProjects.add(container.getProject()); affectedProjects.add(container.getProject());
@ -355,7 +355,7 @@ public class MakeContentProvider implements ITreeContentProvider, IMakeTargetLis
return; return;
} }
Set<IProject> affectedProjects = new HashSet<IProject>(); Set<IProject> affectedProjects = new HashSet<>();
collectAffectedProjects(delta, affectedProjects); collectAffectedProjects(delta, affectedProjects);
// If the view is being filtered or source roots shown, // If the view is being filtered or source roots shown,

View file

@ -62,7 +62,7 @@ public class TargetBuild {
if (!BuildAction.isSaveAllSet()) if (!BuildAction.isSaveAllSet())
return; return;
List<IProject> projects = new ArrayList<IProject>(); List<IProject> projects = new ArrayList<>();
for (int i = 0; i < targets.length; ++i) { for (int i = 0; i < targets.length; ++i) {
IMakeTarget target = targets[i]; IMakeTarget target = targets[i];
projects.add(target.getProject()); projects.add(target.getProject());

View file

@ -72,7 +72,7 @@ public class UpdateMakeProjectAction implements IWorkbenchWindowActionDelegate {
public void run(IAction action) { public void run(IAction action) {
if (fSelection instanceof IStructuredSelection) { if (fSelection instanceof IStructuredSelection) {
Object[] elems = ((IStructuredSelection) fSelection).toArray(); Object[] elems = ((IStructuredSelection) fSelection).toArray();
ArrayList<IProject> projects = new ArrayList<IProject>(elems.length); ArrayList<IProject> projects = new ArrayList<>(elems.length);
for (int i = 0; i < elems.length; i++) { for (int i = 0; i < elems.length; i++) {
Object elem = elems[i]; Object elem = elems[i];
@ -102,7 +102,7 @@ public class UpdateMakeProjectAction implements IWorkbenchWindowActionDelegate {
public static IProject[] getOldProjects() { public static IProject[] getOldProjects() {
IProject[] project = MakeUIPlugin.getWorkspace().getRoot().getProjects(); IProject[] project = MakeUIPlugin.getWorkspace().getRoot().getProjects();
Vector<IProject> result = new Vector<IProject>(); Vector<IProject> result = new Vector<>();
try { try {
for (int i = 0; i < project.length; i++) { for (int i = 0; i < project.length; i++) {
if (isOldProject(project[i])) { if (isOldProject(project[i])) {

View file

@ -178,7 +178,7 @@ public abstract class AbstractDiscoveryOptionsBlock extends AbstractCOptionPage
* *
*/ */
private void initializeProfilePageMap() { private void initializeProfilePageMap() {
fProfilePageMap = new HashMap<String, DiscoveryProfilePageConfiguration>(5); fProfilePageMap = new HashMap<>(5);
IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(MakeUIPlugin.getPluginId(), IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(MakeUIPlugin.getPluginId(),
"DiscoveryProfilePage"); //$NON-NLS-1$ "DiscoveryProfilePage"); //$NON-NLS-1$
@ -349,7 +349,7 @@ public abstract class AbstractDiscoveryOptionsBlock extends AbstractCOptionPage
} }
protected List<String> getDiscoveryProfileIdList() { protected List<String> getDiscoveryProfileIdList() {
return new ArrayList<String>(fProfilePageMap.keySet()); return new ArrayList<>(fProfilePageMap.keySet());
} }
protected abstract String getCurrentProfileId(); protected abstract String getCurrentProfileId();

View file

@ -146,7 +146,7 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr
DiscoveredContainerAdapter adapter = new DiscoveredContainerAdapter(); DiscoveredContainerAdapter adapter = new DiscoveredContainerAdapter();
fDiscoveredContainerList = new TreeListDialogField<DiscoveredElement>(adapter, buttonLabels, fDiscoveredContainerList = new TreeListDialogField<>(adapter, buttonLabels,
new DiscoveredElementLabelProvider()); new DiscoveredElementLabelProvider());
fDiscoveredContainerList.setDialogFieldListener(adapter); fDiscoveredContainerList.setDialogFieldListener(adapter);
fDiscoveredContainerList.setLabelText(MakeUIPlugin.getResourceString(CONTAINER_LIST_LABEL)); fDiscoveredContainerList.setLabelText(MakeUIPlugin.getResourceString(CONTAINER_LIST_LABEL));
@ -154,7 +154,7 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr
fDiscoveredContainerList.setTreeExpansionLevel(2); fDiscoveredContainerList.setTreeExpansionLevel(2);
fDiscoveredContainerList.setViewerSorter(new DiscoveredElementSorter()); fDiscoveredContainerList.setViewerSorter(new DiscoveredElementSorter());
dirty = false; dirty = false;
deletedEntries = new ArrayList<DiscoveredElement>(); deletedEntries = new ArrayList<>();
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -220,8 +220,8 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr
if (info instanceof IPerProjectDiscoveredPathInfo) { if (info instanceof IPerProjectDiscoveredPathInfo) {
IPerProjectDiscoveredPathInfo projectPathInfo = (IPerProjectDiscoveredPathInfo) info; IPerProjectDiscoveredPathInfo projectPathInfo = (IPerProjectDiscoveredPathInfo) info;
LinkedHashMap<String, Boolean> includes = new LinkedHashMap<String, Boolean>(); LinkedHashMap<String, Boolean> includes = new LinkedHashMap<>();
LinkedHashMap<String, SymbolEntry> symbols = new LinkedHashMap<String, SymbolEntry>(); LinkedHashMap<String, SymbolEntry> symbols = new LinkedHashMap<>();
DiscoveredElement container = (DiscoveredElement) fDiscoveredContainerList.getElement(0); DiscoveredElement container = (DiscoveredElement) fDiscoveredContainerList.getElement(0);
if (container != null && container.getEntryKind() == DiscoveredElement.CONTAINER) { if (container != null && container.getEntryKind() == DiscoveredElement.CONTAINER) {
@ -264,7 +264,7 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr
try { try {
// update scanner configuration // update scanner configuration
List<IResource> resourceDelta = new ArrayList<IResource>(1); List<IResource> resourceDelta = new ArrayList<>(1);
resourceDelta.add(fCProject.getProject()); resourceDelta.add(fCProject.getProject());
MakeCorePlugin.getDefault().getDiscoveryManager().updateDiscoveredInfo(info, resourceDelta); MakeCorePlugin.getDefault().getDiscoveryManager().updateDiscoveredInfo(info, resourceDelta);
return true; return true;
@ -294,7 +294,7 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr
} }
if (fPathEntry != null) { if (fPathEntry != null) {
DiscoveredElement element = populateDiscoveredElements(fPathEntry); DiscoveredElement element = populateDiscoveredElements(fPathEntry);
ArrayList<DiscoveredElement> elements = new ArrayList<DiscoveredElement>(); ArrayList<DiscoveredElement> elements = new ArrayList<>();
elements.add(element); elements.add(element);
fDiscoveredContainerList.addElements(elements); fDiscoveredContainerList.addElements(elements);
} }
@ -606,7 +606,7 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr
private boolean moveDown() { private boolean moveDown() {
boolean rc = false; boolean rc = false;
List<Object> selElements = fDiscoveredContainerList.getSelectedElements(); List<Object> selElements = fDiscoveredContainerList.getSelectedElements();
List<Object> revSelElements = new ArrayList<Object>(selElements); List<Object> revSelElements = new ArrayList<>(selElements);
Collections.reverse(revSelElements); Collections.reverse(revSelElements);
for (Iterator<Object> i = revSelElements.iterator(); i.hasNext();) { for (Iterator<Object> i = revSelElements.iterator(); i.hasNext();) {
DiscoveredElement elem = (DiscoveredElement) i.next(); DiscoveredElement elem = (DiscoveredElement) i.next();
@ -649,7 +649,7 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr
private boolean deleteEntry() { private boolean deleteEntry() {
boolean rc = false; boolean rc = false;
List<DiscoveredElement> newSelection = new ArrayList<DiscoveredElement>(); List<DiscoveredElement> newSelection = new ArrayList<>();
List<Object> selElements = fDiscoveredContainerList.getSelectedElements(); List<Object> selElements = fDiscoveredContainerList.getSelectedElements();
boolean skipIncludes = false, skipSymbols = false; boolean skipIncludes = false, skipSymbols = false;
for (int i = 0; i < selElements.size(); ++i) { for (int i = 0; i < selElements.size(); ++i) {

View file

@ -331,7 +331,7 @@ public class DiscoveryOptionsBlock extends AbstractDiscoveryOptionsBlock {
ICProject cProject = CoreModel.getDefault().create(project); ICProject cProject = CoreModel.getDefault().create(project);
if (cProject != null) { if (cProject != null) {
IPathEntry[] entries = cProject.getRawPathEntries(); IPathEntry[] entries = cProject.getRawPathEntries();
List<IPathEntry> newEntries = new ArrayList<IPathEntry>(Arrays.asList(entries)); List<IPathEntry> newEntries = new ArrayList<>(Arrays.asList(entries));
if (!newEntries.contains(container)) { if (!newEntries.contains(container)) {
newEntries.add(container); newEntries.add(container);
cProject.setRawPathEntries(newEntries.toArray(new IPathEntry[newEntries.size()]), monitor); cProject.setRawPathEntries(newEntries.toArray(new IPathEntry[newEntries.size()]), monitor);
@ -345,7 +345,7 @@ public class DiscoveryOptionsBlock extends AbstractDiscoveryOptionsBlock {
String profileId = getBuildInfo().getSelectedProfileId(); String profileId = getBuildInfo().getSelectedProfileId();
ScannerConfigScope profileScope = ScannerConfigProfileManager.getInstance().getSCProfileConfiguration(profileId) ScannerConfigScope profileScope = ScannerConfigProfileManager.getInstance().getSCProfileConfiguration(profileId)
.getProfileScope(); .getProfileScope();
List<IResource> changedResources = new ArrayList<IResource>(); List<IResource> changedResources = new ArrayList<>();
// changedResources.add(project.getFullPath()); // changedResources.add(project.getFullPath());
changedResources.add(project); changedResources.add(project);
MakeCorePlugin.getDefault().getDiscoveryManager().changeDiscoveredContainer(project, profileScope, MakeCorePlugin.getDefault().getDiscoveryManager().changeDiscoveredContainer(project, profileScope,

View file

@ -213,7 +213,7 @@ public abstract class AbstractBuilderTest extends TestCase {
boolean externalBuilder) throws CoreException { boolean externalBuilder) throws CoreException {
IProject project = getWorkspace().getRoot().getProject(projectName); IProject project = getWorkspace().getRoot().getProject(projectName);
IFolder buildDir = project.getFolder(cfgName); IFolder buildDir = project.getFolder(cfgName);
Collection<IResource> resources = new LinkedHashSet<IResource>(); Collection<IResource> resources = new LinkedHashSet<>();
resources.add(buildDir); resources.add(buildDir);
if (externalBuilder) { if (externalBuilder) {
resources.add(buildDir.getFile("makefile")); resources.add(buildDir.getFile("makefile"));
@ -250,7 +250,7 @@ public abstract class AbstractBuilderTest extends TestCase {
protected void setWorkspace(String name) { protected void setWorkspace(String name) {
workspace = name; workspace = name;
projects = new ArrayList<IProject>(); projects = new ArrayList<>();
} }
protected IProject loadProject(String name) throws CoreException { protected IProject loadProject(String name) throws CoreException {
@ -263,7 +263,7 @@ public abstract class AbstractBuilderTest extends TestCase {
} }
private List<IMarker> getAllMarkers() throws CoreException { private List<IMarker> getAllMarkers() throws CoreException {
List<IMarker> markers = new ArrayList<IMarker>(); List<IMarker> markers = new ArrayList<>();
for (IProject project : projects) for (IProject project : projects)
markers.addAll(Arrays markers.addAll(Arrays
.asList(project.findMarkers(ICModelMarker.C_MODEL_PROBLEM_MARKER, true, IResource.DEPTH_INFINITE))); .asList(project.findMarkers(ICModelMarker.C_MODEL_PROBLEM_MARKER, true, IResource.DEPTH_INFINITE)));

View file

@ -125,8 +125,8 @@ public class BuildSystemTestHelper {
} }
static public void checkDiff(Object[] expected, Object[] actual) { static public void checkDiff(Object[] expected, Object[] actual) {
LinkedHashSet<? extends Object> set1 = new LinkedHashSet<Object>(Arrays.asList(expected)); LinkedHashSet<? extends Object> set1 = new LinkedHashSet<>(Arrays.asList(expected));
LinkedHashSet<? extends Object> set2 = new LinkedHashSet<Object>(Arrays.asList(actual)); LinkedHashSet<? extends Object> set2 = new LinkedHashSet<>(Arrays.asList(actual));
LinkedHashSet<? extends Object> set1Copy = new LinkedHashSet<Object>(set1); LinkedHashSet<? extends Object> set1Copy = new LinkedHashSet<Object>(set1);
set1.removeAll(set2); set1.removeAll(set2);
set2.removeAll(set1Copy); set2.removeAll(set1Copy);

View file

@ -516,9 +516,9 @@ public class ManagedBuildTestHelper {
ArrayList<String> testArray = mergeContinuationLines(getContents(testFile)); ArrayList<String> testArray = mergeContinuationLines(getContents(testFile));
ArrayList<String> benchmarkArray = mergeContinuationLines(getContents(benchmarkFile)); ArrayList<String> benchmarkArray = mergeContinuationLines(getContents(benchmarkFile));
Set<String> testNotMatchingLines = new TreeSet<String>(); Set<String> testNotMatchingLines = new TreeSet<>();
Set<String> benchNotMatchingLines = new TreeSet<String>(); Set<String> benchNotMatchingLines = new TreeSet<>();
Set<String> extraLines = new TreeSet<String>(); Set<String> extraLines = new TreeSet<>();
for (int i = 0; i < benchmarkArray.size() || i < testArray.size(); i++) { for (int i = 0; i < benchmarkArray.size() || i < testArray.size(); i++) {
if (!(i < benchmarkArray.size())) { if (!(i < benchmarkArray.size())) {
System.err.println(testFile.lastSegment() + ": extra line =[" + testArray.get(i) System.err.println(testFile.lastSegment() + ": extra line =[" + testArray.get(i)
@ -540,9 +540,9 @@ public class ManagedBuildTestHelper {
if (testLine.startsWith(" -$(RM) ")) { if (testLine.startsWith(" -$(RM) ")) {
// accommodate to arbitrary order of 'rm' parameters // accommodate to arbitrary order of 'rm' parameters
final String DELIMITERS = "[ $]"; final String DELIMITERS = "[ $]";
String[] testMacros = new TreeSet<String>(Arrays.asList(testLine.split(DELIMITERS))) String[] testMacros = new TreeSet<>(Arrays.asList(testLine.split(DELIMITERS)))
.toArray(new String[0]); .toArray(new String[0]);
String[] benchMacros = new TreeSet<String>(Arrays.asList(benchmarkLine.split(DELIMITERS))) String[] benchMacros = new TreeSet<>(Arrays.asList(benchmarkLine.split(DELIMITERS)))
.toArray(new String[0]); .toArray(new String[0]);
if (testMacros.length != benchMacros.length) { if (testMacros.length != benchMacros.length) {
return false; return false;
@ -697,7 +697,7 @@ public class ManagedBuildTestHelper {
} }
private static ArrayList<String> getContents(IPath fullPath) { private static ArrayList<String> getContents(IPath fullPath) {
ArrayList<String> lines = new ArrayList<String>(); ArrayList<String> lines = new ArrayList<>();
try { try {
BufferedReader in = new BufferedReader(new FileReader(fullPath.toFile())); BufferedReader in = new BufferedReader(new FileReader(fullPath.toFile()));
String line; String line;
@ -1082,7 +1082,7 @@ public class ManagedBuildTestHelper {
} }
public static ITool[] getRcbsTools(IResourceConfiguration rcConfig) { public static ITool[] getRcbsTools(IResourceConfiguration rcConfig) {
List<ITool> list = new ArrayList<ITool>(); List<ITool> list = new ArrayList<>();
ITool tools[] = rcConfig.getTools(); ITool tools[] = rcConfig.getTools();
for (int i = 0; i < tools.length; i++) { for (int i = 0; i < tools.length; i++) {
ITool tool = tools[i]; ITool tool = tools[i];

View file

@ -112,7 +112,7 @@ public class ResourceDeltaVerifier extends Assert implements IResourceChangeList
/** /**
* Table of IPath -> ExpectedChange * Table of IPath -> ExpectedChange
*/ */
private Hashtable<IPath, ExpectedChange> fExpectedChanges = new Hashtable<IPath, ExpectedChange>(); private Hashtable<IPath, ExpectedChange> fExpectedChanges = new Hashtable<>();
boolean fIsDeltaValid = true; boolean fIsDeltaValid = true;
private StringBuilder fMessage = new StringBuilder(); private StringBuilder fMessage = new StringBuilder();
/** /**
@ -133,7 +133,7 @@ public class ResourceDeltaVerifier extends Assert implements IResourceChangeList
private static final int VERIFICATION_COMPLETE = 2; private static final int VERIFICATION_COMPLETE = 2;
private int fState = RECEIVING_INPUTS; private int fState = RECEIVING_INPUTS;
private Set<IResource> fIgnoreResources = new HashSet<IResource>(); private Set<IResource> fIgnoreResources = new HashSet<>();
/** /**
* @see #addExpectedChange * @see #addExpectedChange
@ -263,7 +263,7 @@ public class ResourceDeltaVerifier extends Assert implements IResourceChangeList
IResourceDelta[] removedChildren = delta.getAffectedChildren(IResourceDelta.REMOVED, IResourceDelta[] removedChildren = delta.getAffectedChildren(IResourceDelta.REMOVED,
IContainer.INCLUDE_TEAM_PRIVATE_MEMBERS | IContainer.INCLUDE_HIDDEN); IContainer.INCLUDE_TEAM_PRIVATE_MEMBERS | IContainer.INCLUDE_HIDDEN);
Hashtable<IResource, IResourceDelta> h = new Hashtable<IResource, IResourceDelta>(affectedChildren.length + 1); Hashtable<IResource, IResourceDelta> h = new Hashtable<>(affectedChildren.length + 1);
for (int i = 0; i < addedChildren.length; ++i) { for (int i = 0; i < addedChildren.length; ++i) {
IResourceDelta childDelta1 = addedChildren[i]; IResourceDelta childDelta1 = addedChildren[i];
@ -467,7 +467,7 @@ public class ResourceDeltaVerifier extends Assert implements IResourceChangeList
* are met after iterating over a resource delta. * are met after iterating over a resource delta.
*/ */
private void finishVerification() { private void finishVerification() {
Hashtable<IPath, IPath> resourcePaths = new Hashtable<IPath, IPath>(); Hashtable<IPath, IPath> resourcePaths = new Hashtable<>();
Enumeration<IPath> keys = fExpectedChanges.keys(); Enumeration<IPath> keys = fExpectedChanges.keys();
while (keys.hasMoreElements()) { while (keys.hasMoreElements()) {

View file

@ -49,7 +49,7 @@ public class Preconditions extends TestCase {
* changed when the tests are run. * changed when the tests are run.
*/ */
public void testContentTypes() { public void testContentTypes() {
Set<String> fileExts = new TreeSet<String>(); Set<String> fileExts = new TreeSet<>();
IContentTypeManager manager = Platform.getContentTypeManager(); IContentTypeManager manager = Platform.getContentTypeManager();
IContentType contentTypeCpp = manager.getContentType(CCorePlugin.CONTENT_TYPE_CXXSOURCE); IContentType contentTypeCpp = manager.getContentType(CCorePlugin.CONTENT_TYPE_CXXSOURCE);
@ -58,7 +58,7 @@ public class Preconditions extends TestCase {
IContentType contentTypeC = manager.getContentType(CCorePlugin.CONTENT_TYPE_CSOURCE); IContentType contentTypeC = manager.getContentType(CCorePlugin.CONTENT_TYPE_CSOURCE);
fileExts.addAll(Arrays.asList(contentTypeC.getFileSpecs(IContentType.FILE_EXTENSION_SPEC))); fileExts.addAll(Arrays.asList(contentTypeC.getFileSpecs(IContentType.FILE_EXTENSION_SPEC)));
Set<String> expectedExts = new TreeSet<String>( Set<String> expectedExts = new TreeSet<>(
Arrays.asList(new String[] { "C", "c", "c++", "cc", "cpp", "cxx" })); Arrays.asList(new String[] { "C", "c", "c++", "cc", "cpp", "cxx" }));
assertEquals("Precodition FAILED - Content Types do not match expected defaults.", expectedExts.toString(), assertEquals("Precodition FAILED - Content Types do not match expected defaults.", expectedExts.toString(),
fileExts.toString()); fileExts.toString());

View file

@ -38,7 +38,7 @@ public class Bug_303953 extends AbstractBuilderTest {
setWorkspace("regressions"); setWorkspace("regressions");
final IProject app = loadProject("helloworldC"); final IProject app = loadProject("helloworldC");
List<IResource> buildOutputResources = new ArrayList<IResource>(); List<IResource> buildOutputResources = new ArrayList<>();
buildOutputResources.addAll(getProjectBuildExeResources("helloworldC", "Debug", "src/helloworldC")); buildOutputResources.addAll(getProjectBuildExeResources("helloworldC", "Debug", "src/helloworldC"));
// Ensure Debug is the active configuration // Ensure Debug is the active configuration

View file

@ -75,7 +75,7 @@ public class BuildDescriptionModelTests extends TestCase {
private Runnable fCleaner = fCompositeCleaner; private Runnable fCleaner = fCompositeCleaner;
private class CompositeCleaner implements Runnable { private class CompositeCleaner implements Runnable {
private List<Runnable> fRunnables = new ArrayList<Runnable>(); private List<Runnable> fRunnables = new ArrayList<>();
public void addRunnable(Runnable r) { public void addRunnable(Runnable r) {
fRunnables.add(r); fRunnables.add(r);
@ -93,7 +93,7 @@ public class BuildDescriptionModelTests extends TestCase {
} }
private class ProjectCleaner implements Runnable { private class ProjectCleaner implements Runnable {
List<String> fProjList = new ArrayList<String>(); List<String> fProjList = new ArrayList<>();
public ProjectCleaner(IProject project) { public ProjectCleaner(IProject project) {
addProject(project); addProject(project);
@ -576,8 +576,8 @@ public class BuildDescriptionModelTests extends TestCase {
} }
*/ */
private void doTestStep(IBuildStep step, IBuildStep oStep, boolean up) { private void doTestStep(IBuildStep step, IBuildStep oStep, boolean up) {
Map<IBuildIOType, IBuildIOType> inMap = new HashMap<IBuildIOType, IBuildIOType>(); Map<IBuildIOType, IBuildIOType> inMap = new HashMap<>();
Map<IBuildIOType, IBuildIOType> outMap = new HashMap<IBuildIOType, IBuildIOType>(); Map<IBuildIOType, IBuildIOType> outMap = new HashMap<>();
stepsMatch(step, oStep, inMap, outMap, true); stepsMatch(step, oStep, inMap, outMap, true);
@ -589,7 +589,7 @@ public class BuildDescriptionModelTests extends TestCase {
} }
private void doTestType(IBuildIOType type, IBuildIOType oType) { private void doTestType(IBuildIOType type, IBuildIOType oType) {
Map<IBuildResource, IBuildResource> map = new HashMap<IBuildResource, IBuildResource>(); Map<IBuildResource, IBuildResource> map = new HashMap<>();
typesMatch(type, oType, map, true); typesMatch(type, oType, map, true);
@ -599,7 +599,7 @@ public class BuildDescriptionModelTests extends TestCase {
} }
private void doTestResource(IBuildResource rc, IBuildResource oRc, boolean up) { private void doTestResource(IBuildResource rc, IBuildResource oRc, boolean up) {
Map<IBuildIOType, IBuildIOType> outMap = new HashMap<IBuildIOType, IBuildIOType>(); Map<IBuildIOType, IBuildIOType> outMap = new HashMap<>();
doTestResourceMatch(rc, oRc, outMap); doTestResourceMatch(rc, oRc, outMap);
@ -607,7 +607,7 @@ public class BuildDescriptionModelTests extends TestCase {
typesMatch(rc.getProducerIOType(), oRc.getProducerIOType(), null, true); typesMatch(rc.getProducerIOType(), oRc.getProducerIOType(), null, true);
doTestStep(rc.getProducerIOType().getStep(), oRc.getProducerIOType().getStep(), up); doTestStep(rc.getProducerIOType().getStep(), oRc.getProducerIOType().getStep(), up);
} else { } else {
Set<IBuildStep> stepSet = new HashSet<IBuildStep>(); Set<IBuildStep> stepSet = new HashSet<>();
for (Entry<IBuildIOType, IBuildIOType> entry : outMap.entrySet()) { for (Entry<IBuildIOType, IBuildIOType> entry : outMap.entrySet()) {
IBuildIOType type = entry.getKey(); IBuildIOType type = entry.getKey();
@ -785,8 +785,8 @@ public class BuildDescriptionModelTests extends TestCase {
return false; return false;
if (resourcesMatch(rcs, oRcs, rcMap)) { if (resourcesMatch(rcs, oRcs, rcMap)) {
Map<IBuildIOType, IBuildIOType> inMap = new HashMap<IBuildIOType, IBuildIOType>(); Map<IBuildIOType, IBuildIOType> inMap = new HashMap<>();
Map<IBuildIOType, IBuildIOType> outMap = new HashMap<IBuildIOType, IBuildIOType>(); Map<IBuildIOType, IBuildIOType> outMap = new HashMap<>();
if (!checkStep) if (!checkStep)
return true; return true;
return stepsMatch(type.getStep(), oType.getStep(), inMap, outMap, false, failOnError); return stepsMatch(type.getStep(), oType.getStep(), inMap, outMap, false, failOnError);

View file

@ -120,7 +120,7 @@ public class BuildSystem40Tests extends TestCase {
assertTrue(Arrays.equals(modifiedValue, value)); assertTrue(Arrays.equals(modifiedValue, value));
{ {
List<ICLanguageSettingEntry> list = new ArrayList<ICLanguageSettingEntry>(); List<ICLanguageSettingEntry> list = new ArrayList<>();
list.addAll(Arrays.asList(entries)); list.addAll(Arrays.asList(entries));
list.add(new CIncludePathEntry(platformDependentPath("dbg 3", "E:\\tmp\\w"), 0)); list.add(new CIncludePathEntry(platformDependentPath("dbg 3", "E:\\tmp\\w"), 0));
entries = list.toArray(new ICLanguageSettingEntry[0]); entries = list.toArray(new ICLanguageSettingEntry[0]);
@ -131,7 +131,7 @@ public class BuildSystem40Tests extends TestCase {
} }
{ {
ArrayList<OptionStringValue> list = new ArrayList<OptionStringValue>(); ArrayList<OptionStringValue> list = new ArrayList<>();
list.addAll(Arrays.asList(value)); list.addAll(Arrays.asList(value));
list.add(new OptionStringValue("\"E:\\tmp\\w\"")); list.add(new OptionStringValue("\"E:\\tmp\\w\""));
value = list.toArray(new OptionStringValue[0]); value = list.toArray(new OptionStringValue[0]);
@ -185,7 +185,7 @@ public class BuildSystem40Tests extends TestCase {
BuildSystemTestHelper.checkDiff(expectedEntries, entries); BuildSystemTestHelper.checkDiff(expectedEntries, entries);
{ {
ArrayList<ICLanguageSettingEntry> list = new ArrayList<ICLanguageSettingEntry>(Arrays.asList(entries)); ArrayList<ICLanguageSettingEntry> list = new ArrayList<>(Arrays.asList(entries));
list.remove(6); //new CIncludePathEntry("/d1_abs/path", 0), list.remove(6); //new CIncludePathEntry("/d1_abs/path", 0),
expectedEntries = list.toArray(new ICLanguageSettingEntry[0]); expectedEntries = list.toArray(new ICLanguageSettingEntry[0]);
ls.setSettingEntries(ICLanguageSettingEntry.INCLUDE_PATH, list); ls.setSettingEntries(ICLanguageSettingEntry.INCLUDE_PATH, list);
@ -219,7 +219,7 @@ public class BuildSystem40Tests extends TestCase {
option = tool.getOptionsOfType(IOption.INCLUDE_PATH)[0]; option = tool.getOptionsOfType(IOption.INCLUDE_PATH)[0];
{ {
ArrayList<OptionStringValue> list = new ArrayList<OptionStringValue>( ArrayList<OptionStringValue> list = new ArrayList<>(
Arrays.asList(option.getBasicStringListValueElements())); Arrays.asList(option.getBasicStringListValueElements()));
assertTrue(list.remove(new OptionStringValue("${IncludeDefaults}"))); assertTrue(list.remove(new OptionStringValue("${IncludeDefaults}")));
list.add(0, new OptionStringValue("${IncludeDefaults}")); list.add(0, new OptionStringValue("${IncludeDefaults}"));
@ -253,7 +253,7 @@ public class BuildSystem40Tests extends TestCase {
BuildSystemTestHelper.checkDiff(expectedEntries, entries); BuildSystemTestHelper.checkDiff(expectedEntries, entries);
{ {
ArrayList<OptionStringValue> list = new ArrayList<OptionStringValue>( ArrayList<OptionStringValue> list = new ArrayList<>(
Arrays.asList(option.getBasicStringListValueElements())); Arrays.asList(option.getBasicStringListValueElements()));
assertTrue(list.remove(new OptionStringValue("${IncludeDefaults}"))); assertTrue(list.remove(new OptionStringValue("${IncludeDefaults}")));
list.add(list.size(), new OptionStringValue("${IncludeDefaults}")); list.add(list.size(), new OptionStringValue("${IncludeDefaults}"));
@ -335,7 +335,7 @@ public class BuildSystem40Tests extends TestCase {
BuildSystemTestHelper.checkDiff(expectedValue, value); BuildSystemTestHelper.checkDiff(expectedValue, value);
BuildSystemTestHelper.checkDiff(expectedEntries, entries); BuildSystemTestHelper.checkDiff(expectedEntries, entries);
ArrayList<ICLanguageSettingEntry> list = new ArrayList<ICLanguageSettingEntry>(); ArrayList<ICLanguageSettingEntry> list = new ArrayList<>();
list.addAll(Arrays.asList(entries)); list.addAll(Arrays.asList(entries));
list.add(new CIncludePathEntry("/test/another/abs", 0)); list.add(new CIncludePathEntry("/test/another/abs", 0));
expectedEntries = list.toArray(new ICLanguageSettingEntry[0]); expectedEntries = list.toArray(new ICLanguageSettingEntry[0]);
@ -376,7 +376,7 @@ public class BuildSystem40Tests extends TestCase {
BuildSystemTestHelper.checkDiff(expectedValue, value); BuildSystemTestHelper.checkDiff(expectedValue, value);
BuildSystemTestHelper.checkDiff(expectedEntries, entries); BuildSystemTestHelper.checkDiff(expectedEntries, entries);
list = new ArrayList<ICLanguageSettingEntry>(); list = new ArrayList<>();
list.addAll(Arrays.asList(entries)); list.addAll(Arrays.asList(entries));
list.add(new CIncludePathEntry("/another/abs", 0)); list.add(new CIncludePathEntry("/another/abs", 0));
@ -479,7 +479,7 @@ public class BuildSystem40Tests extends TestCase {
} }
}); });
projectList = new ArrayList<IProject>(projectZips.length); projectList = new ArrayList<>(projectZips.length);
for (int i = 0; i < projectZips.length; i++) { for (int i = 0; i < projectZips.length; i++) {
try { try {
String projectName = projectZips[i].getName(); String projectName = projectZips[i].getName();
@ -505,7 +505,7 @@ public class BuildSystem40Tests extends TestCase {
try { try {
IProject project = ManagedBuildTestHelper.createProject(projName, null, location, projectTypeId); IProject project = ManagedBuildTestHelper.createProject(projName, null, location, projectTypeId);
if (project != null) if (project != null)
projectList = new ArrayList<IProject>(1); projectList = new ArrayList<>(1);
projectList.add(project); projectList.add(project);
} catch (Exception e) { } catch (Exception e) {
} }

View file

@ -47,7 +47,7 @@ public class DefaultFortranDependencyCalculator implements IManagedDependencyGen
* Return a list of the names of all modules used by a file * Return a list of the names of all modules used by a file
*/ */
private String[] findUsedModuleNames(File file) { private String[] findUsedModuleNames(File file) {
ArrayList<String> names = new ArrayList<String>(); ArrayList<String> names = new ArrayList<>();
InputStream in = null; InputStream in = null;
try { try {
in = new BufferedInputStream(new FileInputStream(file)); in = new BufferedInputStream(new FileInputStream(file));
@ -88,7 +88,7 @@ public class DefaultFortranDependencyCalculator implements IManagedDependencyGen
* Return a list of the names of all modules defined in a file * Return a list of the names of all modules defined in a file
*/ */
private String[] findModuleNames(File file) { private String[] findModuleNames(File file) {
ArrayList<String> names = new ArrayList<String>(); ArrayList<String> names = new ArrayList<>();
InputStream in = null; InputStream in = null;
try { try {
in = new BufferedInputStream(new FileInputStream(file)); in = new BufferedInputStream(new FileInputStream(file));
@ -148,7 +148,7 @@ public class DefaultFortranDependencyCalculator implements IManagedDependencyGen
*/ */
private IResource[] FindModulesInResources(IProject project, ITool tool, IResource resource, private IResource[] FindModulesInResources(IProject project, ITool tool, IResource resource,
IResource[] resourcesToSearch, String topBuildDir, String[] usedNames) { IResource[] resourcesToSearch, String topBuildDir, String[] usedNames) {
ArrayList<IResource> modRes = new ArrayList<IResource>(); ArrayList<IResource> modRes = new ArrayList<>();
for (int ir = 0; ir < resourcesToSearch.length; ir++) { for (int ir = 0; ir < resourcesToSearch.length; ir++) {
if (resourcesToSearch[ir].equals(resource)) if (resourcesToSearch[ir].equals(resource))
continue; continue;
@ -199,7 +199,7 @@ public class DefaultFortranDependencyCalculator implements IManagedDependencyGen
*/ */
@Override @Override
public IResource[] findDependencies(IResource resource, IProject project) { public IResource[] findDependencies(IResource resource, IProject project) {
ArrayList<IResource> dependencies = new ArrayList<IResource>(); ArrayList<IResource> dependencies = new ArrayList<>();
// TODO: This method should be passed the ITool and the relative path of the top build directory // TODO: This method should be passed the ITool and the relative path of the top build directory
// For now we'll figure this out from the project. // For now we'll figure this out from the project.
@ -268,7 +268,7 @@ public class DefaultFortranDependencyCalculator implements IManagedDependencyGen
@Override @Override
public IPath[] getOutputNames(ITool tool, IPath[] primaryInputNames) { public IPath[] getOutputNames(ITool tool, IPath[] primaryInputNames) {
// TODO: This method should be passed the relative path of the top build directory? // TODO: This method should be passed the relative path of the top build directory?
ArrayList<IPath> outs = new ArrayList<IPath>(); ArrayList<IPath> outs = new ArrayList<>();
if (primaryInputNames.length > 0) { if (primaryInputNames.length > 0) {
// Get the names of modules created by this source file // Get the names of modules created by this source file
String[] modules = findModuleNames(primaryInputNames[0].toFile()); String[] modules = findModuleNames(primaryInputNames[0].toFile());

View file

@ -141,7 +141,7 @@ public class ManagedBuildCoreTests extends TestCase {
// //
ITargetPlatform platform = toolChain.getTargetPlatform(); ITargetPlatform platform = toolChain.getTargetPlatform();
List<String> expectedOSListarr = new ArrayList<String>(); List<String> expectedOSListarr = new ArrayList<>();
String[] expectedOSListTokens = expectedOSList.split(","); //$NON-NLS-1$ String[] expectedOSListTokens = expectedOSList.split(","); //$NON-NLS-1$
for (i = 0; i < expectedOSListTokens.length; ++i) { for (i = 0; i < expectedOSListTokens.length; ++i) {
expectedOSListarr.add(expectedOSListTokens[i].trim()); expectedOSListarr.add(expectedOSListTokens[i].trim());
@ -208,7 +208,7 @@ public class ManagedBuildCoreTests extends TestCase {
assertEquals(optionDefaultValue, expectedOptionIdValue1[iconfig]); assertEquals(optionDefaultValue, expectedOptionIdValue1[iconfig]);
String optionEnumCmd1 = option.getEnumCommand(optionDefaultValue); String optionEnumCmd1 = option.getEnumCommand(optionDefaultValue);
assertEquals(optionEnumCmd1, expectedOptionEnumCmd1arr[iconfig]); assertEquals(optionEnumCmd1, expectedOptionEnumCmd1arr[iconfig]);
List<String> expectedEnumList1arr = new ArrayList<String>(); List<String> expectedEnumList1arr = new ArrayList<>();
String[] expectedEnumList1Tokens = expectedEnumList1.split(","); //$NON-NLS-1$ String[] expectedEnumList1Tokens = expectedEnumList1.split(","); //$NON-NLS-1$
for (i = 0; i < expectedEnumList1Tokens.length; ++i) { for (i = 0; i < expectedEnumList1Tokens.length; ++i) {
expectedEnumList1arr.add(expectedEnumList1Tokens[i].trim()); expectedEnumList1arr.add(expectedEnumList1Tokens[i].trim());
@ -314,7 +314,7 @@ public class ManagedBuildCoreTests extends TestCase {
IToolChain toolChain = configs[iconfig].getToolChain(); IToolChain toolChain = configs[iconfig].getToolChain();
assertEquals(toolChain.getName(), (expectedToolChainName[iconfig])); assertEquals(toolChain.getName(), (expectedToolChainName[iconfig]));
List<String> expectedOSListarr = new ArrayList<String>(); List<String> expectedOSListarr = new ArrayList<>();
String[] expectedOSListTokens = expectedOSList.split(","); //$NON-NLS-1$ String[] expectedOSListTokens = expectedOSList.split(","); //$NON-NLS-1$
for (i = 0; i < expectedOSListTokens.length; ++i) { for (i = 0; i < expectedOSListTokens.length; ++i) {
expectedOSListarr.add(expectedOSListTokens[i].trim()); expectedOSListarr.add(expectedOSListTokens[i].trim());
@ -502,7 +502,7 @@ public class ManagedBuildCoreTests extends TestCase {
// //
IToolChain toolChain = configs[iconfig].getToolChain(); IToolChain toolChain = configs[iconfig].getToolChain();
List<String> expectedOSListarr = new ArrayList<String>(); List<String> expectedOSListarr = new ArrayList<>();
String[] expectedOSListTokens = expectedOSList.split(","); //$NON-NLS-1$ String[] expectedOSListTokens = expectedOSList.split(","); //$NON-NLS-1$
for (i = 0; i < expectedOSListTokens.length; ++i) { for (i = 0; i < expectedOSListTokens.length; ++i) {
expectedOSListarr.add(expectedOSListTokens[i].trim()); expectedOSListarr.add(expectedOSListTokens[i].trim());
@ -571,7 +571,7 @@ public class ManagedBuildCoreTests extends TestCase {
String optionEnumCmd1 = option.getEnumCommand(optionDefaultValue); String optionEnumCmd1 = option.getEnumCommand(optionDefaultValue);
assertEquals(optionEnumCmd1, (expectedOptionEnumCmd1arr[iconfig])); assertEquals(optionEnumCmd1, (expectedOptionEnumCmd1arr[iconfig]));
List<String> expectedEnumList1arr = new ArrayList<String>(); List<String> expectedEnumList1arr = new ArrayList<>();
String[] expectedEnumList1Tokens = expectedEnumList1.split(","); //$NON-NLS-1$ String[] expectedEnumList1Tokens = expectedEnumList1.split(","); //$NON-NLS-1$
for (i = 0; i < expectedEnumList1Tokens.length; ++i) { for (i = 0; i < expectedEnumList1Tokens.length; ++i) {
expectedEnumList1arr.add(expectedEnumList1Tokens[i].trim()); expectedEnumList1arr.add(expectedEnumList1Tokens[i].trim());

View file

@ -74,7 +74,7 @@ public class ManagedBuildDependencyCalculatorTests extends TestCase {
} }
}); });
projectList = new ArrayList<IProject>(projectZips.length); projectList = new ArrayList<>(projectZips.length);
for (int i = 0; i < projectZips.length; i++) { for (int i = 0; i < projectZips.length; i++) {
try { try {
String projectName = projectZips[i].getName(); String projectName = projectZips[i].getName();
@ -100,7 +100,7 @@ public class ManagedBuildDependencyCalculatorTests extends TestCase {
try { try {
IProject project = ManagedBuildTestHelper.createProject(projName, null, location, projectTypeId); IProject project = ManagedBuildTestHelper.createProject(projName, null, location, projectTypeId);
if (project != null) if (project != null)
projectList = new ArrayList<IProject>(1); projectList = new ArrayList<>(1);
projectList.add(project); projectList.add(project);
} catch (Exception e) { } catch (Exception e) {
} }

View file

@ -190,7 +190,7 @@ public class ManagedBuildDependencyLibsTests extends AbstractBuilderTest {
} }
private long getArtifactTimeStamp(IProject project) { private long getArtifactTimeStamp(IProject project) {
List<IFile> files = new ArrayList<IFile>(); List<IFile> files = new ArrayList<>();
findFiles(project, getArtefactFullName(project), files); findFiles(project, getArtefactFullName(project), files);
if (files.size() == 0) // File not exists if (files.size() == 0) // File not exists
return 0; return 0;

View file

@ -258,7 +258,7 @@ public class ManagedBuildMacrosTests extends TestCase {
PATH_ENV_VAR }; PATH_ENV_VAR };
String[] resArr1 = { "new a", /*"test=CFGTEST",*/ "x", "y", "z", "PRJ=NewMacrosForProjectContext", String[] resArr1 = { "new a", /*"test=CFGTEST",*/ "x", "y", "z", "PRJ=NewMacrosForProjectContext",
"LIST=x|y|z" }; "LIST=x|y|z" };
List<String> res1 = new ArrayList<String>(Arrays.asList(resArr1)); List<String> res1 = new ArrayList<>(Arrays.asList(resArr1));
try { try {
// Add split ${PATH} to res1 // Add split ${PATH} to res1
String strList = mp.resolveValue(PATH_ENV_VAR, UNKNOWN, LISTSEP, IBuildMacroProvider.CONTEXT_OPTION, String strList = mp.resolveValue(PATH_ENV_VAR, UNKNOWN, LISTSEP, IBuildMacroProvider.CONTEXT_OPTION,
@ -272,7 +272,7 @@ public class ManagedBuildMacrosTests extends TestCase {
opt = cfgs[0].setOption(t, opt, set1); opt = cfgs[0].setOption(t, opt, set1);
assertNotNull(opt); assertNotNull(opt);
ArrayList<String> res2 = new ArrayList<String>(res1.size()); ArrayList<String> res2 = new ArrayList<>(res1.size());
for (int i = 0; i < set1.length; i++) { for (int i = 0; i < set1.length; i++) {
try { try {
String[] aus = mp.resolveStringListValue(set1[i], UNKNOWN, LISTSEP, String[] aus = mp.resolveStringListValue(set1[i], UNKNOWN, LISTSEP,
@ -698,7 +698,7 @@ public class ManagedBuildMacrosTests extends TestCase {
// returns a list of macro's NAMES (not values). // returns a list of macro's NAMES (not values).
private String[] printMacros(IBuildMacro[] vars, String head) { private String[] printMacros(IBuildMacro[] vars, String head) {
ArrayList<String> ar = new ArrayList<String>(0); ArrayList<String> ar = new ArrayList<>(0);
if (vars != null) { if (vars != null) {
if (vars.length > 0) { if (vars.length > 0) {
for (int i = 0; i < vars.length; i++) { for (int i = 0; i < vars.length; i++) {

View file

@ -99,7 +99,7 @@ public class ManagedProject21MakefileTests extends TestCase {
} }
}); });
projectList = new ArrayList<IProject>(projectZips.length); projectList = new ArrayList<>(projectZips.length);
for (int i = 0; i < projectZips.length; i++) { for (int i = 0; i < projectZips.length; i++) {
try { try {
String projectName = projectZips[i].getName(); String projectName = projectZips[i].getName();
@ -125,7 +125,7 @@ public class ManagedProject21MakefileTests extends TestCase {
try { try {
IProject project = ManagedBuildTestHelper.createProject(projName, null, location, projectTypeId); IProject project = ManagedBuildTestHelper.createProject(projName, null, location, projectTypeId);
if (project != null) if (project != null)
projectList = new ArrayList<IProject>(1); projectList = new ArrayList<>(1);
projectList.add(project); projectList.add(project);
} catch (Exception e) { } catch (Exception e) {
} }

View file

@ -84,7 +84,7 @@ public class ManagedProjectUpdateTests extends TestCase {
} }
}); });
ArrayList<IProject> projectList = new ArrayList<IProject>(projectZips.length); ArrayList<IProject> projectList = new ArrayList<>(projectZips.length);
for (int i = 0; i < projectZips.length; i++) { for (int i = 0; i < projectZips.length; i++) {
try { try {
String projectName = projectZips[i].getName(); String projectName = projectZips[i].getName();

View file

@ -500,7 +500,7 @@ public class MultiVersionSupportTests extends TestCase {
} }
}); });
ArrayList<IProject> projectList = new ArrayList<IProject>(projectZips.length); ArrayList<IProject> projectList = new ArrayList<>(projectZips.length);
assertEquals(projectZips.length, 1); assertEquals(projectZips.length, 1);
try { try {

View file

@ -30,7 +30,7 @@ public class TestConfigElement implements IManagedConfigElement {
public TestConfigElement(String name, String[][] attributes, IManagedConfigElement[] children) { public TestConfigElement(String name, String[][] attributes, IManagedConfigElement[] children) {
this.name = name; this.name = name;
this.children = children; this.children = children;
this.attributeMap = new TreeMap<String, String>(); this.attributeMap = new TreeMap<>();
for (int i = 0; i < attributes.length; i++) { for (int i = 0; i < attributes.length; i++) {
attributeMap.put(attributes[i][0], attributes[i][1]); attributeMap.put(attributes[i][0], attributes[i][1]);
} }
@ -65,7 +65,7 @@ public class TestConfigElement implements IManagedConfigElement {
*/ */
@Override @Override
public IManagedConfigElement[] getChildren(String elementName) { public IManagedConfigElement[] getChildren(String elementName) {
List<IManagedConfigElement> ret = new ArrayList<IManagedConfigElement>(children.length); List<IManagedConfigElement> ret = new ArrayList<>(children.length);
for (int i = 0; i < children.length; i++) { for (int i = 0; i < children.length; i++) {
if (children[i].getName().equals(elementName)) { if (children[i].getName().equals(elementName)) {
ret.add(children[i]); ret.add(children[i]);

View file

@ -72,7 +72,7 @@ public class ToolChainModificationTests extends TestCase {
assertTrue(cfgM.isBuilderCompatible()); assertTrue(cfgM.isBuilderCompatible());
IToolChain[] ctcs = cfgM.getCompatibleToolChains(); IToolChain[] ctcs = cfgM.getCompatibleToolChains();
HashSet<IHoldsOptions> set = new HashSet<IHoldsOptions>(); HashSet<IHoldsOptions> set = new HashSet<>();
FolderInfo foInfo = (FolderInfo) cfg.getRootFolderInfo(); FolderInfo foInfo = (FolderInfo) cfg.getRootFolderInfo();
ToolChain tc = (ToolChain) foInfo.getToolChain(); ToolChain tc = (ToolChain) foInfo.getToolChain();
IToolChain[] allSys = ManagedBuildManager.getRealToolChains(); IToolChain[] allSys = ManagedBuildManager.getRealToolChains();
@ -83,12 +83,12 @@ public class ToolChainModificationTests extends TestCase {
set.remove(incompatibleTc); set.remove(incompatibleTc);
compare(Arrays.asList(ctcs), set); compare(Arrays.asList(ctcs), set);
HashSet<IToolChain> incomp = new HashSet<IToolChain>(Arrays.asList(allSys)); HashSet<IToolChain> incomp = new HashSet<>(Arrays.asList(allSys));
incomp.removeAll(Arrays.asList(ctcs)); incomp.removeAll(Arrays.asList(ctcs));
assertTrue(incomp.contains(incompatibleTc)); assertTrue(incomp.contains(incompatibleTc));
IBuilder[] cbs = cfgM.getCompatibleBuilders(); IBuilder[] cbs = cfgM.getCompatibleBuilders();
Set<IHoldsOptions> bSet = new HashSet<IHoldsOptions>(); Set<IHoldsOptions> bSet = new HashSet<>();
IBuilder[] allSysB = ManagedBuildManager.getRealBuilders(); IBuilder[] allSysB = ManagedBuildManager.getRealBuilders();
filterPropsSupported(cfg, allSysB, bSet); filterPropsSupported(cfg, allSysB, bSet);
IBuilder incompatibleB = ManagedBuildManager.getExtensionBuilder("tcm.tc4.b1"); IBuilder incompatibleB = ManagedBuildManager.getExtensionBuilder("tcm.tc4.b1");
@ -97,7 +97,7 @@ public class ToolChainModificationTests extends TestCase {
bSet.remove(incompatibleB); bSet.remove(incompatibleB);
compare(Arrays.asList(cbs), bSet); compare(Arrays.asList(cbs), bSet);
HashSet<IBuilder> incompB = new HashSet<IBuilder>(Arrays.asList(allSysB)); HashSet<IBuilder> incompB = new HashSet<>(Arrays.asList(allSysB));
incompB.removeAll(Arrays.asList(cbs)); incompB.removeAll(Arrays.asList(cbs));
assertTrue(incompB.contains(incompatibleB)); assertTrue(incompB.contains(incompatibleB));
@ -115,7 +115,7 @@ public class ToolChainModificationTests extends TestCase {
} }
private HashSet<IHoldsOptions> filterSupportedToolChains(IFolderInfo foInfo, IToolChain tc) { private HashSet<IHoldsOptions> filterSupportedToolChains(IFolderInfo foInfo, IToolChain tc) {
HashSet<IHoldsOptions> set = new HashSet<IHoldsOptions>(); HashSet<IHoldsOptions> set = new HashSet<>();
IToolChain[] allSys = ManagedBuildManager.getRealToolChains(); IToolChain[] allSys = ManagedBuildManager.getRealToolChains();
filterPropsSupported((FolderInfo) foInfo, (ToolChain) tc, allSys, set); filterPropsSupported((FolderInfo) foInfo, (ToolChain) tc, allSys, set);
set.remove(ManagedBuildManager.getRealToolChain(tc)); set.remove(ManagedBuildManager.getRealToolChain(tc));
@ -239,7 +239,7 @@ public class ToolChainModificationTests extends TestCase {
HashSet<? extends IHoldsOptions> s1 = new HashSet<IHoldsOptions>(c1); HashSet<? extends IHoldsOptions> s1 = new HashSet<IHoldsOptions>(c1);
HashSet<? extends IHoldsOptions> s1c = new HashSet<IHoldsOptions>(s1); HashSet<? extends IHoldsOptions> s1c = new HashSet<IHoldsOptions>(s1);
HashSet<IHoldsOptions> s2 = new HashSet<IHoldsOptions>(c2); HashSet<IHoldsOptions> s2 = new HashSet<>(c2);
s1.removeAll(s2); s1.removeAll(s2);
s2.removeAll(s1c); s2.removeAll(s1c);
@ -267,7 +267,7 @@ public class ToolChainModificationTests extends TestCase {
private Collection<IHoldsOptions> filterPropsSupported(FolderInfo foInfo, ToolChain tc, IToolChain[] tcs, private Collection<IHoldsOptions> filterPropsSupported(FolderInfo foInfo, ToolChain tc, IToolChain[] tcs,
Collection<IHoldsOptions> c) { Collection<IHoldsOptions> c) {
if (c == null) if (c == null)
c = new ArrayList<IHoldsOptions>(); c = new ArrayList<>();
for (int i = 0; i < tcs.length; i++) { for (int i = 0; i < tcs.length; i++) {
if (foInfo.isToolChainCompatible(tc, tcs[i])) if (foInfo.isToolChainCompatible(tc, tcs[i]))
c.add(tcs[i]); c.add(tcs[i]);
@ -279,7 +279,7 @@ public class ToolChainModificationTests extends TestCase {
private Collection<IHoldsOptions> filterPropsSupported(IConfiguration cfg, IBuilder[] bs, private Collection<IHoldsOptions> filterPropsSupported(IConfiguration cfg, IBuilder[] bs,
Collection<IHoldsOptions> c) { Collection<IHoldsOptions> c) {
if (c == null) if (c == null)
c = new ArrayList<IHoldsOptions>(); c = new ArrayList<>();
for (int i = 0; i < bs.length; i++) { for (int i = 0; i < bs.length; i++) {
if (cfg.isBuilderCompatible(bs[i])) if (cfg.isBuilderCompatible(bs[i]))
c.add(bs[i]); c.add(bs[i]);
@ -340,7 +340,7 @@ public class ToolChainModificationTests extends TestCase {
IModificationOperation[] ops = tm.getSupportedOperations(); IModificationOperation[] ops = tm.getSupportedOperations();
ITool tool31 = ManagedBuildManager.getExtensionTool("tcm.tc3.t1"); ITool tool31 = ManagedBuildManager.getExtensionTool("tcm.tc3.t1");
Set<ITool> replacement = new HashSet<ITool>(); Set<ITool> replacement = new HashSet<>();
boolean removable = getReplacementToolInfo(ops, replacement); boolean removable = getReplacementToolInfo(ops, replacement);
assertFalse(removable); assertFalse(removable);
@ -350,7 +350,7 @@ public class ToolChainModificationTests extends TestCase {
assertTrue(tm.isProjectTool()); assertTrue(tm.isProjectTool());
ops = tm.getSupportedOperations(); ops = tm.getSupportedOperations();
replacement = new HashSet<ITool>(); replacement = new HashSet<>();
removable = getReplacementToolInfo(ops, replacement); removable = getReplacementToolInfo(ops, replacement);
assertFalse(removable); assertFalse(removable);

View file

@ -299,11 +299,11 @@ public class BuiltinSpecsDetectorTest extends BaseTestCase {
{ {
// provider configured with non-null parameters // provider configured with non-null parameters
MockBuiltinSpecsDetectorExecutedFlag provider = new MockBuiltinSpecsDetectorExecutedFlag(); MockBuiltinSpecsDetectorExecutedFlag provider = new MockBuiltinSpecsDetectorExecutedFlag();
List<String> languages = new ArrayList<String>(); List<String> languages = new ArrayList<>();
languages.add(LANGUAGE_ID); languages.add(LANGUAGE_ID);
Map<String, String> properties = new HashMap<String, String>(); Map<String, String> properties = new HashMap<>();
properties.put(ATTR_PARAMETER, CUSTOM_COMMAND_1); properties.put(ATTR_PARAMETER, CUSTOM_COMMAND_1);
List<ICLanguageSettingEntry> entries = new ArrayList<ICLanguageSettingEntry>(); List<ICLanguageSettingEntry> entries = new ArrayList<>();
ICLanguageSettingEntry entry = new CMacroEntry("MACRO", "VALUE", ICLanguageSettingEntry entry = new CMacroEntry("MACRO", "VALUE",
ICSettingEntry.BUILTIN | ICSettingEntry.READONLY); ICSettingEntry.BUILTIN | ICSettingEntry.READONLY);
entries.add(entry); entries.add(entry);
@ -349,9 +349,9 @@ public class BuiltinSpecsDetectorTest extends BaseTestCase {
// create instance to compare to // create instance to compare to
MockDetectorCloneable provider = new MockDetectorCloneable(); MockDetectorCloneable provider = new MockDetectorCloneable();
List<String> languages = new ArrayList<String>(); List<String> languages = new ArrayList<>();
languages.add(LANGUAGE_ID); languages.add(LANGUAGE_ID);
List<ICLanguageSettingEntry> entries = new ArrayList<ICLanguageSettingEntry>(); List<ICLanguageSettingEntry> entries = new ArrayList<>();
ICLanguageSettingEntry entry = new CMacroEntry("MACRO", "VALUE", ICLanguageSettingEntry entry = new CMacroEntry("MACRO", "VALUE",
ICSettingEntry.BUILTIN | ICSettingEntry.READONLY); ICSettingEntry.BUILTIN | ICSettingEntry.READONLY);
entries.add(entry); entries.add(entry);
@ -361,7 +361,7 @@ public class BuiltinSpecsDetectorTest extends BaseTestCase {
assertTrue(provider.equals(clone0)); assertTrue(provider.equals(clone0));
// configure provider // configure provider
Map<String, String> properties = new HashMap<String, String>(); Map<String, String> properties = new HashMap<>();
properties.put(ATTR_PARAMETER, CUSTOM_COMMAND_1); properties.put(ATTR_PARAMETER, CUSTOM_COMMAND_1);
provider.configureProvider(PROVIDER_ID, PROVIDER_NAME, languages, entries, properties); provider.configureProvider(PROVIDER_ID, PROVIDER_NAME, languages, entries, properties);
assertEquals(false, provider.isConsoleEnabled()); assertEquals(false, provider.isConsoleEnabled());
@ -410,7 +410,7 @@ public class BuiltinSpecsDetectorTest extends BaseTestCase {
// check entries // check entries
{ {
MockDetectorCloneable clone = provider.clone(); MockDetectorCloneable clone = provider.clone();
List<ICLanguageSettingEntry> entries2 = new ArrayList<ICLanguageSettingEntry>(); List<ICLanguageSettingEntry> entries2 = new ArrayList<>();
entries2.add(new CMacroEntry("MACRO2", "VALUE2", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY)); entries2.add(new CMacroEntry("MACRO2", "VALUE2", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY));
clone.setSettingEntries(null, null, null, entries2); clone.setSettingEntries(null, null, null, entries2);
assertFalse(provider.equals(clone)); assertFalse(provider.equals(clone));
@ -489,7 +489,7 @@ public class BuiltinSpecsDetectorTest extends BaseTestCase {
{ {
// create provider // create provider
MockBuiltinSpecsDetectorExecutedFlag provider = new MockBuiltinSpecsDetectorExecutedFlag(); MockBuiltinSpecsDetectorExecutedFlag provider = new MockBuiltinSpecsDetectorExecutedFlag();
List<ICLanguageSettingEntry> entries = new ArrayList<ICLanguageSettingEntry>(); List<ICLanguageSettingEntry> entries = new ArrayList<>();
entries.add(new CIncludePathEntry("path0", 1)); entries.add(new CIncludePathEntry("path0", 1));
provider.setSettingEntries(null, null, null, entries); provider.setSettingEntries(null, null, null, entries);
// serialize entries // serialize entries
@ -708,7 +708,7 @@ public class BuiltinSpecsDetectorTest extends BaseTestCase {
ICConfigurationDescription cfgDescriptionWritable = prjDescriptionWritable.getActiveConfiguration(); ICConfigurationDescription cfgDescriptionWritable = prjDescriptionWritable.getActiveConfiguration();
// Create provider // Create provider
MockBuiltinSpecsDetectorEnvironmentChangeListener provider = new MockBuiltinSpecsDetectorEnvironmentChangeListener(); MockBuiltinSpecsDetectorEnvironmentChangeListener provider = new MockBuiltinSpecsDetectorEnvironmentChangeListener();
List<ILanguageSettingsProvider> providers = new ArrayList<ILanguageSettingsProvider>(); List<ILanguageSettingsProvider> providers = new ArrayList<>();
providers.add(provider); providers.add(provider);
((ILanguageSettingsProvidersKeeper) cfgDescriptionWritable).setLanguageSettingProviders(providers); ((ILanguageSettingsProvidersKeeper) cfgDescriptionWritable).setLanguageSettingProviders(providers);
// Write to project description // Write to project description

View file

@ -195,7 +195,7 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
ICConfigurationDescription cfgDescription = cfgDescriptions[0]; ICConfigurationDescription cfgDescription = cfgDescriptions[0];
Map<String, String> refs = cfgDescription.getReferenceInfo(); Map<String, String> refs = cfgDescription.getReferenceInfo();
assertEquals(1, refs.size()); assertEquals(1, refs.size());
Set<String> referencedProjectsNames = new LinkedHashSet<String>(refs.keySet()); Set<String> referencedProjectsNames = new LinkedHashSet<>(refs.keySet());
assertEquals(projectReferenced.getName(), referencedProjectsNames.toArray()[0]); assertEquals(projectReferenced.getName(), referencedProjectsNames.toArray()[0]);
} }
@ -221,11 +221,11 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
{ {
// provider configured with non-null parameters // provider configured with non-null parameters
MockBuildCommandParser provider = new MockBuildCommandParser(); MockBuildCommandParser provider = new MockBuildCommandParser();
List<String> languages = new ArrayList<String>(); List<String> languages = new ArrayList<>();
languages.add(LANGUAGE_ID); languages.add(LANGUAGE_ID);
Map<String, String> properties = new HashMap<String, String>(); Map<String, String> properties = new HashMap<>();
properties.put(ATTR_PARAMETER, CUSTOM_PARAMETER); properties.put(ATTR_PARAMETER, CUSTOM_PARAMETER);
List<ICLanguageSettingEntry> entries = new ArrayList<ICLanguageSettingEntry>(); List<ICLanguageSettingEntry> entries = new ArrayList<>();
ICLanguageSettingEntry entry = new CMacroEntry("MACRO", "VALUE", ICLanguageSettingEntry entry = new CMacroEntry("MACRO", "VALUE",
ICSettingEntry.BUILTIN | ICSettingEntry.READONLY); ICSettingEntry.BUILTIN | ICSettingEntry.READONLY);
entries.add(entry); entries.add(entry);
@ -381,7 +381,7 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
public boolean processLine(String line) { public boolean processLine(String line) {
// pretending that we parsed the line // pretending that we parsed the line
currentResource = file; currentResource = file;
List<ICLanguageSettingEntry> entries = new ArrayList<ICLanguageSettingEntry>(); List<ICLanguageSettingEntry> entries = new ArrayList<>();
ICLanguageSettingEntry entry = new CMacroEntry("MACRO", "VALUE", ICSettingEntry.BUILTIN); ICLanguageSettingEntry entry = new CMacroEntry("MACRO", "VALUE", ICSettingEntry.BUILTIN);
entries.add(entry); entries.add(entry);
setSettingEntries(entries); setSettingEntries(entries);
@ -2089,7 +2089,7 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
parser.shutdown(); parser.shutdown();
// check populated entries // check populated entries
List<ICLanguageSettingEntry> expected = new ArrayList<ICLanguageSettingEntry>(); List<ICLanguageSettingEntry> expected = new ArrayList<>();
expected.add(new CIncludePathEntry("/path0", 0)); expected.add(new CIncludePathEntry("/path0", 0));
assertEquals(expected, parser.getSettingEntries(cfgDescription, file, languageId)); assertEquals(expected, parser.getSettingEntries(cfgDescription, file, languageId));
assertEquals(null, parser.getSettingEntries(cfgDescription, folder, languageId)); assertEquals(null, parser.getSettingEntries(cfgDescription, folder, languageId));
@ -2122,7 +2122,7 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
parser.shutdown(); parser.shutdown();
// check populated entries // check populated entries
List<ICLanguageSettingEntry> expected = new ArrayList<ICLanguageSettingEntry>(); List<ICLanguageSettingEntry> expected = new ArrayList<>();
expected.add(new CIncludePathEntry("/path0", 0)); expected.add(new CIncludePathEntry("/path0", 0));
assertEquals(null, parser.getSettingEntries(cfgDescription, file, languageId)); assertEquals(null, parser.getSettingEntries(cfgDescription, file, languageId));
assertEquals(expected, parser.getSettingEntries(cfgDescription, folder, languageId)); assertEquals(expected, parser.getSettingEntries(cfgDescription, folder, languageId));
@ -2155,7 +2155,7 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
parser.shutdown(); parser.shutdown();
// check populated entries // check populated entries
List<ICLanguageSettingEntry> expected = new ArrayList<ICLanguageSettingEntry>(); List<ICLanguageSettingEntry> expected = new ArrayList<>();
expected.add(new CIncludePathEntry("/path0", 0)); expected.add(new CIncludePathEntry("/path0", 0));
assertEquals(null, parser.getSettingEntries(cfgDescription, file, languageId)); assertEquals(null, parser.getSettingEntries(cfgDescription, file, languageId));
@ -2180,7 +2180,7 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
parser.shutdown(); parser.shutdown();
// check populated entries // check populated entries
List<ICLanguageSettingEntry> expected = new ArrayList<ICLanguageSettingEntry>(); List<ICLanguageSettingEntry> expected = new ArrayList<>();
expected.add(new CIncludePathEntry("/path0", 0)); expected.add(new CIncludePathEntry("/path0", 0));
assertEquals(expected, parser.getSettingEntries(null, null, LANG_CPP)); assertEquals(expected, parser.getSettingEntries(null, null, LANG_CPP));
} }

View file

@ -651,7 +651,7 @@ public class GCCBuiltinSpecsDetectorTest extends BaseTestCase {
ICConfigurationDescription[] cfgDescriptions = prjDescriptionWritable.getConfigurations(); ICConfigurationDescription[] cfgDescriptions = prjDescriptionWritable.getConfigurations();
assertTrue(cfgDescriptions.length > 0); assertTrue(cfgDescriptions.length > 0);
ICConfigurationDescription cfgDescription = cfgDescriptions[0]; ICConfigurationDescription cfgDescription = cfgDescriptions[0];
List<ILanguageSettingsProvider> providers = new ArrayList<ILanguageSettingsProvider>(); List<ILanguageSettingsProvider> providers = new ArrayList<>();
providers.add(detector); providers.add(detector);
((ILanguageSettingsProvidersKeeper) cfgDescription).setLanguageSettingProviders(providers); ((ILanguageSettingsProvidersKeeper) cfgDescription).setLanguageSettingProviders(providers);
// change the default command in all the tools of the toolchain // change the default command in all the tools of the toolchain

View file

@ -50,8 +50,8 @@ import junit.framework.TestCase;
public class TemplateEngineTestsHelper { public class TemplateEngineTestsHelper {
public static final String LOGGER_FILE_NAME = "TemplateEngineTests"; //$NON-NLS-1$ public static final String LOGGER_FILE_NAME = "TemplateEngineTests"; //$NON-NLS-1$
private static List<IProjectType> projectTypes = new ArrayList<IProjectType>(); private static List<IProjectType> projectTypes = new ArrayList<>();
private static List<String> projectTypeNames = new ArrayList<String>(); private static List<String> projectTypeNames = new ArrayList<>();
/** /**
* get the url of a xml template, by passing the xml file name. * get the url of a xml template, by passing the xml file name.

View file

@ -31,7 +31,7 @@ import junit.framework.TestSuite;
public class BackwardCompatiblityTests extends TestCase { public class BackwardCompatiblityTests extends TestCase {
private static final String TEST_3X_STD_MAKE_PROJECTS = "test3xStdMakeProjects"; private static final String TEST_3X_STD_MAKE_PROJECTS = "test3xStdMakeProjects";
private List<IProject> projList = new LinkedList<IProject>(); private List<IProject> projList = new LinkedList<>();
public static Test suite() { public static Test suite() {
return new TestSuite(BackwardCompatiblityTests.class); return new TestSuite(BackwardCompatiblityTests.class);

View file

@ -81,7 +81,7 @@ public class OptionStringListValueTests extends TestCase {
IFolderInfo fInfo = cfg.getRootFolderInfo(); IFolderInfo fInfo = cfg.getRootFolderInfo();
ICLanguageSetting ls = fDes.getLanguageSettingForFile("a.c"); ICLanguageSetting ls = fDes.getLanguageSettingForFile("a.c");
List<ICLanguageSettingEntry> list = new ArrayList<ICLanguageSettingEntry>(); List<ICLanguageSettingEntry> list = new ArrayList<>();
list.add(new CIncludePathEntry("a", 0)); list.add(new CIncludePathEntry("a", 0));
list.add(new CIncludePathEntry("b", 0)); list.add(new CIncludePathEntry("b", 0));
list.addAll(ls.getSettingEntriesList(ICSettingEntry.INCLUDE_PATH)); list.addAll(ls.getSettingEntriesList(ICSettingEntry.INCLUDE_PATH));
@ -129,7 +129,7 @@ public class OptionStringListValueTests extends TestCase {
ICFolderDescription fDes = cfgDes.getRootFolderDescription(); ICFolderDescription fDes = cfgDes.getRootFolderDescription();
ICLanguageSetting ls = fDes.getLanguageSettingForFile("a.c"); ICLanguageSetting ls = fDes.getLanguageSettingForFile("a.c");
List<ICLanguageSettingEntry> list = new ArrayList<ICLanguageSettingEntry>(); List<ICLanguageSettingEntry> list = new ArrayList<>();
list.add(new CLibraryFileEntry("usr_a", 0, new Path("ap"), new Path("arp"), new Path("apx"))); list.add(new CLibraryFileEntry("usr_a", 0, new Path("ap"), new Path("arp"), new Path("apx")));
list.add(new CLibraryFileEntry("usr_b", 0, new Path("bp"), null, null)); list.add(new CLibraryFileEntry("usr_b", 0, new Path("bp"), null, null));
list.add(new CLibraryFileEntry("usr_c", 0, new Path("cp"), new Path("crp"), null)); list.add(new CLibraryFileEntry("usr_c", 0, new Path("cp"), new Path("crp"), null));
@ -178,9 +178,9 @@ public class OptionStringListValueTests extends TestCase {
} }
private void checkEntriesMatch(List<ICLanguageSettingEntry> list1, List<ICLanguageSettingEntry> list2) { private void checkEntriesMatch(List<ICLanguageSettingEntry> list1, List<ICLanguageSettingEntry> list2) {
Set<ICLanguageSettingEntry> set1 = new LinkedHashSet<ICLanguageSettingEntry>(list1); Set<ICLanguageSettingEntry> set1 = new LinkedHashSet<>(list1);
set1.removeAll(list2); set1.removeAll(list2);
Set<ICLanguageSettingEntry> set2 = new LinkedHashSet<ICLanguageSettingEntry>(list2); Set<ICLanguageSettingEntry> set2 = new LinkedHashSet<>(list2);
set2.removeAll(list1); set2.removeAll(list1);
if (set1.size() != 0 || set2.size() != 0) { if (set1.size() != 0 || set2.size() != 0) {
fail("entries diff"); fail("entries diff");
@ -229,7 +229,7 @@ public class OptionStringListValueTests extends TestCase {
checkOptionValues(option); checkOptionValues(option);
List<Object> list = new ArrayList<Object>(); List<Object> list = new ArrayList<>();
list.add("usr_1"); list.add("usr_1");
list.add("usr_2"); list.add("usr_2");
list.addAll(Arrays.asList(option.getBasicStringListValue())); list.addAll(Arrays.asList(option.getBasicStringListValue()));
@ -239,7 +239,7 @@ public class OptionStringListValueTests extends TestCase {
assertTrue(Arrays.equals(updated, option.getBasicStringListValue())); assertTrue(Arrays.equals(updated, option.getBasicStringListValue()));
checkOptionValues(option); checkOptionValues(option);
list = new ArrayList<Object>(); list = new ArrayList<>();
list.add(new OptionStringValue("usr_3", false, "ap", "arp", "apx")); list.add(new OptionStringValue("usr_3", false, "ap", "arp", "apx"));
list.add(new OptionStringValue("usr_4", false, null, null, null)); list.add(new OptionStringValue("usr_4", false, null, null, null));
list.add(new OptionStringValue("usr_5", false, "cp", null, null)); list.add(new OptionStringValue("usr_5", false, "cp", null, null));

View file

@ -637,7 +637,7 @@ public class ProjectModelTests extends TestCase implements IElementChangedListen
} }
CMacroEntry entry = new CMacroEntry("a", "b", 0); CMacroEntry entry = new CMacroEntry("a", "b", 0);
List<ICLanguageSettingEntry> list = new ArrayList<ICLanguageSettingEntry>(); List<ICLanguageSettingEntry> list = new ArrayList<>();
list.add(entry); list.add(entry);
list.addAll(Arrays.asList(entries)); list.addAll(Arrays.asList(entries));

View file

@ -219,7 +219,7 @@ public class CfgDiscoveredPathManager implements IResourceChangeListener {
.getSettingInfos(cInfo.fLoadContext.getConfiguration().getOwner().getProject(), data, info, true); .getSettingInfos(cInfo.fLoadContext.getConfiguration().getOwner().getProject(), data, info, true);
CResourceData rcDatas[] = data.getResourceDatas(); CResourceData rcDatas[] = data.getResourceDatas();
Map<IPath, CResourceData> rcDataMap = new HashMap<IPath, CResourceData>(); Map<IPath, CResourceData> rcDataMap = new HashMap<>();
CResourceData rcData; CResourceData rcData;
for (int i = 0; i < rcDatas.length; i++) { for (int i = 0; i < rcDatas.length; i++) {
rcData = rcDatas[i]; rcData = rcDatas[i];

View file

@ -158,7 +158,7 @@ public class CfgScannerConfigUtil {
public static Set<String> getAllScannerDiscoveryProfileIds(IToolChain toolchain) { public static Set<String> getAllScannerDiscoveryProfileIds(IToolChain toolchain) {
Assert.isNotNull(toolchain); Assert.isNotNull(toolchain);
Set<String> profiles = new TreeSet<String>(); Set<String> profiles = new TreeSet<>();
if (toolchain != null) { if (toolchain != null) {
String toolchainProfileId = null; String toolchainProfileId = null;
@ -201,7 +201,7 @@ public class CfgScannerConfigUtil {
throw new UnsupportedOperationException(msg); throw new UnsupportedOperationException(msg);
} }
Set<String> profiles = new TreeSet<String>(); Set<String> profiles = new TreeSet<>();
for (IInputType inputType : ((Tool) tool).getAllInputTypes()) { for (IInputType inputType : ((Tool) tool).getAllInputTypes()) {
for (String profileId : getAllScannerDiscoveryProfileIds(inputType)) { for (String profileId : getAllScannerDiscoveryProfileIds(inputType)) {
@ -233,7 +233,7 @@ public class CfgScannerConfigUtil {
throw new UnsupportedOperationException(msg); throw new UnsupportedOperationException(msg);
} }
Set<String> profiles = new TreeSet<String>(); Set<String> profiles = new TreeSet<>();
String attribute = ((InputType) inputType).getLegacyDiscoveryProfileIdAttribute(); String attribute = ((InputType) inputType).getLegacyDiscoveryProfileIdAttribute();
if (attribute != null) { if (attribute != null) {

View file

@ -87,7 +87,7 @@ public class PerFileSettingsCalculator {
void add(ILangSettingInfo info) { void add(ILangSettingInfo info) {
if (fLangInfoList == null) if (fLangInfoList == null)
fLangInfoList = new ArrayList<ILangSettingInfo>(); fLangInfoList = new ArrayList<>();
fLangInfoList.add(info); fLangInfoList.add(info);
} }
} }
@ -130,9 +130,9 @@ public class PerFileSettingsCalculator {
} }
public void add(int index, PathFilePathInfo value) { public void add(int index, PathFilePathInfo value) {
List<PathFilePathInfo> list = checkResize(index) ? new ArrayList<PathFilePathInfo>() : fStore[index]; List<PathFilePathInfo> list = checkResize(index) ? new ArrayList<>() : fStore[index];
if (list == null) { if (list == null) {
list = new ArrayList<PathFilePathInfo>(); list = new ArrayList<>();
fStore[index] = list; fStore[index] = list;
} }
@ -157,7 +157,7 @@ public class PerFileSettingsCalculator {
public List<PathFilePathInfo>[] getLists() { public List<PathFilePathInfo>[] getLists() {
int size = fMaxIndex + 1; int size = fMaxIndex + 1;
List<List<PathFilePathInfo>> list = new ArrayList<List<PathFilePathInfo>>(size); List<List<PathFilePathInfo>> list = new ArrayList<>(size);
List<PathFilePathInfo> l; List<PathFilePathInfo> l;
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
l = fStore[i]; l = fStore[i];
@ -214,13 +214,13 @@ public class PerFileSettingsCalculator {
public void add(PathFilePathInfo pInfo) { public void add(PathFilePathInfo pInfo) {
if (fPathFilePathInfoMap == null) if (fPathFilePathInfoMap == null)
fPathFilePathInfoMap = new HashMap<PathInfo, List<PathFilePathInfo>>(3); fPathFilePathInfoMap = new HashMap<>(3);
PathInfo fileInfo = pInfo.fInfo; PathInfo fileInfo = pInfo.fInfo;
List<PathFilePathInfo> list = fileInfo == fMaxMatchInfo ? fMaxMatchInfoList List<PathFilePathInfo> list = fileInfo == fMaxMatchInfo ? fMaxMatchInfoList
: fPathFilePathInfoMap.get(fileInfo); : fPathFilePathInfoMap.get(fileInfo);
if (list == null) { if (list == null) {
List<PathFilePathInfo> emptyList = new ArrayList<PathFilePathInfo>(); List<PathFilePathInfo> emptyList = new ArrayList<>();
fPathFilePathInfoMap.put(fileInfo, emptyList); fPathFilePathInfoMap.put(fileInfo, emptyList);
if (fMaxMatchInfo == null) { if (fMaxMatchInfo == null) {
fMaxMatchInfo = fileInfo; fMaxMatchInfo = fileInfo;
@ -342,7 +342,7 @@ public class PerFileSettingsCalculator {
private HashSet<String> calcExtsSet() { private HashSet<String> calcExtsSet() {
if (fExtsSet == null) if (fExtsSet == null)
fExtsSet = new HashSet<String>(Arrays.asList(fExts)); fExtsSet = new HashSet<>(Arrays.asList(fExts));
return fExtsSet; return fExtsSet;
} }
@ -473,7 +473,7 @@ public class PerFileSettingsCalculator {
void internalAdd(ExtsSetSettings setting) { void internalAdd(ExtsSetSettings setting) {
if (fExtsSetToExtsSetSettingsMap == null) { if (fExtsSetToExtsSetSettingsMap == null) {
fExtsSetToExtsSetSettingsMap = new HashMap<ExtsSet, ExtsSetSettings>(); fExtsSetToExtsSetSettingsMap = new HashMap<>();
} }
ExtsSetSettings cur = fExtsSetToExtsSetSettingsMap.get(setting.fExtsSet); ExtsSetSettings cur = fExtsSetToExtsSetSettingsMap.get(setting.fExtsSet);
@ -507,7 +507,7 @@ public class PerFileSettingsCalculator {
// } // }
public RcSetSettings[] getChildren(final boolean includeCurrent) { public RcSetSettings[] getChildren(final boolean includeCurrent) {
final List<RcSetSettings> list = new ArrayList<RcSetSettings>(); final List<RcSetSettings> list = new ArrayList<>();
fContainer.accept(new IPathSettingsContainerVisitor() { fContainer.accept(new IPathSettingsContainerVisitor() {
@Override @Override
@ -572,7 +572,7 @@ public class PerFileSettingsCalculator {
String[] exts = setting.fExtsSet.fExts; String[] exts = setting.fExtsSet.fExts;
String ext; String ext;
if (map == null) { if (map == null) {
map = new HashMap<String, ExtsSetSettings>(); map = new HashMap<>();
forceAdd = true; forceAdd = true;
} }
@ -611,7 +611,7 @@ public class PerFileSettingsCalculator {
path = rcData.getPath(); path = rcData.getPath();
curRcSet = rcSet.createChild(path, rcData, false); curRcSet = rcSet.createChild(path, rcData, false);
if (rcData.getType() == ICSettingBase.SETTING_FILE) { if (rcData.getType() == ICSettingBase.SETTING_FILE) {
fileMap = new HashMap<ExtsSet, ExtsSetSettings>(1); fileMap = new HashMap<>(1);
fileSetting = createExtsSetSettings(path, (CFileData) rcData); fileSetting = createExtsSetSettings(path, (CFileData) rcData);
fileMap.put(fileSetting.fExtsSet, fileSetting); fileMap.put(fileSetting.fExtsSet, fileSetting);
curRcSet.internalSetSettingsMap(fileMap); curRcSet.internalSetSettingsMap(fileMap);
@ -664,7 +664,7 @@ public class PerFileSettingsCalculator {
private static void addEmptyLanguageInfos(RcSettingInfo rcInfo, CLanguageData[] lDatas) { private static void addEmptyLanguageInfos(RcSettingInfo rcInfo, CLanguageData[] lDatas) {
ArrayList<ILangSettingInfo> list = rcInfo.fLangInfoList; ArrayList<ILangSettingInfo> list = rcInfo.fLangInfoList;
if (list == null) { if (list == null) {
list = new ArrayList<ILangSettingInfo>(lDatas.length); list = new ArrayList<>(lDatas.length);
rcInfo.fLangInfoList = list; rcInfo.fLangInfoList = list;
} else { } else {
list.ensureCapacity(lDatas.length); list.ensureCapacity(lDatas.length);
@ -682,7 +682,7 @@ public class PerFileSettingsCalculator {
IPath projRelPath; IPath projRelPath;
CResourceData rcData; CResourceData rcData;
// RcSetSettings dataSetting; // RcSetSettings dataSetting;
List<IRcSettingInfo> list = new ArrayList<IRcSettingInfo>(pfpis.length); List<IRcSettingInfo> list = new ArrayList<>(pfpis.length);
RcSettingInfo rcInfo; RcSettingInfo rcInfo;
LangSettingInfo lInfo; LangSettingInfo lInfo;
CLanguageData lData; CLanguageData lData;
@ -723,7 +723,7 @@ public class PerFileSettingsCalculator {
if (rcInfo == null) { if (rcInfo == null) {
rcInfo = new RcSettingInfo(rootData); rcInfo = new RcSettingInfo(rootData);
tmpList = new ArrayList<ILangSettingInfo>(lDatas.length - k); tmpList = new ArrayList<>(lDatas.length - k);
rcInfo.fLangInfoList = tmpList; rcInfo.fLangInfoList = tmpList;
} }
@ -777,7 +777,7 @@ public class PerFileSettingsCalculator {
if (lData != null) { if (lData != null) {
rcInfo = new RcSettingInfo(rcData); rcInfo = new RcSettingInfo(rcData);
lInfo = new LangSettingInfo(lData, pInfo); lInfo = new LangSettingInfo(lData, pInfo);
tmpList = new ArrayList<ILangSettingInfo>(1); tmpList = new ArrayList<>(1);
tmpList.add(lInfo); tmpList.add(lInfo);
rcInfo.fLangInfoList = tmpList; rcInfo.fLangInfoList = tmpList;
list.add(rcInfo); list.add(rcInfo);
@ -806,7 +806,7 @@ public class PerFileSettingsCalculator {
RcSetSettings settings[] = rootSetting.getChildren(true); RcSetSettings settings[] = rootSetting.getChildren(true);
RcSetSettings setting; RcSetSettings setting;
CResourceData rcData; CResourceData rcData;
List<IRcSettingInfo> resultList = new ArrayList<IRcSettingInfo>(); List<IRcSettingInfo> resultList = new ArrayList<>();
LangSettingInfo langInfo; LangSettingInfo langInfo;
RcSettingInfo rcInfo; RcSettingInfo rcInfo;
PathInfo pathInfo; PathInfo pathInfo;
@ -838,7 +838,7 @@ public class PerFileSettingsCalculator {
if (pathInfo != null) { if (pathInfo != null) {
langInfo = new LangSettingInfo(extSetting.fBaseLangData, pathInfo); langInfo = new LangSettingInfo(extSetting.fBaseLangData, pathInfo);
rcInfo = new RcSettingInfo(rcData); rcInfo = new RcSettingInfo(rcData);
rcInfo.fLangInfoList = new ArrayList<ILangSettingInfo>(1); rcInfo.fLangInfoList = new ArrayList<>(1);
rcInfo.fLangInfoList.add(langInfo); rcInfo.fLangInfoList.add(langInfo);
resultList.add(rcInfo); resultList.add(rcInfo);
} }
@ -846,7 +846,7 @@ public class PerFileSettingsCalculator {
} else { } else {
if (setting.fExtsSetToExtsSetSettingsMap.size() != 0) { if (setting.fExtsSetToExtsSetSettingsMap.size() != 0) {
rcInfo = new RcSettingInfo(rcData); rcInfo = new RcSettingInfo(rcData);
rcInfo.fLangInfoList = new ArrayList<ILangSettingInfo>(setting.fExtsSetToExtsSetSettingsMap.size()); rcInfo.fLangInfoList = new ArrayList<>(setting.fExtsSetToExtsSetSettingsMap.size());
resultList.add(rcInfo); resultList.add(rcInfo);
Collection<ExtsSetSettings> values = setting.fExtsSetToExtsSetSettingsMap.values(); Collection<ExtsSetSettings> values = setting.fExtsSetToExtsSetSettingsMap.values();
@ -1008,7 +1008,7 @@ public class PerFileSettingsCalculator {
private static HashMap<ExtsSet, ExtsSetSettings> createExtsSetSettingsMap(CFolderData data) { private static HashMap<ExtsSet, ExtsSetSettings> createExtsSetSettingsMap(CFolderData data) {
CLanguageData[] lDatas = data.getLanguageDatas(); CLanguageData[] lDatas = data.getLanguageDatas();
HashMap<ExtsSet, ExtsSetSettings> map = new HashMap<ExtsSet, ExtsSetSettings>(lDatas.length); HashMap<ExtsSet, ExtsSetSettings> map = new HashMap<>(lDatas.length);
ExtsSetSettings settings; ExtsSetSettings settings;
if (lDatas.length != 0) { if (lDatas.length != 0) {
@ -1028,7 +1028,7 @@ public class PerFileSettingsCalculator {
IPath path; IPath path;
PathInfo info, storedInfo; PathInfo info, storedInfo;
ListIndexStore store = new ListIndexStore(10); ListIndexStore store = new ListIndexStore(10);
HashMap<PathInfo, PathInfo> infoMap = new HashMap<PathInfo, PathInfo>(); HashMap<PathInfo, PathInfo> infoMap = new HashMap<>();
// LinkedHashMap result; // LinkedHashMap result;
Set<Entry<IResource, PathInfo>> entrySet = map.entrySet(); Set<Entry<IResource, PathInfo>> entrySet = map.entrySet();

View file

@ -133,13 +133,13 @@ public class CfgScannerConfigInfoFactory2 {
} }
if (fContainer == null) { if (fContainer == null) {
fContainer = new SoftReference<IScannerConfigBuilderInfo2Set>(container); fContainer = new SoftReference<>(container);
} }
return container; return container;
} }
private Map<CfgInfoContext, IScannerConfigBuilderInfo2> createMap() { private Map<CfgInfoContext, IScannerConfigBuilderInfo2> createMap() {
HashMap<CfgInfoContext, IScannerConfigBuilderInfo2> map = new HashMap<CfgInfoContext, IScannerConfigBuilderInfo2>(); HashMap<CfgInfoContext, IScannerConfigBuilderInfo2> map = new HashMap<>();
try { try {
IScannerConfigBuilderInfo2Set container = getContainer(); IScannerConfigBuilderInfo2Set container = getContainer();
@ -314,7 +314,7 @@ public class CfgScannerConfigInfoFactory2 {
private Map<CfgInfoContext, IScannerConfigBuilderInfo2> getConfigInfoMap( private Map<CfgInfoContext, IScannerConfigBuilderInfo2> getConfigInfoMap(
Map<InfoContext, IScannerConfigBuilderInfo2> baseMap) { Map<InfoContext, IScannerConfigBuilderInfo2> baseMap) {
Map<CfgInfoContext, IScannerConfigBuilderInfo2> map = new HashMap<CfgInfoContext, IScannerConfigBuilderInfo2>(); Map<CfgInfoContext, IScannerConfigBuilderInfo2> map = new HashMap<>();
for (Entry<InfoContext, IScannerConfigBuilderInfo2> entry : baseMap.entrySet()) { for (Entry<InfoContext, IScannerConfigBuilderInfo2> entry : baseMap.entrySet()) {
InfoContext baseContext = entry.getKey(); InfoContext baseContext = entry.getKey();

Some files were not shown because too many files have changed in this diff Show more