1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 14:12:10 +02:00

Cosmetics.

Change-Id: I4022285d11267b77861cc8e4333adbea9c780ea7
This commit is contained in:
Sergey Prigogin 2016-03-21 19:40:36 -07:00
parent de3b172c7d
commit 52432d7370
3 changed files with 21 additions and 23 deletions

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]);
} }
} }
@ -220,11 +220,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);
@ -382,7 +382,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);
@ -2366,10 +2366,10 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
*/ */
public void testEntriesProjectLevelGlobalProvider() throws Exception { public void testEntriesProjectLevelGlobalProvider() throws Exception {
// create GCCBuildCommandParser // create GCCBuildCommandParser
ILanguageSettingsProvider wspProvider = LanguageSettingsManager ILanguageSettingsProvider wspProvider =
.getWorkspaceProvider(GCC_BUILD_COMMAND_PARSER_EXT); LanguageSettingsManager.getWorkspaceProvider(GCC_BUILD_COMMAND_PARSER_EXT);
GCCBuildCommandParser parser = (GCCBuildCommandParser) LanguageSettingsManager GCCBuildCommandParser parser =
.getRawProvider(wspProvider); (GCCBuildCommandParser) LanguageSettingsManager.getRawProvider(wspProvider);
parser.setResourceScope(AbstractBuildCommandParser.ResourceScope.PROJECT); parser.setResourceScope(AbstractBuildCommandParser.ResourceScope.PROJECT);
parser.clear(); parser.clear();
@ -2379,7 +2379,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((IBuildConfiguration) null, null, LANG_CPP)); assertEquals(expected, parser.getSettingEntries((IBuildConfiguration) null, null, LANG_CPP));
} }
@ -2440,8 +2440,8 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
String languageId = ls.getLanguageId(); String languageId = ls.getLanguageId();
// create GCCBuildCommandParser // create GCCBuildCommandParser
GCCBuildCommandParser parser = (GCCBuildCommandParser) LanguageSettingsManager GCCBuildCommandParser parser = (GCCBuildCommandParser) LanguageSettingsManager.getExtensionProviderCopy(
.getExtensionProviderCopy(GCC_BUILD_COMMAND_PARSER_EXT, true); GCC_BUILD_COMMAND_PARSER_EXT, true);
parser.setResourceScope(AbstractBuildCommandParser.ResourceScope.PROJECT); parser.setResourceScope(AbstractBuildCommandParser.ResourceScope.PROJECT);
// parse line // parse line
@ -2461,10 +2461,10 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
*/ */
public void testFileAbsolutePath_ProjectLevelGlobalProvider() throws Exception { public void testFileAbsolutePath_ProjectLevelGlobalProvider() throws Exception {
// create GCCBuildCommandParser // create GCCBuildCommandParser
ILanguageSettingsProvider wspProvider = LanguageSettingsManager ILanguageSettingsProvider wspProvider =
.getWorkspaceProvider(GCC_BUILD_COMMAND_PARSER_EXT); LanguageSettingsManager.getWorkspaceProvider(GCC_BUILD_COMMAND_PARSER_EXT);
GCCBuildCommandParser parser = (GCCBuildCommandParser) LanguageSettingsManager GCCBuildCommandParser parser =
.getRawProvider(wspProvider); (GCCBuildCommandParser) LanguageSettingsManager.getRawProvider(wspProvider);
parser.setResourceScope(AbstractBuildCommandParser.ResourceScope.PROJECT); parser.setResourceScope(AbstractBuildCommandParser.ResourceScope.PROJECT);
parser.clear(); parser.clear();
@ -2479,5 +2479,4 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
List<ICLanguageSettingEntry> entries = parser.getSettingEntries((IBuildConfiguration) null, null, LANG_CPP); List<ICLanguageSettingEntry> entries = parser.getSettingEntries((IBuildConfiguration) null, null, LANG_CPP);
assertEquals(new CIncludePathEntry("/path0", 0), entries.get(0)); assertEquals(new CIncludePathEntry("/path0", 0), entries.get(0));
} }
} }

