Removed the highly unnecessary JavaSourceFile abstraction, which served no real purpose.
Review by: jat
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@5166 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/dev/core/src/com/google/gwt/dev/cfg/ModuleDef.java b/dev/core/src/com/google/gwt/dev/cfg/ModuleDef.java
index 2756b87..1e2358c 100644
--- a/dev/core/src/com/google/gwt/dev/cfg/ModuleDef.java
+++ b/dev/core/src/com/google/gwt/dev/cfg/ModuleDef.java
@@ -22,9 +22,6 @@
import com.google.gwt.core.ext.linker.LinkerOrder.Order;
import com.google.gwt.core.ext.typeinfo.TypeOracle;
import com.google.gwt.dev.javac.CompilationState;
-import com.google.gwt.dev.javac.JavaSourceFile;
-import com.google.gwt.dev.javac.JavaSourceOracle;
-import com.google.gwt.dev.javac.impl.JavaSourceOracleImpl;
import com.google.gwt.dev.resource.Resource;
import com.google.gwt.dev.resource.impl.DefaultFilters;
import com.google.gwt.dev.resource.impl.PathPrefix;
@@ -83,8 +80,6 @@
private CompilationState lazyCompilationState;
- private JavaSourceOracle lazyJavaSourceOracle;
-
private ResourceOracleImpl lazyPublicOracle;
private ResourceOracleImpl lazySourceOracle;
@@ -233,7 +228,7 @@
public CompilationState getCompilationState(TreeLogger logger)
throws UnableToCompleteException {
if (lazyCompilationState == null) {
- lazyCompilationState = new CompilationState(logger, lazyJavaSourceOracle);
+ lazyCompilationState = new CompilationState(logger, lazySourceOracle);
checkForSeedTypes(logger);
}
return lazyCompilationState;
@@ -358,8 +353,8 @@
* @param partialPath
* @return
*/
- synchronized JavaSourceFile findSourceFile(String partialPath) {
- return lazyJavaSourceOracle.getSourceMap().get(partialPath);
+ synchronized Resource findSourceFile(String partialPath) {
+ return lazySourceOracle.getResourceMap().get(partialPath);
}
/**
@@ -409,7 +404,6 @@
branch.log(TreeLogger.WARN,
"No source path entries; expect subsequent failures", null);
}
- lazyJavaSourceOracle = new JavaSourceOracleImpl(lazySourceOracle);
PerfLogger.end();
}
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 53b7ec5..8fb5a22 100644
--- a/dev/core/src/com/google/gwt/dev/javac/CompilationState.java
+++ b/dev/core/src/com/google/gwt/dev/javac/CompilationState.java
@@ -20,6 +20,8 @@
import com.google.gwt.dev.javac.CompilationUnit.State;
import com.google.gwt.dev.javac.impl.SourceFileCompilationUnit;
import com.google.gwt.dev.js.ast.JsProgram;
+import com.google.gwt.dev.resource.Resource;
+import com.google.gwt.dev.resource.ResourceOracle;
import com.google.gwt.dev.util.PerfLogger;
import java.util.Collection;
@@ -62,7 +64,8 @@
* protected for testing.
*/
Map<String, CompilationUnit> graveyardUnits;
- private Set<JavaSourceFile> cachedSourceFiles = Collections.emptySet();
+
+ private Set<Resource> cachedSourceFiles = Collections.emptySet();
/**
* Classes mapped by binary name.
@@ -99,7 +102,7 @@
/**
* Our source file inputs.
*/
- private final JavaSourceOracle sourceOracle;
+ private final ResourceOracle sourceOracle;
/**
* Construct a new {@link CompilationState}.
@@ -107,7 +110,7 @@
* @param sourceOracle an oracle used to retrieve source code and check for
* changes in the underlying source code base
*/
- public CompilationState(TreeLogger logger, JavaSourceOracle sourceOracle) {
+ public CompilationState(TreeLogger logger, ResourceOracle sourceOracle) {
this.sourceOracle = sourceOracle;
refresh(logger);
}
@@ -127,7 +130,8 @@
}
/**
- * Reset all units to FRESH and clear TypeOracle to free up memory.
+ * Clear up all internal state to free up memory. Resets all units to FRESH
+ * and clears TypeOracle.
*/
public void clear() {
// Always remove all generated compilation units.
@@ -372,17 +376,17 @@
private void refreshFromSourceOracle() {
// See if the source oracle has changed.
- Set<JavaSourceFile> newSourceFiles = sourceOracle.getSourceFiles();
+ Set<Resource> newSourceFiles = sourceOracle.getResources();
if (cachedSourceFiles == newSourceFiles) {
return;
}
// Divide resources into changed and unchanged.
- Set<JavaSourceFile> unchanged = new HashSet<JavaSourceFile>(
+ Set<Resource> unchanged = new HashSet<Resource>(
cachedSourceFiles);
unchanged.retainAll(newSourceFiles);
- Set<JavaSourceFile> changed = new HashSet<JavaSourceFile>(newSourceFiles);
+ Set<Resource> changed = new HashSet<Resource>(newSourceFiles);
changed.removeAll(unchanged);
// First remove any stale units.
@@ -396,8 +400,8 @@
}
// Then add any new source files.
- for (JavaSourceFile newSourceFile : changed) {
- String typeName = newSourceFile.getTypeName();
+ for (Resource newSourceFile : changed) {
+ String typeName = SourceFileCompilationUnit.getTypeName(newSourceFile);
assert (!unitMap.containsKey(typeName));
unitMap.put(typeName, new SourceFileCompilationUnit(newSourceFile));
// invalid a graveyard unit, if a new unit has the same type.
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 bede4e1..cd296df 100644
--- a/dev/core/src/com/google/gwt/dev/javac/CompilationUnit.java
+++ b/dev/core/src/com/google/gwt/dev/javac/CompilationUnit.java
@@ -21,6 +21,7 @@
import com.google.gwt.dev.asm.commons.EmptyVisitor;
import com.google.gwt.dev.jdt.TypeRefVisitor;
import com.google.gwt.dev.shell.CompilingClassLoader;
+import com.google.gwt.dev.util.DiskCache;
import com.google.gwt.dev.util.Util;
import com.google.gwt.dev.util.collect.HashMap;
import com.google.gwt.dev.util.collect.HashSet;
@@ -55,6 +56,8 @@
*/
public abstract class CompilationUnit {
+ protected static final DiskCache diskCache = new DiskCache();
+
/**
* Encapsulates the functionality to find all nested classes of this class
* that have compiler-generated names. All class bytes are loaded from the
diff --git a/dev/core/src/com/google/gwt/dev/javac/JavaSourceFile.java b/dev/core/src/com/google/gwt/dev/javac/JavaSourceFile.java
deleted file mode 100644
index 571b501..0000000
--- a/dev/core/src/com/google/gwt/dev/javac/JavaSourceFile.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright 2008 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.javac;
-
-/**
- * Provides information about a single Java source file.
- */
-public abstract class JavaSourceFile {
-
- /**
- * Overridden to finalize; always returns object identity.
- */
- @Override
- public final boolean equals(Object obj) {
- return super.equals(obj);
- }
-
- /**
- * Returns the last modified time of the compilation unit.
- */
- public abstract long getLastModified();
-
- /**
- * Returns the user-relevant location of the source file. No programmatic
- * assumptions should be made about the return value.
- */
- public abstract String getLocation();
-
- /**
- * Returns the name of the package.
- */
- public abstract String getPackageName();
-
- /**
- * Returns the unqualified name of the top level public type.
- */
- public abstract String getShortName();
-
- /**
- * Returns the fully-qualified name of the top level public type.
- */
- public abstract String getTypeName();
-
- /**
- * Overridden to finalize; always returns identity hash code.
- */
- @Override
- public final int hashCode() {
- return super.hashCode();
- }
-
- /**
- * @return true if the corresponding source comes from super-source.
- */
- public abstract boolean isSuperSource();
-
- /**
- * Returns the Java code contained in this source file. May return
- * <code>null</code> if this {@link JavaSourceFile} has been invalidated by
- * its containing {@link JavaSourceOracle}. This method may be expensive as
- * the implementor is generally not required to cache the results.
- */
- public abstract String readSource();
-
- /**
- * Overridden to finalize; always returns {@link #getLocation()}.
- */
- public final String toString() {
- return getLocation();
- }
-
-}
diff --git a/dev/core/src/com/google/gwt/dev/javac/JavaSourceOracle.java b/dev/core/src/com/google/gwt/dev/javac/JavaSourceOracle.java
deleted file mode 100644
index e1b3730..0000000
--- a/dev/core/src/com/google/gwt/dev/javac/JavaSourceOracle.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright 2006 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.javac;
-
-import java.util.Map;
-import java.util.Set;
-
-/**
- * An unmodifiable view of a module's Java source tree.
- *
- * <p>
- * The identity of the returned sets and maps will change exactly when the
- * underlying module is refreshed.
- * </p>
- *
- * <p>
- * Even when the identity of a returned set changes, the identity of any
- * contained {@link JavaSourceFile} values is guaranteed to differ from a
- * previous result exactly when that particular source file becomes invalid.
- * </p>
- *
- * <p>
- * A source file could become invalid for various reasons, including:
- * <ul>
- * <li>the underlying file was deleted or modified</li>
- * <li>another file with the same logical name superceded it on the classpath</li>
- * <li>the underlying module changed to exclude this file or supercede it with
- * another file</li>
- * </ul>
- * </p>
- *
- * <p>
- * After a refresh, a client can reliably detect changes by checking which of
- * its cached source files is still contained in the new result of
- * {@link #getSourceFiles()}.
- * </p>
- */
-public interface JavaSourceOracle {
-
- /**
- * Frees up all existing resources and transient internal state. The
- * underlying ResourceOracle must be refreshed to be valid again.
- */
- void clear();
-
- /**
- * Returns an unmodifiable set of fully-qualified class names with constant
- * lookup time.
- */
- Set<String> getClassNames();
-
- /**
- * Returns an unmodifiable set of unique source files with constant lookup
- * time.
- */
- Set<JavaSourceFile> getSourceFiles();
-
- /**
- * Returns an unmodifiable map of fully-qualified class name to source file.
- */
- Map<String, JavaSourceFile> getSourceMap();
-}
diff --git a/dev/core/src/com/google/gwt/dev/javac/impl/JavaSourceOracleImpl.java b/dev/core/src/com/google/gwt/dev/javac/impl/JavaSourceOracleImpl.java
deleted file mode 100644
index c7bbda1..0000000
--- a/dev/core/src/com/google/gwt/dev/javac/impl/JavaSourceOracleImpl.java
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
- * Copyright 2008 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.javac.impl;
-
-import com.google.gwt.dev.javac.JavaSourceFile;
-import com.google.gwt.dev.javac.JavaSourceOracle;
-import com.google.gwt.dev.resource.Resource;
-import com.google.gwt.dev.resource.ResourceOracle;
-import com.google.gwt.dev.util.Util;
-
-import java.io.InputStream;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * Implements {@link JavaSourceOracle} on top of a {@link ResourceOracle}.
- */
-public class JavaSourceOracleImpl implements JavaSourceOracle {
-
- private static class JavaSourceFileImpl extends JavaSourceFile {
-
- private final String location;
- private final String name;
- private final String packageName;
- private Resource resource;
- private final String shortName;
-
- public JavaSourceFileImpl(Resource resource) {
- this.resource = resource;
- location = resource.getLocation();
- String path = resource.getPath();
- assert (path.endsWith(".java"));
- path = path.substring(0, path.lastIndexOf('.'));
- name = path.replace('/', '.');
- int pos = name.lastIndexOf('.');
- if (pos < 0) {
- shortName = name;
- packageName = "";
- } else {
- shortName = name.substring(pos + 1);
- packageName = name.substring(0, pos);
- }
- }
-
- @Override
- public long getLastModified() {
- return resource.getLastModified();
- }
-
- @Override
- public String getLocation() {
- return location;
- }
-
- @Override
- public String getPackageName() {
- return packageName;
- }
-
- @Override
- public String getShortName() {
- return shortName;
- }
-
- @Override
- public String getTypeName() {
- return name;
- }
-
- @Override
- public boolean isSuperSource() {
- return resource.wasRerooted();
- }
-
- @Override
- public String readSource() {
- if (resource != null) {
- InputStream contents = resource.openContents();
- return Util.readStreamAsString(contents);
- }
- return null;
- }
-
- Resource getResource() {
- return resource;
- }
-
- void invalidate() {
- resource = null;
- }
- }
-
- /**
- * The last resource set returned by my oracle.
- */
- private Set<Resource> cachedResources = Collections.emptySet();
-
- /**
- * An unmodifiable set of exposedClassNames to return to a client.
- */
- private Set<String> exposedClassNames = Collections.emptySet();
-
- /**
- * An unmodifiable set of exposedSourceFiles to return to a client.
- */
- private Set<JavaSourceFile> exposedSourceFiles = Collections.emptySet();
-
- /**
- * An unmodifiable source map to return to a client.
- */
- private Map<String, JavaSourceFile> exposedSourceMap = Collections.emptyMap();
-
- /**
- * My resource oracle.
- */
- private final ResourceOracle oracle;
-
- /**
- * My internal set of source files.
- */
- private final Set<JavaSourceFileImpl> sourceFiles = new HashSet<JavaSourceFileImpl>();
-
- public JavaSourceOracleImpl(ResourceOracle oracle) {
- this.oracle = oracle;
- }
-
- public void clear() {
- cachedResources = Collections.emptySet();
- exposedClassNames = Collections.emptySet();
- exposedSourceFiles = Collections.emptySet();
- exposedSourceMap = Collections.emptyMap();
- sourceFiles.clear();
- oracle.clear();
- }
-
- public Set<String> getClassNames() {
- refresh();
- return exposedClassNames;
- }
-
- public Set<JavaSourceFile> getSourceFiles() {
- refresh();
- return exposedSourceFiles;
- }
-
- public Map<String, JavaSourceFile> getSourceMap() {
- refresh();
- return exposedSourceMap;
- }
-
- private void refresh() {
- Set<Resource> newResources = oracle.getResources();
- if (newResources == cachedResources) {
- // We're up to date.
- return;
- }
-
- // Divide resources into changed and unchanged.
- Set<Resource> unchanged = new HashSet<Resource>(cachedResources);
- unchanged.retainAll(newResources);
-
- Set<Resource> changed = new HashSet<Resource>(newResources);
- changed.removeAll(unchanged);
-
- // First remove any stale source files.
- for (Iterator<JavaSourceFileImpl> it = sourceFiles.iterator(); it.hasNext();) {
- JavaSourceFileImpl sourceFile = it.next();
- if (!unchanged.contains(sourceFile.getResource())) {
- sourceFile.invalidate();
- it.remove();
- }
- }
-
- // Then add any new source files.
- for (Resource newResource : changed) {
- sourceFiles.add(new JavaSourceFileImpl(newResource));
- }
-
- // Finally rebuild the unmodifiable views.
- Map<String, JavaSourceFile> sourceMap = new HashMap<String, JavaSourceFile>();
- for (JavaSourceFileImpl sourceFile : sourceFiles) {
- sourceMap.put(sourceFile.getTypeName(), sourceFile);
- }
- exposedSourceMap = Collections.unmodifiableMap(sourceMap);
- exposedClassNames = Collections.unmodifiableSet(sourceMap.keySet());
- HashSet<JavaSourceFile> sourceFilesConstantLookup = new HashSet<JavaSourceFile>(
- sourceMap.values());
- exposedSourceFiles = Collections.unmodifiableSet(sourceFilesConstantLookup);
-
- // Record the update.
- cachedResources = newResources;
- }
-}
diff --git a/dev/core/src/com/google/gwt/dev/javac/impl/SourceFileCompilationUnit.java b/dev/core/src/com/google/gwt/dev/javac/impl/SourceFileCompilationUnit.java
index 6c9830e..6d68253 100644
--- a/dev/core/src/com/google/gwt/dev/javac/impl/SourceFileCompilationUnit.java
+++ b/dev/core/src/com/google/gwt/dev/javac/impl/SourceFileCompilationUnit.java
@@ -16,16 +16,38 @@
package com.google.gwt.dev.javac.impl;
import com.google.gwt.dev.javac.CompilationUnit;
-import com.google.gwt.dev.javac.JavaSourceFile;
+import com.google.gwt.dev.resource.Resource;
+import com.google.gwt.dev.util.Util;
+
+import java.io.InputStream;
/**
* A compilation unit that was generated.
*/
public class SourceFileCompilationUnit extends CompilationUnit {
- private JavaSourceFile sourceFile;
+ public static String getTypeName(Resource sourceFile) {
+ String path = sourceFile.getPath();
+ assert (path.endsWith(".java"));
+ path = path.substring(0, path.lastIndexOf('.'));
+ return path.replace('/', '.');
+ }
- public SourceFileCompilationUnit(JavaSourceFile sourceFile) {
+ public static String readSource(Resource sourceFile) {
+ InputStream contents = sourceFile.openContents();
+ return Util.readStreamAsString(contents);
+ }
+
+ /**
+ * A token to retrieve this object's bytes from the disk cache. It's generally
+ * much faster to read from the disk cache than to reread individual
+ * resources.
+ */
+ private long cacheToken = -1;
+
+ private Resource sourceFile;
+
+ public SourceFileCompilationUnit(Resource sourceFile) {
this.sourceFile = sourceFile;
}
@@ -41,16 +63,22 @@
@Override
public String getSource() {
- return sourceFile.readSource();
+ if (cacheToken < 0) {
+ String sourceCode = readSource(sourceFile);
+ cacheToken = diskCache.writeString(sourceCode);
+ return sourceCode;
+ } else {
+ return diskCache.readString(cacheToken);
+ }
}
- public JavaSourceFile getSourceFile() {
+ public Resource getSourceFile() {
return sourceFile;
}
@Override
public String getTypeName() {
- return sourceFile.getTypeName();
+ return getTypeName(sourceFile);
}
@Override
@@ -60,6 +88,6 @@
@Override
public boolean isSuperSource() {
- return sourceFile.isSuperSource();
+ return sourceFile.wasRerooted();
}
}
diff --git a/dev/core/test/com/google/gwt/dev/javac/CompilationStateTest.java b/dev/core/test/com/google/gwt/dev/javac/CompilationStateTest.java
index d0fdef0..ef955fc 100644
--- a/dev/core/test/com/google/gwt/dev/javac/CompilationStateTest.java
+++ b/dev/core/test/com/google/gwt/dev/javac/CompilationStateTest.java
@@ -18,8 +18,10 @@
import com.google.gwt.core.ext.TreeLogger;
import com.google.gwt.dev.javac.CompilationUnit.State;
import com.google.gwt.dev.javac.impl.JavaResourceBase;
-import com.google.gwt.dev.javac.impl.MockJavaSourceFile;
+import com.google.gwt.dev.javac.impl.MockJavaResource;
+import com.google.gwt.dev.javac.impl.MockResourceOracle;
import com.google.gwt.dev.javac.impl.SourceFileCompilationUnit;
+import com.google.gwt.dev.resource.Resource;
import com.google.gwt.dev.util.log.AbstractTreeLogger;
import com.google.gwt.dev.util.log.PrintWriterTreeLogger;
@@ -60,8 +62,8 @@
return TreeLogger.NULL;
}
- private MockJavaSourceOracle oracle = new MockJavaSourceOracle(
- JavaSourceCodeBase.getStandardResources());
+ private MockResourceOracle oracle = new MockResourceOracle(
+ JavaResourceBase.getStandardResources());
private CompilationState state = new CompilationState(createTreeLogger(),
oracle);
@@ -70,9 +72,8 @@
validateCompilationState();
// Add a unit and ensure it shows up.
- state.addGeneratedCompilationUnits(createTreeLogger(),
- getCompilationUnits(JavaSourceCodeBase.FOO));
- validateCompilationState(JavaSourceCodeBase.FOO.getTypeName());
+ addGeneratedUnits(JavaResourceBase.FOO);
+ validateCompilationState(SourceFileCompilationUnit.getTypeName(JavaResourceBase.FOO));
// Ensure it disappears after a refresh.
state.refresh(createTreeLogger());
@@ -81,20 +82,20 @@
/* test that a generated unit, if unchanged, is reused */
public void testCaching() {
- testCaching(JavaSourceCodeBase.FOO);
+ testCaching(JavaResourceBase.FOO);
}
/* test that mutiple generated units, if unchanged, are reused */
public void testCachingOfMultipleUnits() {
- testCaching(JavaSourceCodeBase.BAR, JavaSourceCodeBase.FOO);
+ testCaching(JavaResourceBase.BAR, JavaResourceBase.FOO);
}
public void testCompileError() {
- oracle.add(JavaSourceCodeBase.BAR);
+ oracle.add(JavaResourceBase.BAR);
state.refresh(createTreeLogger());
CompilationUnit badUnit = state.getCompilationUnitMap().get(
- JavaSourceCodeBase.BAR.getTypeName());
+ SourceFileCompilationUnit.getTypeName(JavaResourceBase.BAR));
assertSame(State.ERROR, badUnit.getState());
Set<CompilationUnit> goodUnits = new HashSet<CompilationUnit>(
@@ -105,18 +106,16 @@
public void testCompileWithGeneratedUnits() {
assertUnitsChecked(state.getCompilationUnits());
- state.addGeneratedCompilationUnits(createTreeLogger(),
- getCompilationUnits(JavaSourceCodeBase.FOO));
+ addGeneratedUnits(JavaResourceBase.FOO);
assertUnitsChecked(state.getCompilationUnits());
}
public void testCompileWithGeneratedUnitsError() {
assertUnitsChecked(state.getCompilationUnits());
- state.addGeneratedCompilationUnits(createTreeLogger(),
- getCompilationUnits(JavaSourceCodeBase.BAR));
+ addGeneratedUnits(JavaResourceBase.BAR);
CompilationUnit badUnit = state.getCompilationUnitMap().get(
- JavaSourceCodeBase.BAR.getTypeName());
+ SourceFileCompilationUnit.getTypeName(JavaResourceBase.BAR));
assertSame(State.ERROR, badUnit.getState());
Set<CompilationUnit> goodUnits = new HashSet<CompilationUnit>(
@@ -127,20 +126,22 @@
public void testCompileWithGeneratedUnitsErrorAndDepedentGeneratedUnit() {
assertUnitsChecked(state.getCompilationUnits());
- MockJavaSourceFile badFoo = new MockJavaSourceFile(JavaResourceBase.FOO) {
+ MockJavaResource badFoo = new MockJavaResource(
+ SourceFileCompilationUnit.getTypeName(JavaResourceBase.FOO)) {
@Override
- public String readSource() {
- return super.readSource() + "\ncompilation error LOL!";
+ protected CharSequence getContent() {
+ return SourceFileCompilationUnit.readSource(JavaResourceBase.FOO)
+ + "\ncompilation error LOL!";
}
};
state.addGeneratedCompilationUnits(createTreeLogger(), getCompilationUnits(
- badFoo, JavaSourceCodeBase.BAR));
+ badFoo, JavaResourceBase.BAR));
CompilationUnit badUnit = state.getCompilationUnitMap().get(
- badFoo.getTypeName());
+ SourceFileCompilationUnit.getTypeName(badFoo));
assertSame(State.ERROR, badUnit.getState());
CompilationUnit invalidUnit = state.getCompilationUnitMap().get(
- JavaSourceCodeBase.BAR.getTypeName());
+ SourceFileCompilationUnit.getTypeName(JavaResourceBase.BAR));
assertSame(State.FRESH, invalidUnit.getState());
Set<CompilationUnit> goodUnits = new HashSet<CompilationUnit>(
@@ -155,13 +156,12 @@
* another generated unit it depends on can be reused
*/
public void testComplexCacheInvalidation() {
- Set<CompilationUnit> modifiedUnits = getCompilationUnits(JavaSourceCodeBase.FOO);
- modifiedUnits.addAll(getModifiedCompilationUnits(JavaSourceCodeBase.BAR));
+ Set<CompilationUnit> modifiedUnits = getCompilationUnits(JavaResourceBase.FOO);
+ modifiedUnits.addAll(getModifiedCompilationUnits(JavaResourceBase.BAR));
Set<String> reusedTypes = new HashSet<String>();
- reusedTypes.add(JavaSourceCodeBase.FOO.getTypeName());
- testCachingOverMultipleRefreshes(getCompilationUnits(
- JavaSourceCodeBase.FOO, JavaSourceCodeBase.BAR), modifiedUnits,
- reusedTypes, 1);
+ reusedTypes.add(SourceFileCompilationUnit.getTypeName(JavaResourceBase.FOO));
+ testCachingOverMultipleRefreshes(getCompilationUnits(JavaResourceBase.FOO,
+ JavaResourceBase.BAR), modifiedUnits, reusedTypes, 1);
}
public void testInitialization() {
@@ -169,17 +169,16 @@
}
public void testInvalidation() {
- testCachingOverMultipleRefreshes(
- getCompilationUnits(JavaSourceCodeBase.FOO),
- getModifiedCompilationUnits(JavaSourceCodeBase.FOO),
+ testCachingOverMultipleRefreshes(getCompilationUnits(JavaResourceBase.FOO),
+ getModifiedCompilationUnits(JavaResourceBase.FOO),
Collections.<String> emptySet(), 1);
}
public void testInvalidationOfMultipleUnits() {
- testCachingOverMultipleRefreshes(getCompilationUnits(
- JavaSourceCodeBase.BAR, JavaSourceCodeBase.FOO),
- getModifiedCompilationUnits(JavaSourceCodeBase.BAR,
- JavaSourceCodeBase.FOO), Collections.<String> emptySet(), 2);
+ testCachingOverMultipleRefreshes(getCompilationUnits(JavaResourceBase.BAR,
+ JavaResourceBase.FOO), getModifiedCompilationUnits(
+ JavaResourceBase.BAR, JavaResourceBase.FOO),
+ Collections.<String> emptySet(), 2);
}
/*
@@ -189,11 +188,11 @@
*/
public void testInvalidationWhenSourceUnitsChange() {
validateCompilationState();
- oracle.add(JavaSourceCodeBase.FOO);
+ oracle.add(JavaResourceBase.FOO);
state.refresh(createTreeLogger());
// add generated units
- Set<CompilationUnit> generatedCups = getCompilationUnits(JavaSourceCodeBase.BAR);
+ Set<CompilationUnit> generatedCups = getCompilationUnits(JavaResourceBase.BAR);
Map<String, CompilationUnit> usefulUnits = state.getUsefulGraveyardUnits(generatedCups);
assertEquals(0, usefulUnits.size());
state.addGeneratedCompilationUnits(createTreeLogger(), generatedCups,
@@ -201,10 +200,12 @@
assertUnitsChecked(state.getCompilationUnits());
// change unit in source oracle
- oracle.replace(new MockJavaSourceFile(JavaSourceCodeBase.FOO) {
+ oracle.replace(new MockJavaResource(
+ SourceFileCompilationUnit.getTypeName(JavaResourceBase.FOO)) {
@Override
- public String readSource() {
- return JavaSourceCodeBase.FOO.readSource() + "\n";
+ protected CharSequence getContent() {
+ return SourceFileCompilationUnit.readSource(JavaResourceBase.FOO)
+ + "\n";
}
});
state.refresh(createTreeLogger());
@@ -223,7 +224,7 @@
validateCompilationState();
int size = state.getCompilationUnits().size();
- oracle.add(JavaSourceCodeBase.FOO);
+ oracle.add(JavaResourceBase.FOO);
state.refresh(createTreeLogger());
assertEquals(size + 1, state.getCompilationUnits().size());
validateCompilationState();
@@ -234,7 +235,7 @@
}
public void testSourceOracleEmpty() {
- oracle = new MockJavaSourceOracle();
+ oracle = new MockResourceOracle();
state = new CompilationState(createTreeLogger(), oracle);
validateCompilationState();
}
@@ -243,7 +244,7 @@
validateCompilationState();
int size = state.getCompilationUnits().size();
- oracle.remove(JavaSourceCodeBase.OBJECT.getTypeName());
+ oracle.remove(JavaResourceBase.OBJECT.getPath());
state.refresh(createTreeLogger());
assertEquals(size - 1, state.getCompilationUnits().size());
validateCompilationState();
@@ -253,7 +254,12 @@
validateCompilationState();
int size = state.getCompilationUnits().size();
- oracle.replace(new MockJavaSourceFile(JavaSourceCodeBase.OBJECT));
+ oracle.replace(new MockJavaResource("java.lang.Object") {
+ @Override
+ protected CharSequence getContent() {
+ return SourceFileCompilationUnit.readSource(JavaResourceBase.OBJECT);
+ }
+ });
state.refresh(createTreeLogger());
assertEquals(size, state.getCompilationUnits().size());
validateCompilationState();
@@ -263,7 +269,7 @@
validateCompilationState();
int size = state.getCompilationUnits().size();
- oracle.replace(JavaSourceCodeBase.OBJECT);
+ oracle.replace(JavaResourceBase.OBJECT);
state.refresh(createTreeLogger());
assertEquals(size, state.getCompilationUnits().size());
validateCompilationState();
@@ -271,17 +277,22 @@
/* test if generatedUnits that depend on stale generatedUnits are invalidated */
public void testTransitiveInvalidation() {
- Set<CompilationUnit> modifiedUnits = getModifiedCompilationUnits(JavaSourceCodeBase.FOO);
- modifiedUnits.addAll(getCompilationUnits(JavaSourceCodeBase.BAR));
- testCachingOverMultipleRefreshes(getCompilationUnits(
- JavaSourceCodeBase.BAR, JavaSourceCodeBase.FOO), modifiedUnits,
- Collections.<String> emptySet(), 2);
+ Set<CompilationUnit> modifiedUnits = getModifiedCompilationUnits(JavaResourceBase.FOO);
+ modifiedUnits.addAll(getCompilationUnits(JavaResourceBase.BAR));
+ testCachingOverMultipleRefreshes(getCompilationUnits(JavaResourceBase.BAR,
+ JavaResourceBase.FOO), modifiedUnits, Collections.<String> emptySet(),
+ 2);
+ }
+
+ private void addGeneratedUnits(MockJavaResource... sourceFiles) {
+ Set<CompilationUnit> units = getCompilationUnits(sourceFiles);
+ state.addGeneratedCompilationUnits(createTreeLogger(), units);
}
private Set<CompilationUnit> getCompilationUnits(
- JavaSourceFile... sourceFiles) {
+ MockJavaResource... sourceFiles) {
Set<CompilationUnit> units = new HashSet<CompilationUnit>();
- for (JavaSourceFile sourceFile : sourceFiles) {
+ for (MockJavaResource sourceFile : sourceFiles) {
units.add(new SourceFileCompilationUnit(sourceFile) {
@Override
public boolean isGenerated() {
@@ -293,9 +304,9 @@
}
private Set<CompilationUnit> getModifiedCompilationUnits(
- JavaSourceFile... sourceFiles) {
+ MockJavaResource... sourceFiles) {
Set<CompilationUnit> units = new HashSet<CompilationUnit>();
- for (JavaSourceFile sourceFile : sourceFiles) {
+ for (MockJavaResource sourceFile : sourceFiles) {
units.add(new SourceFileCompilationUnit(sourceFile) {
/* modified the source */
@Override
@@ -312,10 +323,10 @@
return units;
}
- private void testCaching(JavaSourceFile... files) {
+ private void testCaching(MockJavaResource... files) {
Set<String> reusedTypes = new HashSet<String>();
- for (JavaSourceFile file : files) {
- reusedTypes.add(file.getTypeName());
+ for (MockJavaResource file : files) {
+ reusedTypes.add(SourceFileCompilationUnit.getTypeName(file));
}
testCachingOverMultipleRefreshes(getCompilationUnits(files),
getCompilationUnits(files), reusedTypes, 0);
@@ -406,8 +417,8 @@
assertEquals(new HashSet<CompilationUnit>(unitMap.values()), units);
// Save off a mutable copy of the source map and generated types to compare.
- Map<String, JavaSourceFile> sourceMap = new HashMap<String, JavaSourceFile>(
- oracle.getSourceMap());
+ Map<String, Resource> sourceMap = new HashMap<String, Resource>(
+ oracle.getResourceMap());
Set<String> generatedTypes = new HashSet<String>(
Arrays.asList(generatedTypeNames));
assertEquals(sourceMap.size() + generatedTypes.size(), units.size());
@@ -422,9 +433,10 @@
assertTrue(generatedTypes.contains(className));
assertNotNull(generatedTypes.remove(className));
} else {
- assertTrue(sourceMap.containsKey(className));
+ String partialPath = className.replace('.', '/') + ".java";
+ assertTrue(sourceMap.containsKey(partialPath));
// TODO: Validate the source file matches the resource.
- assertNotNull(sourceMap.remove(className));
+ assertNotNull(sourceMap.remove(partialPath));
}
}
// The mutable sets should be empty now.
diff --git a/dev/core/test/com/google/gwt/dev/javac/CompilationUnitFileReferenceTest.java b/dev/core/test/com/google/gwt/dev/javac/CompilationUnitFileReferenceTest.java
index 90f119a..04bbf1a 100644
--- a/dev/core/test/com/google/gwt/dev/javac/CompilationUnitFileReferenceTest.java
+++ b/dev/core/test/com/google/gwt/dev/javac/CompilationUnitFileReferenceTest.java
@@ -18,7 +18,7 @@
import com.google.gwt.core.ext.TreeLogger;
import com.google.gwt.dev.javac.impl.JavaResourceBase;
import com.google.gwt.dev.javac.impl.MockJavaResource;
-import com.google.gwt.dev.javac.impl.MockJavaSourceFile;
+import com.google.gwt.dev.javac.impl.MockResourceOracle;
import com.google.gwt.dev.javac.impl.SourceFileCompilationUnit;
import com.google.gwt.dev.resource.Resource;
import com.google.gwt.dev.util.log.AbstractTreeLogger;
@@ -159,8 +159,8 @@
EXPECTED_DEPENDENCIES.put(source.getLocation(), targetSet);
}
- private MockJavaSourceOracle oracle = new MockJavaSourceOracle(
- JavaSourceCodeBase.getStandardResources());
+ private MockResourceOracle oracle = new MockResourceOracle(
+ JavaResourceBase.getStandardResources());
private CompilationState state = new CompilationState(createTreeLogger(),
oracle);
@@ -174,7 +174,7 @@
}
public void testBinaryBindingsWithSimpleUnits() {
- testBinaryBindings(JavaSourceCodeBase.FOO, JavaSourceCodeBase.BAR);
+ testBinaryBindings(JavaResourceBase.FOO, JavaResourceBase.BAR);
}
public void testBinaryBindingsWithStaticInnerClass() {
@@ -190,7 +190,7 @@
}
public void testSourceBindingsWithSimpleUnits() {
- testSourceBindings(JavaSourceCodeBase.FOO, JavaSourceCodeBase.BAR);
+ testSourceBindings(JavaResourceBase.FOO, JavaResourceBase.BAR);
}
public void testSourceBindingsWithStaticInnerClass() {
@@ -199,22 +199,22 @@
public void testWithGeneratedUnits() {
state.addGeneratedCompilationUnits(createTreeLogger(),
- copyAsGeneratedUnits(JavaSourceCodeBase.BAR, JavaSourceCodeBase.FOO));
- assertRefsMatchExpectedRefs(JavaSourceCodeBase.BAR, JavaSourceCodeBase.FOO);
+ copyAsGeneratedUnits(JavaResourceBase.BAR, JavaResourceBase.FOO));
+ assertRefsMatchExpectedRefs(JavaResourceBase.BAR, JavaResourceBase.FOO);
}
public void testWithMixedUnits() {
- oracle.add(JavaSourceCodeBase.FOO);
+ oracle.add(JavaResourceBase.FOO);
state.refresh(createTreeLogger());
state.addGeneratedCompilationUnits(createTreeLogger(),
- copyAsGeneratedUnits(JavaSourceCodeBase.BAR));
- assertRefsMatchExpectedRefs(JavaSourceCodeBase.BAR, JavaSourceCodeBase.FOO);
+ copyAsGeneratedUnits(JavaResourceBase.BAR));
+ assertRefsMatchExpectedRefs(JavaResourceBase.BAR, JavaResourceBase.FOO);
}
- private void assertRefsMatchExpectedRefs(JavaSourceFile... files) {
- for (JavaSourceFile sourceFile : files) {
+ private void assertRefsMatchExpectedRefs(Resource... files) {
+ for (Resource sourceFile : files) {
Set<String> sourceFileRefs = state.getCompilationUnitMap().get(
- sourceFile.getTypeName()).getFileNameRefs();
+ SourceFileCompilationUnit.getTypeName(sourceFile)).getFileNameRefs();
Set<String> expectedSourceFileRefs = EXPECTED_DEPENDENCIES.get(sourceFile.getLocation());
assertEquals(expectedSourceFileRefs, sourceFileRefs);
}
@@ -224,10 +224,9 @@
* Returns copies of units as generated units for testing interactions with
* generated units.
*/
- private Set<CompilationUnit> copyAsGeneratedUnits(
- JavaSourceFile... sourceFiles) {
+ private Set<CompilationUnit> copyAsGeneratedUnits(Resource... sourceFiles) {
Set<CompilationUnit> units = new HashSet<CompilationUnit>();
- for (JavaSourceFile sourceFile : sourceFiles) {
+ for (Resource sourceFile : sourceFiles) {
units.add(new SourceFileCompilationUnit(sourceFile) {
@Override
public boolean isGenerated() {
@@ -243,40 +242,24 @@
* have only binary references to the previous unit(s). This tests the binary
* reference matching in {@link CompilationState}.
*/
- private void testBinaryBindings(JavaSourceFile... files) {
- for (JavaSourceFile sourceFile : files) {
+ private void testBinaryBindings(Resource... files) {
+ for (Resource sourceFile : files) {
oracle.add(sourceFile);
state.refresh(createTreeLogger());
}
assertRefsMatchExpectedRefs(files);
}
- private void testBinaryBindings(MockJavaResource... resources) {
- JavaSourceFile[] files = new JavaSourceFile[resources.length];
- for (int i = 0; i < resources.length; ++i) {
- files[i] = new MockJavaSourceFile(resources[i]);
- }
- testBinaryBindings(files);
- }
-
/**
* Compiles all files together so that all units will have source references
* to each other. This tests the source reference matching in
* {@link CompilationState}.
*/
- private void testSourceBindings(JavaSourceFile... files) {
- for (JavaSourceFile sourceFile : files) {
+ private void testSourceBindings(Resource... files) {
+ for (Resource sourceFile : files) {
oracle.add(sourceFile);
}
state.refresh(createTreeLogger());
assertRefsMatchExpectedRefs(files);
}
-
- private void testSourceBindings(MockJavaResource... resources) {
- JavaSourceFile[] files = new JavaSourceFile[resources.length];
- for (int i = 0; i < resources.length; ++i) {
- files[i] = new MockJavaSourceFile(resources[i]);
- }
- testSourceBindings(files);
- }
}
diff --git a/dev/core/test/com/google/gwt/dev/javac/JavaCompilationSuite.java b/dev/core/test/com/google/gwt/dev/javac/JavaCompilationSuite.java
index f391487..c6efa75 100644
--- a/dev/core/test/com/google/gwt/dev/javac/JavaCompilationSuite.java
+++ b/dev/core/test/com/google/gwt/dev/javac/JavaCompilationSuite.java
@@ -15,7 +15,6 @@
*/
package com.google.gwt.dev.javac;
-import com.google.gwt.dev.javac.impl.JavaSourceOracleImplTest;
import com.google.gwt.dev.javac.impl.JdtBehaviorTest;
import junit.framework.Test;
@@ -35,7 +34,6 @@
suite.addTestSuite(JdtBehaviorTest.class);
suite.addTestSuite(JdtCompilerTest.class);
suite.addTestSuite(JSORestrictionsTest.class);
- suite.addTestSuite(JavaSourceOracleImplTest.class);
suite.addTestSuite(JsniCheckerTest.class);
suite.addTestSuite(TypeOracleMediatorTest.class);
diff --git a/dev/core/test/com/google/gwt/dev/javac/JavaSourceCodeBase.java b/dev/core/test/com/google/gwt/dev/javac/JavaSourceCodeBase.java
deleted file mode 100644
index d3679d9..0000000
--- a/dev/core/test/com/google/gwt/dev/javac/JavaSourceCodeBase.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2008 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.javac;
-
-import com.google.gwt.dev.javac.impl.JavaResourceBase;
-import com.google.gwt.dev.javac.impl.MockJavaSourceFile;
-
-/**
- * Contains standard Java source files for testing.
- */
-public class JavaSourceCodeBase {
-
- public static final MockJavaSourceFile ANNOTATION = new MockJavaSourceFile(
- JavaResourceBase.ANNOTATION);
- public static final MockJavaSourceFile BAR = new MockJavaSourceFile(
- JavaResourceBase.BAR);
- public static final MockJavaSourceFile CLASS = new MockJavaSourceFile(
- JavaResourceBase.CLASS);
- public static final MockJavaSourceFile FOO = new MockJavaSourceFile(
- JavaResourceBase.FOO);
- public static final MockJavaSourceFile JAVASCRIPTOBJECT = new MockJavaSourceFile(
- JavaResourceBase.JAVASCRIPTOBJECT);
- public static final MockJavaSourceFile MAP = new MockJavaSourceFile(
- JavaResourceBase.MAP);
- public static final MockJavaSourceFile OBJECT = new MockJavaSourceFile(
- JavaResourceBase.OBJECT);
- public static final MockJavaSourceFile SERIALIZABLE = new MockJavaSourceFile(
- JavaResourceBase.SERIALIZABLE);
- public static final MockJavaSourceFile STRING = new MockJavaSourceFile(
- JavaResourceBase.STRING);
- public static final MockJavaSourceFile SUPPRESS_WARNINGS = new MockJavaSourceFile(
- JavaResourceBase.SUPPRESS_WARNINGS);
-
- public static MockJavaSourceFile[] getStandardResources() {
- return new MockJavaSourceFile[] {
- ANNOTATION, CLASS, JAVASCRIPTOBJECT, MAP, OBJECT, SERIALIZABLE, STRING,
- SUPPRESS_WARNINGS};
- }
-}
diff --git a/dev/core/test/com/google/gwt/dev/javac/JdtCompilerTest.java b/dev/core/test/com/google/gwt/dev/javac/JdtCompilerTest.java
index 539abe7..abf07cc 100644
--- a/dev/core/test/com/google/gwt/dev/javac/JdtCompilerTest.java
+++ b/dev/core/test/com/google/gwt/dev/javac/JdtCompilerTest.java
@@ -15,7 +15,9 @@
*/
package com.google.gwt.dev.javac;
+import com.google.gwt.dev.javac.impl.JavaResourceBase;
import com.google.gwt.dev.javac.impl.SourceFileCompilationUnit;
+import com.google.gwt.dev.resource.Resource;
import junit.framework.TestCase;
@@ -31,6 +33,14 @@
*/
public class JdtCompilerTest extends TestCase {
+ static void assertUnitHasErrors(CompilationUnit unit, int numErrors) {
+ CompilationUnitDeclaration cud = unit.getJdtCud();
+ CompilationResult result = cud.compilationResult();
+ assertTrue(result.hasErrors());
+ assertEquals(numErrors, result.getErrors().length);
+ assertTrue(result.getClassFiles().length > 0);
+ }
+
static void assertUnitsCompiled(Collection<CompilationUnit> units) {
for (CompilationUnit unit : units) {
CompilationUnitDeclaration cud = unit.getJdtCud();
@@ -41,26 +51,18 @@
}
}
- static void assertUnitHasErrors(CompilationUnit unit, int numErrors) {
- CompilationUnitDeclaration cud = unit.getJdtCud();
- CompilationResult result = cud.compilationResult();
- assertTrue(result.hasErrors());
- assertEquals(numErrors, result.getErrors().length);
- assertTrue(result.getClassFiles().length > 0);
- }
-
public void testCompile() {
List<CompilationUnit> units = new ArrayList<CompilationUnit>();
- addAll(units, JavaSourceCodeBase.getStandardResources());
- addAll(units, JavaSourceCodeBase.FOO, JavaSourceCodeBase.BAR);
+ addAll(units, JavaResourceBase.getStandardResources());
+ addAll(units, JavaResourceBase.FOO, JavaResourceBase.BAR);
JdtCompiler.compile(units);
assertUnitsCompiled(units);
}
public void testCompileError() {
List<CompilationUnit> units = new ArrayList<CompilationUnit>();
- addAll(units, JavaSourceCodeBase.getStandardResources());
- addAll(units, JavaSourceCodeBase.BAR);
+ addAll(units, JavaResourceBase.getStandardResources());
+ addAll(units, JavaResourceBase.BAR);
JdtCompiler.compile(units);
assertUnitsCompiled(units.subList(0, units.size() - 1));
assertUnitHasErrors(units.get(units.size() - 1), 1);
@@ -68,17 +70,17 @@
public void testCompileIncremental() {
List<CompilationUnit> units = new ArrayList<CompilationUnit>();
- addAll(units, JavaSourceCodeBase.getStandardResources());
+ addAll(units, JavaResourceBase.getStandardResources());
JdtCompiler.compile(units);
assertUnitsCompiled(units);
- addAll(units, JavaSourceCodeBase.FOO, JavaSourceCodeBase.BAR);
+ addAll(units, JavaResourceBase.FOO, JavaResourceBase.BAR);
JdtCompiler.compile(units);
assertUnitsCompiled(units);
}
private void addAll(Collection<CompilationUnit> units,
- JavaSourceFile... sourceFiles) {
- for (JavaSourceFile sourceFile : sourceFiles) {
+ Resource... sourceFiles) {
+ for (Resource sourceFile : sourceFiles) {
units.add(new SourceFileCompilationUnit(sourceFile));
}
}
diff --git a/dev/core/test/com/google/gwt/dev/javac/MockJavaSourceOracle.java b/dev/core/test/com/google/gwt/dev/javac/MockJavaSourceOracle.java
deleted file mode 100644
index 25e13ec..0000000
--- a/dev/core/test/com/google/gwt/dev/javac/MockJavaSourceOracle.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright 2008 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.javac;
-
-import com.google.gwt.dev.javac.JavaSourceFile;
-import com.google.gwt.dev.javac.JavaSourceOracle;
-
-import junit.framework.Assert;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * A simple {@link ResourceOracle} for testing.
- */
-public class MockJavaSourceOracle implements JavaSourceOracle {
-
- private Map<String, JavaSourceFile> exportedMap = Collections.emptyMap();
- private Set<JavaSourceFile> exportedValues = Collections.emptySet();
-
- public MockJavaSourceOracle(JavaSourceFile... sourceFiles) {
- add(sourceFiles);
- }
-
- public void clear() {
- }
-
- public Set<String> getClassNames() {
- return exportedMap.keySet();
- }
-
- public Set<JavaSourceFile> getSourceFiles() {
- return exportedValues;
- }
-
- public Map<String, JavaSourceFile> getSourceMap() {
- return exportedMap;
- }
-
- void add(JavaSourceFile... sourceFiles) {
- Map<String, JavaSourceFile> newMap = new HashMap<String, JavaSourceFile>(
- exportedMap);
- for (JavaSourceFile sourceFile : sourceFiles) {
- String className = sourceFile.getTypeName();
- Assert.assertFalse(newMap.containsKey(className));
- newMap.put(className, sourceFile);
- }
- export(newMap);
- }
-
- void remove(String... classNames) {
- Map<String, JavaSourceFile> newMap = new HashMap<String, JavaSourceFile>(
- exportedMap);
- for (String className : classNames) {
- JavaSourceFile oldValue = newMap.remove(className);
- Assert.assertNotNull(oldValue);
- }
- export(newMap);
- }
-
- void replace(JavaSourceFile... sourceFiles) {
- Map<String, JavaSourceFile> newMap = new HashMap<String, JavaSourceFile>(
- exportedMap);
- for (JavaSourceFile sourceFile : sourceFiles) {
- String className = sourceFile.getTypeName();
- Assert.assertTrue(newMap.containsKey(className));
- newMap.put(className, sourceFile);
- }
- export(newMap);
- }
-
- private void export(Map<String, JavaSourceFile> newMap) {
- exportedMap = Collections.unmodifiableMap(newMap);
- // Make a new hash set for constant lookup.
- exportedValues = Collections.unmodifiableSet(new HashSet<JavaSourceFile>(
- exportedMap.values()));
- }
-
-}
\ No newline at end of file
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 2a63336..d7d962d 100644
--- a/dev/core/test/com/google/gwt/dev/javac/TypeOracleTestingUtils.java
+++ b/dev/core/test/com/google/gwt/dev/javac/TypeOracleTestingUtils.java
@@ -17,6 +17,8 @@
import com.google.gwt.core.ext.TreeLogger;
import com.google.gwt.core.ext.typeinfo.TypeOracle;
+import com.google.gwt.dev.javac.impl.JavaResourceBase;
+import com.google.gwt.dev.javac.impl.MockJavaResource;
import com.google.gwt.dev.javac.impl.SourceFileCompilationUnit;
import java.util.Collections;
@@ -73,7 +75,7 @@
* Add compilation units for basic classes like Object and String.
*/
private static void addStandardCups(Set<CompilationUnit> units) {
- for (JavaSourceFile resource : JavaSourceCodeBase.getStandardResources()) {
+ for (MockJavaResource resource : JavaResourceBase.getStandardResources()) {
units.add(new SourceFileCompilationUnit(resource));
}
}
diff --git a/dev/core/test/com/google/gwt/dev/javac/impl/JavaResourceBase.java b/dev/core/test/com/google/gwt/dev/javac/impl/JavaResourceBase.java
index f2d220e..1eaede2 100644
--- a/dev/core/test/com/google/gwt/dev/javac/impl/JavaResourceBase.java
+++ b/dev/core/test/com/google/gwt/dev/javac/impl/JavaResourceBase.java
@@ -20,7 +20,7 @@
*/
public class JavaResourceBase {
- public static final MockResource ANNOTATION = new MockJavaResource(
+ public static final MockJavaResource ANNOTATION = new MockJavaResource(
"java.lang.annotation.Annotation") {
@Override
protected CharSequence getContent() {
@@ -42,7 +42,7 @@
return code;
}
};
- public static final MockResource CLASS = new MockJavaResource(
+ public static final MockJavaResource CLASS = new MockJavaResource(
"java.lang.Class") {
@Override
protected CharSequence getContent() {
@@ -64,7 +64,7 @@
return code;
}
};
- public static final MockResource JAVASCRIPTOBJECT = new MockJavaResource(
+ public static final MockJavaResource JAVASCRIPTOBJECT = new MockJavaResource(
"com.google.gwt.core.client.JavaScriptObject") {
@Override
protected CharSequence getContent() {
@@ -76,7 +76,8 @@
return code;
}
};
- public static final MockResource MAP = new MockJavaResource("java.util.Map") {
+ public static final MockJavaResource MAP = new MockJavaResource(
+ "java.util.Map") {
@Override
protected CharSequence getContent() {
StringBuffer code = new StringBuffer();
@@ -85,7 +86,7 @@
return code;
}
};
- public static final MockResource OBJECT = new MockJavaResource(
+ public static final MockJavaResource OBJECT = new MockJavaResource(
"java.lang.Object") {
@Override
protected CharSequence getContent() {
@@ -98,7 +99,7 @@
return code;
}
};
- public static final MockResource SERIALIZABLE = new MockJavaResource(
+ public static final MockJavaResource SERIALIZABLE = new MockJavaResource(
"java.io.Serializable") {
@Override
protected CharSequence getContent() {
@@ -108,7 +109,7 @@
return code;
}
};
- public static final MockResource STRING = new MockJavaResource(
+ public static final MockJavaResource STRING = new MockJavaResource(
"java.lang.String") {
@Override
protected CharSequence getContent() {
@@ -122,7 +123,7 @@
return code;
}
};
- public static final MockResource SUPPRESS_WARNINGS = new MockJavaResource(
+ public static final MockJavaResource SUPPRESS_WARNINGS = new MockJavaResource(
"java.lang.SuppressWarnings") {
@Override
protected CharSequence getContent() {
@@ -135,8 +136,8 @@
}
};
- public static MockResource[] getStandardResources() {
- return new MockResource[] {
+ public static MockJavaResource[] getStandardResources() {
+ return new MockJavaResource[] {
ANNOTATION, CLASS, JAVASCRIPTOBJECT, MAP, OBJECT, SERIALIZABLE, STRING,
SUPPRESS_WARNINGS};
}
diff --git a/dev/core/test/com/google/gwt/dev/javac/impl/JavaSourceOracleImplTest.java b/dev/core/test/com/google/gwt/dev/javac/impl/JavaSourceOracleImplTest.java
deleted file mode 100644
index b063893..0000000
--- a/dev/core/test/com/google/gwt/dev/javac/impl/JavaSourceOracleImplTest.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Copyright 2008 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.javac.impl;
-
-import com.google.gwt.dev.javac.JavaSourceFile;
-import com.google.gwt.dev.resource.Resource;
-
-import junit.framework.TestCase;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.Map.Entry;
-
-/**
- * Tests {@link JavaSourceOracleImpl} using a mock {@link ResourceOracle}.
- */
-public class JavaSourceOracleImplTest extends TestCase {
-
- private MockResourceOracle resourceOracle = new MockResourceOracle(
- JavaResourceBase.getStandardResources());
-
- private JavaSourceOracleImpl sourceOracle = new JavaSourceOracleImpl(
- resourceOracle);
-
- public void testAdd() {
- validateSourceOracle();
-
- Map<String, JavaSourceFile> originalSourceMap = sourceOracle.getSourceMap();
- resourceOracle.add(JavaResourceBase.FOO);
- Map<String, JavaSourceFile> newSourceMap = sourceOracle.getSourceMap();
- assertNotSame(originalSourceMap, newSourceMap);
- assertEquals(originalSourceMap.size() + 1, newSourceMap.size());
- validateSourceOracle();
- }
-
- public void testBasic() {
- validateSourceOracle();
- }
-
- public void testEmpty() {
- resourceOracle = new MockResourceOracle();
- sourceOracle = new JavaSourceOracleImpl(resourceOracle);
- validateSourceOracle();
- }
-
- public void testRemove() {
- validateSourceOracle();
-
- Map<String, JavaSourceFile> originalSourceMap = sourceOracle.getSourceMap();
- resourceOracle.remove(JavaResourceBase.OBJECT.getPath());
- Map<String, JavaSourceFile> newSourceMap = sourceOracle.getSourceMap();
- assertNotSame(originalSourceMap, newSourceMap);
- assertEquals(originalSourceMap.size() - 1, newSourceMap.size());
- validateSourceOracle();
- }
-
- public void testReplace() {
- validateSourceOracle();
-
- Map<String, JavaSourceFile> originalSourceMap = sourceOracle.getSourceMap();
- resourceOracle.replace(new MockResource(JavaResourceBase.OBJECT.getPath()) {
- @Override
- protected CharSequence getContent() {
- return JavaResourceBase.OBJECT.getContent();
- }
- });
- Map<String, JavaSourceFile> newSourceMap = sourceOracle.getSourceMap();
- assertNotSame(originalSourceMap, newSourceMap);
- assertEquals(originalSourceMap.size(), newSourceMap.size());
- assertFalse(originalSourceMap.equals(newSourceMap));
- validateSourceOracle();
- }
-
- public void testReplaceWithSame() {
- validateSourceOracle();
-
- Map<String, JavaSourceFile> originalSourceMap = sourceOracle.getSourceMap();
- resourceOracle.replace(JavaResourceBase.OBJECT);
- Map<String, JavaSourceFile> newSourceMap = sourceOracle.getSourceMap();
- assertNotSame(originalSourceMap, newSourceMap);
- assertEquals(originalSourceMap.size(), newSourceMap.size());
- assertEquals(originalSourceMap, newSourceMap);
- validateSourceOracle();
- }
-
- /**
- * Validate that the source oracle accurately reflects the resource oracle.
- */
- private void validateSourceOracle() {
- // Save off the reflected collections.
- Map<String, JavaSourceFile> sourceMap = sourceOracle.getSourceMap();
- Set<String> classNames = sourceOracle.getClassNames();
- Set<JavaSourceFile> sourceFiles = sourceOracle.getSourceFiles();
-
- // Validate that the collections are consistent with each other.
- assertEquals(sourceMap.keySet(), classNames);
- assertEquals(new HashSet<JavaSourceFile>(sourceMap.values()), sourceFiles);
-
- // Save off a mutable copy of the resource map to compare with.
- Map<String, Resource> resourceMap = new HashMap<String, Resource>(
- resourceOracle.getResourceMap());
- assertEquals(resourceMap.size(), sourceMap.size());
- for (Entry<String, JavaSourceFile> entry : sourceMap.entrySet()) {
- // Validate source file internally consistent.
- String className = entry.getKey();
- JavaSourceFile sourceFile = entry.getValue();
- assertEquals(className, sourceFile.getTypeName());
- assertEquals(Shared.getPackageName(className),
- sourceFile.getPackageName());
- assertEquals(Shared.getShortName(className), sourceFile.getShortName());
-
- // Find the matching resource (and remove it from the resource map!)
- String expectedPath = Shared.toPath(className);
- assertTrue(resourceMap.containsKey(expectedPath));
-
- // Validate the source file matches the resource.
- Resource resource = resourceMap.remove(expectedPath);
- assertNotNull(resource);
- assertEquals(Shared.readContent(resource.openContents()),
- sourceFile.readSource());
- }
- // The resource map should be empty now.
- assertEquals(0, resourceMap.size());
-
- // Validate collection identity hasn't changed.
- assertSame(sourceMap, sourceOracle.getSourceMap());
- assertSame(sourceFiles, sourceOracle.getSourceFiles());
- assertSame(classNames, sourceOracle.getClassNames());
- }
-}
diff --git a/dev/core/test/com/google/gwt/dev/javac/impl/JdtBehaviorTest.java b/dev/core/test/com/google/gwt/dev/javac/impl/JdtBehaviorTest.java
index 793189a..3466302 100644
--- a/dev/core/test/com/google/gwt/dev/javac/impl/JdtBehaviorTest.java
+++ b/dev/core/test/com/google/gwt/dev/javac/impl/JdtBehaviorTest.java
@@ -142,14 +142,14 @@
private class ResourceAdapter implements ICompilationUnit {
- private final MockJavaSourceFile sourceFile;
+ private final MockResource sourceFile;
public ResourceAdapter(MockResource resource) {
- sourceFile = new MockJavaSourceFile(resource);
+ sourceFile = resource;
}
public char[] getContents() {
- return sourceFile.readSource().toCharArray();
+ return SourceFileCompilationUnit.readSource(sourceFile).toCharArray();
}
public char[] getFileName() {
@@ -157,12 +157,13 @@
}
public char[] getMainTypeName() {
- return sourceFile.getShortName().toCharArray();
+ return Shared.getShortName(
+ SourceFileCompilationUnit.getTypeName(sourceFile)).toCharArray();
}
public char[][] getPackageName() {
- return CharOperation.splitOn('.',
- sourceFile.getPackageName().toCharArray());
+ return CharOperation.splitOn('.', Shared.getPackageName(
+ SourceFileCompilationUnit.getTypeName(sourceFile)).toCharArray());
}
@Override
diff --git a/dev/core/test/com/google/gwt/dev/javac/impl/MockJavaSourceFile.java b/dev/core/test/com/google/gwt/dev/javac/impl/MockJavaSourceFile.java
deleted file mode 100644
index c7d0bbb..0000000
--- a/dev/core/test/com/google/gwt/dev/javac/impl/MockJavaSourceFile.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright 2008 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.javac.impl;
-
-import com.google.gwt.dev.javac.JavaSourceFile;
-
-public class MockJavaSourceFile extends JavaSourceFile {
-
- private final String location;
- private final String qualifiedTypeName;
- private final String source;
-
- public MockJavaSourceFile(JavaSourceFile sourceFile) {
- this(sourceFile.getTypeName(), sourceFile.readSource(),
- sourceFile.getLocation());
- }
-
- public MockJavaSourceFile(MockResource resource) {
- this(Shared.toTypeName(resource.getPath()),
- resource.getContent().toString(), resource.getLocation());
- }
-
- public MockJavaSourceFile(String qualifiedTypeName, String source) {
- this(qualifiedTypeName, source, "/mock/" + Shared.toPath(qualifiedTypeName));
- }
-
- public MockJavaSourceFile(String qualifiedTypeName, String source,
- String location) {
- this.qualifiedTypeName = qualifiedTypeName;
- this.source = source;
- this.location = location;
- }
-
- @Override
- public long getLastModified() {
- return 0;
- }
-
- @Override
- public String getLocation() {
- return location;
- }
-
- @Override
- public String getPackageName() {
- return Shared.getPackageName(qualifiedTypeName);
- }
-
- @Override
- public String getShortName() {
- return Shared.getShortName(qualifiedTypeName);
- }
-
- @Override
- public String getTypeName() {
- return qualifiedTypeName;
- }
-
- @Override
- public boolean isSuperSource() {
- return false;
- }
-
- @Override
- public String readSource() {
- return source;
- }
-
-}
diff --git a/dev/core/test/com/google/gwt/dev/javac/impl/MockResourceOracle.java b/dev/core/test/com/google/gwt/dev/javac/impl/MockResourceOracle.java
index 4c0119e..22383fe 100644
--- a/dev/core/test/com/google/gwt/dev/javac/impl/MockResourceOracle.java
+++ b/dev/core/test/com/google/gwt/dev/javac/impl/MockResourceOracle.java
@@ -38,6 +38,16 @@
add(resources);
}
+ public void add(Resource... resources) {
+ Map<String, Resource> newMap = new HashMap<String, Resource>(exportedMap);
+ for (Resource resource : resources) {
+ String path = resource.getPath();
+ Assert.assertFalse(newMap.containsKey(path));
+ newMap.put(path, resource);
+ }
+ export(newMap);
+ }
+
public void clear() {
}
@@ -53,17 +63,7 @@
return exportedValues;
}
- void add(Resource... resources) {
- Map<String, Resource> newMap = new HashMap<String, Resource>(exportedMap);
- for (Resource resource : resources) {
- String path = resource.getPath();
- Assert.assertFalse(newMap.containsKey(path));
- newMap.put(path, resource);
- }
- export(newMap);
- }
-
- void remove(String... paths) {
+ public void remove(String... paths) {
Map<String, Resource> newMap = new HashMap<String, Resource>(exportedMap);
for (String path : paths) {
Resource oldValue = newMap.remove(path);
@@ -72,7 +72,7 @@
export(newMap);
}
- void replace(Resource... resources) {
+ public void replace(Resource... resources) {
Map<String, Resource> newMap = new HashMap<String, Resource>(exportedMap);
for (Resource resource : resources) {
String path = resource.getPath();
diff --git a/dev/core/test/com/google/gwt/dev/shell/StandardGeneratorContextTest.java b/dev/core/test/com/google/gwt/dev/shell/StandardGeneratorContextTest.java
index 71c9d4a..c2f5de3 100644
--- a/dev/core/test/com/google/gwt/dev/shell/StandardGeneratorContextTest.java
+++ b/dev/core/test/com/google/gwt/dev/shell/StandardGeneratorContextTest.java
@@ -26,8 +26,7 @@
import com.google.gwt.core.ext.linker.GeneratedResource;
import com.google.gwt.dev.cfg.PublicOracle;
import com.google.gwt.dev.javac.CompilationState;
-import com.google.gwt.dev.javac.JavaSourceFile;
-import com.google.gwt.dev.javac.JavaSourceOracle;
+import com.google.gwt.dev.javac.impl.MockResourceOracle;
import com.google.gwt.dev.resource.Resource;
import com.google.gwt.dev.util.Util;
@@ -43,10 +42,7 @@
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Collections;
import java.util.List;
-import java.util.Map;
-import java.util.Set;
/**
* A wide variety of tests on {@link StandardGeneratorContext}.
@@ -56,22 +52,7 @@
public static class MockCompilationState extends CompilationState {
public MockCompilationState() {
- super(TreeLogger.NULL, new JavaSourceOracle() {
- public void clear() {
- }
-
- public Set<String> getClassNames() {
- return Collections.emptySet();
- }
-
- public Set<JavaSourceFile> getSourceFiles() {
- return Collections.emptySet();
- }
-
- public Map<String, JavaSourceFile> getSourceMap() {
- return Collections.emptyMap();
- }
- });
+ super(TreeLogger.NULL, new MockResourceOracle());
}
}
diff --git a/user/test/com/google/gwt/dev/cfg/TestSuperAndSourceTags.java b/user/test/com/google/gwt/dev/cfg/TestSuperAndSourceTags.java
index 9a76d25..6f66ab8 100644
--- a/user/test/com/google/gwt/dev/cfg/TestSuperAndSourceTags.java
+++ b/user/test/com/google/gwt/dev/cfg/TestSuperAndSourceTags.java
@@ -119,10 +119,14 @@
}
private void validateExcluded(Class<?> clazz) {
- assertNull(moduleDef.findSourceFile(getLogicalPath(clazz)));
+ assertNull(moduleDef.findSourceFile(toPath(clazz)));
}
private void validateIncluded(Class<?> clazz) {
- assertNotNull(moduleDef.findSourceFile(getLogicalPath(clazz)));
+ assertNotNull(moduleDef.findSourceFile(toPath(clazz)));
+ }
+
+ private String toPath(Class<?> clazz) {
+ return getLogicalPath(clazz).replace('.', '/') + ".java";
}
}
diff --git a/user/test/com/google/gwt/user/rebind/rpc/SerializableTypeOracleBuilderTest.java b/user/test/com/google/gwt/user/rebind/rpc/SerializableTypeOracleBuilderTest.java
index 1f89dbc..8ceb6fe 100644
--- a/user/test/com/google/gwt/user/rebind/rpc/SerializableTypeOracleBuilderTest.java
+++ b/user/test/com/google/gwt/user/rebind/rpc/SerializableTypeOracleBuilderTest.java
@@ -34,9 +34,9 @@
import com.google.gwt.dev.cfg.ModuleDefLoader;
import com.google.gwt.dev.cfg.StaticPropertyOracle;
import com.google.gwt.dev.javac.CompilationUnit;
-import com.google.gwt.dev.javac.JavaSourceCodeBase;
import com.google.gwt.dev.javac.MockCompilationUnit;
import com.google.gwt.dev.javac.TypeOracleTestingUtils;
+import com.google.gwt.dev.javac.impl.JavaResourceBase;
import com.google.gwt.dev.javac.impl.SourceFileCompilationUnit;
import com.google.gwt.dev.util.UnitTestTreeLogger;
import com.google.gwt.dev.util.log.PrintWriterTreeLogger;
@@ -141,7 +141,7 @@
}
private static void addJavaIoSerializable(Set<CompilationUnit> units) {
- units.add(new SourceFileCompilationUnit(JavaSourceCodeBase.SERIALIZABLE));
+ units.add(new SourceFileCompilationUnit(JavaResourceBase.SERIALIZABLE));
}
private static void addJavaLangException(Set<CompilationUnit> units) {
@@ -154,11 +154,11 @@
}
private static void addJavaLangObject(Set<CompilationUnit> units) {
- units.add(new SourceFileCompilationUnit(JavaSourceCodeBase.OBJECT));
+ units.add(new SourceFileCompilationUnit(JavaResourceBase.OBJECT));
}
private static void addJavaLangString(Set<CompilationUnit> units) {
- units.add(new SourceFileCompilationUnit(JavaSourceCodeBase.STRING));
+ units.add(new SourceFileCompilationUnit(JavaResourceBase.STRING));
}
private static void addJavaLangThrowable(Set<CompilationUnit> units) {
@@ -179,7 +179,7 @@
}
private static void addJavaUtilMap(Set<CompilationUnit> units) {
- units.add(new SourceFileCompilationUnit(JavaSourceCodeBase.MAP));
+ units.add(new SourceFileCompilationUnit(JavaResourceBase.MAP));
}
private static void addSerializationStreamReader(Set<CompilationUnit> units) {
@@ -2170,8 +2170,7 @@
* @throws UnableToCompleteException
* @throws NotFoundException
*/
- public void testTypeConstrainer() throws UnableToCompleteException,
- NotFoundException {
+ public void testTypeConstrainer() throws NotFoundException {
Set<CompilationUnit> units = new HashSet<CompilationUnit>();
addStandardClasses(units);
@@ -2326,8 +2325,8 @@
JTypeParameter syntheticTypeParam = new JTypeParameter("U", 0);
// Force the type parameter to have a declaring class
- JClassType mockType = new JGenericType(to, a.getPackage(), null, false,
- "C", false, new JTypeParameter[] {syntheticTypeParam});
+ new JGenericType(to, a.getPackage(), null, false, "C", false,
+ new JTypeParameter[] {syntheticTypeParam});
syntheticTypeParam.setBounds(makeArray(b));
JParameterizedType parameterizedType = to.getParameterizedType(a,
diff --git a/user/test/com/google/gwt/user/rebind/rpc/TypeHierarchyUtilsTest.java b/user/test/com/google/gwt/user/rebind/rpc/TypeHierarchyUtilsTest.java
index 2ef52d0..f9bf8d9 100644
--- a/user/test/com/google/gwt/user/rebind/rpc/TypeHierarchyUtilsTest.java
+++ b/user/test/com/google/gwt/user/rebind/rpc/TypeHierarchyUtilsTest.java
@@ -16,7 +16,6 @@
package com.google.gwt.user.rebind.rpc;
import com.google.gwt.core.ext.TreeLogger;
-import com.google.gwt.core.ext.UnableToCompleteException;
import com.google.gwt.core.ext.typeinfo.JClassType;
import com.google.gwt.core.ext.typeinfo.NotFoundException;
import com.google.gwt.core.ext.typeinfo.TypeOracle;
@@ -43,8 +42,7 @@
return logger;
}
- public void testParameterizedInterface() throws UnableToCompleteException,
- NotFoundException {
+ public void testParameterizedInterface() throws NotFoundException {
Set<CompilationUnit> units = new HashSet<CompilationUnit>();
{
StringBuilder code = new StringBuilder();