1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 09:25:31 +02:00

Relaxed type constraints.

This commit is contained in:
Sergey Prigogin 2014-05-02 10:25:24 -07:00
parent 355027f0c9
commit 7e686b6744
6 changed files with 22 additions and 20 deletions

View file

@ -152,7 +152,7 @@ public abstract class AbstractBuildCommandParser extends AbstractLanguageSetting
}
@Override
protected void setSettingEntries(List<ICLanguageSettingEntry> entries) {
protected void setSettingEntries(List<? extends ICLanguageSettingEntry> entries) {
IResource rc = null;
switch (getResourceScope()) {
case FILE:

View file

@ -760,7 +760,7 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
}
@Override
protected void setSettingEntries(List<ICLanguageSettingEntry> entries) {
protected void setSettingEntries(List<? extends ICLanguageSettingEntry> entries) {
// Built-in specs detectors collect entries not per line but for the whole output
// so collect them to save later when output finishes
if (entries != null) {

View file

@ -608,7 +608,7 @@ public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSett
*
* @param entries - language settings entries to set.
*/
protected void setSettingEntries(List<ICLanguageSettingEntry> entries) {
protected void setSettingEntries(List<? extends ICLanguageSettingEntry> entries) {
setSettingEntries(currentCfgDescription, currentResource, currentLanguageId, entries);
}

View file

@ -8,7 +8,6 @@
* Contributors:
* Andrew Gvozdev - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.core.language.settings.providers;
import java.util.List;
@ -23,7 +22,6 @@ import org.eclipse.core.resources.IResource;
* their settings themselves and not providing such option to the user.
*
* @since 5.4
*
*/
public interface ILanguageSettingsEditableProvider extends ILanguageSettingsBroadcastingProvider, Cloneable {
@Override
@ -43,7 +41,8 @@ public interface ILanguageSettingsEditableProvider extends ILanguageSettingsBroa
* to be defined as default entries for languages.
* @param entries - language settings entries to set.
*/
public void setSettingEntries(ICConfigurationDescription cfgDescription, IResource rc, String languageId, List<ICLanguageSettingEntry> entries);
public void setSettingEntries(ICConfigurationDescription cfgDescription, IResource rc, String languageId,
List<? extends ICLanguageSettingEntry> entries);
/**
* Shallow clone of the provider. "Shallow" is defined here as the exact copy except that

View file

@ -105,22 +105,23 @@ public class LanguageSettingsSerializableProvider extends LanguageSettingsBasePr
}
/**
* Set the language scope of the provider.
* Sets the language scope of the provider.
*
* @param languages - the list of languages this provider provides for.
* If {@code null}, the provider provides for any language.
*
* @see #getLanguageScope()
*/
public void setLanguageScope(List <String> languages) {
if (languages==null)
public void setLanguageScope(List<String> languages) {
if (languages == null) {
this.languageScope = null;
else
this.languageScope = new ArrayList<String>(languages);
} else {
this.languageScope = new ArrayList<>(languages);
}
}
/**
* Clear all the entries for all configurations, all resources and all languages.
* Clears all the entries for all configurations, all resources and all languages.
*/
public void clear() {
fStorage.clear();
@ -141,7 +142,8 @@ public class LanguageSettingsSerializableProvider extends LanguageSettingsBasePr
* to be defined for the language scope. See {@link #getLanguageScope()}
* @param entries - language settings entries to set.
*/
public void setSettingEntries(ICConfigurationDescription cfgDescription, IResource rc, String languageId, List<ICLanguageSettingEntry> entries) {
public void setSettingEntries(ICConfigurationDescription cfgDescription, IResource rc, String languageId,
List<? extends ICLanguageSettingEntry> entries) {
String rcProjectPath = rc!=null ? rc.getProjectRelativePath().toString() : null;
fStorage.setSettingEntries(rcProjectPath, languageId, entries);
}

View file

@ -69,8 +69,8 @@ public class LanguageSettingsStorage implements Cloneable {
* @param entries - list of entries to sort.
* @return - sorted entries.
*/
private List<ICLanguageSettingEntry> sortEntries(List<ICLanguageSettingEntry> entries) {
List<ICLanguageSettingEntry> sortedEntries = new ArrayList<ICLanguageSettingEntry>(entries);
private List<ICLanguageSettingEntry> sortEntries(List<? extends ICLanguageSettingEntry> entries) {
List<ICLanguageSettingEntry> sortedEntries = new ArrayList<>(entries);
Collections.sort(sortedEntries, new Comparator<ICLanguageSettingEntry>() {
/**
* This comparator sorts by kinds first and the macros are sorted additionally by name.
@ -79,7 +79,7 @@ public class LanguageSettingsStorage implements Cloneable {
public int compare(ICLanguageSettingEntry entry0, ICLanguageSettingEntry entry1) {
int kind0 = entry0.getKind();
int kind1 = entry1.getKind();
if (kind0==ICSettingEntry.MACRO && kind1==ICSettingEntry.MACRO) {
if (kind0 == ICSettingEntry.MACRO && kind1 == ICSettingEntry.MACRO) {
return entry0.getName().compareTo(entry1.getName());
}
@ -98,11 +98,12 @@ public class LanguageSettingsStorage implements Cloneable {
* to be defined for the language scope.
* @param entries - language settings entries to set.
*/
public void setSettingEntries(String rcProjectPath, String languageId, List<ICLanguageSettingEntry> entries) {
public void setSettingEntries(String rcProjectPath, String languageId,
List<? extends ICLanguageSettingEntry> entries) {
synchronized (fStorage) {
if (entries!=null) {
Map<String, List<ICLanguageSettingEntry>> langMap = fStorage.get(languageId);
if (langMap==null) {
if (langMap == null) {
langMap = new HashMap<String, List<ICLanguageSettingEntry>>();
fStorage.put(languageId, langMap);
}
@ -111,9 +112,9 @@ public class LanguageSettingsStorage implements Cloneable {
} else {
// reduct the empty maps in the tables
Map<String, List<ICLanguageSettingEntry>> langMap = fStorage.get(languageId);
if (langMap!=null) {
if (langMap != null) {
langMap.remove(rcProjectPath);
if (langMap.size()==0) {
if (langMap.isEmpty()) {
fStorage.remove(languageId);
}
}