View file

@ -581,7 +581,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

@ -34,14 +34,14 @@ public class LanguageSettingsStorage implements Cloneable {
/** Storage to keep settings entries. */ /** Storage to keep settings entries. */
protected Map<String, // languageId protected Map<String, // languageId
Map<String, // resource project path Map<String, // resource project path
List<ICLanguageSettingEntry>>> fStorage = new HashMap<String, Map<String, List<ICLanguageSettingEntry>>>(); List<ICLanguageSettingEntry>>> fStorage = new HashMap<>();
/** /**
* Pool of LSE lists implemented as WeakHashSet. That allows to gain memory savings * Pool of LSE lists implemented as WeakHashSet. That allows to gain memory savings
* at the expense of CPU time. WeakHashSet handles garbage collection when a list is not * at the expense of CPU time. WeakHashSet handles garbage collection when a list is not
* referenced anywhere else. See JavaDoc {@link java.lang.ref.WeakReference} about weak reference objects. * referenced anywhere else. See JavaDoc {@link java.lang.ref.WeakReference} about weak reference objects.
*/ */
private static WeakHashSet<List<ICLanguageSettingEntry>> listPool = new WeakHashSetSynchronized<List<ICLanguageSettingEntry>>(); private static WeakHashSet<List<ICLanguageSettingEntry>> listPool = new WeakHashSetSynchronized<>();
/** /**
* Returns the list of setting entries for the given resource and language. * Returns the list of setting entries for the given resource and language.
@ -218,13 +218,13 @@ public class LanguageSettingsStorage implements Cloneable {
@Override @Override
public LanguageSettingsStorage clone() throws CloneNotSupportedException { public LanguageSettingsStorage clone() throws CloneNotSupportedException {
LanguageSettingsStorage storageClone = (LanguageSettingsStorage) super.clone(); LanguageSettingsStorage storageClone = (LanguageSettingsStorage) super.clone();
storageClone.fStorage = new HashMap<String, Map<String, List<ICLanguageSettingEntry>>>(); storageClone.fStorage = new HashMap<>();
synchronized (fStorage) { synchronized (fStorage) {
Set<Entry<String, Map<String, List<ICLanguageSettingEntry>>>> entrySetLang = fStorage.entrySet(); Set<Entry<String, Map<String, List<ICLanguageSettingEntry>>>> entrySetLang = fStorage.entrySet();
for (Entry<String, Map<String, List<ICLanguageSettingEntry>>> entryLang : entrySetLang) { for (Entry<String, Map<String, List<ICLanguageSettingEntry>>> entryLang : entrySetLang) {
String langId = entryLang.getKey(); String langId = entryLang.getKey();
Map<String, List<ICLanguageSettingEntry>> mapRc = entryLang.getValue(); Map<String, List<ICLanguageSettingEntry>> mapRc = entryLang.getValue();
Map<String, List<ICLanguageSettingEntry>> mapRcClone = new HashMap<String, List<ICLanguageSettingEntry>>(); Map<String, List<ICLanguageSettingEntry>> mapRcClone = new HashMap<>();
Set<Entry<String, List<ICLanguageSettingEntry>>> entrySetRc = mapRc.entrySet(); Set<Entry<String, List<ICLanguageSettingEntry>>> entrySetRc = mapRc.entrySet();
for (Entry<String, List<ICLanguageSettingEntry>> entryRc : entrySetRc) { for (Entry<String, List<ICLanguageSettingEntry>> entryRc : entrySetRc) {
String rcProjectPath = entryRc.getKey(); String rcProjectPath = entryRc.getKey();
@ -262,5 +262,4 @@ public class LanguageSettingsStorage implements Cloneable {
return false; return false;
return true; return true;
} }
} }