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

Bug 571309: Use java Collections instead of System.arraycopy

System.arraycopy is more error prone and subsequent commits will
be modifying the array. This commit is to keep unrelated code
separate.

Change-Id: I2490318176da3e631a63974ffe5fa62da44a96ea
This commit is contained in:
Jonah Graham 2021-02-24 15:23:50 -05:00
parent a028e22442
commit 55c2df3b03
2 changed files with 5 additions and 6 deletions

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.managedbuilder.core; singleton:=true
Bundle-Version: 9.2.0.qualifier
Bundle-Version: 9.2.100.qualifier
Bundle-Activator: org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin

View file

@ -58,16 +58,15 @@ public class HeadlessBuilderExternalSettingsProvider extends CExternalSettingPro
static void hookExternalSettingsProvider() {
if (additionalSettings.isEmpty())
return;
// Remove the external settings providers from all the hooked projects
// hook the external settings providers to all projects
for (IProject project : ResourcesPlugin.getWorkspace().getRoot().getProjects()) {
ICProjectDescription desc = CCorePlugin.getDefault().getProjectDescription(project);
if (desc == null)
continue;
for (ICConfigurationDescription cfg : desc.getConfigurations()) {
String[] extSettingIds = cfg.getExternalSettingsProviderIds();
String[] newSettingIds = new String[extSettingIds.length + 1];
System.arraycopy(extSettingIds, 0, newSettingIds, 0, extSettingIds.length);
newSettingIds[extSettingIds.length] = ID;
List<String> settingIds = new ArrayList<>(Arrays.asList(cfg.getExternalSettingsProviderIds()));
settingIds.add(ID);
String[] newSettingIds = settingIds.toArray(String[]::new);
cfg.setExternalSettingsProviderIds(newSettingIds);
}
try {