1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

bug 319512: Missing type arguments on managedbuilder.core

This commit is contained in:
Andrew Gvozdev 2010-07-31 05:29:07 +00:00
parent 40b90fc643
commit 9ba43eaffd
2 changed files with 29 additions and 29 deletions

View file

@ -38,7 +38,7 @@ public class MatchObjectElement {
private int fType; private int fType;
private String fString; private String fString;
private static ObjectTypeBasedStorage fTypeAssociationStorage = new ObjectTypeBasedStorage(); private static ObjectTypeBasedStorage fTypeAssociationStorage = new ObjectTypeBasedStorage();
private static Map fStringAssociationStorage = new HashMap(); private static Map<String, TypeToStringAssociation> fStringAssociationStorage = new HashMap<String, TypeToStringAssociation>();
public static TypeToStringAssociation TOOL = new TypeToStringAssociation(IRealBuildObjectAssociation.OBJECT_TOOL, "tool"); //$NON-NLS-1$ public static TypeToStringAssociation TOOL = new TypeToStringAssociation(IRealBuildObjectAssociation.OBJECT_TOOL, "tool"); //$NON-NLS-1$
public static TypeToStringAssociation TOOLCHAIN = new TypeToStringAssociation(IRealBuildObjectAssociation.OBJECT_TOOLCHAIN, "toolChain"); //$NON-NLS-1$ public static TypeToStringAssociation TOOLCHAIN = new TypeToStringAssociation(IRealBuildObjectAssociation.OBJECT_TOOLCHAIN, "toolChain"); //$NON-NLS-1$
@ -61,7 +61,7 @@ public class MatchObjectElement {
} }
public static TypeToStringAssociation getAssociation(String str){ public static TypeToStringAssociation getAssociation(String str){
return (TypeToStringAssociation)fStringAssociationStorage.get(str); return fStringAssociationStorage.get(str);
} }
public static TypeToStringAssociation getAssociation(int type){ public static TypeToStringAssociation getAssociation(int type){
@ -94,8 +94,8 @@ public class MatchObjectElement {
} }
public class PatternElement { public class PatternElement {
private HashSet fIds; private HashSet<String> fIds;
private int fHash; private int fHashPE;
private int fType; private int fType;
private static final int SEARCH_TYPE_MASK = 0xff; private static final int SEARCH_TYPE_MASK = 0xff;
@ -118,7 +118,7 @@ public class MatchObjectElement {
PatternElement(IConfigurationElement el, int defaultSearchType, int defaultIdType){ PatternElement(IConfigurationElement el, int defaultSearchType, int defaultIdType){
String tmp = el.getAttribute(ATTR_OBJECT_IDS); String tmp = el.getAttribute(ATTR_OBJECT_IDS);
fIds = new HashSet(Arrays.asList(CDataUtil.stringToArray(tmp, DELIMITER))); fIds = new HashSet<String>(Arrays.asList(CDataUtil.stringToArray(tmp, DELIMITER)));
int type = 0; int type = 0;
tmp = el.getAttribute(ATTR_PATTERN_TYPE_SEARCH_SCOPE); tmp = el.getAttribute(ATTR_PATTERN_TYPE_SEARCH_SCOPE);
@ -150,13 +150,13 @@ public class MatchObjectElement {
fType = type; fType = type;
} }
private PatternElement(HashSet ids, int type){ private PatternElement(HashSet<String> ids, int type){
fIds = ids; fIds = ids;
fType = type; fType = type;
} }
public String[] getIds(){ public String[] getIds(){
return (String[])fIds.toArray(new String[fIds.size()]); return fIds.toArray(new String[fIds.size()]);
} }
@Override @Override
@ -176,17 +176,17 @@ public class MatchObjectElement {
@Override @Override
public int hashCode() { public int hashCode() {
if(fHash == 0){ if(fHashPE == 0){
fHash = fIds.hashCode(); fHashPE = fIds.hashCode();
} }
return fHash; return fHashPE;
} }
public PatternElement merge(PatternElement el) throws IllegalArgumentException { public PatternElement merge(PatternElement el) throws IllegalArgumentException {
if(el.fType != fType) if(el.fType != fType)
throw new IllegalArgumentException(); throw new IllegalArgumentException();
HashSet set = new HashSet(); HashSet<String> set = new HashSet<String>();
set.addAll(fIds); set.addAll(fIds);
set.addAll(el.fIds); set.addAll(el.fIds);
return new PatternElement(set, fType); return new PatternElement(set, fType);
@ -212,7 +212,7 @@ public class MatchObjectElement {
fObjectType = assoc.getType(); fObjectType = assoc.getType();
Map patternMap = new HashMap(); Map<PatternTypeKey, PatternElement> patternMap = new HashMap<PatternTypeKey, PatternElement>();
int defaultSearchType = PatternElement.DEFAULT_PATTERN_SEARCH_TYPE; int defaultSearchType = PatternElement.DEFAULT_PATTERN_SEARCH_TYPE;
int defaultIdType = PatternElement.DEFAULT_PATTERN_ID_TYPE; int defaultIdType = PatternElement.DEFAULT_PATTERN_ID_TYPE;
@ -228,7 +228,7 @@ public class MatchObjectElement {
for(int i = 0; i < patternsChildren.length; i++){ for(int i = 0; i < patternsChildren.length; i++){
PatternElement el = new PatternElement(patternsChildren[i], defaultSearchType, defaultIdType); PatternElement el = new PatternElement(patternsChildren[i], defaultSearchType, defaultIdType);
PatternTypeKey key = new PatternTypeKey(el); PatternTypeKey key = new PatternTypeKey(el);
PatternElement cur = (PatternElement)patternMap.get(key); PatternElement cur = patternMap.get(key);
if(cur != null){ if(cur != null){
patternMap.put(key, cur.merge(el)); patternMap.put(key, cur.merge(el));
} else { } else {
@ -241,7 +241,7 @@ public class MatchObjectElement {
throw new IllegalArgumentException(); throw new IllegalArgumentException();
} }
fPatterns = (PatternElement[])patternMap.values().toArray(new PatternElement[patternMap.size()]); fPatterns = patternMap.values().toArray(new PatternElement[patternMap.size()]);
} }
public int getObjectType(){ public int getObjectType(){

View file

@ -43,7 +43,7 @@ public class RulesManager {
private ConflictDefinition[] fConflictDefinitions; private ConflictDefinition[] fConflictDefinitions;
private Map fMatchObjectMap = new HashMap(); private Map<MatchObjectElement, IObjectSet> fMatchObjectMap = new HashMap<MatchObjectElement, IObjectSet>();
private PerTypeMapStorage fObjToChildSuperClassMap; private PerTypeMapStorage fObjToChildSuperClassMap;
private StarterJob fStarter; private StarterJob fStarter;
private boolean fIsStartInited; private boolean fIsStartInited;
@ -103,7 +103,7 @@ public class RulesManager {
fConflictDefinitions = new ConflictDefinition[0]; fConflictDefinitions = new ConflictDefinition[0];
} else { } else {
IExtension[] extensions = extensionPoint.getExtensions(); IExtension[] extensions = extensionPoint.getExtensions();
List conflictDefs = new ArrayList(); List<ConflictDefinition> conflictDefs = new ArrayList<ConflictDefinition>();
for (int i = 0; i < extensions.length; ++i) { for (int i = 0; i < extensions.length; ++i) {
IExtension extension = extensions[i]; IExtension extension = extensions[i];
IConfigurationElement[] elements = extension.getConfigurationElements(); IConfigurationElement[] elements = extension.getConfigurationElements();
@ -123,7 +123,7 @@ public class RulesManager {
} }
} }
fConflictDefinitions = (ConflictDefinition[])conflictDefs.toArray(new ConflictDefinition[conflictDefs.size()]); fConflictDefinitions = conflictDefs.toArray(new ConflictDefinition[conflictDefs.size()]);
} }
} }
@ -146,11 +146,11 @@ public class RulesManager {
} }
private IObjectSet resolve(MatchObjectElement el){ private IObjectSet resolve(MatchObjectElement el){
IObjectSet oSet = (IObjectSet)fMatchObjectMap.get(el); IObjectSet oSet = fMatchObjectMap.get(el);
if(oSet == null){ if(oSet == null){
int type = el.getObjectType(); int type = el.getObjectType();
PatternElement[] patterns = el.getPatterns(); PatternElement[] patterns = el.getPatterns();
HashSet objectsSet = new HashSet(); HashSet<IRealBuildObjectAssociation> objectsSet = new HashSet<IRealBuildObjectAssociation>();
for(int i = 0; i < patterns.length; i++){ for(int i = 0; i < patterns.length; i++){
PatternElement pattern = patterns[i]; PatternElement pattern = patterns[i];
processPattern(type, pattern, objectsSet); processPattern(type, pattern, objectsSet);
@ -171,19 +171,19 @@ public class RulesManager {
IRealBuildObjectAssociation[] allObjs = TcModificationUtil.getExtensionObjects(objType); IRealBuildObjectAssociation[] allObjs = TcModificationUtil.getExtensionObjects(objType);
Pattern pattern = Pattern.compile(id); Pattern pattern = Pattern.compile(id);
List list = new ArrayList(); List<IRealBuildObjectAssociation> list = new ArrayList<IRealBuildObjectAssociation>();
for(int i = 0; i < allObjs.length; i++){ for(int i = 0; i < allObjs.length; i++){
if(pattern.matcher(allObjs[i].getId()).matches()) if(pattern.matcher(allObjs[i].getId()).matches())
list.add(allObjs[i]); list.add(allObjs[i]);
} }
return (IRealBuildObjectAssociation[])list.toArray(new IRealBuildObjectAssociation[list.size()]); return list.toArray(new IRealBuildObjectAssociation[list.size()]);
} }
private Set processPattern(int objType, PatternElement el, Set set){ private Set<IRealBuildObjectAssociation> processPattern(int objType, PatternElement el, Set<IRealBuildObjectAssociation> set){
if(set == null) if(set == null)
set = new HashSet(); set = new HashSet<IRealBuildObjectAssociation>();
String ids[] = el.getIds(); String ids[] = el.getIds();
if(el.getSearchType() == PatternElement.TYPE_SEARCH_EXTENSION_OBJECT){ if(el.getSearchType() == PatternElement.TYPE_SEARCH_EXTENSION_OBJECT){
@ -202,7 +202,7 @@ public class RulesManager {
set.add(obj.getRealBuildObject()); set.add(obj.getRealBuildObject());
Set childRealSet = getChildSuperClassRealSet(obj, allReal); Set<IRealBuildObjectAssociation> childRealSet = getChildSuperClassRealSet(obj, allReal);
set.addAll(childRealSet); set.addAll(childRealSet);
// for(int k = 0; k < allReal.length; k++){ // for(int k = 0; k < allReal.length; k++){
@ -230,15 +230,15 @@ public class RulesManager {
return set; return set;
} }
private Set getChildSuperClassRealSet(IRealBuildObjectAssociation obj, IRealBuildObjectAssociation[] all){ private Set<IRealBuildObjectAssociation> getChildSuperClassRealSet(IRealBuildObjectAssociation obj, IRealBuildObjectAssociation[] all){
if(fObjToChildSuperClassMap == null) if(fObjToChildSuperClassMap == null)
fObjToChildSuperClassMap = new PerTypeMapStorage(); fObjToChildSuperClassMap = new PerTypeMapStorage();
if(all == null) if(all == null)
all = TcModificationUtil.getExtensionObjects(obj.getType()); all = TcModificationUtil.getExtensionObjects(obj.getType());
Map map = fObjToChildSuperClassMap.getMap(obj.getType(), true); Map<IRealBuildObjectAssociation, Set<IRealBuildObjectAssociation>> map = fObjToChildSuperClassMap.getMap(obj.getType(), true);
Set set = (Set)map.get(obj); Set<IRealBuildObjectAssociation> set = map.get(obj);
if(set == null){ if(set == null){
set = createChildSuperClassRealSet(obj, all, null); set = createChildSuperClassRealSet(obj, all, null);
map.put(obj, set); map.put(obj, set);
@ -247,9 +247,9 @@ public class RulesManager {
return set; return set;
} }
private static Set createChildSuperClassRealSet(IRealBuildObjectAssociation obj, IRealBuildObjectAssociation[] all, Set set){ private static Set<IRealBuildObjectAssociation> createChildSuperClassRealSet(IRealBuildObjectAssociation obj, IRealBuildObjectAssociation[] all, Set<IRealBuildObjectAssociation> set){
if(set == null) if(set == null)
set = new HashSet(); set = new HashSet<IRealBuildObjectAssociation>();
if(all == null) if(all == null)
all = TcModificationUtil.getExtensionObjects(obj.getType()); all = TcModificationUtil.getExtensionObjects(obj.getType());