Renames CompiledClass.getBinaryName() -> CompiledClass.getInternalName().
Patch by: jat
Review by: me
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@6660 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/dev/core/src/com/google/gwt/dev/javac/CompilationState.java b/dev/core/src/com/google/gwt/dev/javac/CompilationState.java
index 5c025ad..bb34b9d 100644
--- a/dev/core/src/com/google/gwt/dev/javac/CompilationState.java
+++ b/dev/core/src/com/google/gwt/dev/javac/CompilationState.java
@@ -374,7 +374,7 @@
for (CompilationUnit unit : unitMap.values()) {
if (unit.isCompiled()) {
for (CompiledClass compiledClass : unit.getCompiledClasses()) {
- classFileMap.put(compiledClass.getBinaryName(), compiledClass);
+ classFileMap.put(compiledClass.getInternalName(), compiledClass);
classFileMapBySource.put(compiledClass.getSourceName(), compiledClass);
}
}
diff --git a/dev/core/src/com/google/gwt/dev/javac/CompilationUnit.java b/dev/core/src/com/google/gwt/dev/javac/CompilationUnit.java
index ad46c6e..25e1e0e 100644
--- a/dev/core/src/com/google/gwt/dev/javac/CompilationUnit.java
+++ b/dev/core/src/com/google/gwt/dev/javac/CompilationUnit.java
@@ -446,6 +446,7 @@
/**
* Overridden to finalize; always returns {@link #getDisplayLocation()}.
*/
+ @Override
public final String toString() {
return getDisplayLocation();
}
@@ -544,8 +545,8 @@
List<String> classNames = new ArrayList<String>();
for (CompiledClass cc : getCompiledClasses()) {
if (isAnonymousClass(cc)
- && cc.getBinaryName().startsWith(topLevelClass + "$")) {
- classNames.add(cc.getBinaryName());
+ && cc.getInternalName().startsWith(topLevelClass + "$")) {
+ classNames.add(cc.getInternalName());
}
}
Collections.sort(classNames, new GeneratedClassnameComparator());
@@ -556,7 +557,7 @@
List<String> topLevelClasses = new ArrayList<String>();
for (CompiledClass cc : getCompiledClasses()) {
if (cc.getEnclosingClass() == null) {
- topLevelClasses.add(cc.binaryName);
+ topLevelClasses.add(cc.getInternalName());
}
}
return topLevelClasses;
@@ -584,6 +585,6 @@
* real difference and add a unit test, or else simply this.
*/
private boolean isAnonymousClass(CompiledClass cc) {
- return cc.isLocal() && isClassnameGenerated(cc.getBinaryName());
+ return cc.isLocal() && isClassnameGenerated(cc.getInternalName());
}
}
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 e5eadc4..e24b458 100644
--- a/dev/core/src/com/google/gwt/dev/javac/CompiledClass.java
+++ b/dev/core/src/com/google/gwt/dev/javac/CompiledClass.java
@@ -18,6 +18,7 @@
import com.google.gwt.core.ext.typeinfo.JRealClassType;
import com.google.gwt.dev.javac.impl.Shared;
import com.google.gwt.dev.util.DiskCache;
+import com.google.gwt.dev.util.Name.InternalName;
import org.eclipse.jdt.core.compiler.CharOperation;
import org.eclipse.jdt.internal.compiler.ClassFile;
@@ -64,8 +65,8 @@
return false;
}
- protected final String binaryName;
protected final CompiledClass enclosingClass;
+ protected final String internalName;
protected final boolean isLocal;
protected final String location;
protected final CompilationUnit unit;
@@ -87,8 +88,8 @@
this.typeDeclaration = typeDeclaration;
this.enclosingClass = enclosingClass;
SourceTypeBinding binding = typeDeclaration.binding;
- this.binaryName = CharOperation.charToString(binding.constantPoolName());
- ClassFile classFile = getClassFile(typeDeclaration, binaryName);
+ this.internalName = CharOperation.charToString(binding.constantPoolName());
+ ClassFile classFile = getClassFile(typeDeclaration, internalName);
byte[] bytes = classFile.getBytes();
this.cacheToken = diskCache.writeByteArray(bytes);
this.location = String.valueOf(classFile.fileName());
@@ -96,13 +97,6 @@
}
/**
- * Returns the binary class name, e.g. {@code java/util/Map$Entry}.
- */
- public String getBinaryName() {
- return binaryName;
- }
-
- /**
* Returns the bytes of the compiled class.
*/
public byte[] getBytes() {
@@ -114,17 +108,24 @@
}
/**
+ * Returns the binary class name, e.g. {@code java/util/Map$Entry}.
+ */
+ public String getInternalName() {
+ return internalName;
+ }
+
+ /**
* Returns the enclosing package, e.g. {@code java.util}.
*/
public String getPackageName() {
- return Shared.getPackageNameFromBinary(binaryName);
+ return Shared.getPackageNameFromBinary(internalName);
}
/**
* Returns the qualified source name, e.g. {@code java.util.Map.Entry}.
*/
public String getSourceName() {
- return binaryName.replace('/', '.').replace('$', '.');
+ return InternalName.toSourceName(internalName);
}
public CompilationUnit getUnit() {
@@ -141,7 +142,7 @@
@Override
public String toString() {
- return binaryName;
+ return internalName;
}
/**
diff --git a/dev/core/src/com/google/gwt/dev/javac/JdtCompiler.java b/dev/core/src/com/google/gwt/dev/javac/JdtCompiler.java
index ba1b7d7..818d4c6 100644
--- a/dev/core/src/com/google/gwt/dev/javac/JdtCompiler.java
+++ b/dev/core/src/com/google/gwt/dev/javac/JdtCompiler.java
@@ -273,8 +273,8 @@
private void recordBinaryTypes(Set<CompiledClass> compiledClasses) {
for (CompiledClass compiledClass : compiledClasses) {
- binaryTypes.put(compiledClass.getBinaryName(), compiledClass);
- binaryTypesRefs.put(compiledClass.getBinaryName(),
+ binaryTypes.put(compiledClass.getInternalName(), compiledClass);
+ binaryTypesRefs.put(compiledClass.getInternalName(),
compiledClass.getUnit().getDisplayLocation());
}
}
diff --git a/dev/core/src/com/google/gwt/dev/javac/JsniCollector.java b/dev/core/src/com/google/gwt/dev/javac/JsniCollector.java
index 4d04213..808d29e 100644
--- a/dev/core/src/com/google/gwt/dev/javac/JsniCollector.java
+++ b/dev/core/src/com/google/gwt/dev/javac/JsniCollector.java
@@ -25,6 +25,7 @@
import com.google.gwt.dev.js.ast.JsProgram;
import com.google.gwt.dev.js.ast.JsStatement;
import com.google.gwt.dev.util.Empty;
+import com.google.gwt.dev.util.Name.InternalName;
import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
import org.eclipse.jdt.internal.compiler.ast.Argument;
@@ -185,7 +186,7 @@
TypeDeclaration typeDecl = compiledClass.getTypeDeclaration();
int[] lineEnds = typeDecl.compilationResult.getLineSeparatorPositions();
List<JsniMethod> jsniMethods = new ArrayList<JsniMethod>();
- String enclosingType = compiledClass.getBinaryName().replace('/', '.');
+ String enclosingType = InternalName.toBinaryName(compiledClass.getInternalName());
AbstractMethodDeclaration[] methods = typeDecl.methods;
if (methods != null) {
for (AbstractMethodDeclaration method : methods) {
diff --git a/dev/core/src/com/google/gwt/dev/javac/TypeOracleMediator.java b/dev/core/src/com/google/gwt/dev/javac/TypeOracleMediator.java
index fb265fe..fee85bc 100644
--- a/dev/core/src/com/google/gwt/dev/javac/TypeOracleMediator.java
+++ b/dev/core/src/com/google/gwt/dev/javac/TypeOracleMediator.java
@@ -276,20 +276,20 @@
JRealClassType type = compiledClass.getRealClassType();
assert (type != null);
type.resurrect();
- binaryMapper.put(compiledClass.getBinaryName(), type);
+ binaryMapper.put(compiledClass.getInternalName(), type);
}
break;
case COMPILED:
for (CompiledClass compiledClass : unit.getCompiledClasses()) {
JRealClassType type = createType(compiledClass);
- binaryMapper.put(compiledClass.getBinaryName(), type);
+ binaryMapper.put(compiledClass.getInternalName(), type);
}
break;
case CHECKED:
for (CompiledClass compiledClass : unit.getCompiledClasses()) {
JRealClassType type = compiledClass.getRealClassType();
assert (type != null);
- binaryMapper.put(compiledClass.getBinaryName(), type);
+ binaryMapper.put(compiledClass.getInternalName(), type);
}
break;
}
diff --git a/dev/core/test/com/google/gwt/dev/javac/TypeOracleTestingUtils.java b/dev/core/test/com/google/gwt/dev/javac/TypeOracleTestingUtils.java
index d7d962d..f201f73 100644
--- a/dev/core/test/com/google/gwt/dev/javac/TypeOracleTestingUtils.java
+++ b/dev/core/test/com/google/gwt/dev/javac/TypeOracleTestingUtils.java
@@ -55,7 +55,7 @@
Set<CompiledClass> compiledClasses = unit.getCompiledClasses();
if (compiledClasses != null) {
for (CompiledClass compiledClass : compiledClasses) {
- validBinaryTypeNames.add(compiledClass.getBinaryName());
+ validBinaryTypeNames.add(compiledClass.getInternalName());
}
}
}