diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/internal/core/scannerconfig/PerFileSettingsCalculator.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/internal/core/scannerconfig/PerFileSettingsCalculator.java index 879028c45ee..6d3e0f377ee 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/internal/core/scannerconfig/PerFileSettingsCalculator.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/internal/core/scannerconfig/PerFileSettingsCalculator.java @@ -12,11 +12,13 @@ package org.eclipse.cdt.build.internal.core.scannerconfig; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collection; import java.util.HashMap; import java.util.HashSet; -import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry; import org.eclipse.cdt.core.settings.model.ICSettingBase; @@ -61,7 +63,7 @@ public class PerFileSettingsCalculator { } private static class RcSettingInfo implements IRcSettingInfo{ - private ArrayList fLangInfoList; + private ArrayList fLangInfoList; private CResourceData fRcData; RcSettingInfo(CResourceData rcData){ @@ -70,7 +72,7 @@ public class PerFileSettingsCalculator { public ILangSettingInfo[] getLangInfos() { if(fLangInfoList != null && fLangInfoList.size() != 0) - return (ILangSettingInfo[])fLangInfoList.toArray(new ILangSettingInfo[fLangInfoList.size()]); + return fLangInfoList.toArray(new ILangSettingInfo[fLangInfoList.size()]); return new ILangSettingInfo[0]; } @@ -80,7 +82,7 @@ public class PerFileSettingsCalculator { void add(ILangSettingInfo info){ if(fLangInfoList == null) - fLangInfoList = new ArrayList(); + fLangInfoList = new ArrayList(); fLangInfoList.add(info); } } @@ -106,7 +108,7 @@ public class PerFileSettingsCalculator { private static class ListIndexStore { private int fMaxIndex; - private List[] fStore; + private List[] fStore; public ListIndexStore(int size){ if(size < 0) @@ -115,10 +117,10 @@ public class PerFileSettingsCalculator { fStore = new List[size]; } - public void add(int index, Object value){ - List list = checkResize(index) ? new ArrayList() : fStore[index]; + public void add(int index, PathFilePathInfo value){ + List list = checkResize(index) ? new ArrayList() : fStore[index]; if(list == null){ - list = new ArrayList(); + list = new ArrayList(); fStore[index] = list; } @@ -131,7 +133,7 @@ public class PerFileSettingsCalculator { private boolean checkResize(int index){ if(index >= fStore.length){ int newSize = ++index; - List resized[] = new List[newSize]; + List resized[] = new List[newSize]; if(fStore != null && fStore.length != 0){ System.arraycopy(fStore, 0, resized, 0, fStore.length); } @@ -141,17 +143,17 @@ public class PerFileSettingsCalculator { return false; } - public List[] getLists(){ + public List[] getLists(){ int size = fMaxIndex + 1; - List list = new ArrayList(size); - List l; + List> list = new ArrayList>(size); + List l; for(int i = 0; i < size; i++){ l = fStore[i]; if(l != null) list.add(l); } - return (List[])list.toArray(new List[list.size()]); + return list.toArray(new List[list.size()]); } } @@ -169,11 +171,11 @@ public class PerFileSettingsCalculator { // String[] fExts; // HashSet fExtsSet; private ExtsSet fExtsSet; - Map fPathFilePathInfoMap; + Map> fPathFilePathInfoMap; CLanguageData fBaseLangData; boolean fIsDerived; private PathInfo fMaxMatchInfo; - private List fMaxMatchInfoList; + private List fMaxMatchInfoList; private int fHash; public ExtsSetSettings(CLanguageData baseLangData, ExtsSet extsSet, boolean isDerived) { @@ -184,35 +186,32 @@ public class PerFileSettingsCalculator { void add(ExtsSetSettings setting){ if(setting.fPathFilePathInfoMap != null){ - List list; - int size; - for(Iterator iter = setting.fPathFilePathInfoMap.values().iterator(); iter.hasNext();){ - list = (List)iter.next(); - size = list.size(); - for(int i = 0; i < size; i++){ - add((PathFilePathInfo)list.get(i)); + Collection> values = setting.fPathFilePathInfoMap.values(); + for (List list : values) { + for (PathFilePathInfo pInfo : list) { + add(pInfo); } } } } - void updateLangData(CLanguageData lData, boolean isDerived){ - fBaseLangData = lData; - fIsDerived = lData != null ? isDerived : false; - } +// void updateLangData(CLanguageData lData, boolean isDerived){ +// fBaseLangData = lData; +// fIsDerived = lData != null ? isDerived : false; +// } public void add(PathFilePathInfo pInfo){ if(fPathFilePathInfoMap == null) - fPathFilePathInfoMap = new HashMap(3); + fPathFilePathInfoMap = new HashMap>(3); PathInfo fileInfo = pInfo.fInfo; List list = fileInfo == fMaxMatchInfo ? fMaxMatchInfoList : (List)fPathFilePathInfoMap.get(fileInfo); if(list == null){ - list = new ArrayList(); - fPathFilePathInfoMap.put(fileInfo, list); + List emptyList = new ArrayList(); + fPathFilePathInfoMap.put(fileInfo, emptyList); if(fMaxMatchInfo == null){ fMaxMatchInfo = fileInfo; - fMaxMatchInfoList = list; + fMaxMatchInfoList = emptyList; } // else { // fIsMultiple = true; @@ -232,9 +231,9 @@ public class PerFileSettingsCalculator { return fPathFilePathInfoMap != null && fPathFilePathInfoMap.size() > 1; } - public PathInfo getMaxMatchPathInfo(){ - return fMaxMatchInfo; - } +// public PathInfo getMaxMatchPathInfo(){ +// return fMaxMatchInfo; +// } @Override public boolean equals(Object obj) { @@ -282,7 +281,7 @@ public class PerFileSettingsCalculator { private static class ExtsSet { private String[] fExts; - private HashSet fExtsSet; + private HashSet fExtsSet; private int fHash; public ExtsSet(String[] exts){ @@ -302,7 +301,8 @@ public class PerFileSettingsCalculator { return false; if(fExts.length != 0){ - HashSet set = (HashSet)calcExtsSet().clone(); + @SuppressWarnings("unchecked") + HashSet set = (HashSet)calcExtsSet().clone(); set.removeAll(other.calcExtsSet()); if(set.size() != 0) return false; @@ -310,9 +310,9 @@ public class PerFileSettingsCalculator { return true; } - public String[] getExtensions(){ - return fExts.clone(); - } +// public String[] getExtensions(){ +// return fExts.clone(); +// } @Override public int hashCode() { @@ -327,9 +327,9 @@ public class PerFileSettingsCalculator { return hash; } - private HashSet calcExtsSet(){ + private HashSet calcExtsSet(){ if(fExtsSet == null) - fExtsSet = new HashSet(Arrays.asList(fExts)); + fExtsSet = new HashSet(Arrays.asList(fExts)); return fExtsSet; } @@ -351,8 +351,8 @@ public class PerFileSettingsCalculator { private static class RcSetSettings { private CResourceData fRcData; - private HashMap fExtToExtsSetMap; - private HashMap fExtsSetToExtsSetSettingsMap; + private HashMap fExtToExtsSetMap; + private HashMap fExtsSetToExtsSetSettingsMap; private PathSettingsContainer fContainer; private boolean fIsDerived; @@ -377,9 +377,9 @@ public class PerFileSettingsCalculator { return null; } - public CResourceData getResourceData() { - return fRcData; - } +// public CResourceData getResourceData() { +// return fRcData; +// } public RcSetSettings createChild(IPath path, CResourceData data, boolean isDerived){ PathSettingsContainer cr = fContainer.getChildContainer(path, true, true); @@ -398,11 +398,9 @@ public class PerFileSettingsCalculator { } private void updateLangDatas(){ - ExtsSetSettings extSetting; - if(fRcData.getType() == ICSettingBase.SETTING_FILE){ CLanguageData lData = ((CFileData)fRcData).getLanguageData(); - extSetting = (ExtsSetSettings)fExtToExtsSetMap.get(getFileExt(fRcData.getPath())); + ExtsSetSettings extSetting = fExtToExtsSetMap.get(getFileExt(fRcData.getPath())); if(extSetting != null){ extSetting.fBaseLangData = lData; extSetting.fIsDerived = lData != null ? fIsDerived : false; @@ -411,9 +409,8 @@ public class PerFileSettingsCalculator { if(extSetting != null ? fExtsSetToExtsSetSettingsMap.size() > 1 : fExtsSetToExtsSetSettingsMap.size() > 0){ - ExtsSetSettings s; - for(Iterator iter = fExtsSetToExtsSetSettingsMap.values().iterator(); iter.hasNext();){ - s = (ExtsSetSettings)iter.next(); + Collection values = fExtsSetToExtsSetSettingsMap.values(); + for (ExtsSetSettings s : values) { if(s != extSetting){ s.fBaseLangData = null; s.fIsDerived = false; @@ -422,12 +419,13 @@ public class PerFileSettingsCalculator { } } else { CLanguageData[] lDatas = ((CFolderData)fRcData).getLanguageDatas(); - Map map = (HashMap)fExtsSetToExtsSetSettingsMap.clone(); + @SuppressWarnings("unchecked") + Map map = (HashMap)fExtsSetToExtsSetSettingsMap.clone(); CLanguageData lData; for(int i = 0; i < lDatas.length; i++){ lData = lDatas[i]; - extSetting = (ExtsSetSettings)map.remove(new ExtsSet(lData.getSourceExtensions())); + ExtsSetSettings extSetting = map.remove(new ExtsSet(lData.getSourceExtensions())); if(extSetting != null){ extSetting.fBaseLangData = lData; extSetting.fIsDerived = this.fIsDerived; @@ -435,8 +433,8 @@ public class PerFileSettingsCalculator { } if(map.size() != 0){ - for(Iterator iter = map.values().iterator(); iter.hasNext();){ - extSetting = (ExtsSetSettings)iter.next(); + Collection values = map.values(); + for (ExtsSetSettings extSetting : values) { extSetting.fBaseLangData = null; extSetting.fIsDerived = false; } @@ -455,17 +453,17 @@ public class PerFileSettingsCalculator { return null; } - void internalSetSettingsMap(HashMap map){ + void internalSetSettingsMap(HashMap map){ fExtsSetToExtsSetSettingsMap = map; fExtToExtsSetMap = calcExtToExtSetSettingsMap(map); } void internalAdd(ExtsSetSettings setting){ if(fExtsSetToExtsSetSettingsMap == null){ - fExtsSetToExtsSetSettingsMap = new HashMap(); + fExtsSetToExtsSetSettingsMap = new HashMap(); } - ExtsSetSettings cur = (ExtsSetSettings)fExtsSetToExtsSetSettingsMap.get(setting.fExtsSet); + ExtsSetSettings cur = fExtsSetToExtsSetSettingsMap.get(setting.fExtsSet); if(cur != null){ cur.add(setting); } else { @@ -474,11 +472,11 @@ public class PerFileSettingsCalculator { } } - void internalAddSettingsMap(HashMap map){ - ExtsSetSettings setting;//, thisSetting; + void internalAddSettingsMap(HashMap map){ +// ExtsSetSettings thisSetting; // ExtsSet extsSet; - for(Iterator iter = map.values().iterator(); iter.hasNext();){ - setting = (ExtsSetSettings)iter.next(); + Collection values = map.values(); + for (ExtsSetSettings setting : values) { internalAdd(setting); // extsSet = setting.fExtsSet; // thisSetting = (ExtsSetSettings)fExtsSetToExtsSetSettingsMap.get(extsSet); @@ -491,40 +489,38 @@ public class PerFileSettingsCalculator { } } - public boolean settingsEqual(RcSetSettings other){ - return fExtsSetToExtsSetSettingsMap.equals(other.fExtsSetToExtsSetSettingsMap); - } +// public boolean settingsEqual(RcSetSettings other){ +// return fExtsSetToExtsSetSettingsMap.equals(other.fExtsSetToExtsSetSettingsMap); +// } public RcSetSettings[] getChildren(final boolean includeCurrent){ - final List list = new ArrayList(); + final List list = new ArrayList(); fContainer.accept(new IPathSettingsContainerVisitor(){ public boolean visit(PathSettingsContainer container) { if(includeCurrent || container != fContainer){ - list.add(container.getValue()); + RcSetSettings value = (RcSetSettings)container.getValue(); + list.add(value); } return true; } }); - return (RcSetSettings[])list.toArray(new RcSetSettings[list.size()]); + return list.toArray(new RcSetSettings[list.size()]); } public boolean containsEqualMaxMatches(RcSetSettings other, boolean ignoreGenerated){ if(!ignoreGenerated && fExtsSetToExtsSetSettingsMap.size() < other.fExtsSetToExtsSetSettingsMap.size()) return false; - ExtsSetSettings otherSetting, thisSetting; - Map.Entry entry; - - for(Iterator iter = other.fExtsSetToExtsSetSettingsMap.entrySet().iterator(); iter.hasNext();){ - entry = (Map.Entry)iter.next(); - otherSetting = (ExtsSetSettings)entry.getValue(); + Set> entrySet = other.fExtsSetToExtsSetSettingsMap.entrySet(); + for (Entry entry : entrySet) { + ExtsSetSettings otherSetting = entry.getValue(); if(ignoreGenerated && otherSetting.fBaseLangData == null) continue; - thisSetting = (ExtsSetSettings)fExtsSetToExtsSetSettingsMap.get(entry.getKey()); + ExtsSetSettings thisSetting = fExtsSetToExtsSetSettingsMap.get(entry.getKey()); if(thisSetting == null) return false; @@ -546,22 +542,21 @@ public class PerFileSettingsCalculator { } } - private static HashMap calcExtToExtSetSettingsMap(Map extsSetMap){ - HashMap result = null; - ExtsSetSettings setting; - for(Iterator iter = extsSetMap.values().iterator(); iter.hasNext();){ - setting = (ExtsSetSettings)iter.next(); + private static HashMap calcExtToExtSetSettingsMap(Map extsSetMap){ + HashMap result = null; + Collection values = extsSetMap.values(); + for (ExtsSetSettings setting : values) { result = addExtsInfoToMap(setting, result); } return result; } - private static HashMap addExtsInfoToMap(ExtsSetSettings setting, HashMap map){ + private static HashMap addExtsInfoToMap(ExtsSetSettings setting, HashMap map){ boolean forceAdd = false; String[] exts = setting.fExtsSet.fExts; String ext; if(map == null){ - map = new HashMap(); + map = new HashMap(); forceAdd = true; } @@ -585,7 +580,7 @@ public class PerFileSettingsCalculator { CResourceData[] rcDatas = data.getResourceDatas(); CResourceData rcData; RcSetSettings curRcSet; - HashMap fileMap; + HashMap fileMap; ExtsSetSettings fileSetting; IPath path; @@ -600,7 +595,7 @@ public class PerFileSettingsCalculator { path = rcData.getPath(); curRcSet = rcSet.createChild(path, rcData, false); if(rcData.getType() == ICSettingBase.SETTING_FILE){ - fileMap = new HashMap(1); + fileMap = new HashMap(1); fileSetting = createExtsSetSettings(path, (CFileData)rcData); fileMap.put(fileSetting.fExtsSet, fileSetting); curRcSet.internalSetSettingsMap(fileMap); @@ -630,7 +625,7 @@ public class PerFileSettingsCalculator { private RcSetSettings createRcSetSettings(CConfigurationData data, IDiscoveredPathManager.IPerFileDiscoveredPathInfo2 discoveredInfo){ RcSetSettings rcSet = createRcSetInfo(data); - Map map = discoveredInfo.getPathInfoMap(); + Map map = discoveredInfo.getPathInfoMap(); PathFilePathInfo pInfos[] = createOrderedInfo(map); mapDiscoveredInfo(rcSet, pInfos); checkRemoveDups(rcSet); @@ -648,9 +643,9 @@ public class PerFileSettingsCalculator { } private static void addEmptyLanguageInfos(RcSettingInfo rcInfo, CLanguageData[] lDatas){ - ArrayList list = rcInfo.fLangInfoList; + ArrayList list = rcInfo.fLangInfoList; if(list == null){ - list = new ArrayList(lDatas.length); + list = new ArrayList(lDatas.length); rcInfo.fLangInfoList = list; } else { list.ensureCapacity(lDatas.length); @@ -667,11 +662,11 @@ public class PerFileSettingsCalculator { IPath projRelPath; CResourceData rcData; // RcSetSettings dataSetting; - List list = new ArrayList(pfpis.length); + List list = new ArrayList(pfpis.length); RcSettingInfo rcInfo; LangSettingInfo lInfo; CLanguageData lData; - ArrayList tmpList; + ArrayList tmpList; PathFilePathInfo pfpi; for(int i = 0; i < pfpis.length; i++){ @@ -688,7 +683,7 @@ public class PerFileSettingsCalculator { IPath[] quotedIncPaths = pInfo.getQuoteIncludePaths(); IPath[] incFiles = pInfo.getIncludeFiles(); IPath[] macroFiles = pInfo.getMacroFiles(); - Map symbolMap = pInfo.getSymbols(); + Map symbolMap = pInfo.getSymbols(); int kinds = 0; if(incPaths.length != 0 || quotedIncPaths.length != 0) @@ -708,7 +703,7 @@ public class PerFileSettingsCalculator { if(rcInfo == null){ rcInfo = new RcSettingInfo(rootData); - tmpList = new ArrayList(lDatas.length - k); + tmpList = new ArrayList(lDatas.length - k); rcInfo.fLangInfoList = tmpList; } @@ -762,7 +757,7 @@ public class PerFileSettingsCalculator { if(lData != null){ rcInfo = new RcSettingInfo(rcData); lInfo = new LangSettingInfo(lData, pInfo); - tmpList = new ArrayList(1); + tmpList = new ArrayList(1); tmpList.add(lInfo); rcInfo.fLangInfoList = tmpList; list.add(rcInfo); @@ -773,7 +768,7 @@ public class PerFileSettingsCalculator { // break; // } } - return (RcSettingInfo[])list.toArray(new RcSettingInfo[list.size()]); + return list.toArray(new RcSettingInfo[list.size()]); } public IRcSettingInfo[] getSettingInfos(IProject project, CConfigurationData data, IDiscoveredPathManager.IPerFileDiscoveredPathInfo2 discoveredInfo, boolean fileDataMode){ @@ -790,8 +785,7 @@ public class PerFileSettingsCalculator { RcSetSettings settings[] = rootSetting.getChildren(true); RcSetSettings setting; CResourceData rcData; - ExtsSetSettings extSetting; - List resultList = new ArrayList(); + List resultList = new ArrayList(); LangSettingInfo langInfo; RcSettingInfo rcInfo; PathInfo pathInfo; @@ -817,13 +811,13 @@ public class PerFileSettingsCalculator { } if(rcData.getType() == ICSettingBase.SETTING_FILE){ - extSetting = (ExtsSetSettings)setting.fExtToExtsSetMap.get(getFileExt(rcData.getPath())); + ExtsSetSettings extSetting = setting.fExtToExtsSetMap.get(getFileExt(rcData.getPath())); if(extSetting != null){ pathInfo = extSetting.fMaxMatchInfo; if(pathInfo != null){ langInfo = new LangSettingInfo(extSetting.fBaseLangData, pathInfo); rcInfo = new RcSettingInfo(rcData); - rcInfo.fLangInfoList = new ArrayList(1); + rcInfo.fLangInfoList = new ArrayList(1); rcInfo.fLangInfoList.add(langInfo); resultList.add(rcInfo); } @@ -831,11 +825,11 @@ public class PerFileSettingsCalculator { } else { if(setting.fExtsSetToExtsSetSettingsMap.size() != 0 ){ rcInfo = new RcSettingInfo(rcData); - rcInfo.fLangInfoList = new ArrayList(setting.fExtsSetToExtsSetSettingsMap.size()); + rcInfo.fLangInfoList = new ArrayList(setting.fExtsSetToExtsSetSettingsMap.size()); resultList.add(rcInfo); - for(Iterator iter = setting.fExtsSetToExtsSetSettingsMap.values().iterator(); iter.hasNext();){ - extSetting = (ExtsSetSettings)iter.next(); + Collection values = setting.fExtsSetToExtsSetSettingsMap.values(); + for (ExtsSetSettings extSetting : values) { if(extSetting.fMaxMatchInfo == null) continue; @@ -850,28 +844,17 @@ public class PerFileSettingsCalculator { rcInfo.add(new LangSettingInfo(extSetting.fBaseLangData, extSetting.fMaxMatchInfo)); if(extSetting.isMultiple()){ - Map.Entry entry; - List piList; - int sz; - PathFilePathInfo pi; - CFileData fiData; - RcSettingInfo fiInfo; - CLanguageData fiLangData; - - for(Iterator pathInfoIter = extSetting.fPathFilePathInfoMap.entrySet().iterator(); pathInfoIter.hasNext();){ - entry = (Map.Entry)pathInfoIter.next(); + Set>> entrySet = extSetting.fPathFilePathInfoMap.entrySet(); + for (Entry> entry : entrySet) { if(entry.getKey().equals(extSetting.fMaxMatchInfo)) continue; - piList = (List)entry.getValue(); - sz = piList.size(); - - for(int k = 0; k < sz; k++){ - pi = (PathFilePathInfo)piList.get(k); + List piList = entry.getValue(); + for (PathFilePathInfo pi : piList) { try { - fiData = createFileData(data, pi.fPath, (CFolderData)rcData, extSetting.fBaseLangData); - fiLangData = fiData.getLanguageData(); + CFileData fiData = createFileData(data, pi.fPath, (CFolderData)rcData, extSetting.fBaseLangData); + CLanguageData fiLangData = fiData.getLanguageData(); if(fiLangData != null){ - fiInfo = new RcSettingInfo(fiData); + RcSettingInfo fiInfo = new RcSettingInfo(fiData); fiInfo.add(new LangSettingInfo(fiLangData, pi.fInfo)); resultList.add(fiInfo); } @@ -887,7 +870,7 @@ public class PerFileSettingsCalculator { } // } - return (RcSettingInfo[])resultList.toArray(new RcSettingInfo[resultList.size()]); + return resultList.toArray(new RcSettingInfo[resultList.size()]); } private CFolderData createFolderData(CConfigurationData cfg, CResourceData base, RcSetSettings setting) throws CoreException{ @@ -949,7 +932,7 @@ public class PerFileSettingsCalculator { processProjectPaths(child, pInfo); } else { ext = getFileExt(pInfo.fPath); - extsSet = (ExtsSetSettings)child.fExtToExtsSetMap.get(ext); + extsSet = child.fExtToExtsSetMap.get(ext); if(extsSet == null){ extsSet = new ExtsSetSettings(null, new ExtsSet(new String[]{ext}), false); child.internalAdd(extsSet); @@ -961,9 +944,8 @@ public class PerFileSettingsCalculator { } private static void processProjectPaths(RcSetSettings rcSet, PathFilePathInfo pfpi){ - ExtsSetSettings setting; - for(Iterator iter = rcSet.fExtsSetToExtsSetSettingsMap.values().iterator(); iter.hasNext();){ - setting = (ExtsSetSettings)iter.next(); + Collection settings = rcSet.fExtsSetToExtsSetSettingsMap.values(); + for (ExtsSetSettings setting : settings) { setting.add(pfpi); } } @@ -975,12 +957,13 @@ public class PerFileSettingsCalculator { return ""; //$NON-NLS-1$ } - private static HashMap createEmptyExtSetMapCopy(HashMap base){ - HashMap map = (HashMap)base.clone(); + private static HashMap createEmptyExtSetMapCopy(HashMap base){ + @SuppressWarnings("unchecked") + HashMap map = (HashMap)base.clone(); ExtsSetSettings extsSet; - for(Iterator iter = map.entrySet().iterator(); iter.hasNext();){ - Map.Entry entry = (Map.Entry)iter.next(); - extsSet = (ExtsSetSettings)entry.getValue(); + Set> entrySet = map.entrySet(); + for (Entry entry : entrySet) { + extsSet = entry.getValue(); extsSet = new ExtsSetSettings(extsSet.fBaseLangData, extsSet.fExtsSet, true); entry.setValue(extsSet); } @@ -1000,9 +983,9 @@ public class PerFileSettingsCalculator { return new ExtsSetSettings(lData, new ExtsSet(exts), false); } - private static HashMap createExtsSetSettingsMap(CFolderData data){ + private static HashMap createExtsSetSettingsMap(CFolderData data){ CLanguageData[] lDatas = data.getLanguageDatas(); - HashMap map = new HashMap(lDatas.length); + HashMap map = new HashMap(lDatas.length); ExtsSetSettings settings; if(lDatas.length != 0) { @@ -1017,18 +1000,17 @@ public class PerFileSettingsCalculator { return map; } - private static PathFilePathInfo[] createOrderedInfo(Map map){ - Map.Entry entry; + private static PathFilePathInfo[] createOrderedInfo(Map map){ IResource rc; IPath path; PathInfo info, storedInfo; ListIndexStore store = new ListIndexStore(10); - HashMap infoMap = new HashMap(); + HashMap infoMap = new HashMap(); // LinkedHashMap result; - for(Iterator iter = map.entrySet().iterator(); iter.hasNext();){ - entry = (Map.Entry)iter.next(); - rc = (IResource)entry.getKey(); + Set> entrySet = map.entrySet(); + for (Entry entry : entrySet) { + rc = entry.getKey(); path = rc.getProjectRelativePath(); int segCount = path.segmentCount(); // if(segCount < 1) @@ -1037,8 +1019,8 @@ public class PerFileSettingsCalculator { // path = path.removeFirstSegments(1); // segCount--; - info = (PathInfo)entry.getValue(); - storedInfo = (PathInfo)infoMap.get(info); + info = entry.getValue(); + storedInfo = infoMap.get(info); if(storedInfo == null){ storedInfo = info; infoMap.put(storedInfo, storedInfo); @@ -1047,7 +1029,7 @@ public class PerFileSettingsCalculator { store.add(segCount, new PathFilePathInfo(path, storedInfo)); } - List lists[] = store.getLists(); + List lists[] = store.getLists(); // result = new LinkedHashMap(map.size()); // List l; // int lSize; @@ -1071,12 +1053,12 @@ public class PerFileSettingsCalculator { infos = new PathFilePathInfo[size]; int num = 0; int listSize; - List list; + List list; for(int i = 0; i < lists.length; i++){ list = lists[i]; listSize = list.size(); for(int k = 0; k < listSize; k++){ - infos[num++] = (PathFilePathInfo)list.get(k); + infos[num++] = list.get(k); } }