Rolls back r8845, "Reduce DevMode memory footprint by using a WeakInterner
for potentially duplicated strings," due to NullPointerExceptions in gwtc
Review by: scottb@google.com
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@8848 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/dev/build.xml b/dev/build.xml
index 74d6514..85feef9 100755
--- a/dev/build.xml
+++ b/dev/build.xml
@@ -108,7 +108,6 @@
<include name="w3c/sac/sac-1.3.jar" />
<!-- htmlunit dependencies not already included: END -->
<include name="sun/swingworker/swing-worker-1.1.jar" />
- <include name="guava/guava-r06/guava-r06-rebased.jar" />
</fileset>
<fileset file="build.xml"/>
</sourcefiles>
@@ -171,7 +170,6 @@
<zipfileset src="${gwt.tools.lib}/w3c/sac/sac-1.3.jar" />
<!-- htmlunit dependencies not already included: END -->
<zipfileset src="${gwt.tools.lib}/sun/swingworker/swing-worker-1.1.jar" />
- <zipfileset src="${gwt.tools.lib}/guava/guava-r06/guava-r06-rebased.jar" />
</gwt.jar>
</sequential>
</outofdate>
@@ -209,7 +207,6 @@
<pathelement location="${gwt.tools.lib}/eclipse/jdt-3.4.2.jar" />
<pathelement location="${gwt.tools.lib}/tomcat/commons-collections-3.1.jar" />
<pathelement location="${gwt.tools.lib}/junit/junit-3.8.1.jar" />
- <pathelement location="${gwt.tools.lib}/guava/guava-r06/guava-r06-rebased.jar" />
</classpath>
</gwt.javac>
diff --git a/dev/core/src/com/google/gwt/core/ext/typeinfo/JAbstractMethod.java b/dev/core/src/com/google/gwt/core/ext/typeinfo/JAbstractMethod.java
index 8748e74..2e144a9 100644
--- a/dev/core/src/com/google/gwt/core/ext/typeinfo/JAbstractMethod.java
+++ b/dev/core/src/com/google/gwt/core/ext/typeinfo/JAbstractMethod.java
@@ -15,7 +15,6 @@
*/
package com.google.gwt.core.ext.typeinfo;
-import com.google.gwt.dev.util.StringInterner;
import com.google.gwt.dev.util.collect.Lists;
import java.lang.annotation.Annotation;
@@ -56,7 +55,7 @@
JAbstractMethod(String name,
Map<Class<? extends Annotation>, Annotation> declaredAnnotations,
JTypeParameter[] jtypeParameters) {
- this.name = StringInterner.get().intern(name);
+ this.name = name;
annotations = new Annotations(declaredAnnotations);
if (jtypeParameters != null) {
@@ -240,13 +239,7 @@
for (int i = 0; i < n; ++i) {
// Identity tests are ok since identity is durable within an oracle.
if (params.get(i) == parameter) {
- String realParameterName;
- if (realParameterNames == null) {
- realParameterName = StringInterner.get().intern("arg" + i);
- } else {
- realParameterName = StringInterner.get().intern(realParameterNames[i]);
- }
- return realParameterName;
+ return realParameterNames == null ? "arg" + i : realParameterNames[i];
}
}
// TODO: report error if we are asked for an unknown JParameter?
diff --git a/dev/core/src/com/google/gwt/core/ext/typeinfo/JArrayType.java b/dev/core/src/com/google/gwt/core/ext/typeinfo/JArrayType.java
index ed2afaa..055d936 100644
--- a/dev/core/src/com/google/gwt/core/ext/typeinfo/JArrayType.java
+++ b/dev/core/src/com/google/gwt/core/ext/typeinfo/JArrayType.java
@@ -15,8 +15,6 @@
*/
package com.google.gwt.core.ext.typeinfo;
-import com.google.gwt.dev.util.StringInterner;
-
import java.lang.annotation.Annotation;
import java.util.Map;
@@ -207,8 +205,7 @@
@Override
public String getSimpleSourceName() {
if (lazySimpleName == null) {
- lazySimpleName = StringInterner.get().intern(
- getComponentType().getSimpleSourceName() + "[]");
+ lazySimpleName = getComponentType().getSimpleSourceName() + "[]";
}
return lazySimpleName;
}
diff --git a/dev/core/src/com/google/gwt/core/ext/typeinfo/JField.java b/dev/core/src/com/google/gwt/core/ext/typeinfo/JField.java
index 8a3f3d6..ea912fb 100644
--- a/dev/core/src/com/google/gwt/core/ext/typeinfo/JField.java
+++ b/dev/core/src/com/google/gwt/core/ext/typeinfo/JField.java
@@ -15,8 +15,6 @@
*/
package com.google.gwt.core.ext.typeinfo;
-import com.google.gwt.dev.util.StringInterner;
-
import java.lang.annotation.Annotation;
import java.util.Map;
@@ -52,7 +50,7 @@
Map<Class<? extends Annotation>, Annotation> declaredAnnotations) {
assert (enclosingType != null);
this.enclosingType = enclosingType;
- this.name = StringInterner.get().intern(name);
+ this.name = name;
this.enclosingType.addField(this);
annotations = new Annotations(declaredAnnotations);
}
diff --git a/dev/core/src/com/google/gwt/core/ext/typeinfo/JParameter.java b/dev/core/src/com/google/gwt/core/ext/typeinfo/JParameter.java
index 3e30132..f7b0686 100644
--- a/dev/core/src/com/google/gwt/core/ext/typeinfo/JParameter.java
+++ b/dev/core/src/com/google/gwt/core/ext/typeinfo/JParameter.java
@@ -15,8 +15,6 @@
*/
package com.google.gwt.core.ext.typeinfo;
-import com.google.gwt.dev.util.StringInterner;
-
import java.lang.annotation.Annotation;
import java.util.Map;
@@ -39,7 +37,7 @@
JParameter(JAbstractMethod enclosingMethod, JParameter srcParam) {
this.enclosingMethod = enclosingMethod;
this.type = srcParam.type;
- this.name = StringInterner.get().intern(srcParam.name);
+ this.name = srcParam.name;
this.annotations = new Annotations(srcParam.annotations);
}
@@ -58,7 +56,7 @@
boolean argNameIsReal) {
this.enclosingMethod = enclosingMethod;
this.type = type;
- this.name = StringInterner.get().intern(name);
+ this.name = name;
this.argNameIsReal = argNameIsReal;
enclosingMethod.addParameter(this);
@@ -125,7 +123,7 @@
// Only called by JAbstractMethod after real parameter names are fetched.
void setName(String name) {
- this.name = StringInterner.get().intern(name);
+ this.name = name;
}
// Called when parameter types are found to be parameterized
diff --git a/dev/core/src/com/google/gwt/core/ext/typeinfo/JRealClassType.java b/dev/core/src/com/google/gwt/core/ext/typeinfo/JRealClassType.java
index b40ab8d..1d64d80 100644
--- a/dev/core/src/com/google/gwt/core/ext/typeinfo/JRealClassType.java
+++ b/dev/core/src/com/google/gwt/core/ext/typeinfo/JRealClassType.java
@@ -15,7 +15,6 @@
*/
package com.google.gwt.core.ext.typeinfo;
-import com.google.gwt.dev.util.StringInterner;
import com.google.gwt.dev.util.collect.IdentitySets;
import com.google.gwt.dev.util.collect.Lists;
@@ -76,7 +75,7 @@
String enclosingTypeName, String name, boolean isInterface) {
this.oracle = oracle;
this.declaringPackage = declaringPackage;
- this.name = StringInterner.get().intern(name);
+ this.name = name;
this.isInterface = isInterface;
if (enclosingTypeName == null) {
// Add myself to my package.
@@ -245,7 +244,6 @@
} else {
lazyQualifiedName = nestedName;
}
- lazyQualifiedName = StringInterner.get().intern(lazyQualifiedName);
}
return lazyQualifiedName;
}
diff --git a/dev/core/src/com/google/gwt/core/ext/typeinfo/JTypeParameter.java b/dev/core/src/com/google/gwt/core/ext/typeinfo/JTypeParameter.java
index 1084c4f..74de83a 100644
--- a/dev/core/src/com/google/gwt/core/ext/typeinfo/JTypeParameter.java
+++ b/dev/core/src/com/google/gwt/core/ext/typeinfo/JTypeParameter.java
@@ -15,8 +15,6 @@
*/
package com.google.gwt.core.ext.typeinfo;
-import com.google.gwt.dev.util.StringInterner;
-
import java.util.ArrayList;
import java.util.List;
@@ -30,7 +28,7 @@
private final String typeName;
public JTypeParameter(String typeName, int ordinal) {
- this.typeName = StringInterner.get().intern(typeName);
+ this.typeName = typeName;
this.ordinal = ordinal;
}
diff --git a/dev/core/src/com/google/gwt/dev/javac/CompilationStateBuilder.java b/dev/core/src/com/google/gwt/dev/javac/CompilationStateBuilder.java
index 09dfd61..2be3f89 100644
--- a/dev/core/src/com/google/gwt/dev/javac/CompilationStateBuilder.java
+++ b/dev/core/src/com/google/gwt/dev/javac/CompilationStateBuilder.java
@@ -22,7 +22,6 @@
import com.google.gwt.dev.javac.JdtCompiler.UnitProcessor;
import com.google.gwt.dev.js.ast.JsProgram;
import com.google.gwt.dev.resource.Resource;
-import com.google.gwt.dev.util.StringInterner;
import com.google.gwt.dev.util.log.speedtracer.DevModeEventType;
import com.google.gwt.dev.util.log.speedtracer.SpeedTracerLogger;
import com.google.gwt.dev.util.log.speedtracer.SpeedTracerLogger.Event;
@@ -82,25 +81,21 @@
MethodArgNamesLookup methodArgs = MethodParamCollector.collect(cud);
- StringInterner interner = StringInterner.get();
- String packageName = interner.intern(
- Shared.getPackageName(builder.getTypeName()));
+ String packageName = Shared.getPackageName(builder.getTypeName());
List<String> unresolvedQualified = new ArrayList<String>();
List<String> unresolvedSimple = new ArrayList<String>();
for (char[] simpleRef : cud.compilationResult().simpleNameReferences) {
- unresolvedSimple.add(interner.intern(String.valueOf(simpleRef)));
+ unresolvedSimple.add(canonical(String.valueOf(simpleRef)));
}
- for (char[][] qualifiedRef :
- cud.compilationResult().qualifiedReferences) {
- unresolvedQualified.add(
- interner.intern(CharOperation.toString(qualifiedRef)));
+ for (char[][] qualifiedRef : cud.compilationResult().qualifiedReferences) {
+ unresolvedQualified.add(canonical(CharOperation.toString(qualifiedRef)));
}
for (String jsniDep : jsniDeps) {
- unresolvedQualified.add(interner.intern(jsniDep));
+ unresolvedQualified.add(canonical(jsniDep));
}
ArrayList<String> apiRefs = compiler.collectApiRefs(cud);
for (int i = 0; i < apiRefs.size(); ++i) {
- apiRefs.set(i, interner.intern(apiRefs.get(i)));
+ apiRefs.set(i, canonical(apiRefs.get(i)));
}
Dependencies dependencies = new Dependencies(packageName,
unresolvedQualified, unresolvedSimple, apiRefs);
@@ -123,6 +118,15 @@
}
newlyBuiltUnits.add(unit);
}
+
+ private String canonical(String str) {
+ String result = internedTypeNames.get(str);
+ if (result != null) {
+ return result;
+ }
+ internedTypeNames.put(str, str);
+ return str;
+ }
}
/**
@@ -139,6 +143,14 @@
new UnitProcessorImpl());
/**
+ * Memory efficiency only. Stores canonical versions of dependency type
+ * names so that String instances can be shared among many units. Otherwise,
+ * we'd get many duplicate String objects since we have to build them from
+ * JDT's char arrays.
+ */
+ private final Map<String, String> internedTypeNames = new HashMap<String, String>();
+
+ /**
* Continuation state for JSNI checking.
*/
private final JSORestrictionsChecker.CheckerState jsoState = new JSORestrictionsChecker.CheckerState();
diff --git a/dev/core/src/com/google/gwt/dev/javac/CompiledClass.java b/dev/core/src/com/google/gwt/dev/javac/CompiledClass.java
index a0e0585..89d4ec1 100644
--- a/dev/core/src/com/google/gwt/dev/javac/CompiledClass.java
+++ b/dev/core/src/com/google/gwt/dev/javac/CompiledClass.java
@@ -17,7 +17,6 @@
import com.google.gwt.dev.util.DiskCache;
import com.google.gwt.dev.util.Name.InternalName;
-import com.google.gwt.dev.util.StringInterner;
import org.eclipse.jdt.core.compiler.CharOperation;
import org.eclipse.jdt.internal.compiler.ClassFile;
@@ -65,8 +64,7 @@
CompiledClass(ClassFile classFile, CompiledClass enclosingClass) {
this.enclosingClass = enclosingClass;
SourceTypeBinding binding = classFile.referenceBinding;
- this.internalName = StringInterner.get().intern(
- CharOperation.charToString(binding.constantPoolName()));
+ this.internalName = CharOperation.charToString(binding.constantPoolName());
byte[] bytes = classFile.getBytes();
this.cacheToken = diskCache.writeByteArray(bytes);
this.isLocal = isLocalType(binding);
@@ -101,7 +99,7 @@
* Returns the qualified source name, e.g. {@code java.util.Map.Entry}.
*/
public String getSourceName() {
- return StringInterner.get().intern(InternalName.toSourceName(internalName));
+ return InternalName.toSourceName(internalName);
}
public CompilationUnit getUnit() {
diff --git a/dev/core/src/com/google/gwt/dev/javac/Dependencies.java b/dev/core/src/com/google/gwt/dev/javac/Dependencies.java
index 47786a4..6b7253f 100644
--- a/dev/core/src/com/google/gwt/dev/javac/Dependencies.java
+++ b/dev/core/src/com/google/gwt/dev/javac/Dependencies.java
@@ -15,7 +15,6 @@
*/
package com.google.gwt.dev.javac;
-import com.google.gwt.dev.util.StringInterner;
import com.google.gwt.dev.util.collect.HashMap;
import com.google.gwt.dev.util.collect.Lists;
@@ -50,8 +49,7 @@
*/
Dependencies(String myPackage, List<String> unresolvedQualified,
List<String> unresolvedSimple, List<String> apiRefs) {
- this.myPackage = StringInterner.get().intern(
- (myPackage.length() == 0) ? "" : (myPackage + '.'));
+ this.myPackage = (myPackage.length() == 0) ? "" : (myPackage + '.');
this.unresolvedQualified = unresolvedQualified;
this.unresolvedSimple = unresolvedSimple;
this.apiRefs = apiRefs;
diff --git a/dev/core/src/com/google/gwt/dev/javac/MethodArgNamesLookup.java b/dev/core/src/com/google/gwt/dev/javac/MethodArgNamesLookup.java
index aba7337..0b9d667 100644
--- a/dev/core/src/com/google/gwt/dev/javac/MethodArgNamesLookup.java
+++ b/dev/core/src/com/google/gwt/dev/javac/MethodArgNamesLookup.java
@@ -17,7 +17,6 @@
import com.google.gwt.core.ext.typeinfo.JAbstractMethod;
import com.google.gwt.dev.javac.asm.CollectMethodData;
-import com.google.gwt.dev.util.StringInterner;
import com.google.gwt.dev.util.collect.Maps;
import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
@@ -85,13 +84,12 @@
int n = method.arguments.length;
String[] argNames = new String[n];
for (int i = 0; i < n; ++i) {
- argNames[i] = StringInterner.get().intern(
- String.valueOf(method.arguments[i].name));
+ argNames[i] = String.valueOf(method.arguments[i].name);
}
StringBuilder buf = new StringBuilder();
buf.append(enclosingType).append('.').append(method.selector);
buf.append(method.binding.signature());
- String key = StringInterner.get().intern(buf.toString());
+ String key = buf.toString();
methodArgs.put(key, argNames);
}
}
diff --git a/dev/core/src/com/google/gwt/dev/javac/asm/CollectAnnotationData.java b/dev/core/src/com/google/gwt/dev/javac/asm/CollectAnnotationData.java
index bf4c4af..e4f92b5 100644
--- a/dev/core/src/com/google/gwt/dev/javac/asm/CollectAnnotationData.java
+++ b/dev/core/src/com/google/gwt/dev/javac/asm/CollectAnnotationData.java
@@ -17,7 +17,6 @@
import com.google.gwt.dev.asm.AnnotationVisitor;
import com.google.gwt.dev.javac.asm.CollectClassData.AnnotationEnum;
-import com.google.gwt.dev.util.StringInterner;
import java.util.ArrayList;
import java.util.HashMap;
@@ -38,12 +37,12 @@
private final boolean visible;
protected AnnotationData(String desc, boolean visible) {
- this.desc = StringInterner.get().intern(desc);
+ this.desc = desc;
this.visible = visible;
}
public void addValue(String name, Object value) {
- values.put(StringInterner.get().intern(name), value);
+ values.put(name, value);
}
/**
diff --git a/dev/core/src/com/google/gwt/dev/javac/asm/CollectClassData.java b/dev/core/src/com/google/gwt/dev/javac/asm/CollectClassData.java
index 733edb7..602d020 100644
--- a/dev/core/src/com/google/gwt/dev/javac/asm/CollectClassData.java
+++ b/dev/core/src/com/google/gwt/dev/javac/asm/CollectClassData.java
@@ -21,7 +21,6 @@
import com.google.gwt.dev.asm.Opcodes;
import com.google.gwt.dev.asm.commons.EmptyVisitor;
import com.google.gwt.dev.util.Name;
-import com.google.gwt.dev.util.StringInterner;
import java.util.ArrayList;
import java.util.List;
@@ -115,8 +114,8 @@
* @param value actual value in this enum
*/
public AnnotationEnum(String desc, String value) {
- this.desc = StringInterner.get().intern(desc);
- this.value = StringInterner.get().intern(value);
+ this.desc = desc;
+ this.value = value;
}
/**
diff --git a/dev/core/src/com/google/gwt/dev/jjs/ast/JMethod.java b/dev/core/src/com/google/gwt/dev/jjs/ast/JMethod.java
index 9d598b1..7e1660e 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/ast/JMethod.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/ast/JMethod.java
@@ -17,7 +17,6 @@
import com.google.gwt.dev.jjs.InternalCompilerException;
import com.google.gwt.dev.jjs.SourceInfo;
-import com.google.gwt.dev.util.StringInterner;
import com.google.gwt.dev.util.collect.Lists;
import java.io.IOException;
@@ -79,7 +78,7 @@
JType returnType, boolean isAbstract, boolean isStatic, boolean isFinal,
boolean isPrivate) {
super(info);
- this.name = StringInterner.get().intern(name);
+ this.name = name;
this.enclosingType = enclosingType;
this.returnType = returnType;
this.isAbstract = isAbstract;
diff --git a/dev/core/src/com/google/gwt/dev/jjs/ast/JParameter.java b/dev/core/src/com/google/gwt/dev/jjs/ast/JParameter.java
index 02cb31e..2faba7d 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/ast/JParameter.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/ast/JParameter.java
@@ -16,7 +16,6 @@
package com.google.gwt.dev.jjs.ast;
import com.google.gwt.dev.jjs.SourceInfo;
-import com.google.gwt.dev.util.StringInterner;
/**
* Java method parameter definition.
@@ -29,8 +28,8 @@
assert (type != null);
assert (enclosingMethod != null);
- JParameter x = new JParameter(info, StringInterner.get().intern(name), type,
- isFinal, isThis, enclosingMethod);
+ JParameter x = new JParameter(info, name, type, isFinal, isThis,
+ enclosingMethod);
enclosingMethod.addParam(x);
return x;
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsName.java b/dev/core/src/com/google/gwt/dev/js/ast/JsName.java
index a087d15..96d7e50 100644
--- a/dev/core/src/com/google/gwt/dev/js/ast/JsName.java
+++ b/dev/core/src/com/google/gwt/dev/js/ast/JsName.java
@@ -16,7 +16,6 @@
package com.google.gwt.dev.js.ast;
import com.google.gwt.dev.jjs.SourceInfo;
-import com.google.gwt.dev.util.StringInterner;
import java.io.Serializable;
@@ -41,8 +40,8 @@
*/
JsName(JsScope enclosing, String ident, String shortIdent) {
this.enclosing = enclosing;
- this.ident = StringInterner.get().intern(ident);
- this.shortIdent = StringInterner.get().intern(shortIdent);
+ this.ident = ident;
+ this.shortIdent = shortIdent;
this.isObfuscatable = true;
}
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsNameRef.java b/dev/core/src/com/google/gwt/dev/js/ast/JsNameRef.java
index e967138..03c3433 100644
--- a/dev/core/src/com/google/gwt/dev/js/ast/JsNameRef.java
+++ b/dev/core/src/com/google/gwt/dev/js/ast/JsNameRef.java
@@ -16,7 +16,6 @@
package com.google.gwt.dev.js.ast;
import com.google.gwt.dev.jjs.SourceInfo;
-import com.google.gwt.dev.util.StringInterner;
/**
* Represents a JavaScript expression that references a name.
@@ -37,7 +36,7 @@
public JsNameRef(SourceInfo sourceInfo, String ident) {
super(sourceInfo);
- this.ident = StringInterner.get().intern(ident);
+ this.ident = ident;
}
public String getIdent() {
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsScope.java b/dev/core/src/com/google/gwt/dev/js/ast/JsScope.java
index b317f38..de9552a 100644
--- a/dev/core/src/com/google/gwt/dev/js/ast/JsScope.java
+++ b/dev/core/src/com/google/gwt/dev/js/ast/JsScope.java
@@ -16,7 +16,6 @@
package com.google.gwt.dev.js.ast;
import com.google.gwt.dev.js.JsKeywords;
-import com.google.gwt.dev.util.StringInterner;
import com.google.gwt.dev.util.collect.Lists;
import com.google.gwt.dev.util.collect.Maps;
@@ -60,7 +59,7 @@
if (JsKeywords.isKeyword(ident)) {
ident = ident + "_$";
}
- return StringInterner.get().intern(ident);
+ return ident;
}
private List<JsScope> children = Collections.emptyList();
@@ -73,7 +72,7 @@
*/
public JsScope(JsScope parent, String description) {
assert (parent != null);
- this.description = StringInterner.get().intern(description);
+ this.description = description;
this.parent = parent;
parent.children = Lists.add(parent.children, this);
}
@@ -82,7 +81,7 @@
* Subclasses can be parentless.
*/
protected JsScope(String description) {
- this.description = StringInterner.get().intern(description);
+ this.description = description;
this.parent = null;
}
@@ -201,8 +200,6 @@
* Creates a new name in this scope.
*/
protected JsName doCreateName(String ident, String shortIdent) {
- ident = StringInterner.get().intern(ident);
- shortIdent = StringInterner.get().intern(shortIdent);
JsName name = new JsName(this, ident, shortIdent);
names = Maps.putOrdered(names, ident, name);
return name;
diff --git a/dev/core/src/com/google/gwt/dev/js/ast/JsStringLiteral.java b/dev/core/src/com/google/gwt/dev/js/ast/JsStringLiteral.java
index f6fd8cc..1d2ea51 100644
--- a/dev/core/src/com/google/gwt/dev/js/ast/JsStringLiteral.java
+++ b/dev/core/src/com/google/gwt/dev/js/ast/JsStringLiteral.java
@@ -16,7 +16,6 @@
package com.google.gwt.dev.js.ast;
import com.google.gwt.dev.jjs.SourceInfo;
-import com.google.gwt.dev.util.StringInterner;
/**
* A JavaScript string literal expression.
@@ -28,7 +27,7 @@
// These only get created by JsProgram so that they can be interned.
JsStringLiteral(SourceInfo sourceInfo, String value) {
super(sourceInfo);
- this.value = StringInterner.get().intern(value);
+ this.value = value;
}
public String getValue() {
diff --git a/dev/core/src/com/google/gwt/dev/resource/impl/PathPrefixSet.java b/dev/core/src/com/google/gwt/dev/resource/impl/PathPrefixSet.java
index a1270ef..0963fc7 100644
--- a/dev/core/src/com/google/gwt/dev/resource/impl/PathPrefixSet.java
+++ b/dev/core/src/com/google/gwt/dev/resource/impl/PathPrefixSet.java
@@ -15,7 +15,6 @@
*/
package com.google.gwt.dev.resource.impl;
-import com.google.gwt.dev.util.StringInterner;
import com.google.gwt.dev.util.collect.Maps;
import java.util.ArrayList;
@@ -43,11 +42,10 @@
private PathPrefix prefix;
public TrieNode(String part) {
- this.part = StringInterner.get().intern(part);
+ this.part = part;
}
public TrieNode addChild(String part) {
- part = StringInterner.get().intern(part);
TrieNode newChild = new TrieNode(part);
assert !children.containsKey(part);
children = Maps.put(children, part, newChild);
diff --git a/dev/core/src/com/google/gwt/dev/resource/impl/ZipFileResource.java b/dev/core/src/com/google/gwt/dev/resource/impl/ZipFileResource.java
index b746913..e715bf6 100644
--- a/dev/core/src/com/google/gwt/dev/resource/impl/ZipFileResource.java
+++ b/dev/core/src/com/google/gwt/dev/resource/impl/ZipFileResource.java
@@ -15,8 +15,6 @@
*/
package com.google.gwt.dev.resource.impl;
-import com.google.gwt.dev.util.StringInterner;
-
import java.io.IOException;
import java.io.InputStream;
import java.util.zip.ZipEntry;
@@ -33,7 +31,7 @@
public ZipFileResource(ZipFileClassPathEntry classPathEntry, String path,
long lastModified) {
this.classPathEntry = classPathEntry;
- this.path = StringInterner.get().intern(path);
+ this.path = path;
this.lastModified = lastModified;
}
diff --git a/dev/core/src/com/google/gwt/dev/shell/DispatchClassInfo.java b/dev/core/src/com/google/gwt/dev/shell/DispatchClassInfo.java
index d4dbda9..27819b3 100644
--- a/dev/core/src/com/google/gwt/dev/shell/DispatchClassInfo.java
+++ b/dev/core/src/com/google/gwt/dev/shell/DispatchClassInfo.java
@@ -16,7 +16,6 @@
package com.google.gwt.dev.shell;
import com.google.gwt.dev.util.JsniRef;
-import com.google.gwt.dev.util.StringInterner;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
@@ -83,8 +82,7 @@
private void addMemberIfUnique(String name, List<Member> membersForName) {
if (membersForName.size() == 1) {
memberById.add(membersForName.get(0));
- memberIdByName.put(
- StringInterner.get().intern(name), memberById.size() - 1);
+ memberIdByName.put(name, memberById.size() - 1);
}
}
@@ -184,8 +182,7 @@
}
sb.append(")");
- String mangledName = StringInterner.get().intern(sb.toString());
-
+ String mangledName = sb.toString();
return mangledName;
}
diff --git a/dev/core/src/com/google/gwt/dev/util/StringInterner.java b/dev/core/src/com/google/gwt/dev/util/StringInterner.java
deleted file mode 100644
index e193293..0000000
--- a/dev/core/src/com/google/gwt/dev/util/StringInterner.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.gwt.dev.util;
-
-import com.google.gwt.thirdparty.guava.common.collect.Interner;
-import com.google.gwt.thirdparty.guava.common.collect.Interners;
-
-/**
- * A utility class for reducing String memory waste. Note that this does not use
- * the String.intern() method which would prevent GC and fill the PermGen space.
- * Instead, we use a Google Collections WeakInterner.
- */
-public class StringInterner {
- private static final StringInterner instance = new StringInterner();
-
- public static StringInterner get() {
- return instance;
- }
-
- private final Interner<String> stringPool = Interners.newWeakInterner();
-
- protected StringInterner() {
- }
-
- public String intern(String s) {
- return stringPool.intern(s);
- }
-
-}
diff --git a/eclipse/dev/.classpath b/eclipse/dev/.classpath
index 022782a..4502d00 100644
--- a/eclipse/dev/.classpath
+++ b/eclipse/dev/.classpath
@@ -40,6 +40,5 @@
<classpathentry kind="var" path="GWT_TOOLS/lib/htmlunit/htmlunit-r5940/htmlunit-core-js-r5940.jar" sourcepath="/GWT_TOOLS/lib/htmlunit/htmlunit-r5940/htmlunit-core-js-r5940-sources.jar"/>
<classpathentry kind="var" path="GWT_TOOLS/lib/htmlunit/htmlunit-r5940/htmlunit-r5940.jar" sourcepath="/GWT_TOOLS/lib/htmlunit/htmlunit-r5940/htmlunit-r5940-sources.jar"/>
<classpathentry kind="var" path="GWT_TOOLS/lib/protobuf/protobuf-2.2.0/protobuf-java-rebased-2.2.0.jar"/>
- <classpathentry kind="var" path="GWT_TOOLS/lib/guava/guava-r06/guava-r06-rebased.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>