Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Recoskie2011-03-24 13:11:35 -0400
committerChris Recoskie2011-03-24 13:11:35 -0400
commite923b9a3c98bbc65427024c63316b210099c4138 (patch)
treee36919239a95ab81d090bcc118d35ff0c223587e
parent4ab1f9b72f901f384cd4286894b9105e7ed45ff2 (diff)
downloadorg.eclipse.cdt-e923b9a3c98bbc65427024c63316b210099c4138.tar.gz
org.eclipse.cdt-e923b9a3c98bbc65427024c63316b210099c4138.tar.xz
org.eclipse.cdt-e923b9a3c98bbc65427024c63316b210099c4138.zip
Bug 205257 - CDTProject creation scalability issue
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/PathInfo.java27
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathInfo.java14
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/CCommandDSC.java25
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/SymbolEntry.java12
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerFileSICollector.java11
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/ScannerConfigInfoFactory2.java10
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/ScannerConfigProfileManager.java9
-rw-r--r--build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/DiscoveredPathContainerPage.java5
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/internal/core/scannerconfig2/CfgScannerConfigInfoFactory2.java31
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/OptionStringValue.java12
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildproperties/BuildProperty.java10
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/AdditionalInput.java108
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Builder.java77
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Configuration.java56
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/EnvVarBuildPath.java41
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/InputOrder.java120
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/InputType.java59
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedProject.java5
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/MapStorageElement.java8
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Option.java75
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/OptionCategory.java15
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/OptionReference.java6
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/OutputType.java48
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ProjectType.java18
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ResourceConfiguration.java8
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ResourceInfo.java12
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/SupportedProperties.java8
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Target.java31
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/TargetPlatform.java30
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Tool.java77
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ToolChain.java56
-rw-r--r--core/org.eclipse.cdt.core/META-INF/MANIFEST.MF2
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/cdtvariables/CdtVariable.java10
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/envvar/EnvironmentVariable.java8
-rw-r--r--core/org.eclipse.cdt.core/utils/org/eclipse/cdt/internal/core/SafeStringInterner.java141
-rw-r--r--core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/envvar/StorableEnvVar.java12
36 files changed, 719 insertions, 478 deletions
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/PathInfo.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/PathInfo.java
index 1c13c074c0..499a14ad67 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/PathInfo.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/PathInfo.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Intel Corporation and others.
+ * Copyright (c) 2007, 2011 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* Intel Corporation - Initial API and implementation
+ * IBM Corporation
*******************************************************************************/
package org.eclipse.cdt.make.core.scannerconfig;
@@ -14,6 +15,7 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
+import org.eclipse.cdt.internal.core.SafeStringInterner;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
@@ -40,11 +42,32 @@ public final class PathInfo {
IPath[] macroFiles){
fIncludePaths = includePaths != null && includePaths.length != 0 ? (IPath[])includePaths.clone() : EMPTY_PATH_ARRAY;
fQuoteIncludePaths = quoteIncludePaths != null && quoteIncludePaths.length != 0 ? (IPath[])quoteIncludePaths.clone() : EMPTY_PATH_ARRAY;
- fSymbols = symbols != null && symbols.size() != 0 ? new HashMap<String, String>(symbols) : new HashMap<String, String>(0);
+ fSymbols = symbols != null && symbols.size() != 0 ? getInternedHashMap(symbols) : new HashMap<String, String>(0);
fIncludeFiles = includeFiles != null && includeFiles.length != 0 ? (IPath[])includeFiles.clone() : EMPTY_PATH_ARRAY;
fMacroFiles = macroFiles != null && macroFiles.length != 0 ? (IPath[])macroFiles.clone() : EMPTY_PATH_ARRAY;
}
+ /**
+ * Returns a new HashMap whereby all the strings used as keys and values are interned.
+ *
+ * @param oldMap
+ * @return HashMap<String, String>
+ */
+ protected HashMap<String, String> getInternedHashMap(Map<String, String> oldMap) {
+ if(oldMap == null)
+ return null;
+
+ if(oldMap.isEmpty())
+ return new HashMap<String, String>(oldMap);
+
+ HashMap<String, String> newMap = new HashMap<String, String>(oldMap.size());
+ for(String key : oldMap.keySet()) {
+ newMap.put(SafeStringInterner.safeIntern(key), SafeStringInterner.safeIntern(oldMap.get(key)));
+ }
+
+ return newMap;
+ }
+
/**
* Get include paths
*/
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathInfo.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathInfo.java
index 58194088b1..4e503a3534 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathInfo.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathInfo.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2010 QNX Software Systems and others.
+ * Copyright (c) 2004, 2011 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* QNX Software Systems - initial API and implementation
+ * IBM Corporation
*******************************************************************************/
package org.eclipse.cdt.make.internal.core.scannerconfig;
@@ -17,6 +18,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
+import org.eclipse.cdt.internal.core.SafeStringInterner;
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredScannerInfoSerializable;
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerProjectDiscoveredPathInfo;
import org.eclipse.cdt.make.internal.core.scannerconfig.util.SymbolEntry;
@@ -73,7 +75,7 @@ public class DiscoveredPathInfo implements IPerProjectDiscoveredPathInfo, IDisco
}
public synchronized void setIncludeMap(LinkedHashMap<String, Boolean> paths) {
- discoveredPaths = new LinkedHashMap<String, Boolean>(paths);
+ discoveredPaths = SafeStringInterner.safeIntern(new LinkedHashMap<String, Boolean>(paths));
activePaths = null;
}
@@ -98,7 +100,7 @@ public class DiscoveredPathInfo implements IPerProjectDiscoveredPathInfo, IDisco
}
public synchronized void setSymbolMap(LinkedHashMap<String, SymbolEntry> symbols) {
- discoveredSymbols = new LinkedHashMap<String, SymbolEntry>(symbols);
+ discoveredSymbols = SafeStringInterner.safeIntern(new LinkedHashMap<String, SymbolEntry>(symbols));
activeSymbols = null;
}
@@ -109,7 +111,7 @@ public class DiscoveredPathInfo implements IPerProjectDiscoveredPathInfo, IDisco
Map<String, String> aSymbols = getActiveSymbolsMap();
aSymbols.clear();
- aSymbols.putAll(ScannerConfigUtil.scSymbolEntryMap2Map(discoveredSymbols));
+ aSymbols.putAll(SafeStringInterner.safeIntern(ScannerConfigUtil.scSymbolEntryMap2Map(discoveredSymbols)));
}
private List<Path> getActivePathList() {
@@ -178,10 +180,10 @@ public class DiscoveredPathInfo implements IPerProjectDiscoveredPathInfo, IDisco
while (child != null) {
if (child.getNodeName().equals(INCLUDE_PATH)) {
// Add the path to the property list
- includes.put( ((Element)child).getAttribute(PATH), Boolean.valueOf( ((Element)child).getAttribute(REMOVED)));
+ includes.put( SafeStringInterner.safeIntern(((Element)child).getAttribute(PATH)), Boolean.valueOf( ((Element)child).getAttribute(REMOVED)));
} else if (child.getNodeName().equals(DEFINED_SYMBOL)) {
// Add the symbol to the symbol list
- String symbol = ((Element)child).getAttribute(SYMBOL);
+ String symbol = SafeStringInterner.safeIntern(((Element)child).getAttribute(SYMBOL));
String removed = ((Element)child).getAttribute(REMOVED);
boolean bRemoved = (removed != null && removed.equals("true")); //$NON-NLS-1$
ScannerConfigUtil.scAddSymbolString2SymbolEntryMap(symbols, symbol, !bRemoved);
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/CCommandDSC.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/CCommandDSC.java
index 5174c9d274..50e6724729 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/CCommandDSC.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/CCommandDSC.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2010 IBM Corporation and others.
+ * Copyright (c) 2004, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -17,6 +17,7 @@ import java.util.Collections;
import java.util.Iterator;
import java.util.List;
+import org.eclipse.cdt.internal.core.SafeStringInterner;
import org.eclipse.cdt.internal.core.resources.ResourceLookup;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
@@ -83,7 +84,7 @@ public class CCommandDSC {
{
String value = option.getValue();
value = CygpathTranslator.translateIncludePaths(project, Collections.singletonList(value)).get(0);
- value = makeRelative(project, new Path(value)).toOSString();
+ value = SafeStringInterner.safeIntern(makeRelative(project, new Path(value)).toOSString());
option = new KVStringPair(option.getKey(), value);
}
compilerCommand.add(option);
@@ -322,8 +323,8 @@ public class CCommandDSC {
NodeList optionList = descElem.getElementsByTagName(OPTION_ELEM);
for (int i = 0; i < optionList.getLength(); ++i) {
Element optionElem = (Element) optionList.item(i);
- String key = optionElem.getAttribute(KEY_ATTR);
- String value = optionElem.getAttribute(VALUE_ATTR);
+ String key = SafeStringInterner.safeIntern(optionElem.getAttribute(KEY_ATTR));
+ String value = SafeStringInterner.safeIntern(optionElem.getAttribute(VALUE_ATTR));
KVStringPair option = new KVStringPair(key, value);
addSCOption(option);
}
@@ -340,14 +341,14 @@ public class CCommandDSC {
String quote = siItemElem.getAttribute(QUOTE_INCLUDE_ATTR);
if (kind.equals("INCLUDE_PATH")) { //$NON-NLS-1$
if (quote.equals("true")) { //$NON-NLS-1$
- quoteIncludes.add(value);
+ quoteIncludes.add(SafeStringInterner.safeIntern(value));
}
else {
includes.add(value);
}
}
else if (kind.equals("SYMBOL_DEFINITION")) { //$NON-NLS-1$
- symbols.add(value);
+ symbols.add(SafeStringInterner.safeIntern(value));
}
}
setDiscovered(true);
@@ -365,13 +366,13 @@ public class CCommandDSC {
String key = optionPair.getKey();
String value = optionPair.getValue();
if (key.equals(SCDOptionsEnum.INCLUDE.toString()) || key.equals(SCDOptionsEnum.ISYSTEM.toString())) {
- includes.add(value);
+ includes.add(SafeStringInterner.safeIntern(value));
}
else if (key.equals(SCDOptionsEnum.IQUOTE.toString())) {
- quoteincludes.add(value);
+ quoteincludes.add(SafeStringInterner.safeIntern(value));
}
else if (key.equals(SCDOptionsEnum.DEFINE.toString())) {
- symbols.add(value);
+ symbols.add(SafeStringInterner.safeIntern(value));
}
}
setIncludes(includes);
@@ -411,7 +412,7 @@ public class CCommandDSC {
for (Iterator<String> iter=paths.iterator(); iter.hasNext(); ) {
String path = iter.next();
path = makeRelative(project, new Path(path)).toOSString();
- list.add(path);
+ list.add(SafeStringInterner.safeIntern(path));
}
return list;
}
@@ -429,7 +430,7 @@ public class CCommandDSC {
}
// path = new File(project.getLocation().toOSString(), path).getAbsolutePath();
}
- return path;
+ return SafeStringInterner.safeIntern(path);
}
public static List<String> makeAbsolute(IProject project, List<String> paths) {
@@ -437,7 +438,7 @@ public class CCommandDSC {
for (Iterator<String> iter=paths.iterator(); iter.hasNext(); ) {
String path = iter.next();
path = makeAbsolute(project, path);
- list.add(path);
+ list.add(SafeStringInterner.safeIntern(path));
}
return list;
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/SymbolEntry.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/SymbolEntry.java
index df073cda61..4ff66c2014 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/SymbolEntry.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/SymbolEntry.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2008 IBM Corporation and others.
+ * Copyright (c) 2004, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -16,6 +16,8 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import org.eclipse.cdt.internal.core.SafeStringInterner;
+
/**
* Represents a symbol definition with possible multiple values
@@ -31,15 +33,15 @@ public class SymbolEntry {
private Map<String, Boolean> values; // Values can be either in the active (selected) group or in the removed group
public SymbolEntry(String name, String value, boolean active) {
- this.name = name;
+ this.name = SafeStringInterner.safeIntern(name);
if (values == null) {
values = new LinkedHashMap<String, Boolean>(1);
}
- values.put(value, Boolean.valueOf(active));
+ values.put(SafeStringInterner.safeIntern(value), Boolean.valueOf(active));
}
public boolean add(String value, boolean active) {
- Boolean old= values.put(value, Boolean.valueOf(active));
+ Boolean old= values.put(SafeStringInterner.safeIntern(value), Boolean.valueOf(active));
return old == null || old.booleanValue() != active;
}
@@ -125,6 +127,6 @@ public class SymbolEntry {
}
buffer.append('\n');
}
- return buffer.toString();
+ return SafeStringInterner.safeIntern(buffer.toString());
}
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerFileSICollector.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerFileSICollector.java
index 61ee97fa0f..ab5f2e5ea8 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerFileSICollector.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerFileSICollector.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2010 IBM Corporation and others.
+ * Copyright (c) 2004, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -25,6 +25,7 @@ import java.util.SortedSet;
import java.util.TreeSet;
import java.util.Map.Entry;
+import org.eclipse.cdt.internal.core.SafeStringInterner;
import org.eclipse.cdt.make.core.MakeCorePlugin;
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector3;
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorCleaner;
@@ -685,8 +686,8 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
List<String> symbols = cmd.getSymbols();
Map<String, String> definedSymbols = new HashMap<String, String>(symbols.size());
for (String symbol : symbols) {
- String key = ScannerConfigUtil.getSymbolKey(symbol);
- String value = ScannerConfigUtil.getSymbolValue(symbol);
+ String key = SafeStringInterner.safeIntern(ScannerConfigUtil.getSymbolKey(symbol));
+ String value = SafeStringInterner.safeIntern(ScannerConfigUtil.getSymbolValue(symbol));
definedSymbols.put(key, value);
}
return definedSymbols;
@@ -903,8 +904,8 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
if (cmd.isDiscovered()) {
List<String> discovered = cmd.getSymbols();
for (String symbol : discovered) {
- String key = ScannerConfigUtil.getSymbolKey(symbol);
- String value = ScannerConfigUtil.getSymbolValue(symbol);
+ String key = SafeStringInterner.safeIntern(ScannerConfigUtil.getSymbolKey(symbol));
+ String value = SafeStringInterner.safeIntern(ScannerConfigUtil.getSymbolValue(symbol));
symbols.put(key, value);
}
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/ScannerConfigInfoFactory2.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/ScannerConfigInfoFactory2.java
index 0e7f57929e..db1b2df83e 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/ScannerConfigInfoFactory2.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/ScannerConfigInfoFactory2.java
@@ -26,6 +26,7 @@ import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.ICDescriptor;
import org.eclipse.cdt.core.settings.model.ICStorageElement;
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
+import org.eclipse.cdt.internal.core.SafeStringInterner;
import org.eclipse.cdt.make.core.MakeCorePlugin;
import org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo;
import org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2;
@@ -510,6 +511,7 @@ public class ScannerConfigInfoFactory2 {
this.autoDiscoveryEnabled = base.autoDiscoveryEnabled;
this.problemReportingEnabled = base.problemReportingEnabled;
this.selectedProfile = ScannerConfigProfileManager.NULL_PROFILE_ID.equals(profileId) ? base.selectedProfile : profileId;
+ this.selectedProfile = SafeStringInterner.safeIntern(this.selectedProfile);
this.profileOptionsMap.putAll(base.profileOptionsMap);
for (Map.Entry<String, ProfileOptions> entry : profileOptionsMap.entrySet()) {
ProfileOptions basePo = entry.getValue();
@@ -556,7 +558,7 @@ public class ScannerConfigInfoFactory2 {
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#setSelectedProfileId(java.lang.String)
*/
public void setSelectedProfileId(String profileId) {
- selectedProfile = setDirty(selectedProfile, profileId);
+ selectedProfile = SafeStringInterner.safeIntern(setDirty(selectedProfile, profileId));
// if (isDirty) {
// try {
// load();
@@ -897,6 +899,7 @@ public class ScannerConfigInfoFactory2 {
selectedProfile = (profileId == ScannerConfigProfileManager.NULL_PROFILE_ID)
? sc.getAttribute(SELECTED_PROFILE_ID)
: profileId;
+ selectedProfile = SafeStringInterner.safeIntern(selectedProfile);
problemReportingEnabled = Boolean.valueOf(
sc.getAttribute(PROBLEM_REPORTING_ENABLED)).booleanValue();
performMigration = false;
@@ -925,7 +928,7 @@ public class ScannerConfigInfoFactory2 {
autoDiscoveryEnabled = oldInfo.isAutoDiscoveryEnabled();
problemReportingEnabled = oldInfo.isSIProblemGenerationEnabled();
// effectively a PerProject profile
- selectedProfile = profileId;
+ selectedProfile = SafeStringInterner.safeIntern(profileId);
ProfileOptions po = new ProfileOptions();
po.buildOutputFileActionEnabled = false;
@@ -1171,10 +1174,11 @@ public class ScannerConfigInfoFactory2 {
selectedProfile = (ScannerConfigProfileManager.NULL_PROFILE_ID.equals(profileId)) ?
getString(prefix + SCANNER_CONFIG_SELECTED_PROFILE_ID_SUFFIX) :
profileId;
+ selectedProfile = SafeStringInterner.safeIntern(selectedProfile);
problemReportingEnabled = getBoolean(prefix + SCANNER_CONFIG_PROBLEM_REPORTING_ENABLED_SUFFIX);
if (ScannerConfigProfileManager.NULL_PROFILE_ID.equals(selectedProfile) && !useDefaults) {
// get the default value
- selectedProfile = prefs.getDefaultString(prefix + SCANNER_CONFIG_SELECTED_PROFILE_ID_SUFFIX);
+ selectedProfile = SafeStringInterner.safeIntern(prefs.getDefaultString(prefix + SCANNER_CONFIG_SELECTED_PROFILE_ID_SUFFIX));
}
List<String> profileIds = ScannerConfigProfileManager.getInstance().getProfileIds(context);
profileOptionsMap = new LinkedHashMap<String, ProfileOptions>(profileIds.size());
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/ScannerConfigProfileManager.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/ScannerConfigProfileManager.java
index 3d1f5ac30c..167b67a8fe 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/ScannerConfigProfileManager.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/ScannerConfigProfileManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2010 IBM Corporation and others.
+ * Copyright (c) 2004, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.cdt.make.internal.core.scannerconfig2;
+import java.lang.ref.SoftReference;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
@@ -116,10 +117,12 @@ public final class ScannerConfigProfileManager {
synchronized (fLock) {
// is the project's profile already loaded?
Map<InfoContext, Object> map = getProfileMap(project, true);
- SCProfileInstance profileInstance = (SCProfileInstance) map.get(context);
+ SoftReference<SCProfileInstance> profileInstanceReference = (SoftReference<SCProfileInstance>) map.get(context);
+ SCProfileInstance profileInstance = profileInstanceReference != null ? profileInstanceReference.get() : null;
+
if (profileInstance == null || !profileInstance.getProfile().getId().equals(profileId)) {
profileInstance = new SCProfileInstance(project, context, getSCProfileConfiguration(profileId));
- map.put(context, profileInstance);
+ map.put(context, new SoftReference<SCProfileInstance>(profileInstance));
}
return profileInstance;
}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/DiscoveredPathContainerPage.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/DiscoveredPathContainerPage.java
index 1e429ef2be..6980635d6a 100644
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/DiscoveredPathContainerPage.java
+++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/DiscoveredPathContainerPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2010 IBM Corporation and others.
+ * Copyright (c) 2004, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -24,6 +24,7 @@ import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.core.model.IContainerEntry;
import org.eclipse.cdt.core.model.IPathEntry;
import org.eclipse.cdt.core.model.IPathEntryContainer;
+import org.eclipse.cdt.internal.core.SafeStringInterner;
import org.eclipse.cdt.internal.ui.CPluginImages;
import org.eclipse.cdt.internal.ui.wizards.dialogfields.DialogField;
import org.eclipse.cdt.internal.ui.wizards.dialogfields.IDialogFieldListener;
@@ -232,7 +233,7 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr
if (gChildren != null) {
for (int j = 0; j < gChildren.length; ++j) {
DiscoveredElement include = (DiscoveredElement) gChildren[j];
- includes.put(include.getEntry(), Boolean.valueOf(include.isRemoved()));
+ includes.put(SafeStringInterner.safeIntern(include.getEntry()), Boolean.valueOf(include.isRemoved()));
}
}
}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/internal/core/scannerconfig2/CfgScannerConfigInfoFactory2.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/internal/core/scannerconfig2/CfgScannerConfigInfoFactory2.java
index 3052323e8c..98fa6c5029 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/internal/core/scannerconfig2/CfgScannerConfigInfoFactory2.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/internal/core/scannerconfig2/CfgScannerConfigInfoFactory2.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 Intel Corporation and others.
+ * Copyright (c) 2007, 2011 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,9 +7,11 @@
*
* Contributors:
* Intel Corporation - Initial API and implementation
+ * IBM Corporation
*******************************************************************************/
package org.eclipse.cdt.build.internal.core.scannerconfig2;
+import java.lang.ref.SoftReference;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
@@ -56,7 +58,7 @@ public class CfgScannerConfigInfoFactory2 {
}
private static class CfgInfo implements ICfgScannerConfigBuilderInfo2Set {
private Configuration cfg;
- private IScannerConfigBuilderInfo2Set fContainer;
+ private SoftReference<IScannerConfigBuilderInfo2Set> fContainer;
// private HashMap map;
CfgInfo(Configuration cfg){
@@ -92,7 +94,8 @@ public class CfgScannerConfigInfoFactory2 {
}
private IScannerConfigBuilderInfo2Set getContainer() throws CoreException{
- if(fContainer == null){
+ IScannerConfigBuilderInfo2Set container = fContainer != null ? fContainer.get() : null;
+ if(container == null){
if(!cfg.isPreference()){
ICConfigurationDescription cfgDes = ManagedBuildManager.getDescriptionForConfiguration(cfg);
if(cfgDes != null){
@@ -100,24 +103,28 @@ public class CfgScannerConfigInfoFactory2 {
if(projDes != null){
ContainerInfo cInfo = (ContainerInfo)projDes.getSessionProperty(CONTAINER_INFO_PROPERTY);
if(cInfo != null && cInfo.matches(projDes)){
- fContainer = cInfo.fContainer;
+ container = cInfo.fContainer;
} else {
- fContainer = ScannerConfigProfileManager.createScannerConfigBuildInfo2Set(cfg.getOwner().getProject());
- cInfo = new ContainerInfo(projDes, fContainer);
+ container = ScannerConfigProfileManager.createScannerConfigBuildInfo2Set(cfg.getOwner().getProject());
+ cInfo = new ContainerInfo(projDes, container);
projDes.setSessionProperty(CONTAINER_INFO_PROPERTY, cInfo);
}
}
}
- if(fContainer == null){
- fContainer = ScannerConfigProfileManager.createScannerConfigBuildInfo2Set(cfg.getOwner().getProject());
+ if(container == null){
+ container = ScannerConfigProfileManager.createScannerConfigBuildInfo2Set(cfg.getOwner().getProject());
}
} else {
Preferences prefs = MakeCorePlugin.getDefault().getPluginPreferences();
- fContainer = ScannerConfigProfileManager.createScannerConfigBuildInfo2Set(prefs, false);
+ container = ScannerConfigProfileManager.createScannerConfigBuildInfo2Set(prefs, false);
}
}
- return fContainer;
+
+ if(fContainer == null) {
+ fContainer = new SoftReference<IScannerConfigBuilderInfo2Set>(container);
+ }
+ return container;
}
private Map<CfgInfoContext, IScannerConfigBuilderInfo2> createMap(){
@@ -326,7 +333,7 @@ public class CfgScannerConfigInfoFactory2 {
CfgInfo cfgInfo = new CfgInfo(cfg);
cfg.setCfgScannerConfigInfo(cfgInfo);
cfgInfo.getInfoMap();
- cfgInfo.fContainer.save();
+ cfgInfo.getContainer().save();
des.setSessionProperty(CONTAINER_INFO_PROPERTY, null);
}
}
@@ -334,7 +341,7 @@ public class CfgScannerConfigInfoFactory2 {
public static void savePreference(IConfiguration cfg) throws CoreException{
ICfgScannerConfigBuilderInfo2Set container = ((Configuration)cfg).getCfgScannerConfigInfo();
if(container != null){
- IScannerConfigBuilderInfo2Set baseContainer = ((CfgInfo)container).fContainer;
+ IScannerConfigBuilderInfo2Set baseContainer = ((CfgInfo)container).getContainer();
if(baseContainer != null){
baseContainer.save();
}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/OptionStringValue.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/OptionStringValue.java
index a7ea619d93..1ef33b40bd 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/OptionStringValue.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/OptionStringValue.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Intel Corporation and others.
+ * Copyright (c) 2007, 2011 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,12 +7,14 @@
*
* Contributors:
* Intel Corporation - Initial API and implementation
+ * IBM Corporation
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.core;
import org.eclipse.cdt.core.settings.model.ICLibraryFileEntry;
import org.eclipse.cdt.core.settings.model.ICStorageElement;
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
+import org.eclipse.cdt.internal.core.SafeStringInterner;
import org.eclipse.cdt.managedbuilder.internal.core.Option;
public final class OptionStringValue {
@@ -46,10 +48,10 @@ public final class OptionStringValue {
} else {
isBuiltIn = false;
}
- value = el.getAttribute(Option.LIST_ITEM_VALUE);
- srcPath = el.getAttribute(ATTR_SRC_PATH);
- srcRootPath = el.getAttribute(ATTR_SRC_ROOT_PATH);
- srcPrefixMapping = el.getAttribute(ATTR_SRC_PREFIX_MAPPING);
+ value = SafeStringInterner.safeIntern(el.getAttribute(Option.LIST_ITEM_VALUE));
+ srcPath = SafeStringInterner.safeIntern(el.getAttribute(ATTR_SRC_PATH));
+ srcRootPath = SafeStringInterner.safeIntern(el.getAttribute(ATTR_SRC_ROOT_PATH));
+ srcPrefixMapping = SafeStringInterner.safeIntern(el.getAttribute(ATTR_SRC_PREFIX_MAPPING));
if(value == null)
value = Option.EMPTY_STRING;
}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildproperties/BuildProperty.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildproperties/BuildProperty.java
index 62f45bbd52..c63d9eec9a 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildproperties/BuildProperty.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildproperties/BuildProperty.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Intel Corporation and others.
+ * Copyright (c) 2007, 2011 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,9 +7,11 @@
*
* Contributors:
* Intel Corporation - Initial API and implementation
+ * IBM Corporation
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.internal.buildproperties;
+import org.eclipse.cdt.internal.core.SafeStringInterner;
import org.eclipse.cdt.managedbuilder.buildproperties.IBuildProperty;
import org.eclipse.cdt.managedbuilder.buildproperties.IBuildPropertyType;
import org.eclipse.cdt.managedbuilder.buildproperties.IBuildPropertyValue;
@@ -26,10 +28,10 @@ public class BuildProperty implements IBuildProperty{
int index = property.indexOf(BuildPropertyManager.PROPERTY_VALUE_SEPARATOR);
String type, value;
if(index != -1){
- type = property.substring(0, index);
- value = property.substring(index + 1);
+ type = SafeStringInterner.safeIntern(property.substring(0, index));
+ value = SafeStringInterner.safeIntern(property.substring(index + 1));
} else {
- type = property;
+ type = SafeStringInterner.safeIntern(property);
value = null;
}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/AdditionalInput.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/AdditionalInput.java
index d18194cf02..15fe519739 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/AdditionalInput.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/AdditionalInput.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 Intel Corporation and others.
+ * Copyright (c) 2005, 2011 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,11 +7,13 @@
*
* Contributors:
* Intel Corporation - Initial API and implementation
+ * IBM Corporation
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.internal.core;
import org.eclipse.cdt.core.settings.model.ICStorageElement;
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
+import org.eclipse.cdt.internal.core.SafeStringInterner;
import org.eclipse.cdt.managedbuilder.core.IAdditionalInput;
import org.eclipse.cdt.managedbuilder.core.IInputType;
import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement;
@@ -22,15 +24,15 @@ public class AdditionalInput implements IAdditionalInput {
// Superclass
// Parent and children
- private IInputType parent;
+ private IInputType fParent;
// Managed Build model attributes
- private String paths;
- private Integer kind;
+ private String fPaths;
+ private Integer fKind;
// Miscellaneous
- private boolean isExtensionAdditionalInput = false;
- private boolean isDirty = false;
- private boolean resolved = true;
- private boolean rebuildState;
+ private boolean fIsExtensionAdditionalInput = false;
+ private boolean fIsDirty = false;
+ private boolean fResolved = true;
+ private boolean fRebuildState;
/*
* C O N S T R U C T O R S
@@ -45,11 +47,11 @@ public class AdditionalInput implements IAdditionalInput {
* provider
*/
public AdditionalInput(IInputType parent, IManagedConfigElement element) {
- this.parent = parent;
- isExtensionAdditionalInput = true;
+ this.fParent = parent;
+ fIsExtensionAdditionalInput = true;
// setup for resolving
- resolved = false;
+ fResolved = false;
loadFromManifest(element);
}
@@ -62,8 +64,8 @@ public class AdditionalInput implements IAdditionalInput {
* @param isExtensionElement Indicates whether this is an extension element or a managed project element
*/
public AdditionalInput(InputType parent, boolean isExtensionElement) {
- this.parent = parent;
- isExtensionAdditionalInput = isExtensionElement;
+ this.fParent = parent;
+ fIsExtensionAdditionalInput = isExtensionElement;
if (!isExtensionElement) {
setDirty(true);
setRebuildState(true);
@@ -78,8 +80,8 @@ public class AdditionalInput implements IAdditionalInput {
* @param element The XML element that contains the AdditionalInput settings.
*/
public AdditionalInput(IInputType parent, ICStorageElement element) {
- this.parent = parent;
- isExtensionAdditionalInput = false;
+ this.fParent = parent;
+ fIsExtensionAdditionalInput = false;
// Initialize from the XML attributes
loadFromProject(element);
@@ -92,16 +94,16 @@ public class AdditionalInput implements IAdditionalInput {
* @param additionalInput The existing AdditionalInput to clone.
*/
public AdditionalInput(IInputType parent, AdditionalInput additionalInput) {
- this.parent = parent;
- isExtensionAdditionalInput = false;
+ this.fParent = parent;
+ fIsExtensionAdditionalInput = false;
// Copy the remaining attributes
- if (additionalInput.paths != null) {
- paths = new String(additionalInput.paths);
+ if (additionalInput.fPaths != null) {
+ fPaths = new String(additionalInput.fPaths);
}
- if (additionalInput.kind != null) {
- kind = new Integer(additionalInput.kind.intValue());
+ if (additionalInput.fKind != null) {
+ fKind = new Integer(additionalInput.fKind.intValue());
}
setDirty(true);
@@ -121,16 +123,16 @@ public class AdditionalInput implements IAdditionalInput {
protected void loadFromManifest(IManagedConfigElement element) {
// path
- paths = element.getAttribute(IAdditionalInput.PATHS);
+ fPaths = SafeStringInterner.safeIntern(element.getAttribute(IAdditionalInput.PATHS));
// kind
String kindStr = element.getAttribute(IAdditionalInput.KIND);
if (kindStr == null || kindStr.equals(ADDITIONAL_INPUT_DEPENDENCY)) {
- kind = new Integer(KIND_ADDITIONAL_INPUT_DEPENDENCY);
+ fKind = new Integer(KIND_ADDITIONAL_INPUT_DEPENDENCY);
} else if (kindStr.equals(ADDITIONAL_INPUT)) {
- kind = new Integer(KIND_ADDITIONAL_INPUT);
+ fKind = new Integer(KIND_ADDITIONAL_INPUT);
} else if (kindStr.equals(ADDITIONAL_DEPENDENCY)) {
- kind = new Integer(KIND_ADDITIONAL_DEPENDENCY);
+ fKind = new Integer(KIND_ADDITIONAL_DEPENDENCY);
}
}
@@ -144,18 +146,18 @@ public class AdditionalInput implements IAdditionalInput {
// path
if (element.getAttribute(IAdditionalInput.PATHS) != null) {
- paths = element.getAttribute(IAdditionalInput.PATHS);
+ fPaths = SafeStringInterner.safeIntern(element.getAttribute(IAdditionalInput.PATHS));
}
// kind
if (element.getAttribute(IAdditionalInput.KIND) != null) {
String kindStr = element.getAttribute(IAdditionalInput.KIND);
if (kindStr == null || kindStr.equals(ADDITIONAL_INPUT_DEPENDENCY)) {
- kind = new Integer(KIND_ADDITIONAL_INPUT_DEPENDENCY);
+ fKind = new Integer(KIND_ADDITIONAL_INPUT_DEPENDENCY);
} else if (kindStr.equals(ADDITIONAL_INPUT)) {
- kind = new Integer(KIND_ADDITIONAL_INPUT);
+ fKind = new Integer(KIND_ADDITIONAL_INPUT);
} else if (kindStr.equals(ADDITIONAL_DEPENDENCY)) {
- kind = new Integer(KIND_ADDITIONAL_DEPENDENCY);
+ fKind = new Integer(KIND_ADDITIONAL_DEPENDENCY);
}
}
}
@@ -165,11 +167,11 @@ public class AdditionalInput implements IAdditionalInput {
*/
public void serialize(ICStorageElement element) {
- if (paths != null) {
- element.setAttribute(IAdditionalInput.PATHS, paths);
+ if (fPaths != null) {
+ element.setAttribute(IAdditionalInput.PATHS, fPaths);
}
- if (kind != null) {
+ if (fKind != null) {
String str;
switch (getKind()) {
case KIND_ADDITIONAL_INPUT:
@@ -189,7 +191,7 @@ public class AdditionalInput implements IAdditionalInput {
}
// I am clean now
- isDirty = false;
+ fIsDirty = false;
}
/*
@@ -200,7 +202,7 @@ public class AdditionalInput implements IAdditionalInput {
* @see org.eclipse.cdt.core.build.managed.IAdditionalInput#getParent()
*/
public IInputType getParent() {
- return parent;
+ return fParent;
}
/*
@@ -211,10 +213,10 @@ public class AdditionalInput implements IAdditionalInput {
* @see org.eclipse.cdt.core.build.managed.IAdditionalInput#getPaths()
*/
public String[] getPaths() {
- if (paths == null) {
+ if (fPaths == null) {
return null;
}
- String[] nameTokens = CDataUtil.stringToArray(paths, ";"); //$NON-NLS-1$
+ String[] nameTokens = CDataUtil.stringToArray(fPaths, ";"); //$NON-NLS-1$
return nameTokens;
}
@@ -222,10 +224,10 @@ public class AdditionalInput implements IAdditionalInput {
* @see org.eclipse.cdt.core.build.managed.IAdditionalInput#setPaths()
*/
public void setPaths(String newPaths) {
- if (paths == null && newPaths == null) return;
- if (paths == null || newPaths == null || !(paths.equals(newPaths))) {
- paths = newPaths;
- isDirty = true;
+ if (fPaths == null && newPaths == null) return;
+ if (fPaths == null || newPaths == null || !(fPaths.equals(newPaths))) {
+ fPaths = newPaths;
+ fIsDirty = true;
setRebuildState(true);
}
}
@@ -234,19 +236,19 @@ public class AdditionalInput implements IAdditionalInput {
* @see org.eclipse.cdt.core.build.managed.IAdditionalInput#getKind()
*/
public int getKind() {
- if (kind == null) {
+ if (fKind == null) {
return KIND_ADDITIONAL_INPUT_DEPENDENCY;
}
- return kind.intValue();
+ return fKind.intValue();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IAdditionalInput#setKind()
*/
public void setKind(int newKind) {
- if (kind == null || !(kind.intValue() == newKind)) {
- kind = new Integer(newKind);
- isDirty = true;
+ if (fKind == null || !(fKind.intValue() == newKind)) {
+ fKind = new Integer(newKind);
+ fIsDirty = true;
setRebuildState(true);
}
}
@@ -259,7 +261,7 @@ public class AdditionalInput implements IAdditionalInput {
* @see org.eclipse.cdt.managedbuilder.core.IAdditionalInput#isExtensionElement()
*/
public boolean isExtensionElement() {
- return isExtensionAdditionalInput;
+ return fIsExtensionAdditionalInput;
}
/* (non-Javadoc)
@@ -267,35 +269,35 @@ public class AdditionalInput implements IAdditionalInput {
*/
public boolean isDirty() {
// This shouldn't be called for an extension AdditionalInput
- if (isExtensionAdditionalInput) return false;
- return isDirty;
+ if (fIsExtensionAdditionalInput) return false;
+ return fIsDirty;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IAdditionalInput#setDirty(boolean)
*/
public void setDirty(boolean isDirty) {
- this.isDirty = isDirty;
+ this.fIsDirty = isDirty;
}
/* (non-Javadoc)
* Resolve the element IDs to interface references
*/
public void resolveReferences() {
- if (!resolved) {
- resolved = true;
+ if (!fResolved) {
+ fResolved = true;
}
}
public boolean needsRebuild(){
- return rebuildState;
+ return fRebuildState;
}
public void setRebuildState(boolean rebuild){
if(isExtensionElement() && rebuild)
return;
- rebuildState = rebuild;
+ fRebuildState = rebuild;
}
}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Builder.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Builder.java
index 954bfba324..b0948e333c 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Builder.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Builder.java
@@ -7,6 +7,7 @@
*
* Contributors:
* Intel Corporation - Initial API and implementation
+ * IBM Corporation
* James Blackburn (Broadcom Corp.)
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.internal.core;
@@ -38,6 +39,7 @@ import org.eclipse.cdt.core.settings.model.ICStorageElement;
import org.eclipse.cdt.core.settings.model.extension.CBuildData;
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
import org.eclipse.cdt.core.settings.model.util.LanguageSettingEntriesSerializer;
+import org.eclipse.cdt.internal.core.SafeStringInterner;
import org.eclipse.cdt.managedbuilder.core.BuildException;
import org.eclipse.cdt.managedbuilder.core.ExternalBuildRunner;
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
@@ -448,28 +450,30 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
ManagedBuildManager.putConfigElement(this, element);
// id
- setId(element.getAttribute(IBuildObject.ID));
+ String idAttribute = SafeStringInterner.safeIntern(element.getAttribute(IBuildObject.ID));;
+ setId(idAttribute);
// Get the name
- setName(element.getAttribute(IBuildObject.NAME));
+ final String nameAttribute = SafeStringInterner.safeIntern(element.getAttribute(IBuildObject.NAME));
+ setName(nameAttribute);
// Set the version after extracting from 'id' attribute
setVersion(getVersionFromId());
// superClass
- superClassId = element.getAttribute(IProjectType.SUPERCLASS);
+ superClassId = SafeStringInterner.safeIntern(element.getAttribute(IProjectType.SUPERCLASS));
// Get the unused children, if any
- unusedChildren = element.getAttribute(IProjectType.UNUSED_CHILDREN);
+ unusedChildren = SafeStringInterner.safeIntern(element.getAttribute(IProjectType.UNUSED_CHILDREN));
// Get the 'versionsSupported' attribute
- versionsSupported = element.getAttribute(VERSIONS_SUPPORTED);
+ versionsSupported = SafeStringInterner.safeIntern(element.getAttribute(VERSIONS_SUPPORTED));
// Get the 'convertToId' attribute
- convertToId = element.getAttribute(CONVERT_TO_ID);
+ convertToId = SafeStringInterner.safeIntern(element.getAttribute(CONVERT_TO_ID));
// get the 'variableFormat' attribute
- builderVariablePattern = element.getAttribute(VARIABLE_FORMAT);
+ builderVariablePattern = SafeStringInterner.safeIntern(element.getAttribute(VARIABLE_FORMAT));
// get the 'isVariableCaseSensitive' attribute
String isCS = element.getAttribute(IS_VARIABLE_CASE_SENSITIVE);
@@ -480,6 +484,8 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
String reservedNames = element.getAttribute(RESERVED_MACRO_NAMES);
if(reservedNames != null)
reservedMacroNames = reservedNames.split(","); //$NON-NLS-1$
+
+ reservedMacroNames = SafeStringInterner.safeIntern(reservedMacroNames);
// Get the reservedMacroNameSupplier configuration element
String reservedMacroNameSupplier = element.getAttribute(RESERVED_MACRO_NAME_SUPPLIER);
@@ -495,20 +501,25 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
}
// command
- command = element.getAttribute(IBuilder.COMMAND);
+ command = SafeStringInterner.safeIntern(element.getAttribute(IBuilder.COMMAND));
// arguments
- args = element.getAttribute(IBuilder.ARGUMENTS);
+ args = SafeStringInterner.safeIntern(element.getAttribute(IBuilder.ARGUMENTS));
+
+ autoBuildTarget = SafeStringInterner.safeIntern(element.getAttribute(ATTRIBUTE_TARGET_AUTO));
- autoBuildTarget = element.getAttribute(ATTRIBUTE_TARGET_AUTO);
String tmp = element.getAttribute(ATTRIBUTE_AUTO_ENABLED);
if(tmp != null)
autoBuildEnabled = Boolean.valueOf(tmp);
- incrementalBuildTarget = element.getAttribute(ATTRIBUTE_TARGET_INCREMENTAL);
+
+ incrementalBuildTarget = SafeStringInterner.safeIntern(element.getAttribute(ATTRIBUTE_TARGET_INCREMENTAL));
+
tmp = element.getAttribute(ATTRIBUTE_AUTO_ENABLED);
if(tmp != null)
incrementalBuildEnabled = Boolean.valueOf(tmp);
- cleanBuildTarget = element.getAttribute(ATTRIBUTE_TARGET_CLEAN);
+
+ cleanBuildTarget = SafeStringInterner.safeIntern(element.getAttribute(ATTRIBUTE_TARGET_CLEAN));
+
tmp = element.getAttribute(ATTRIBUTE_CLEAN_ENABLED);
if(tmp != null)
cleanBuildEnabled = Boolean.valueOf(tmp);
@@ -522,8 +533,12 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
if(tmp != null)
supportsManagedBuild = Boolean.valueOf(tmp);
tmp = element.getAttribute(ATTRIBUTE_CUSTOMIZED_ERROR_PARSERS);
+
if(tmp != null)
customizedErrorParserIds = CDataUtil.stringToArray(tmp, ";"); //$NON-NLS-1$
+
+ customizedErrorParserIds = SafeStringInterner.safeIntern(customizedErrorParserIds);
+
tmp = element.getAttribute(ATTRIBUTE_ENVIRONMENT);
if(tmp != null)
customizedEnvironment = MapStorageElement.decodeMap(tmp);
@@ -535,11 +550,14 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
if(tmp != null)
customBuildProperties = MapStorageElement.decodeMap(tmp);
- ignoreErrCmd = element.getAttribute(ATTRIBUTE_IGNORE_ERR_CMD);
+ ignoreErrCmd = SafeStringInterner.safeIntern(element.getAttribute(ATTRIBUTE_IGNORE_ERR_CMD));
+
tmp = element.getAttribute(ATTRIBUTE_STOP_ON_ERR);
if(tmp != null)
stopOnErr = Boolean.valueOf(tmp);
- parallelBuildCmd = element.getAttribute(ATTRIBUTE_PARALLEL_BUILD_CMD);
+
+ parallelBuildCmd = SafeStringInterner.safeIntern(element.getAttribute(ATTRIBUTE_PARALLEL_BUILD_CMD));
+
tmp = element.getAttribute(ATTRIBUTE_PARALLELIZATION_NUMBER);
if(tmp != null){
try {
@@ -552,7 +570,7 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
parallelBuildOn = Boolean.valueOf(tmp);
// Get the semicolon separated list of IDs of the error parsers
- errorParserIds = element.getAttribute(IToolChain.ERROR_PARSERS);
+ errorParserIds = SafeStringInterner.safeIntern(element.getAttribute(IToolChain.ERROR_PARSERS));
// Store the configuration element IFF there is a build file generator defined
String buildfileGenerator = element.getAttribute(BUILDFILEGEN_ID);
@@ -609,12 +627,13 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
protected void loadFromProject(ICStorageElement element) {
// id
+ // note: IDs are unique so no benefit to intern them
if(element.getAttribute(IBuildObject.ID) != null)
setId(element.getAttribute(IBuildObject.ID));
// name
if (element.getAttribute(IBuildObject.NAME) != null) {
- setName(element.getAttribute(IBuildObject.NAME));
+ setName(SafeStringInterner.safeIntern(element.getAttribute(IBuildObject.NAME)));
}
// Set the version after extracting from 'id' attribute
@@ -622,7 +641,7 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
// superClass
if(element.getAttribute(IProjectType.SUPERCLASS) != null){
- superClassId = element.getAttribute(IProjectType.SUPERCLASS);
+ superClassId = SafeStringInterner.safeIntern(element.getAttribute(IProjectType.SUPERCLASS));
if (superClassId != null && superClassId.length() > 0) {
superClass = ManagedBuildManager.getExtensionBuilder(superClassId);
// Check for migration support
@@ -632,17 +651,17 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
// Get the 'versionSupported' attribute
if (element.getAttribute(VERSIONS_SUPPORTED) != null) {
- versionsSupported = element.getAttribute(VERSIONS_SUPPORTED);
+ versionsSupported = SafeStringInterner.safeIntern(element.getAttribute(VERSIONS_SUPPORTED));
}
// Get the 'convertToId' id
if (element.getAttribute(CONVERT_TO_ID) != null) {
- convertToId = element.getAttribute(CONVERT_TO_ID);
+ convertToId = SafeStringInterner.safeIntern(element.getAttribute(CONVERT_TO_ID));
}
// Get the unused children, if any
if (element.getAttribute(IProjectType.UNUSED_CHILDREN) != null) {
- unusedChildren = element.getAttribute(IProjectType.UNUSED_CHILDREN);
+ unusedChildren = SafeStringInterner.safeIntern(element.getAttribute(IProjectType.UNUSED_CHILDREN));
}
// isAbstract
@@ -655,30 +674,30 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
// command
if (element.getAttribute(IBuilder.COMMAND) != null) {
- command = element.getAttribute(IBuilder.COMMAND);
+ command = SafeStringInterner.safeIntern(element.getAttribute(IBuilder.COMMAND));
}
// arguments
if (element.getAttribute(IBuilder.ARGUMENTS) != null) {
- args = element.getAttribute(IBuilder.ARGUMENTS);
+ args = SafeStringInterner.safeIntern(element.getAttribute(IBuilder.ARGUMENTS));
}
if(element.getAttribute(ATTRIBUTE_TARGET_AUTO) != null)
- autoBuildTarget = element.getAttribute(ATTRIBUTE_TARGET_AUTO);
+ autoBuildTarget = SafeStringInterner.safeIntern(element.getAttribute(ATTRIBUTE_TARGET_AUTO));
String tmp = element.getAttribute(ATTRIBUTE_AUTO_ENABLED);
if(tmp != null)
autoBuildEnabled = Boolean.valueOf(tmp);
if(element.getAttribute(ATTRIBUTE_TARGET_INCREMENTAL) != null)
- incrementalBuildTarget = element.getAttribute(ATTRIBUTE_TARGET_INCREMENTAL);
+ incrementalBuildTarget = SafeStringInterner.safeIntern(element.getAttribute(ATTRIBUTE_TARGET_INCREMENTAL));
tmp = element.getAttribute(ATTRIBUTE_INCREMENTAL_ENABLED);
if(tmp != null)
incrementalBuildEnabled = Boolean.valueOf(tmp);
if(element.getAttribute(ATTRIBUTE_TARGET_CLEAN) != null)
- cleanBuildTarget = element.getAttribute(ATTRIBUTE_TARGET_CLEAN);
+ cleanBuildTarget = SafeStringInterner.safeIntern(element.getAttribute(ATTRIBUTE_TARGET_CLEAN));
tmp = element.getAttribute(ATTRIBUTE_CLEAN_ENABLED);
if(tmp != null)
@@ -709,7 +728,7 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
appendEnvironment = Boolean.valueOf(tmp);
if(element.getAttribute(ATTRIBUTE_BUILD_PATH) != null)
- buildPath = element.getAttribute(ATTRIBUTE_BUILD_PATH);
+ buildPath = SafeStringInterner.safeIntern(element.getAttribute(ATTRIBUTE_BUILD_PATH));
tmp = element.getAttribute(ATTRIBUTE_CUSTOM_PROPS);
if(tmp != null)
@@ -717,7 +736,7 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
// Get the semicolon separated list of IDs of the error parsers
if (element.getAttribute(IToolChain.ERROR_PARSERS) != null) {
- errorParserIds = element.getAttribute(IToolChain.ERROR_PARSERS);
+ errorParserIds = SafeStringInterner.safeIntern(element.getAttribute(IToolChain.ERROR_PARSERS));
}
// Note: build file generator cannot be specified in a project file because
@@ -727,14 +746,14 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
}
if(element.getAttribute(ATTRIBUTE_IGNORE_ERR_CMD) != null)
- ignoreErrCmd = element.getAttribute(ATTRIBUTE_IGNORE_ERR_CMD);
+ ignoreErrCmd = SafeStringInterner.safeIntern(element.getAttribute(ATTRIBUTE_IGNORE_ERR_CMD));
tmp = element.getAttribute(ATTRIBUTE_STOP_ON_ERR);
if(tmp != null)
stopOnErr = Boolean.valueOf(tmp);
if(element.getAttribute(ATTRIBUTE_PARALLEL_BUILD_CMD) != null)
- parallelBuildCmd = element.getAttribute(ATTRIBUTE_PARALLEL_BUILD_CMD);
+ parallelBuildCmd = SafeStringInterner.safeIntern(element.getAttribute(ATTRIBUTE_PARALLEL_BUILD_CMD));
tmp = element.getAttribute(ATTRIBUTE_PARALLELIZATION_NUMBER);
if(tmp != null){
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Configuration.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Configuration.java
index d4535b34a4..ef84a29dc1 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Configuration.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Configuration.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2010 IBM Corporation and others.
+ * Copyright (c) 2003, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -45,6 +45,7 @@ import org.eclipse.cdt.core.settings.model.extension.CConfigurationData;
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
import org.eclipse.cdt.core.settings.model.util.LanguageSettingEntriesSerializer;
import org.eclipse.cdt.core.settings.model.util.PathSettingsContainer;
+import org.eclipse.cdt.internal.core.SafeStringInterner;
import org.eclipse.cdt.managedbuilder.buildproperties.IBuildProperty;
import org.eclipse.cdt.managedbuilder.buildproperties.IBuildPropertyType;
import org.eclipse.cdt.managedbuilder.buildproperties.IBuildPropertyValue;
@@ -254,11 +255,11 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
if(rootFolderInfo == null)
createRootFolderInfo();
- String props = element.getAttribute(BUILD_PROPERTIES);
+ String props = SafeStringInterner.safeIntern(element.getAttribute(BUILD_PROPERTIES));
if(props != null)
buildProperties = new BuildObjectProperties(props, this, this);
- String artType = element.getAttribute(BUILD_ARTEFACT_TYPE);
+ String artType = SafeStringInterner.safeIntern(element.getAttribute(BUILD_ARTEFACT_TYPE));
if(artType != null){
if(buildProperties == null)
buildProperties = new BuildObjectProperties(this, this);
@@ -761,40 +762,41 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
ManagedBuildManager.putConfigElement(this, element);
// id
- setId(element.getAttribute(IConfiguration.ID));
+ setId(SafeStringInterner.safeIntern(element.getAttribute(IConfiguration.ID)));
// name
- name = element.getAttribute(IConfiguration.NAME);
+ name = SafeStringInterner.safeIntern(element.getAttribute(IConfiguration.NAME));
// description
- description = element.getAttribute(IConfiguration.DESCRIPTION);
+ description = SafeStringInterner.safeIntern(element.getAttribute(IConfiguration.DESCRIPTION));
// parent
- parentId = element.getAttribute(IConfiguration.PARENT);
+ parentId = SafeStringInterner.safeIntern(element.getAttribute(IConfiguration.PARENT));
+
// if (parentID != null) {
// // Lookup the parent configuration by ID
// parent = ManagedBuildManager.getExtensionConfiguration(parentID);
// }
// Get the name of the build artifact associated with configuration
- artifactName = element.getAttribute(ARTIFACT_NAME);
+ artifactName = SafeStringInterner.safeIntern(element.getAttribute(ARTIFACT_NAME));
// Get the semicolon separated list of IDs of the error parsers
- errorParserIds = element.getAttribute(ERROR_PARSERS);
+ errorParserIds = SafeStringInterner.safeIntern(element.getAttribute(ERROR_PARSERS));
// Get the artifact extension
- artifactExtension = element.getAttribute(EXTENSION);
+ artifactExtension = SafeStringInterner.safeIntern(element.getAttribute(EXTENSION));
// Get the clean command
- cleanCommand = element.getAttribute(CLEAN_COMMAND);
+ cleanCommand = SafeStringInterner.safeIntern(element.getAttribute(CLEAN_COMMAND));
// Get the pre-build and post-build commands
- prebuildStep = element.getAttribute(PREBUILD_STEP);
- postbuildStep = element.getAttribute(POSTBUILD_STEP);
+ prebuildStep = SafeStringInterner.safeIntern(element.getAttribute(PREBUILD_STEP));
+ postbuildStep = SafeStringInterner.safeIntern(element.getAttribute(POSTBUILD_STEP));
// Get the pre-build and post-build announcements
- preannouncebuildStep = element.getAttribute(PREANNOUNCEBUILD_STEP);
- postannouncebuildStep = element.getAttribute(POSTANNOUNCEBUILD_STEP);
+ preannouncebuildStep = SafeStringInterner.safeIntern(element.getAttribute(PREANNOUNCEBUILD_STEP));
+ postannouncebuildStep = SafeStringInterner.safeIntern(element.getAttribute(POSTANNOUNCEBUILD_STEP));
String tmp = element.getAttribute(IS_SYSTEM);
if(tmp != null)
@@ -810,21 +812,22 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
protected void loadFromProject(ICStorageElement element) {
// id
+ // note: IDs are unique so no benefit to intern them
setId(element.getAttribute(IConfiguration.ID));
// name
if (element.getAttribute(IConfiguration.NAME) != null)
- setName(element.getAttribute(IConfiguration.NAME));
+ setName(SafeStringInterner.safeIntern(element.getAttribute(IConfiguration.NAME)));
// description
if (element.getAttribute(IConfiguration.DESCRIPTION) != null)
- this.description = element.getAttribute(IConfiguration.DESCRIPTION);
+ description = SafeStringInterner.safeIntern(element.getAttribute(IConfiguration.DESCRIPTION));
String props = element.getAttribute(BUILD_PROPERTIES);
if(props != null)
buildProperties = new BuildObjectProperties(props, this, this);
- String artType = element.getAttribute(BUILD_ARTEFACT_TYPE);
+ String artType = SafeStringInterner.safeIntern(element.getAttribute(BUILD_ARTEFACT_TYPE));
if(artType != null){
if(buildProperties == null)
buildProperties = new BuildObjectProperties(this, this);
@@ -854,41 +857,40 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
// Get the name of the build artifact associated with target (usually
// in the plugin specification).
if (element.getAttribute(ARTIFACT_NAME) != null) {
- artifactName = element.getAttribute(ARTIFACT_NAME);
+ artifactName = SafeStringInterner.safeIntern(element.getAttribute(ARTIFACT_NAME));
}
// Get the semicolon separated list of IDs of the error parsers
if (element.getAttribute(ERROR_PARSERS) != null) {
- errorParserIds = element.getAttribute(ERROR_PARSERS);
+ errorParserIds = SafeStringInterner.safeIntern(element.getAttribute(ERROR_PARSERS));
}
// Get the artifact extension
if (element.getAttribute(EXTENSION) != null) {
- artifactExtension = element.getAttribute(EXTENSION);
+ artifactExtension = SafeStringInterner.safeIntern(element.getAttribute(EXTENSION));
}
// Get the clean command
if (element.getAttribute(CLEAN_COMMAND) != null) {
- cleanCommand = element.getAttribute(CLEAN_COMMAND);
+ cleanCommand = SafeStringInterner.safeIntern(element.getAttribute(CLEAN_COMMAND));
}
// Get the pre-build and post-build commands
if (element.getAttribute(PREBUILD_STEP) != null) {
- prebuildStep = element.getAttribute(PREBUILD_STEP);
+ prebuildStep = SafeStringInterner.safeIntern(element.getAttribute(PREBUILD_STEP));
}
if (element.getAttribute(POSTBUILD_STEP) != null) {
- postbuildStep = element.getAttribute(POSTBUILD_STEP);
+ postbuildStep = SafeStringInterner.safeIntern(element.getAttribute(POSTBUILD_STEP));
}
// Get the pre-build and post-build announcements
if (element.getAttribute(PREANNOUNCEBUILD_STEP) != null) {
- preannouncebuildStep = element.getAttribute(PREANNOUNCEBUILD_STEP);
+ preannouncebuildStep = SafeStringInterner.safeIntern(element.getAttribute(PREANNOUNCEBUILD_STEP));
}
if (element.getAttribute(POSTANNOUNCEBUILD_STEP) != null) {
- postannouncebuildStep = element
- .getAttribute(POSTANNOUNCEBUILD_STEP);
+ postannouncebuildStep = SafeStringInterner.safeIntern(element.getAttribute(POSTANNOUNCEBUILD_STEP));
}
}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/EnvVarBuildPath.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/EnvVarBuildPath.java
index c08a21866b..298ce39ee0 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/EnvVarBuildPath.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/EnvVarBuildPath.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 Intel Corporation and others.
+ * Copyright (c) 2005, 2011 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,9 +7,11 @@
*
* Contributors:
* Intel Corporation - Initial API and implementation
+ * IBM Corporation
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.internal.core;
+import org.eclipse.cdt.internal.core.SafeStringInterner;
import org.eclipse.cdt.managedbuilder.core.IBuildPathResolver;
import org.eclipse.cdt.managedbuilder.core.IEnvVarBuildPath;
import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement;
@@ -21,11 +23,11 @@ import org.eclipse.core.runtime.IConfigurationElement;
public class EnvVarBuildPath implements
IEnvVarBuildPath {
- private int type;
- private String variableNames[];
- private String pathDelimiter;
- private IBuildPathResolver buildPathResolver;
- private IConfigurationElement buildPathResolverElement;
+ private int fType;
+ private String fVariableNames[];
+ private String fPathDelimiter;
+ private IBuildPathResolver fBuildPathResolver;
+ private IConfigurationElement fBuildPathResolverElement;
/**
@@ -47,14 +49,14 @@ public class EnvVarBuildPath implements
setType(convertPathTypeToInt(element.getAttribute(TYPE)));
- setVariableNames(element.getAttribute(LIST));
+ setVariableNames(SafeStringInterner.safeIntern(element.getAttribute(LIST)));
- setPathDelimiter(element.getAttribute(PATH_DELIMITER));
+ setPathDelimiter(SafeStringInterner.safeIntern(element.getAttribute(PATH_DELIMITER)));
// Store the configuration element IFF there is a build path resolver defined
String buildPathResolver = element.getAttribute(BUILD_PATH_RESOLVER);
if (buildPathResolver != null && element instanceof DefaultManagedConfigElement) {
- buildPathResolverElement = ((DefaultManagedConfigElement)element).getConfigurationElement();
+ fBuildPathResolverElement = ((DefaultManagedConfigElement)element).getConfigurationElement();
}
}
@@ -62,22 +64,23 @@ public class EnvVarBuildPath implements
* @see org.eclipse.cdt.managedbuilder.core.IEnvVarBuildPath#getType()
*/
public int getType() {
- return type;
+ return fType;
}
public void setType(int type){
- this.type = type;
+ this.fType = type;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IEnvVarBuildPath#getVariableNames()
*/
public String[] getVariableNames() {
- return variableNames;
+ return fVariableNames;
}
public void setVariableNames(String names[]){
- this.variableNames = names;
+ fVariableNames = names;
+ fVariableNames = SafeStringInterner.safeIntern(fVariableNames);
}
public void setVariableNames(String names){
@@ -94,13 +97,13 @@ public class EnvVarBuildPath implements
* @see org.eclipse.cdt.managedbuilder.core.IEnvVarBuildPath#getPathDelimiter()
*/
public String getPathDelimiter() {
- return pathDelimiter;
+ return fPathDelimiter;
}
public void setPathDelimiter(String delimiter) {
if(delimiter == null)
delimiter = ManagedBuildManager.getEnvironmentVariableProvider().getDefaultDelimiter();
- this.pathDelimiter = delimiter;
+ fPathDelimiter = SafeStringInterner.safeIntern(delimiter);
}
private int convertPathTypeToInt(String pathType){
@@ -123,14 +126,14 @@ public class EnvVarBuildPath implements
* @see org.eclipse.cdt.managedbuilder.core.IEnvVarBuildPath#getBuildPathResolver()
*/
public IBuildPathResolver getBuildPathResolver() {
- if(buildPathResolver == null && buildPathResolverElement != null){
+ if(fBuildPathResolver == null && fBuildPathResolverElement != null){
try {
- if (buildPathResolverElement.getAttribute(BUILD_PATH_RESOLVER) != null) {
- buildPathResolver = (IBuildPathResolver) buildPathResolverElement.createExecutableExtension(BUILD_PATH_RESOLVER);
+ if (fBuildPathResolverElement.getAttribute(BUILD_PATH_RESOLVER) != null) {
+ fBuildPathResolver = (IBuildPathResolver) fBuildPathResolverElement.createExecutableExtension(BUILD_PATH_RESOLVER);
}
} catch (CoreException e) {}
}
- return buildPathResolver;
+ return fBuildPathResolver;
}
}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/InputOrder.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/InputOrder.java
index 4e3aacff3a..c9b4b7bddd 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/InputOrder.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/InputOrder.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 Intel Corporation and others.
+ * Copyright (c) 2005, 2011 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,10 +7,12 @@
*
* Contributors:
* Intel Corporation - Initial API and implementation
+ * IBM Corporation
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.internal.core;
import org.eclipse.cdt.core.settings.model.ICStorageElement;
+import org.eclipse.cdt.internal.core.SafeStringInterner;
import org.eclipse.cdt.managedbuilder.core.IInputOrder;
import org.eclipse.cdt.managedbuilder.core.IInputType;
import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement;
@@ -18,16 +20,16 @@ import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement;
public class InputOrder implements IInputOrder {
// Superclass
// Parent and children
- private IInputType parent;
+ private IInputType fParent;
// Managed Build model attributes
- private String path;
- private String order;
- private Boolean excluded;
+ private String fPath;
+ private String fOrder;
+ private Boolean fExcluded;
// Miscellaneous
- private boolean isExtensionInputOrder = false;
- private boolean isDirty = false;
- private boolean resolved = true;
- private boolean rebuildState;
+ private boolean fIsExtensionInputOrder = false;
+ private boolean fIsDirty = false;
+ private boolean fResolved = true;
+ private boolean fRebuildState;
/*
* C O N S T R U C T O R S
@@ -42,11 +44,11 @@ public class InputOrder implements IInputOrder {
* provider
*/
public InputOrder(IInputType parent, IManagedConfigElement element) {
- this.parent = parent;
- isExtensionInputOrder = true;
+ this.fParent = parent;
+ fIsExtensionInputOrder = true;
// setup for resolving
- resolved = false;
+ fResolved = false;
loadFromManifest(element);
}
@@ -59,8 +61,8 @@ public class InputOrder implements IInputOrder {
* @param isExtensionElement Indicates whether this is an extension element or a managed project element
*/
public InputOrder(InputType parent, boolean isExtensionElement) {
- this.parent = parent;
- isExtensionInputOrder = isExtensionElement;
+ this.fParent = parent;
+ fIsExtensionInputOrder = isExtensionElement;
if (!isExtensionElement) {
setDirty(true);
}
@@ -74,8 +76,8 @@ public class InputOrder implements IInputOrder {
* @param element The XML element that contains the InputOrder settings.
*/
public InputOrder(IInputType parent, ICStorageElement element) {
- this.parent = parent;
- isExtensionInputOrder = false;
+ this.fParent = parent;
+ fIsExtensionInputOrder = false;
// Initialize from the XML attributes
loadFromProject(element);
@@ -88,20 +90,20 @@ public class InputOrder implements IInputOrder {
* @param inputOrder The existing InputOrder to clone.
*/
public InputOrder(IInputType parent, InputOrder inputOrder) {
- this.parent = parent;
- isExtensionInputOrder = false;
+ this.fParent = parent;
+ fIsExtensionInputOrder = false;
// Copy the remaining attributes
- if (inputOrder.path != null) {
- path = new String(inputOrder.path);
+ if (inputOrder.fPath != null) {
+ fPath = new String(inputOrder.fPath);
}
- if (inputOrder.order != null) {
- order = new String(inputOrder.order);
+ if (inputOrder.fOrder != null) {
+ fOrder = new String(inputOrder.fOrder);
}
- if (inputOrder.excluded != null) {
- excluded = new Boolean(inputOrder.excluded.booleanValue());
+ if (inputOrder.fExcluded != null) {
+ fExcluded = new Boolean(inputOrder.fExcluded.booleanValue());
}
setDirty(true);
@@ -121,15 +123,15 @@ public class InputOrder implements IInputOrder {
protected void loadFromManifest(IManagedConfigElement element) {
// path
- path = element.getAttribute(IInputOrder.PATH);
+ fPath = SafeStringInterner.safeIntern(element.getAttribute(IInputOrder.PATH));
// order
- order = element.getAttribute(IInputOrder.ORDER);
+ fOrder = SafeStringInterner.safeIntern(element.getAttribute(IInputOrder.ORDER));
// excluded
String isEx = element.getAttribute(IInputOrder.EXCLUDED);
if (isEx != null){
- excluded = new Boolean("true".equals(isEx)); //$NON-NLS-1$
+ fExcluded = new Boolean("true".equals(isEx)); //$NON-NLS-1$
}
}
@@ -143,19 +145,19 @@ public class InputOrder implements IInputOrder {
// path
if (element.getAttribute(IInputOrder.PATH) != null) {
- path = element.getAttribute(IInputOrder.PATH);
+ fPath = SafeStringInterner.safeIntern(element.getAttribute(IInputOrder.PATH));
}
// order
if (element.getAttribute(IInputOrder.ORDER) != null) {
- order = element.getAttribute(IInputOrder.ORDER);
+ fOrder = SafeStringInterner.safeIntern(element.getAttribute(IInputOrder.ORDER));
}
// excluded
if (element.getAttribute(IInputOrder.EXCLUDED) != null) {
String isEx = element.getAttribute(IInputOrder.EXCLUDED);
if (isEx != null){
- excluded = new Boolean("true".equals(isEx)); //$NON-NLS-1$
+ fExcluded = new Boolean("true".equals(isEx)); //$NON-NLS-1$
}
}
}
@@ -165,20 +167,20 @@ public class InputOrder implements IInputOrder {
*/
public void serialize(ICStorageElement element) {
- if (path != null) {
- element.setAttribute(IInputOrder.PATH, path);
+ if (fPath != null) {
+ element.setAttribute(IInputOrder.PATH, fPath);
}
- if (order != null) {
- element.setAttribute(IInputOrder.ORDER, order);
+ if (fOrder != null) {
+ element.setAttribute(IInputOrder.ORDER, fOrder);
}
- if (excluded != null) {
- element.setAttribute(IInputOrder.EXCLUDED, excluded.toString());
+ if (fExcluded != null) {
+ element.setAttribute(IInputOrder.EXCLUDED, fExcluded.toString());
}
// I am clean now
- isDirty = false;
+ fIsDirty = false;
}
/*
@@ -189,7 +191,7 @@ public class InputOrder implements IInputOrder {
* @see org.eclipse.cdt.core.build.managed.IInputOrder#getParent()
*/
public IInputType getParent() {
- return parent;
+ return fParent;
}
/*
@@ -200,17 +202,17 @@ public class InputOrder implements IInputOrder {
* @see org.eclipse.cdt.core.build.managed.IInputOrder#getPsth()
*/
public String getPath() {
- return path;
+ return fPath;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IInputOrder#setPath()
*/
public void setPath(String newPath) {
- if (path == null && newPath == null) return;
- if (path == null || newPath == null || !(path.equals(newPath))) {
- path = newPath;
- isDirty = true;
+ if (fPath == null && newPath == null) return;
+ if (fPath == null || newPath == null || !(fPath.equals(newPath))) {
+ fPath = newPath;
+ fIsDirty = true;
setRebuildState(true);
}
}
@@ -219,17 +221,17 @@ public class InputOrder implements IInputOrder {
* @see org.eclipse.cdt.core.build.managed.IInputOrder#getOrder()
*/
public String getOrder() {
- return order;
+ return fOrder;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IInputOrder#setOrder()
*/
public void setOrder(String newOrder) {
- if (order == null && newOrder == null) return;
- if (order == null || newOrder == null || !(order.equals(newOrder))) {
- order = newOrder;
- isDirty = true;
+ if (fOrder == null && newOrder == null) return;
+ if (fOrder == null || newOrder == null || !(fOrder.equals(newOrder))) {
+ fOrder = newOrder;
+ fIsDirty = true;
setRebuildState(true);
}
}
@@ -238,15 +240,15 @@ public class InputOrder implements IInputOrder {
* @see org.eclipse.cdt.core.build.managed.IInputOrder#getExcluded()
*/
public boolean getExcluded() {
- return excluded.booleanValue();
+ return fExcluded.booleanValue();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IInputOrder#setExcluded()
*/
public void setExcluded(boolean b) {
- if (excluded == null || !(b == excluded.booleanValue())) {
- excluded = new Boolean(b);
+ if (fExcluded == null || !(b == fExcluded.booleanValue())) {
+ fExcluded = new Boolean(b);
setDirty(true);
setRebuildState(true);
}
@@ -261,7 +263,7 @@ public class InputOrder implements IInputOrder {
* @see org.eclipse.cdt.managedbuilder.core.IInputOrder#isExtensionElement()
*/
public boolean isExtensionElement() {
- return isExtensionInputOrder;
+ return fIsExtensionInputOrder;
}
/* (non-Javadoc)
@@ -269,34 +271,34 @@ public class InputOrder implements IInputOrder {
*/
public boolean isDirty() {
// This shouldn't be called for an extension InputOrder
- if (isExtensionInputOrder) return false;
- return isDirty;
+ if (fIsExtensionInputOrder) return false;
+ return fIsDirty;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IInputOrder#setDirty(boolean)
*/
public void setDirty(boolean isDirty) {
- this.isDirty = isDirty;
+ this.fIsDirty = isDirty;
}
/* (non-Javadoc)
* Resolve the element IDs to interface references
*/
public void resolveReferences() {
- if (!resolved) {
- resolved = true;
+ if (!fResolved) {
+ fResolved = true;
}
}
public boolean needsRebuild(){
- return rebuildState;
+ return fRebuildState;
}
public void setRebuildState(boolean rebuild){
if(isExtensionElement() && rebuild)
return;
- rebuildState = rebuild;
+ fRebuildState = rebuild;
}
}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/InputType.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/InputType.java
index ef5d7f8ba8..d2088edbfc 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/InputType.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/InputType.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2009 Intel Corporation and others.
+ * Copyright (c) 2005, 2011 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* Intel Corporation - Initial API and implementation
+ * IBM Corporation
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.internal.core;
@@ -18,6 +19,7 @@ import java.util.Vector;
import org.eclipse.cdt.core.settings.model.ICStorageElement;
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
+import org.eclipse.cdt.internal.core.SafeStringInterner;
import org.eclipse.cdt.managedbuilder.core.IAdditionalInput;
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
import org.eclipse.cdt.managedbuilder.core.IFileInfo;
@@ -308,13 +310,13 @@ public class InputType extends BuildObject implements IInputType {
ManagedBuildManager.putConfigElement(this, element);
// id
- setId(element.getAttribute(IBuildObject.ID));
+ setId(SafeStringInterner.safeIntern(element.getAttribute(IBuildObject.ID)));
// Get the name
- setName(element.getAttribute(IBuildObject.NAME));
+ setName(SafeStringInterner.safeIntern(element.getAttribute(IBuildObject.NAME)));
// superClass
- superClassId = element.getAttribute(IProjectType.SUPERCLASS);
+ superClassId = SafeStringInterner.safeIntern(element.getAttribute(IProjectType.SUPERCLASS));
// sourceContentType
List<String> list = new ArrayList<String>();
@@ -322,7 +324,7 @@ public class InputType extends BuildObject implements IInputType {
if(ids != null){
StringTokenizer tokenizer = new StringTokenizer(ids, DEFAULT_SEPARATOR);
while (tokenizer.hasMoreElements()) {
- list.add(tokenizer.nextToken());
+ list.add(SafeStringInterner.safeIntern(tokenizer.nextToken()));
}
if(list.size() != 0){
sourceContentTypeIds = list.toArray(new String[list.size()]);
@@ -335,7 +337,7 @@ public class InputType extends BuildObject implements IInputType {
if (inputs != null) {
StringTokenizer tokenizer = new StringTokenizer(inputs, DEFAULT_SEPARATOR);
while (tokenizer.hasMoreElements()) {
- list.add(tokenizer.nextToken());
+ list.add(SafeStringInterner.safeIntern(tokenizer.nextToken()));
}
if(list.size() != 0){
@@ -349,7 +351,7 @@ public class InputType extends BuildObject implements IInputType {
if(ids != null){
StringTokenizer tokenizer = new StringTokenizer(ids, DEFAULT_SEPARATOR);
while (tokenizer.hasMoreElements()) {
- list.add(tokenizer.nextToken());
+ list.add(SafeStringInterner.safeIntern(tokenizer.nextToken()));
}
if(list.size() != 0){
headerContentTypeIds = list.toArray(new String[list.size()]);
@@ -362,7 +364,7 @@ public class InputType extends BuildObject implements IInputType {
if (hs != null) {
StringTokenizer tokenizer = new StringTokenizer(hs, DEFAULT_SEPARATOR);
while (tokenizer.hasMoreElements()) {
- list.add(tokenizer.nextToken());
+ list.add(SafeStringInterner.safeIntern(tokenizer.nextToken()));
}
if(list.size() != 0){
@@ -379,15 +381,15 @@ public class InputType extends BuildObject implements IInputType {
if (headers != null) {
StringTokenizer tokenizer = new StringTokenizer(headers, DEFAULT_SEPARATOR);
while (tokenizer.hasMoreElements()) {
- getDependencyExtensionsList().add(tokenizer.nextToken());
+ getDependencyExtensionsList().add(SafeStringInterner.safeIntern(tokenizer.nextToken()));
}
}
// option
- optionId = element.getAttribute(IInputType.OPTION);
+ optionId = SafeStringInterner.safeIntern(element.getAttribute(IInputType.OPTION));
// assignToOption
- assignToOptionId = element.getAttribute(IInputType.ASSIGN_TO_OPTION);
+ assignToOptionId = SafeStringInterner.safeIntern(element.getAttribute(IInputType.ASSIGN_TO_OPTION));
// multipleOfType
String isMOT = element.getAttribute(IInputType.MULTIPLE_OF_TYPE);
@@ -402,17 +404,17 @@ public class InputType extends BuildObject implements IInputType {
}
// buildVariable
- buildVariable = element.getAttribute(IInputType.BUILD_VARIABLE);
+ buildVariable = SafeStringInterner.safeIntern(element.getAttribute(IInputType.BUILD_VARIABLE));
- languageId = element.getAttribute(LANGUAGE_ID);
- languageName = element.getAttribute(LANGUAGE_NAME);
+ languageId = SafeStringInterner.safeIntern(element.getAttribute(LANGUAGE_ID));
+ languageName = SafeStringInterner.safeIntern(element.getAttribute(LANGUAGE_NAME));
if (element.getAttribute(LANGUAGE_INFO_CALCULATOR) != null && element instanceof DefaultManagedConfigElement) {
languageInfoCalculatorElement = ((DefaultManagedConfigElement)element).getConfigurationElement();
}
// else {
// languageInfoCalculator = new DefaultLanguageInfoCalculator();
// }
- buildInfoDicsoveryProfileId = element.getAttribute(SCANNER_CONFIG_PROFILE_ID);
+ buildInfoDicsoveryProfileId = SafeStringInterner.safeIntern(element.getAttribute(SCANNER_CONFIG_PROFILE_ID));
// Store the configuration element IFF there is a dependency generator defined
String depGenerator = element.getAttribute(ITool.DEP_CALC_ID);
@@ -430,15 +432,16 @@ public class InputType extends BuildObject implements IInputType {
protected boolean loadFromProject(ICStorageElement element) {
// id
+ // note: IDs are unique so no benefit to intern them
setId(element.getAttribute(IBuildObject.ID));
// name
if (element.getAttribute(IBuildObject.NAME) != null) {
- setName(element.getAttribute(IBuildObject.NAME));
+ setName(SafeStringInterner.safeIntern(element.getAttribute(IBuildObject.NAME)));
}
// superClass
- superClassId = element.getAttribute(IProjectType.SUPERCLASS);
+ superClassId = SafeStringInterner.safeIntern(element.getAttribute(IProjectType.SUPERCLASS));
if (superClassId != null && superClassId.length() > 0) {
superClass = ManagedBuildManager.getExtensionInputType(superClassId);
if (superClass == null) {
@@ -454,7 +457,7 @@ public class InputType extends BuildObject implements IInputType {
if (ids != null) {
StringTokenizer tokenizer = new StringTokenizer(ids, DEFAULT_SEPARATOR);
while (tokenizer.hasMoreElements()) {
- list.add(tokenizer.nextToken());
+ list.add(SafeStringInterner.safeIntern(tokenizer.nextToken()));
}
if(list.size() != 0){
@@ -483,7 +486,7 @@ public class InputType extends BuildObject implements IInputType {
if (inputs != null) {
StringTokenizer tokenizer = new StringTokenizer(inputs, DEFAULT_SEPARATOR);
while (tokenizer.hasMoreElements()) {
- list.add(tokenizer.nextToken());
+ list.add(SafeStringInterner.safeIntern(tokenizer.nextToken()));
}
if(list.size() != 0){
@@ -499,7 +502,7 @@ public class InputType extends BuildObject implements IInputType {
if (ids != null) {
StringTokenizer tokenizer = new StringTokenizer(ids, DEFAULT_SEPARATOR);
while (tokenizer.hasMoreElements()) {
- list.add(tokenizer.nextToken());
+ list.add(SafeStringInterner.safeIntern(tokenizer.nextToken()));
}
if(list.size() != 0){
@@ -528,7 +531,7 @@ public class InputType extends BuildObject implements IInputType {
if (inputs != null) {
StringTokenizer tokenizer = new StringTokenizer(inputs, DEFAULT_SEPARATOR);
while (tokenizer.hasMoreElements()) {
- list.add(tokenizer.nextToken());
+ list.add(SafeStringInterner.safeIntern(tokenizer.nextToken()));
}
if(list.size() != 0){
@@ -553,19 +556,19 @@ public class InputType extends BuildObject implements IInputType {
if (headers != null) {
StringTokenizer tokenizer = new StringTokenizer(headers, DEFAULT_SEPARATOR);
while (tokenizer.hasMoreElements()) {
- getDependencyExtensionsList().add(tokenizer.nextToken());
+ getDependencyExtensionsList().add(SafeStringInterner.safeIntern(tokenizer.nextToken()));
}
}
}
// option
if (element.getAttribute(IInputType.OPTION) != null) {
- optionId = element.getAttribute(IInputType.OPTION);
+ optionId = SafeStringInterner.safeIntern(element.getAttribute(IInputType.OPTION));
}
// assignToOption
if (element.getAttribute(IInputType.ASSIGN_TO_OPTION) != null) {
- assignToOptionId = element.getAttribute(IInputType.ASSIGN_TO_OPTION);
+ assignToOptionId = SafeStringInterner.safeIntern(element.getAttribute(IInputType.ASSIGN_TO_OPTION));
}
// multipleOfType
@@ -586,12 +589,12 @@ public class InputType extends BuildObject implements IInputType {
// buildVariable
if (element.getAttribute(IInputType.BUILD_VARIABLE) != null) {
- buildVariable = element.getAttribute(IInputType.BUILD_VARIABLE);
+ buildVariable = SafeStringInterner.safeIntern(element.getAttribute(IInputType.BUILD_VARIABLE));
}
- languageId = element.getAttribute(LANGUAGE_ID);
- languageName = element.getAttribute(LANGUAGE_NAME);
- buildInfoDicsoveryProfileId = element.getAttribute(SCANNER_CONFIG_PROFILE_ID);
+ languageId = SafeStringInterner.safeIntern(element.getAttribute(LANGUAGE_ID));
+ languageName = SafeStringInterner.safeIntern(element.getAttribute(LANGUAGE_NAME));
+ buildInfoDicsoveryProfileId = SafeStringInterner.safeIntern(element.getAttribute(SCANNER_CONFIG_PROFILE_ID));
// Note: dependency generator cannot be specified in a project file because
// an IConfigurationElement is needed to load it!
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedProject.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedProject.java
index 72111404f6..9f32ebb09b 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedProject.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedProject.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2009 Intel Corporation and others.
+ * Copyright (c) 2004, 2011 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* Intel Corporation - Initial API and implementation
+ * IBM Corporation
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.internal.core;
@@ -168,7 +169,7 @@ public class ManagedProject extends BuildObject implements IManagedProject, IBui
* @param element An XML element containing the project information
*/
protected boolean loadFromProject(ICStorageElement element) {
-
+ // note: id and name are unique, so don't intern them
// id
setId(element.getAttribute(IBuildObject.ID));
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/MapStorageElement.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/MapStorageElement.java
index 8bec35c467..ac593b6907 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/MapStorageElement.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/MapStorageElement.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 Intel Corporation and others.
+ * Copyright (c) 2007, 2011 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,6 +8,7 @@
* Contributors:
* Intel Corporation - Initial API and implementation
* James Blackburn (Broadcom Corp.)
+ * IBM Corporation
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.internal.core;
@@ -20,6 +21,7 @@ import java.util.Map.Entry;
import java.util.Set;
import org.eclipse.cdt.core.settings.model.ICStorageElement;
+import org.eclipse.cdt.internal.core.SafeStringInterner;
import org.eclipse.core.runtime.CoreException;
public class MapStorageElement implements ICStorageElement {
@@ -189,7 +191,7 @@ public class MapStorageElement implements ICStorageElement {
}
lndx++;
}
- map.put(line.substring(0, lndx), line.substring(lndx + 1));
+ map.put(SafeStringInterner.safeIntern(line.substring(0, lndx)), SafeStringInterner.safeIntern(line.substring(lndx + 1)));
}
return map;
@@ -233,7 +235,7 @@ public class MapStorageElement implements ICStorageElement {
lndx++;
}
*/
- list.add(line.toString());
+ list.add(SafeStringInterner.safeIntern(line.toString()));
envStr.delete(0, ndx + 1);
}
} catch (StringIndexOutOfBoundsException e) {
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Option.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Option.java
index cf81b2b055..72f42e2402 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Option.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Option.java
@@ -21,6 +21,7 @@ import java.util.Map;
import java.util.Set;
import org.eclipse.cdt.core.settings.model.ICStorageElement;
+import org.eclipse.cdt.internal.core.SafeStringInterner;
import org.eclipse.cdt.managedbuilder.core.BuildException;
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
import org.eclipse.cdt.managedbuilder.core.IBuildPropertiesRestriction;
@@ -47,7 +48,7 @@ import org.osgi.framework.Version;
public class Option extends BuildObject implements IOption, IBuildPropertiesRestriction {
// Static default return values
- public static final String EMPTY_STRING = new String();
+ public static final String EMPTY_STRING = new String().intern();
public static final String[] EMPTY_STRING_ARRAY = new String[0];
public static final OptionStringValue[] EMPTY_LV_ARRAY = new OptionStringValue[0];
@@ -330,16 +331,16 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
ManagedBuildManager.putConfigElement(this, element);
// id
- setId(element.getAttribute(IBuildObject.ID));
+ setId(SafeStringInterner.safeIntern(element.getAttribute(IBuildObject.ID)));
// Get the name
- setName(element.getAttribute(IBuildObject.NAME));
+ setName(SafeStringInterner.safeIntern(element.getAttribute(IBuildObject.NAME)));
// superClass
- superClassId = element.getAttribute(IProjectType.SUPERCLASS);
+ superClassId = SafeStringInterner.safeIntern(element.getAttribute(IProjectType.SUPERCLASS));
// Get the unused children, if any
- unusedChildren = element.getAttribute(IProjectType.UNUSED_CHILDREN);
+ unusedChildren = SafeStringInterner.safeIntern(element.getAttribute(IProjectType.UNUSED_CHILDREN));
// isAbstract
String isAbs = element.getAttribute(IProjectType.IS_ABSTRACT);
@@ -348,7 +349,7 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
}
// Get the command defined for the option
- command = element.getAttribute(COMMAND);
+ command = SafeStringInterner.safeIntern(element.getAttribute(COMMAND));
// Get the command-generator, if any
String commandGeneratorStr = element.getAttribute(COMMAND_GENERATOR);
@@ -357,13 +358,13 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
}
// Get the command defined for a Boolean option when the value is False
- commandFalse = element.getAttribute(COMMAND_FALSE);
+ commandFalse = SafeStringInterner.safeIntern(element.getAttribute(COMMAND_FALSE));
// Get the tooltip for the option
- tip = element.getAttribute(TOOL_TIP);
+ tip = SafeStringInterner.safeIntern(element.getAttribute(TOOL_TIP));
// Get the contextID for the option
- contextId = element.getAttribute(CONTEXT_ID);
+ contextId = SafeStringInterner.safeIntern(element.getAttribute(CONTEXT_ID));
// Options hold different types of values
String valueTypeStr = element.getAttribute(VALUE_TYPE);
@@ -392,15 +393,15 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
}
// Get the browseFilterPath attribute
- this.browseFilterPath = element.getAttribute(BROWSE_FILTER_PATH);
+ this.browseFilterPath = SafeStringInterner.safeIntern(element.getAttribute(BROWSE_FILTER_PATH));
// Get the browseFilterExtensions attribute
String browseFilterExtensionsStr = element.getAttribute(BROWSE_FILTER_EXTENSIONS);
if (browseFilterExtensionsStr != null) {
- this.browseFilterExtensions = browseFilterExtensionsStr.split("\\s*,\\s*"); //$NON-NLS-1$
+ this.browseFilterExtensions = SafeStringInterner.safeIntern(browseFilterExtensionsStr.split("\\s*,\\s*")); //$NON-NLS-1$
}
- categoryId = element.getAttribute(CATEGORY);
+ categoryId = SafeStringInterner.safeIntern(element.getAttribute(CATEGORY));
// Get the resourceFilter attribute
String resFilterStr = element.getAttribute(RESOURCE_FILTER);
@@ -438,7 +439,7 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
valueHandlerElement = ((DefaultManagedConfigElement)element).getConfigurationElement();
}
// valueHandlerExtraArgument
- valueHandlerExtraArgument = element.getAttribute(VALUE_HANDLER_EXTRA_ARGUMENT);
+ valueHandlerExtraArgument = SafeStringInterner.safeIntern(element.getAttribute(VALUE_HANDLER_EXTRA_ARGUMENT));
// fieldEditor and optional argument
fieldEditorId = element.getAttribute(FIELD_EDITOR_ID);
@@ -453,16 +454,16 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
*/
protected void loadFromProject(ICStorageElement element) {
- // id
+ // id (unique, don't intern)
setId(element.getAttribute(IBuildObject.ID));
// name
if (element.getAttribute(IBuildObject.NAME) != null) {
- setName(element.getAttribute(IBuildObject.NAME));
+ setName(SafeStringInterner.safeIntern(element.getAttribute(IBuildObject.NAME)));
}
// superClass
- superClassId = element.getAttribute(IProjectType.SUPERCLASS);
+ superClassId = SafeStringInterner.safeIntern(element.getAttribute(IProjectType.SUPERCLASS));
if (superClassId != null && superClassId.length() > 0) {
superClass = ManagedBuildManager.getExtensionOption(superClassId);
if (superClass == null) {
@@ -472,7 +473,7 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
// Get the unused children, if any
if (element.getAttribute(IProjectType.UNUSED_CHILDREN) != null) {
- unusedChildren = element.getAttribute(IProjectType.UNUSED_CHILDREN);
+ unusedChildren = SafeStringInterner.safeIntern(element.getAttribute(IProjectType.UNUSED_CHILDREN));
}
// isAbstract
@@ -485,22 +486,22 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
// Get the command defined for the option
if (element.getAttribute(COMMAND) != null) {
- command = element.getAttribute(COMMAND);
+ command = SafeStringInterner.safeIntern(element.getAttribute(COMMAND));
}
// Get the command defined for a Boolean option when the value is False
if (element.getAttribute(COMMAND_FALSE) != null) {
- commandFalse = element.getAttribute(COMMAND_FALSE);
+ commandFalse = SafeStringInterner.safeIntern(element.getAttribute(COMMAND_FALSE));
}
// Get the tooltip for the option
if (element.getAttribute(TOOL_TIP) != null) {
- tip = element.getAttribute(TOOL_TIP);
+ tip = SafeStringInterner.safeIntern(element.getAttribute(TOOL_TIP));
}
// Get the contextID for the option
if (element.getAttribute(CONTEXT_ID) != null) {
- contextId = element.getAttribute(CONTEXT_ID);
+ contextId = SafeStringInterner.safeIntern(element.getAttribute(CONTEXT_ID));
}
// Options hold different types of values
@@ -525,18 +526,18 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
case STRING:
// Just get the value out of the option directly
if (element.getAttribute(VALUE) != null) {
- value = element.getAttribute(VALUE);
+ value = SafeStringInterner.safeIntern(element.getAttribute(VALUE));
}
if (element.getAttribute(DEFAULT_VALUE) != null) {
- defaultValue = element.getAttribute(DEFAULT_VALUE);
+ defaultValue = SafeStringInterner.safeIntern(element.getAttribute(DEFAULT_VALUE));
}
break;
case ENUMERATED:
if (element.getAttribute(VALUE) != null) {
- value = element.getAttribute(VALUE);
+ value = SafeStringInterner.safeIntern(element.getAttribute(VALUE));
}
if (element.getAttribute(DEFAULT_VALUE) != null) {
- defaultValue = element.getAttribute(DEFAULT_VALUE);
+ defaultValue = SafeStringInterner.safeIntern(element.getAttribute(DEFAULT_VALUE));
}
// Do we have enumeratedOptionValue children? If so, load them
@@ -546,7 +547,7 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
ICStorageElement configNode = configElements[i];
if (configNode.getName().equals(ENUM_VALUE)) {
ICStorageElement configElement = configNode;
- String optId = configElement.getAttribute(ID);
+ String optId = SafeStringInterner.safeIntern(configElement.getAttribute(ID));
if (i == 0) {
enumList = new ArrayList<String>();
if (defaultValue == null) {
@@ -555,11 +556,11 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
}
enumList.add(optId);
if (configElement.getAttribute(COMMAND) != null) {
- getEnumCommandMap().put(optId, configElement.getAttribute(COMMAND));
+ getEnumCommandMap().put(optId, SafeStringInterner.safeIntern(configElement.getAttribute(COMMAND)));
} else {
getEnumCommandMap().put(optId, EMPTY_STRING);
}
- getEnumNameMap().put(optId, configElement.getAttribute(NAME));
+ getEnumNameMap().put(optId, SafeStringInterner.safeIntern(configElement.getAttribute(NAME)));
if (configElement.getAttribute(IS_DEFAULT) != null) {
Boolean isDefault = new Boolean(configElement.getAttribute(IS_DEFAULT));
if (isDefault.booleanValue()) {
@@ -607,8 +608,12 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
}
if(vList != null && vList.size() != 0)
value = vList;
+ else
+ value = null;
if(biList != null && biList.size() != 0)
builtIns = biList;
+ else
+ builtIns = null;
break;
default :
@@ -639,19 +644,19 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
// Get the browseFilterPath attribute
if (element.getAttribute(BROWSE_FILTER_PATH) != null) {
- this.browseFilterPath = element.getAttribute(BROWSE_FILTER_PATH);
+ this.browseFilterPath = SafeStringInterner.safeIntern(element.getAttribute(BROWSE_FILTER_PATH));
}
// Get the browseFilterExtensions attribute
if (element.getAttribute(BROWSE_FILTER_EXTENSIONS) != null) {
String browseFilterExtensionsStr = element.getAttribute(BROWSE_FILTER_EXTENSIONS);
if (browseFilterExtensionsStr != null) {
- this.browseFilterExtensions = browseFilterExtensionsStr.split("\\s*,\\s*"); //$NON-NLS-1$
+ this.browseFilterExtensions = SafeStringInterner.safeIntern(browseFilterExtensionsStr.split("\\s*,\\s*")); //$NON-NLS-1$
}
}
if (element.getAttribute(CATEGORY) != null) {
- categoryId = element.getAttribute(CATEGORY);
+ categoryId = SafeStringInterner.safeIntern(element.getAttribute(CATEGORY));
if (categoryId != null) {
category = holder.getOptionCategory(categoryId);
}
@@ -680,7 +685,7 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
// valueHandlerExtraArgument
if (element.getAttribute(VALUE_HANDLER_EXTRA_ARGUMENT) != null) {
- valueHandlerExtraArgument = element.getAttribute(VALUE_HANDLER_EXTRA_ARGUMENT);
+ valueHandlerExtraArgument = SafeStringInterner.safeIntern(element.getAttribute(VALUE_HANDLER_EXTRA_ARGUMENT));
}
}
@@ -2219,7 +2224,7 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
// to define the valid values and the default value.
IManagedConfigElement[] enumElements = element.getChildren(ENUM_VALUE);
for (int i = 0; i < enumElements.length; ++i) {
- String optId = enumElements[i].getAttribute(ID);
+ String optId = SafeStringInterner.safeIntern(enumElements[i].getAttribute(ID));
if (i == 0) {
enumList = new ArrayList<String>();
if (defaultValue == null) {
@@ -2227,8 +2232,8 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
}
}
enumList.add(optId);
- getEnumCommandMap().put(optId, enumElements[i].getAttribute(COMMAND));
- getEnumNameMap().put(optId, enumElements[i].getAttribute(NAME));
+ getEnumCommandMap().put(optId, SafeStringInterner.safeIntern(enumElements[i].getAttribute(COMMAND)));
+ getEnumNameMap().put(optId, SafeStringInterner.safeIntern(enumElements[i].getAttribute(NAME)));
Boolean isDefault = new Boolean(enumElements[i].getAttribute(IS_DEFAULT));
if (isDefault.booleanValue()) {
defaultValue = optId;
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/OptionCategory.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/OptionCategory.java
index 93592da099..6784d1e581 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/OptionCategory.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/OptionCategory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2008 IBM Corporation and others.
+ * Copyright (c) 2003, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -16,6 +16,7 @@ import java.util.ArrayList;
import java.util.List;
import org.eclipse.cdt.core.settings.model.ICStorageElement;
+import org.eclipse.cdt.internal.core.SafeStringInterner;
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IHoldsOptions;
@@ -109,13 +110,13 @@ public class OptionCategory extends BuildObject implements IOptionCategory {
ManagedBuildManager.putConfigElement(this, element);
// id
- setId(element.getAttribute(IOptionCategory.ID));
+ setId(SafeStringInterner.safeIntern(element.getAttribute(IOptionCategory.ID)));
// name
- setName(element.getAttribute(IOptionCategory.NAME));
+ setName(SafeStringInterner.safeIntern(element.getAttribute(IOptionCategory.NAME)));
// owner
- ownerId = element.getAttribute(IOptionCategory.OWNER);
+ ownerId = SafeStringInterner.safeIntern(element.getAttribute(IOptionCategory.OWNER));
// icon
if ( element.getAttribute(IOptionCategory.ICON) != null && element instanceof DefaultManagedConfigElement)
@@ -133,17 +134,17 @@ public class OptionCategory extends BuildObject implements IOptionCategory {
*/
protected void loadFromProject(ICStorageElement element) {
- // id
+ // id (unique, do not intern)
setId(element.getAttribute(IBuildObject.ID));
// name
if (element.getAttribute(IBuildObject.NAME) != null) {
- setName(element.getAttribute(IBuildObject.NAME));
+ setName(SafeStringInterner.safeIntern(element.getAttribute(IBuildObject.NAME)));
}
// owner
if (element.getAttribute(IOptionCategory.OWNER) != null) {
- ownerId = element.getAttribute(IOptionCategory.OWNER);
+ ownerId = SafeStringInterner.safeIntern(element.getAttribute(IOptionCategory.OWNER));
}
if (ownerId != null) {
owner = holder.getOptionCategory(ownerId);
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/OptionReference.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/OptionReference.java
index 5644597483..2abea630b3 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/OptionReference.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/OptionReference.java
@@ -16,6 +16,8 @@ package org.eclipse.cdt.managedbuilder.internal.core;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+
+import org.eclipse.cdt.internal.core.SafeStringInterner;
import org.eclipse.cdt.managedbuilder.core.BuildException;
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
import org.eclipse.cdt.managedbuilder.core.IHoldsOptions;
@@ -214,10 +216,10 @@ public class OptionReference implements IOption {
IManagedConfigElement valueElement = valueElements[i];
Boolean isBuiltIn = new Boolean(valueElement.getAttribute(LIST_ITEM_BUILTIN));
if (isBuiltIn.booleanValue()) {
- getBuiltInList().add(valueElement.getAttribute(LIST_ITEM_VALUE));
+ getBuiltInList().add(SafeStringInterner.safeIntern(valueElement.getAttribute(LIST_ITEM_VALUE)));
}
else {
- valueList.add(valueElement.getAttribute(LIST_ITEM_VALUE));
+ valueList.add(SafeStringInterner.safeIntern(valueElement.getAttribute(LIST_ITEM_VALUE)));
}
}
value = valueList;
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/OutputType.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/OutputType.java
index 5835b2e120..bf1f751360 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/OutputType.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/OutputType.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2008 Intel Corporation and others.
+ * Copyright (c) 2005, 2011 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,10 +7,12 @@
*
* Contributors:
* Intel Corporation - Initial API and implementation
+ * IBM Corporation
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.internal.core;
import org.eclipse.cdt.core.settings.model.ICStorageElement;
+import org.eclipse.cdt.internal.core.SafeStringInterner;
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
import org.eclipse.cdt.managedbuilder.core.IInputType;
import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement;
@@ -215,22 +217,22 @@ public class OutputType extends BuildObject implements IOutputType {
ManagedBuildManager.putConfigElement(this, element);
// id
- setId(element.getAttribute(IBuildObject.ID));
+ setId(SafeStringInterner.safeIntern(element.getAttribute(IBuildObject.ID)));
// Get the name
- setName(element.getAttribute(IBuildObject.NAME));
+ setName(SafeStringInterner.safeIntern(element.getAttribute(IBuildObject.NAME)));
// superClass
- superClassId = element.getAttribute(IProjectType.SUPERCLASS);
+ superClassId = SafeStringInterner.safeIntern(element.getAttribute(IProjectType.SUPERCLASS));
// outputContentType
- outputContentTypeId = element.getAttribute(IOutputType.OUTPUT_CONTENT_TYPE);
+ outputContentTypeId = SafeStringInterner.safeIntern(element.getAttribute(IOutputType.OUTPUT_CONTENT_TYPE));
// outputs
- outputs = element.getAttribute(IOutputType.OUTPUTS);
+ outputs = SafeStringInterner.safeIntern(element.getAttribute(IOutputType.OUTPUTS));
// option
- optionId = element.getAttribute(IOutputType.OPTION);
+ optionId = SafeStringInterner.safeIntern(element.getAttribute(IOutputType.OPTION));
// multipleOfType
String isMOT = element.getAttribute(IOutputType.MULTIPLE_OF_TYPE);
@@ -239,7 +241,7 @@ public class OutputType extends BuildObject implements IOutputType {
}
// primaryInputType
- primaryInputTypeId = element.getAttribute(IOutputType.PRIMARY_INPUT_TYPE);
+ primaryInputTypeId = SafeStringInterner.safeIntern(element.getAttribute(IOutputType.PRIMARY_INPUT_TYPE));
// primaryOutput
String isPO = element.getAttribute(IOutputType.PRIMARY_OUTPUT);
@@ -248,16 +250,16 @@ public class OutputType extends BuildObject implements IOutputType {
}
// outputPrefix
- outputPrefix = element.getAttribute(IOutputType.OUTPUT_PREFIX);
+ outputPrefix = SafeStringInterner.safeIntern(element.getAttribute(IOutputType.OUTPUT_PREFIX));
// outputNames
- outputNames = element.getAttribute(IOutputType.OUTPUT_NAMES);
+ outputNames = SafeStringInterner.safeIntern(element.getAttribute(IOutputType.OUTPUT_NAMES));
// namePattern
- namePattern = element.getAttribute(IOutputType.NAME_PATTERN);
+ namePattern = SafeStringInterner.safeIntern(element.getAttribute(IOutputType.NAME_PATTERN));
// buildVariable
- buildVariable = element.getAttribute(IOutputType.BUILD_VARIABLE);
+ buildVariable = SafeStringInterner.safeIntern(element.getAttribute(IOutputType.BUILD_VARIABLE));
// Store the configuration element IFF there is a name provider defined
String nameProvider = element.getAttribute(IOutputType.NAME_PROVIDER);
@@ -274,16 +276,16 @@ public class OutputType extends BuildObject implements IOutputType {
*/
protected void loadFromProject(ICStorageElement element) {
- // id
+ // id (unique, do not intern)
setId(element.getAttribute(IBuildObject.ID));
// name
if (element.getAttribute(IBuildObject.NAME) != null) {
- setName(element.getAttribute(IBuildObject.NAME));
+ setName(SafeStringInterner.safeIntern(element.getAttribute(IBuildObject.NAME)));
}
// superClass
- superClassId = element.getAttribute(IProjectType.SUPERCLASS);
+ superClassId = SafeStringInterner.safeIntern(element.getAttribute(IProjectType.SUPERCLASS));
if (superClassId != null && superClassId.length() > 0) {
superClass = ManagedBuildManager.getExtensionOutputType(superClassId);
if (superClass == null) {
@@ -293,17 +295,17 @@ public class OutputType extends BuildObject implements IOutputType {
// outputContentType
if (element.getAttribute(IOutputType.OUTPUT_CONTENT_TYPE) != null) {
- outputContentTypeId = element.getAttribute(IOutputType.OUTPUT_CONTENT_TYPE);
+ outputContentTypeId = SafeStringInterner.safeIntern(element.getAttribute(IOutputType.OUTPUT_CONTENT_TYPE));
}
// outputs
if (element.getAttribute(IOutputType.OUTPUTS) != null) {
- outputs = element.getAttribute(IOutputType.OUTPUTS);
+ outputs = SafeStringInterner.safeIntern(element.getAttribute(IOutputType.OUTPUTS));
}
// option
if (element.getAttribute(IOutputType.OPTION) != null) {
- optionId = element.getAttribute(IOutputType.OPTION);
+ optionId = SafeStringInterner.safeIntern(element.getAttribute(IOutputType.OPTION));
}
// multipleOfType
@@ -316,7 +318,7 @@ public class OutputType extends BuildObject implements IOutputType {
// primaryInputType
if (element.getAttribute(IOutputType.PRIMARY_INPUT_TYPE) != null) {
- primaryInputTypeId = element.getAttribute(IOutputType.PRIMARY_INPUT_TYPE);
+ primaryInputTypeId = SafeStringInterner.safeIntern(element.getAttribute(IOutputType.PRIMARY_INPUT_TYPE));
primaryInputType = parent.getInputTypeById(primaryInputTypeId);
}
@@ -330,22 +332,22 @@ public class OutputType extends BuildObject implements IOutputType {
// outputPrefix
if (element.getAttribute(IOutputType.OUTPUT_PREFIX) != null) {
- outputPrefix = element.getAttribute(IOutputType.OUTPUT_PREFIX);
+ outputPrefix = SafeStringInterner.safeIntern(element.getAttribute(IOutputType.OUTPUT_PREFIX));
}
// outputNames
if (element.getAttribute(IOutputType.OUTPUT_NAMES) != null) {
- outputNames = element.getAttribute(IOutputType.OUTPUT_NAMES);
+ outputNames = SafeStringInterner.safeIntern(element.getAttribute(IOutputType.OUTPUT_NAMES));
}
// namePattern
if (element.getAttribute(IOutputType.NAME_PATTERN) != null) {
- namePattern = element.getAttribute(IOutputType.NAME_PATTERN);
+ namePattern = SafeStringInterner.safeIntern(element.getAttribute(IOutputType.NAME_PATTERN));
}
// buildVariable
if (element.getAttribute(IOutputType.BUILD_VARIABLE) != null) {
- buildVariable = element.getAttribute(IOutputType.BUILD_VARIABLE);
+ buildVariable = SafeStringInterner.safeIntern(element.getAttribute(IOutputType.BUILD_VARIABLE));
}
// Note: Name Provider cannot be specified in a project file because
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ProjectType.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ProjectType.java
index 12baf68130..2aa7cfa3fe 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ProjectType.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ProjectType.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2008 Intel Corporation and others.
+ * Copyright (c) 2004, 2011 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* Intel Corporation - Initial API and implementation
+ * IBM Corporation
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.internal.core;
@@ -17,6 +18,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import org.eclipse.cdt.internal.core.SafeStringInterner;
import org.eclipse.cdt.managedbuilder.buildproperties.IBuildProperty;
import org.eclipse.cdt.managedbuilder.buildproperties.IBuildPropertyType;
import org.eclipse.cdt.managedbuilder.buildproperties.IBuildPropertyValue;
@@ -151,22 +153,22 @@ public class ProjectType extends BuildObject implements IProjectType, IBuildProp
ManagedBuildManager.putConfigElement(this, element);
// id
- setId(element.getAttribute(ID));
+ setId(SafeStringInterner.safeIntern(element.getAttribute(ID)));
// Get the name
- setName(element.getAttribute(NAME));
+ setName(SafeStringInterner.safeIntern(element.getAttribute(NAME)));
// version
setVersion(getVersionFromId());
// superClass
- superClassId = element.getAttribute(SUPERCLASS);
+ superClassId = SafeStringInterner.safeIntern(element.getAttribute(SUPERCLASS));
- String props = element.getAttribute(BUILD_PROPERTIES);
+ String props = SafeStringInterner.safeIntern(element.getAttribute(BUILD_PROPERTIES));
if(props != null)
buildProperties = new BuildObjectProperties(props, this, this);
- String artType = element.getAttribute(BUILD_ARTEFACT_TYPE);
+ String artType = SafeStringInterner.safeIntern(element.getAttribute(BUILD_ARTEFACT_TYPE));
if(artType != null){
if(buildProperties == null)
buildProperties = new BuildObjectProperties(this, this);
@@ -180,7 +182,7 @@ public class ProjectType extends BuildObject implements IProjectType, IBuildProp
// Get the unused children, if any
- unusedChildren = element.getAttribute(UNUSED_CHILDREN);
+ unusedChildren = SafeStringInterner.safeIntern(element.getAttribute(UNUSED_CHILDREN));
// isAbstract
String isAbs = element.getAttribute(IS_ABSTRACT);
@@ -212,7 +214,7 @@ public class ProjectType extends BuildObject implements IProjectType, IBuildProp
}
// Get the 'convertToId' attribute if it is available
- convertToId = element.getAttribute(CONVERT_TO_ID);
+ convertToId = SafeStringInterner.safeIntern(element.getAttribute(CONVERT_TO_ID));
}
/*
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ResourceConfiguration.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ResourceConfiguration.java
index a3f2958b4c..62fc3a8410 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ResourceConfiguration.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ResourceConfiguration.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 Intel Corporation and others.
+ * Copyright (c) 2005, 2011 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* Intel Corporation - Initial API and implementation
+ * IBM Corporation
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.internal.core;
@@ -21,6 +22,7 @@ import org.eclipse.cdt.core.settings.model.ICSettingBase;
import org.eclipse.cdt.core.settings.model.ICStorageElement;
import org.eclipse.cdt.core.settings.model.extension.CFileData;
import org.eclipse.cdt.core.settings.model.extension.CLanguageData;
+import org.eclipse.cdt.internal.core.SafeStringInterner;
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IFileInfo;
@@ -347,7 +349,7 @@ public class ResourceConfiguration extends ResourceInfo implements IFileInfo {
ManagedBuildManager.putConfigElement(this, element);
// toolsToInvoke
- toolsToInvoke = element.getAttribute(IResourceConfiguration.TOOLS_TO_INVOKE);
+ toolsToInvoke = SafeStringInterner.safeIntern(element.getAttribute(IResourceConfiguration.TOOLS_TO_INVOKE));
// rcbsApplicability
String rcbsApplicabilityStr = element.getAttribute(IResourceConfiguration.RCBS_APPLICABILITY);
@@ -371,7 +373,7 @@ public class ResourceConfiguration extends ResourceInfo implements IFileInfo {
protected void loadFromProject(ICStorageElement element) {
// toolsToInvoke
if (element.getAttribute(IResourceConfiguration.TOOLS_TO_INVOKE) != null) {
- toolsToInvoke = element.getAttribute(IResourceConfiguration.TOOLS_TO_INVOKE);
+ toolsToInvoke = SafeStringInterner.safeIntern(element.getAttribute(IResourceConfiguration.TOOLS_TO_INVOKE));
}
// rcbsApplicability
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ResourceInfo.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ResourceInfo.java
index ef7337e44f..298c53c63a 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ResourceInfo.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ResourceInfo.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Intel Corporation and others.
+ * Copyright (c) 2007, 2011 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* Intel Corporation - Initial API and implementation
+ * IBM Corporation
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.internal.core;
@@ -17,6 +18,7 @@ import java.util.Set;
import org.eclipse.cdt.core.settings.model.ICSettingBase;
import org.eclipse.cdt.core.settings.model.ICStorageElement;
import org.eclipse.cdt.core.settings.model.extension.CResourceData;
+import org.eclipse.cdt.internal.core.SafeStringInterner;
import org.eclipse.cdt.managedbuilder.core.BuildException;
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
@@ -112,10 +114,10 @@ public abstract class ResourceInfo extends BuildObject implements IResourceInfo
private void loadFromManifest(IManagedConfigElement element) {
// id
- setId(element.getAttribute(ID));
+ setId(SafeStringInterner.safeIntern(element.getAttribute(ID)));
// Get the name
- setName(element.getAttribute(NAME));
+ setName(SafeStringInterner.safeIntern(element.getAttribute(NAME)));
// resourcePath
String tmp = element.getAttribute(RESOURCE_PATH);
@@ -139,12 +141,12 @@ public abstract class ResourceInfo extends BuildObject implements IResourceInfo
private void loadFromProject(ICStorageElement element) {
- // id
+ // id (unique, do not intern)
setId(element.getAttribute(ID));
// name
if (element.getAttribute(NAME) != null) {
- setName(element.getAttribute(NAME));
+ setName(SafeStringInterner.safeIntern(element.getAttribute(NAME)));
}
// resourcePath
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/SupportedProperties.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/SupportedProperties.java
index ed24a6f097..8a1a19f40d 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/SupportedProperties.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/SupportedProperties.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Intel Corporation and others.
+ * Copyright (c) 2007, 2011 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* Intel Corporation - Initial API and implementation
+ * IBM Corporation
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.internal.core;
@@ -17,6 +18,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
+import org.eclipse.cdt.internal.core.SafeStringInterner;
import org.eclipse.cdt.managedbuilder.core.IBuildPropertiesRestriction;
import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement;
@@ -103,7 +105,7 @@ public class SupportedProperties implements IBuildPropertiesRestriction {
for(int i = 0; i < children.length; i++){
IManagedConfigElement child = children[i];
if(PROPERTY.equals(child.getName())){
- String id = child.getAttribute(ID);
+ String id = SafeStringInterner.safeIntern(child.getAttribute(ID));
if(id == null)
continue;
@@ -119,7 +121,7 @@ public class SupportedProperties implements IBuildPropertiesRestriction {
for(int k = 0; k < values.length; k++){
IManagedConfigElement value = values[k];
if(PROPERTY_VALUE.equals(value.getName())){
- String valueId = value.getAttribute(ID);
+ String valueId = SafeStringInterner.safeIntern(value.getAttribute(ID));
if(valueId == null || valueId.length() == 0)
continue;
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Target.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Target.java
index 74223d73df..c7d2d4ad53 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Target.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Target.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
+ * Copyright (c) 2003, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -18,6 +18,7 @@ import java.util.StringTokenizer;
import java.util.Vector;
import org.eclipse.cdt.core.ErrorParserManager;
+import org.eclipse.cdt.internal.core.SafeStringInterner;
import org.eclipse.cdt.managedbuilder.core.IBuilder;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IConfigurationV2;
@@ -77,29 +78,29 @@ public class Target extends BuildObject implements ITarget {
resolved = false;
// id
- setId(element.getAttribute(ID));
+ setId(SafeStringInterner.safeIntern(element.getAttribute(ID)));
// managedBuildRevision
- setManagedBuildRevision(managedBuildRevision);
+ setManagedBuildRevision(SafeStringInterner.safeIntern(managedBuildRevision));
// hook me up
ManagedBuildManager.addExtensionTarget(this);
// Get the target name
- setName(element.getAttribute(NAME));
+ setName(SafeStringInterner.safeIntern(element.getAttribute(NAME)));
// Get the name of the build artifact associated with target (usually
// in the plugin specification).
- artifactName = element.getAttribute(ARTIFACT_NAME);
+ artifactName = SafeStringInterner.safeIntern(element.getAttribute(ARTIFACT_NAME));
// Get the ID of the binary parser
- binaryParserId = element.getAttribute(BINARY_PARSER);
+ binaryParserId = SafeStringInterner.safeIntern(element.getAttribute(BINARY_PARSER));
// Get the semicolon separated list of IDs of the error parsers
- errorParserIds = element.getAttribute(ERROR_PARSERS);
+ errorParserIds = SafeStringInterner.safeIntern(element.getAttribute(ERROR_PARSERS));
// Get the default extension
- defaultExtension = element.getAttribute(DEFAULT_EXTENSION);
+ defaultExtension = SafeStringInterner.safeIntern(element.getAttribute(DEFAULT_EXTENSION));
// isAbstract
isAbstract = ("true".equals(element.getAttribute(IS_ABSTRACT))); //$NON-NLS-1$
@@ -108,16 +109,16 @@ public class Target extends BuildObject implements ITarget {
isTest = ("true".equals(element.getAttribute(IS_TEST))); //$NON-NLS-1$
// Get the clean command
- cleanCommand = element.getAttribute(CLEAN_COMMAND);
+ cleanCommand = SafeStringInterner.safeIntern(element.getAttribute(CLEAN_COMMAND));
// Get the make command
- makeCommand = element.getAttribute(MAKE_COMMAND);
+ makeCommand = SafeStringInterner.safeIntern(element.getAttribute(MAKE_COMMAND));
// Get the make arguments
- makeArguments = element.getAttribute(MAKE_ARGS);
+ makeArguments = SafeStringInterner.safeIntern(element.getAttribute(MAKE_ARGS));
// Get scannerInfoCollectorId
- scannerInfoCollectorId = element.getAttribute(SCANNER_INFO_COLLECTOR_ID);
+ scannerInfoCollectorId = SafeStringInterner.safeIntern(element.getAttribute(SCANNER_INFO_COLLECTOR_ID));
// Get the comma-separated list of valid OS
String os = element.getAttribute(OS_LIST);
@@ -125,7 +126,7 @@ public class Target extends BuildObject implements ITarget {
targetOSList = new ArrayList<String>();
String[] osTokens = os.split(","); //$NON-NLS-1$
for (int i = 0; i < osTokens.length; ++i) {
- targetOSList.add(osTokens[i].trim());
+ targetOSList.add(SafeStringInterner.safeIntern(osTokens[i].trim()));
}
}
@@ -135,7 +136,7 @@ public class Target extends BuildObject implements ITarget {
targetArchList = new ArrayList<String>();
String[] archTokens = arch.split(","); //$NON-NLS-1$
for (int j = 0; j < archTokens.length; ++j) {
- targetArchList.add(archTokens[j].trim());
+ targetArchList.add(SafeStringInterner.safeIntern(archTokens[j].trim()));
}
}
@@ -772,7 +773,7 @@ public class Target extends BuildObject implements ITarget {
resolved = true;
IManagedConfigElement element = ManagedBuildManager.getConfigElement(this);
// parent
- String parentId = element.getAttribute(PARENT);
+ String parentId = SafeStringInterner.safeIntern(element.getAttribute(PARENT));
if (parentId != null) {
parent = ManagedBuildManager.getTarget(null, parentId);
// should resolve before calling methods on it
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/TargetPlatform.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/TargetPlatform.java
index b2b8c904d1..b014abe8dd 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/TargetPlatform.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/TargetPlatform.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2008 Intel Corporation and others.
+ * Copyright (c) 2004, 2011 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* Intel Corporation - Initial API and implementation
+ * IBM Corporation
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.internal.core;
@@ -17,6 +18,7 @@ import java.util.List;
import org.eclipse.cdt.core.settings.model.ICStorageElement;
import org.eclipse.cdt.core.settings.model.extension.CTargetPlatformData;
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
+import org.eclipse.cdt.internal.core.SafeStringInterner;
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement;
import org.eclipse.cdt.managedbuilder.core.IProjectType;
@@ -183,16 +185,16 @@ public class TargetPlatform extends BuildObject implements ITargetPlatform {
ManagedBuildManager.putConfigElement(this, element);
// id
- setId(element.getAttribute(IBuildObject.ID));
+ setId(SafeStringInterner.safeIntern(element.getAttribute(IBuildObject.ID)));
// Get the name
- setName(element.getAttribute(IBuildObject.NAME));
+ setName(SafeStringInterner.safeIntern(element.getAttribute(IBuildObject.NAME)));
// superClass
- superClassId = element.getAttribute(IProjectType.SUPERCLASS);
+ superClassId = SafeStringInterner.safeIntern(element.getAttribute(IProjectType.SUPERCLASS));
// Get the unused children, if any
- unusedChildren = element.getAttribute(IProjectType.UNUSED_CHILDREN);
+ unusedChildren = SafeStringInterner.safeIntern(element.getAttribute(IProjectType.UNUSED_CHILDREN));
// isAbstract
String isAbs = element.getAttribute(IProjectType.IS_ABSTRACT);
@@ -216,7 +218,7 @@ public class TargetPlatform extends BuildObject implements ITargetPlatform {
archList = new ArrayList<String>();
String[] archTokens = arch.split(","); //$NON-NLS-1$
for (int j = 0; j < archTokens.length; ++j) {
- archList.add(archTokens[j].trim());
+ archList.add(SafeStringInterner.safeIntern(archTokens[j].trim()));
}
}
@@ -226,7 +228,7 @@ public class TargetPlatform extends BuildObject implements ITargetPlatform {
binaryParserList = new ArrayList<String>();
String[] bparsTokens = CDataUtil.stringToArray(bpars, ";"); //$NON-NLS-1$
for (int j = 0; j < bparsTokens.length; ++j) {
- binaryParserList.add(bparsTokens[j].trim());
+ binaryParserList.add(SafeStringInterner.safeIntern(bparsTokens[j].trim()));
}
}
}
@@ -239,16 +241,16 @@ public class TargetPlatform extends BuildObject implements ITargetPlatform {
*/
protected void loadFromProject(ICStorageElement element) {
- // id
+ // id (unique, do not intern)
setId(element.getAttribute(IBuildObject.ID));
// name
if (element.getAttribute(IBuildObject.NAME) != null) {
- setName(element.getAttribute(IBuildObject.NAME));
+ setName(SafeStringInterner.safeIntern(element.getAttribute(IBuildObject.NAME)));
}
// superClass
- superClassId = element.getAttribute(IProjectType.SUPERCLASS);
+ superClassId = SafeStringInterner.safeIntern(element.getAttribute(IProjectType.SUPERCLASS));
if (superClassId != null && superClassId.length() > 0) {
superClass = ManagedBuildManager.getExtensionTargetPlatform(superClassId);
if (superClass == null) {
@@ -258,7 +260,7 @@ public class TargetPlatform extends BuildObject implements ITargetPlatform {
// Get the unused children, if any
if (element.getAttribute(IProjectType.UNUSED_CHILDREN) != null) {
- unusedChildren = element.getAttribute(IProjectType.UNUSED_CHILDREN);
+ unusedChildren = SafeStringInterner.safeIntern(element.getAttribute(IProjectType.UNUSED_CHILDREN));
}
// isAbstract
@@ -276,7 +278,7 @@ public class TargetPlatform extends BuildObject implements ITargetPlatform {
osList = new ArrayList<String>();
String[] osTokens = os.split(","); //$NON-NLS-1$
for (int i = 0; i < osTokens.length; ++i) {
- osList.add(osTokens[i].trim());
+ osList.add(SafeStringInterner.safeIntern(osTokens[i].trim()));
}
}
}
@@ -288,7 +290,7 @@ public class TargetPlatform extends BuildObject implements ITargetPlatform {
archList = new ArrayList<String>();
String[] archTokens = arch.split(","); //$NON-NLS-1$
for (int j = 0; j < archTokens.length; ++j) {
- archList.add(archTokens[j].trim());
+ archList.add(SafeStringInterner.safeIntern(archTokens[j].trim()));
}
}
}
@@ -300,7 +302,7 @@ public class TargetPlatform extends BuildObject implements ITargetPlatform {
binaryParserList = new ArrayList<String>();
String[] bparsTokens = CDataUtil.stringToArray(bpars, ";"); //$NON-NLS-1$
for (int j = 0; j < bparsTokens.length; ++j) {
- binaryParserList.add(bparsTokens[j].trim());
+ binaryParserList.add(SafeStringInterner.safeIntern(bparsTokens[j].trim()));
}
}
}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Tool.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Tool.java
index 3e63eab7a5..dbb2d5c25b 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Tool.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Tool.java
@@ -31,6 +31,7 @@ import org.eclipse.cdt.build.internal.core.scannerconfig.CfgDiscoveredPathManage
import org.eclipse.cdt.core.cdtvariables.CdtVariableException;
import org.eclipse.cdt.core.settings.model.ICStorageElement;
import org.eclipse.cdt.core.settings.model.extension.CLanguageData;
+import org.eclipse.cdt.internal.core.SafeStringInterner;
import org.eclipse.cdt.managedbuilder.buildproperties.IBuildPropertyType;
import org.eclipse.cdt.managedbuilder.buildproperties.IBuildPropertyValue;
import org.eclipse.cdt.managedbuilder.core.BuildException;
@@ -667,25 +668,25 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory, IMatch
ManagedBuildManager.putConfigElement(this, element);
// id
- setId(element.getAttribute(IBuildObject.ID));
+ setId(SafeStringInterner.safeIntern(element.getAttribute(IBuildObject.ID)));
// name
- setName(element.getAttribute(IBuildObject.NAME));
+ setName(SafeStringInterner.safeIntern(element.getAttribute(IBuildObject.NAME)));
// version
setVersion(getVersionFromId());
// superClass
- superClassId = element.getAttribute(IProjectType.SUPERCLASS);
+ superClassId = SafeStringInterner.safeIntern(element.getAttribute(IProjectType.SUPERCLASS));
// Get the unused children, if any
- unusedChildren = element.getAttribute(IProjectType.UNUSED_CHILDREN);
+ unusedChildren = SafeStringInterner.safeIntern(element.getAttribute(IProjectType.UNUSED_CHILDREN));
// Get the 'versionsSupported' attribute
- versionsSupported =element.getAttribute(VERSIONS_SUPPORTED);
+ versionsSupported = SafeStringInterner.safeIntern(element.getAttribute(VERSIONS_SUPPORTED));
// Get the 'convertToId' attribute
- convertToId = element.getAttribute(CONVERT_TO_ID);
+ convertToId = SafeStringInterner.safeIntern(element.getAttribute(CONVERT_TO_ID));
// isAbstract
String isAbs = element.getAttribute(IProjectType.IS_ABSTRACT);
@@ -694,7 +695,7 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory, IMatch
}
// Get the semicolon separated list of IDs of the error parsers
- errorParserIds = element.getAttribute(IToolChain.ERROR_PARSERS);
+ errorParserIds = SafeStringInterner.safeIntern(SafeStringInterner.safeIntern(element.getAttribute(IToolChain.ERROR_PARSERS)));
// Get the nature filter
String nature = element.getAttribute(NATURE);
@@ -715,7 +716,7 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory, IMatch
if (inputs != null) {
StringTokenizer tokenizer = new StringTokenizer(inputs, DEFAULT_SEPARATOR);
while (tokenizer.hasMoreElements()) {
- getInputExtensionsList().add((String)tokenizer.nextElement());
+ getInputExtensionsList().add(SafeStringInterner.safeIntern(tokenizer.nextToken()));
}
}
@@ -724,24 +725,24 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory, IMatch
if (headers != null) {
StringTokenizer tokenizer = new StringTokenizer(headers, DEFAULT_SEPARATOR);
while (tokenizer.hasMoreElements()) {
- getInterfaceExtensionsList().add((String)tokenizer.nextElement());
+ getInterfaceExtensionsList().add(SafeStringInterner.safeIntern(tokenizer.nextToken()));
}
}
// Get the output extension
- outputExtensions = element.getAttribute(ITool.OUTPUTS);
+ outputExtensions = SafeStringInterner.safeIntern(element.getAttribute(ITool.OUTPUTS));
// Get the tool invocation command
- command = element.getAttribute(ITool.COMMAND);
+ command = SafeStringInterner.safeIntern(element.getAttribute(ITool.COMMAND));
// Get the flag to control output
- outputFlag = element.getAttribute(ITool.OUTPUT_FLAG);
+ outputFlag = SafeStringInterner.safeIntern(element.getAttribute(ITool.OUTPUT_FLAG));
// Get the output prefix
- outputPrefix = element.getAttribute(ITool.OUTPUT_PREFIX);
+ outputPrefix = SafeStringInterner.safeIntern(element.getAttribute(ITool.OUTPUT_PREFIX));
// Get command line pattern
- commandLinePattern = element.getAttribute( ITool.COMMAND_LINE_PATTERN );
+ commandLinePattern = SafeStringInterner.safeIntern(element.getAttribute( ITool.COMMAND_LINE_PATTERN ));
// Get advancedInputCategory
String advInput = element.getAttribute(ITool.ADVANCED_INPUT_CATEGORY);
@@ -756,7 +757,7 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory, IMatch
}
// Get the announcement text
- announcement = element.getAttribute(ITool.ANNOUNCEMENT);
+ announcement = SafeStringInterner.safeIntern(element.getAttribute(ITool.ANNOUNCEMENT));
// Store the configuration element IFF there is a command line generator defined
String commandLineGenerator = element.getAttribute(COMMAND_LINE_GENERATOR);
@@ -787,7 +788,7 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory, IMatch
if(tmp != null)
supportsManagedBuild = Boolean.valueOf(tmp);
- scannerConfigDiscoveryProfileId = element.getAttribute(IToolChain.SCANNER_CONFIG_PROFILE_ID);
+ scannerConfigDiscoveryProfileId = SafeStringInterner.safeIntern(element.getAttribute(IToolChain.SCANNER_CONFIG_PROFILE_ID));
tmp = element.getAttribute(IS_SYSTEM);
if(tmp != null)
@@ -802,35 +803,23 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory, IMatch
*/
protected void loadFromProject(ICStorageElement element) {
- // id
+ // id (unique, do not intern)
setId(element.getAttribute(IBuildObject.ID));
// name
if (element.getAttribute(IBuildObject.NAME) != null) {
- setName(element.getAttribute(IBuildObject.NAME));
+ setName(SafeStringInterner.safeIntern(element.getAttribute(IBuildObject.NAME)));
}
// version
setVersion(getVersionFromId());
// superClass
- superClassId = element.getAttribute(IProjectType.SUPERCLASS);
-// if (superClassId != null && superClassId.length() > 0) {
-// if( getParent() instanceof IResourceConfiguration ) {
-// IResourceConfiguration resConfig = (IResourceConfiguration) getParent();
-// setSuperClassInternal( resConfig.getParent().getTool(superClassId) );
-// } else {
-// setSuperClassInternal( ManagedBuildManager.getExtensionTool(superClassId) );
-// }
-//
-// // Check for migration support
-// checkForMigrationSupport();
-//
-// }
+ superClassId = SafeStringInterner.safeIntern(element.getAttribute(IProjectType.SUPERCLASS));
// Get the unused children, if any
if (element.getAttribute(IProjectType.UNUSED_CHILDREN) != null) {
- unusedChildren = element.getAttribute(IProjectType.UNUSED_CHILDREN);
+ unusedChildren = SafeStringInterner.safeIntern(element.getAttribute(IProjectType.UNUSED_CHILDREN));
}
// isAbstract
@@ -843,17 +832,17 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory, IMatch
// Get the 'versionSupported' attribute
if (element.getAttribute(VERSIONS_SUPPORTED) != null) {
- versionsSupported = element.getAttribute(VERSIONS_SUPPORTED);
+ versionsSupported = SafeStringInterner.safeIntern(element.getAttribute(VERSIONS_SUPPORTED));
}
// Get the 'convertToId' id
if (element.getAttribute(CONVERT_TO_ID) != null) {
- convertToId = element.getAttribute(CONVERT_TO_ID);
+ convertToId = SafeStringInterner.safeIntern(element.getAttribute(CONVERT_TO_ID));
}
// Get the semicolon separated list of IDs of the error parsers
if (element.getAttribute(IToolChain.ERROR_PARSERS) != null) {
- errorParserIds = element.getAttribute(IToolChain.ERROR_PARSERS);
+ errorParserIds = SafeStringInterner.safeIntern(element.getAttribute(IToolChain.ERROR_PARSERS));
}
// Get the nature filter
@@ -878,7 +867,7 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory, IMatch
if (inputs != null) {
StringTokenizer tokenizer = new StringTokenizer(inputs, DEFAULT_SEPARATOR);
while (tokenizer.hasMoreElements()) {
- getInputExtensionsList().add((String)tokenizer.nextElement());
+ getInputExtensionsList().add(SafeStringInterner.safeIntern(tokenizer.nextToken()));
}
}
}
@@ -889,34 +878,34 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory, IMatch
if (headers != null) {
StringTokenizer tokenizer = new StringTokenizer(headers, DEFAULT_SEPARATOR);
while (tokenizer.hasMoreElements()) {
- getInterfaceExtensionsList().add((String)tokenizer.nextElement());
+ getInterfaceExtensionsList().add(SafeStringInterner.safeIntern(tokenizer.nextToken()));
}
}
}
// Get the output extension
if (element.getAttribute(ITool.OUTPUTS) != null) {
- outputExtensions = element.getAttribute(ITool.OUTPUTS);
+ outputExtensions = SafeStringInterner.safeIntern(element.getAttribute(ITool.OUTPUTS));
}
// Get the tool invocation command
if (element.getAttribute(ITool.COMMAND) != null) {
- command = element.getAttribute(ITool.COMMAND);
+ command = SafeStringInterner.safeIntern(element.getAttribute(ITool.COMMAND));
}
// Get the flag to control output
if (element.getAttribute(ITool.OUTPUT_FLAG) != null) {
- outputFlag = element.getAttribute(ITool.OUTPUT_FLAG);
+ outputFlag = SafeStringInterner.safeIntern(element.getAttribute(ITool.OUTPUT_FLAG));
}
// Get the output prefix
if (element.getAttribute(ITool.OUTPUT_PREFIX) != null) {
- outputPrefix = element.getAttribute(ITool.OUTPUT_PREFIX);
+ outputPrefix = SafeStringInterner.safeIntern(element.getAttribute(ITool.OUTPUT_PREFIX));
}
// Get command line pattern
if( element.getAttribute( ITool.COMMAND_LINE_PATTERN ) != null) {
- commandLinePattern = element.getAttribute( ITool.COMMAND_LINE_PATTERN );
+ commandLinePattern = SafeStringInterner.safeIntern(element.getAttribute( ITool.COMMAND_LINE_PATTERN ));
}
// advancedInputCategory
@@ -937,7 +926,7 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory, IMatch
// Get the announcement text
if (element.getAttribute(ITool.ANNOUNCEMENT) != null) {
- announcement = element.getAttribute(ITool.ANNOUNCEMENT);
+ announcement = SafeStringInterner.safeIntern(element.getAttribute(ITool.ANNOUNCEMENT));
}
// icon - was saved as URL in string form
@@ -952,7 +941,7 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory, IMatch
}
}
- scannerConfigDiscoveryProfileId = element.getAttribute(IToolChain.SCANNER_CONFIG_PROFILE_ID);
+ scannerConfigDiscoveryProfileId = SafeStringInterner.safeIntern(element.getAttribute(IToolChain.SCANNER_CONFIG_PROFILE_ID));
}
void resolveProjectReferences(boolean onLoad){
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ToolChain.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ToolChain.java
index 4223db25ab..6dd49708b6 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ToolChain.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ToolChain.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2010 Intel Corporation and others.
+ * Copyright (c) 2004, 2011 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* Intel Corporation - Initial API and implementation
+ * IBM Corporation
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.internal.core;
@@ -26,6 +27,7 @@ import org.eclipse.cdt.build.internal.core.scannerconfig.CfgDiscoveredPathManage
import org.eclipse.cdt.core.settings.model.ICStorageElement;
import org.eclipse.cdt.core.settings.model.extension.CTargetPlatformData;
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
+import org.eclipse.cdt.internal.core.SafeStringInterner;
import org.eclipse.cdt.internal.core.cdtvariables.StorableCdtVariables;
import org.eclipse.cdt.managedbuilder.buildproperties.IBuildPropertyType;
import org.eclipse.cdt.managedbuilder.buildproperties.IBuildPropertyValue;
@@ -523,19 +525,19 @@ public class ToolChain extends HoldsOptions implements IToolChain, IMatchKeyProv
ManagedBuildManager.putConfigElement(this, element);
// id
- setId(element.getAttribute(IBuildObject.ID));
+ setId(SafeStringInterner.safeIntern(element.getAttribute(IBuildObject.ID)));
// Get the name
- setName(element.getAttribute(IBuildObject.NAME));
+ setName(SafeStringInterner.safeIntern(element.getAttribute(IBuildObject.NAME)));
// version
setVersion(getVersionFromId());
// superClass
- superClassId = element.getAttribute(IProjectType.SUPERCLASS);
+ superClassId = SafeStringInterner.safeIntern(element.getAttribute(IProjectType.SUPERCLASS));
// Get the unused children, if any
- unusedChildren = element.getAttribute(IProjectType.UNUSED_CHILDREN);
+ unusedChildren = SafeStringInterner.safeIntern(element.getAttribute(IProjectType.UNUSED_CHILDREN));
// isAbstract
String isAbs = element.getAttribute(IProjectType.IS_ABSTRACT);
@@ -544,25 +546,25 @@ public class ToolChain extends HoldsOptions implements IToolChain, IMatchKeyProv
}
// Get the semicolon separated list of IDs of the error parsers
- errorParserIds = element.getAttribute(ERROR_PARSERS);
+ errorParserIds = SafeStringInterner.safeIntern(element.getAttribute(ERROR_PARSERS));
// Get the semicolon separated list of IDs of the secondary outputs
- secondaryOutputIds = element.getAttribute(SECONDARY_OUTPUTS);
+ secondaryOutputIds = SafeStringInterner.safeIntern(element.getAttribute(SECONDARY_OUTPUTS));
// Get the target tool id
- targetToolIds = element.getAttribute(TARGET_TOOL);
+ targetToolIds = SafeStringInterner.safeIntern(element.getAttribute(TARGET_TOOL));
// Get the scanner config discovery profile id
- scannerConfigDiscoveryProfileId = element.getAttribute(SCANNER_CONFIG_PROFILE_ID);
+ scannerConfigDiscoveryProfileId = SafeStringInterner.safeIntern(element.getAttribute(SCANNER_CONFIG_PROFILE_ID));
String tmp = element.getAttribute(RESOURCE_TYPE_BASED_DISCOVERY);
if(tmp != null)
isRcTypeBasedDiscovery = Boolean.valueOf(tmp);
// Get the 'versionsSupported' attribute
- versionsSupported =element.getAttribute(VERSIONS_SUPPORTED);
+ versionsSupported = SafeStringInterner.safeIntern(element.getAttribute(VERSIONS_SUPPORTED));
// Get the 'convertToId' attribute
- convertToId = element.getAttribute(CONVERT_TO_ID);
+ convertToId = SafeStringInterner.safeIntern(element.getAttribute(CONVERT_TO_ID));
tmp = element.getAttribute(SUPPORTS_MANAGED_BUILD);
if(tmp != null)
@@ -579,7 +581,7 @@ public class ToolChain extends HoldsOptions implements IToolChain, IMatchKeyProv
osList = new ArrayList<String>();
String[] osTokens = os.split(","); //$NON-NLS-1$
for (int i = 0; i < osTokens.length; ++i) {
- osList.add(osTokens[i].trim());
+ osList.add(SafeStringInterner.safeIntern(osTokens[i].trim()));
}
}
@@ -589,7 +591,7 @@ public class ToolChain extends HoldsOptions implements IToolChain, IMatchKeyProv
archList = new ArrayList<String>();
String[] archTokens = arch.split(","); //$NON-NLS-1$
for (int j = 0; j < archTokens.length; ++j) {
- archList.add(archTokens[j].trim());
+ archList.add(SafeStringInterner.safeIntern(archTokens[j].trim()));
}
}
@@ -617,7 +619,7 @@ public class ToolChain extends HoldsOptions implements IToolChain, IMatchKeyProv
pathconverterElement = ((DefaultManagedConfigElement)element).getConfigurationElement();
}
- nonInternalBuilderId = element.getAttribute(NON_INTERNAL_BUILDER_ID);
+ nonInternalBuilderId = SafeStringInterner.safeIntern(element.getAttribute(NON_INTERNAL_BUILDER_ID));
}
@@ -629,19 +631,19 @@ public class ToolChain extends HoldsOptions implements IToolChain, IMatchKeyProv
*/
protected void loadFromProject(ICStorageElement element) {
- // id
+ // id (unique, do not intern)
setId(element.getAttribute(IBuildObject.ID));
// name
if (element.getAttribute(IBuildObject.NAME) != null) {
- setName(element.getAttribute(IBuildObject.NAME));
+ setName(SafeStringInterner.safeIntern(element.getAttribute(IBuildObject.NAME)));
}
// version
setVersion(getVersionFromId());
// superClass
- superClassId = element.getAttribute(IProjectType.SUPERCLASS);
+ superClassId = SafeStringInterner.safeIntern(element.getAttribute(IProjectType.SUPERCLASS));
if (superClassId != null && superClassId.length() > 0) {
setSuperClassInternal( ManagedBuildManager.getExtensionToolChain(superClassId) );
// Check for migration support
@@ -650,7 +652,7 @@ public class ToolChain extends HoldsOptions implements IToolChain, IMatchKeyProv
// Get the unused children, if any
if (element.getAttribute(IProjectType.UNUSED_CHILDREN) != null) {
- unusedChildren = element.getAttribute(IProjectType.UNUSED_CHILDREN);
+ unusedChildren = SafeStringInterner.safeIntern(element.getAttribute(IProjectType.UNUSED_CHILDREN));
}
// isAbstract
@@ -663,32 +665,32 @@ public class ToolChain extends HoldsOptions implements IToolChain, IMatchKeyProv
// Get the semicolon separated list of IDs of the error parsers
if (element.getAttribute(ERROR_PARSERS) != null) {
- errorParserIds = element.getAttribute(ERROR_PARSERS);
+ errorParserIds = SafeStringInterner.safeIntern(element.getAttribute(ERROR_PARSERS));
}
// Get the semicolon separated list of IDs of the secondary outputs
if (element.getAttribute(SECONDARY_OUTPUTS) != null) {
- secondaryOutputIds = element.getAttribute(SECONDARY_OUTPUTS);
+ secondaryOutputIds = SafeStringInterner.safeIntern(element.getAttribute(SECONDARY_OUTPUTS));
}
// Get the target tool id
if (element.getAttribute(TARGET_TOOL) != null) {
- targetToolIds = element.getAttribute(TARGET_TOOL);
+ targetToolIds = SafeStringInterner.safeIntern(element.getAttribute(TARGET_TOOL));
}
// Get the scanner config discovery profile id
if (element.getAttribute(SCANNER_CONFIG_PROFILE_ID) != null) {
- scannerConfigDiscoveryProfileId = element.getAttribute(SCANNER_CONFIG_PROFILE_ID);
+ scannerConfigDiscoveryProfileId = SafeStringInterner.safeIntern(element.getAttribute(SCANNER_CONFIG_PROFILE_ID));
}
// Get the 'versionSupported' attribute
if (element.getAttribute(VERSIONS_SUPPORTED) != null) {
- versionsSupported = element.getAttribute(VERSIONS_SUPPORTED);
+ versionsSupported = SafeStringInterner.safeIntern(element.getAttribute(VERSIONS_SUPPORTED));
}
// Get the 'convertToId' id
if (element.getAttribute(CONVERT_TO_ID) != null) {
- convertToId = element.getAttribute(CONVERT_TO_ID);
+ convertToId = SafeStringInterner.safeIntern(element.getAttribute(CONVERT_TO_ID));
}
// Get the comma-separated list of valid OS
@@ -698,7 +700,7 @@ public class ToolChain extends HoldsOptions implements IToolChain, IMatchKeyProv
osList = new ArrayList<String>();
String[] osTokens = os.split(","); //$NON-NLS-1$
for (int i = 0; i < osTokens.length; ++i) {
- osList.add(osTokens[i].trim());
+ osList.add(SafeStringInterner.safeIntern(osTokens[i].trim()));
}
}
}
@@ -710,7 +712,7 @@ public class ToolChain extends HoldsOptions implements IToolChain, IMatchKeyProv
archList = new ArrayList<String>();
String[] archTokens = arch.split(","); //$NON-NLS-1$
for (int j = 0; j < archTokens.length; ++j) {
- archList.add(archTokens[j].trim());
+ archList.add(SafeStringInterner.safeIntern(archTokens[j].trim()));
}
}
}
@@ -727,7 +729,7 @@ public class ToolChain extends HoldsOptions implements IToolChain, IMatchKeyProv
if(tmp != null)
isRcTypeBasedDiscovery = Boolean.valueOf(tmp);
- nonInternalBuilderId = element.getAttribute(NON_INTERNAL_BUILDER_ID);
+ nonInternalBuilderId = SafeStringInterner.safeIntern(element.getAttribute(NON_INTERNAL_BUILDER_ID));
// String tmp = element.getAttribute(name)
}
diff --git a/core/org.eclipse.cdt.core/META-INF/MANIFEST.MF b/core/org.eclipse.cdt.core/META-INF/MANIFEST.MF
index dbdf3f6f1c..b628c67b30 100644
--- a/core/org.eclipse.cdt.core/META-INF/MANIFEST.MF
+++ b/core/org.eclipse.cdt.core/META-INF/MANIFEST.MF
@@ -40,7 +40,7 @@ Export-Package: org.eclipse.cdt.core,
org.eclipse.cdt.core.templateengine,
org.eclipse.cdt.core.templateengine.process,
org.eclipse.cdt.core.templateengine.process.processes,
- org.eclipse.cdt.internal.core;x-friends:="org.eclipse.cdt.ui,org.eclipse.cdt.debug.core",
+ org.eclipse.cdt.internal.core;x-friends:="org.eclipse.cdt.ui,org.eclipse.cdt.debug.core,org.eclipse.cdt.managedbuilder.core,org.eclipse.cdt.make.core,org.eclipse.cdt.make.ui",
org.eclipse.cdt.internal.core.browser;x-friends:="org.eclipse.cdt.ui",
org.eclipse.cdt.internal.core.cdtvariables;x-internal:=true,
org.eclipse.cdt.internal.core.dom;x-internal:=true,
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/cdtvariables/CdtVariable.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/cdtvariables/CdtVariable.java
index a9f487f586..1c499322fe 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/cdtvariables/CdtVariable.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/cdtvariables/CdtVariable.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 Intel Corporation and others.
+ * Copyright (c) 2005, 2011 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,9 +7,11 @@
*
* Contributors:
* Intel Corporation - Initial API and implementation
+ * IBM Corporation
*******************************************************************************/
package org.eclipse.cdt.core.cdtvariables;
+import org.eclipse.cdt.internal.core.SafeStringInterner;
import org.eclipse.cdt.utils.cdtvariables.CdtVariableResolver;
/**
@@ -28,13 +30,13 @@ public class CdtVariable implements ICdtVariable {
}
public CdtVariable(String name, int type, String value){
- fName = name;
+ fName = SafeStringInterner.safeIntern(name);
fType = type;
- fStringValue = value;
+ fStringValue = SafeStringInterner.safeIntern(value);
}
public CdtVariable(String name, int type, String value[]){
- fName = name;
+ fName = SafeStringInterner.safeIntern(name);
fType = type;
fStringListValue = value;
}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/envvar/EnvironmentVariable.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/envvar/EnvironmentVariable.java
index e7beeea0c3..1d60dd5944 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/envvar/EnvironmentVariable.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/envvar/EnvironmentVariable.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2009 Intel Corporation and others.
+ * Copyright (c) 2005, 2011 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,9 +8,11 @@
* Contributors:
* Intel Corporation - Initial API and implementation
* James Blackburn (Broadcom Corp.)
+ * IBM Corporation
*******************************************************************************/
package org.eclipse.cdt.core.envvar;
+import org.eclipse.cdt.internal.core.SafeStringInterner;
import org.eclipse.cdt.internal.core.envvar.EnvironmentVariableManager;
@@ -27,9 +29,9 @@ public class EnvironmentVariable implements IEnvironmentVariable, Cloneable {
protected int fOperation;
public EnvironmentVariable(String name, String value, int op, String delimiter) {
- fName = name;
+ fName = SafeStringInterner.safeIntern(name);
fOperation = op;
- fValue = value;
+ fValue = SafeStringInterner.safeIntern(value);
if (delimiter == null)
fDelimiter = EnvironmentVariableManager.getDefault().getDefaultDelimiter();
else
diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/internal/core/SafeStringInterner.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/internal/core/SafeStringInterner.java
new file mode 100644
index 0000000000..a7aeb8c3cd
--- /dev/null
+++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/internal/core/SafeStringInterner.java
@@ -0,0 +1,141 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.internal.core;
+
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+/**
+ * Interns Strings in a safe manner, checking for nulls first.
+ * Does not guard against interning a String that has already been interned.
+ *
+ * @author crecoskie
+ *
+ */
+public class SafeStringInterner {
+
+ /**
+ * Interns the given String, safely checking for null first.
+ *
+ * @param string
+ * @return String
+ */
+ public static String safeIntern(String string) {
+ if(string != null) {
+ return string.intern();
+ }
+ return string;
+ }
+
+ /**
+ * Interns the Strings in the given array, safely checking for null first.
+ *
+ * @param strArray
+ * @return String[]
+ */
+ public static String[] safeIntern(String[] strArray) {
+ if(strArray == null)
+ return null;
+
+ for(int i =0; i < strArray.length; i++) {
+ strArray[i] = safeIntern(strArray[i]);
+ }
+
+ return strArray;
+ }
+
+ /**
+ * Returns a new version of the map such that all string keys and values are interned.
+ *
+ * @param <T>
+ * @param <M>
+ * @param map
+ * @return The map, after modification.
+ */
+ @SuppressWarnings("unchecked")
+ public static <T> HashMap<String, T> safeIntern(HashMap<String, T> map) {
+ if(map == null || map.isEmpty()) {
+ return map;
+ }
+
+ HashMap<String, T> tempMap = new HashMap<String, T>(map);
+ map.clear();
+ for(String string : tempMap.keySet()) {
+ T value = tempMap.get(string);
+
+ if(value instanceof String) {
+ value = (T) safeIntern((String) value);
+ }
+
+ map.put(safeIntern(string), value);
+ }
+
+ return map;
+ }
+
+ /**
+ * Returns a new version of the map such that all string keys and values are interned.
+ *
+ * @param <T>
+ * @param map
+ * @return The map, after modification.
+ */
+ @SuppressWarnings("unchecked")
+ public static <T> LinkedHashMap<String, T> safeIntern(LinkedHashMap<String, T> map) {
+ if(map == null || map.isEmpty()) {
+ return map;
+ }
+
+ LinkedHashMap<String, T> tempMap = new LinkedHashMap<String, T>(map);
+ map.clear();
+ for(String string : tempMap.keySet()) {
+ T value = tempMap.get(string);
+
+ if(value instanceof String) {
+ value = (T) safeIntern((String) value);
+ }
+
+ map.put(safeIntern(string), value);
+ }
+
+ return map;
+ }
+
+ /**
+ * Returns a new version of the map such that all string keys and values are interned.
+ *
+ * @param <T>
+ * @param map
+ * @return The map, after modification.
+ */
+ @SuppressWarnings("unchecked")
+ public static <T> Map<String, T> safeIntern(Map<String, T> map) {
+ if(map == null || map.isEmpty()) {
+ return map;
+ }
+
+ HashMap<String, T> tempMap = new HashMap<String, T>(map);
+ map.clear();
+ for(String string : tempMap.keySet()) {
+ T value = tempMap.get(string);
+
+ if(value instanceof String) {
+ value = (T) safeIntern((String) value);
+ }
+
+ map.put(safeIntern(string), value);
+ }
+
+ return map;
+ }
+
+}
diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/envvar/StorableEnvVar.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/envvar/StorableEnvVar.java
index bb1cbac349..bf88834bb2 100644
--- a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/envvar/StorableEnvVar.java
+++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/envvar/StorableEnvVar.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2009 Intel Corporation and others.
+ * Copyright (c) 2005, 2011 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,11 +8,13 @@
* Contributors:
* Intel Corporation - Initial API and implementation
* James Blackburn (Broadcom Corp.)
+ * IBM Corporation
*******************************************************************************/
package org.eclipse.cdt.utils.envvar;
import org.eclipse.cdt.core.envvar.EnvironmentVariable;
import org.eclipse.cdt.core.settings.model.ICStorageElement;
+import org.eclipse.cdt.internal.core.SafeStringInterner;
import org.osgi.service.prefs.Preferences;
/**
@@ -54,9 +56,9 @@ public class StorableEnvVar extends EnvironmentVariable {
* @param element
*/
public StorableEnvVar(ICStorageElement element){
- fName = element.getAttribute(NAME);
+ fName = SafeStringInterner.safeIntern(element.getAttribute(NAME));
- fValue = element.getAttribute(VALUE);
+ fValue = SafeStringInterner.safeIntern(element.getAttribute(VALUE));
fOperation = opStringToInt(element.getAttribute(OPERATION));
@@ -72,8 +74,8 @@ public class StorableEnvVar extends EnvironmentVariable {
* @since 5.2
*/
public StorableEnvVar(String name, Preferences element){
- fName = name;
- fValue = element.get(VALUE, null);
+ fName = SafeStringInterner.safeIntern(name);
+ fValue = SafeStringInterner.safeIntern(element.get(VALUE, null));
fOperation = opStringToInt(element.get(OPERATION, null));
fDelimiter = element.get(DELIMITER, null);
}

Back to the top