ordercheck passes. git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@27 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/dev/core/src/com/google/gwt/dev/jdt/AbstractCompiler.java b/dev/core/src/com/google/gwt/dev/jdt/AbstractCompiler.java index 1d8c947..0c2f341 100644 --- a/dev/core/src/com/google/gwt/dev/jdt/AbstractCompiler.java +++ b/dev/core/src/com/google/gwt/dev/jdt/AbstractCompiler.java
@@ -62,6 +62,10 @@ */ private class CompilerImpl extends Compiler { + public HashSet resolved = new HashSet(); + + private Set cuds; + public CompilerImpl(INameEnvironment environment, IErrorHandlingPolicy policy, Map settings, ICompilerRequestor requestor, IProblemFactory problemFactory) { @@ -82,7 +86,7 @@ if (cud.scope != null) { cud.scope.faultInTypes(); } - + // verify inherited methods if (cud.scope != null) { cud.scope.verifyMethods(lookupEnvironment.methodVerifier()); @@ -110,9 +114,8 @@ ICompilationUnit cu = cud.compilationResult.compilationUnit; String loc = String.valueOf(cu.getFileName()); - TreeLogger logger = - threadLogger.branch(TreeLogger.SPAM, - "Scanning for additional dependencies: " + loc, null); + TreeLogger logger = threadLogger.branch(TreeLogger.SPAM, + "Scanning for additional dependencies: " + loc, null); // Examine the cud for magic types. // @@ -121,7 +124,7 @@ typeNames = doFindAdditionalTypesUsingJsni(logger, cud); } catch (UnableToCompleteException e) { problemReporter.abortDueToInternalError( - "Unable to resolve required JSNI dependencies", cud); + "Unable to resolve required JSNI dependencies", cud); return; } @@ -144,7 +147,7 @@ typeNames = doFindAdditionalTypesUsingRebinds(logger, cud); } catch (UnableToCompleteException e) { problemReporter.abortDueToInternalError( - "Unable to resolve required rebind dependencies", cud); + "Unable to resolve required rebind dependencies", cud); return; } @@ -164,37 +167,36 @@ // sanity check rebind results if (type == null) { problemReporter.abortDueToInternalError("Rebind result '" + typeName - + "' could not be found"); + + "' could not be found"); return; } if (!type.isClass()) { problemReporter.abortDueToInternalError("Rebind result '" + typeName - + "' must be a class"); + + "' must be a class"); return; } if (type.isAbstract()) { problemReporter.abortDueToInternalError("Rebind result '" + typeName - + "' cannot be abstract"); + + "' cannot be abstract"); return; } if (type.isNestedType() && !type.isStatic()) { problemReporter.abortDueToInternalError("Rebind result '" + typeName - + "' cannot be a non-static nested class"); + + "' cannot be a non-static nested class"); return; } if (type.isLocalType()) { problemReporter.abortDueToInternalError("Rebind result '" + typeName - + "' cannot be a local class"); + + "' cannot be a local class"); return; } // look for a noArg ctor - MethodBinding noArgCtor = - type.getExactMethod("<init>".toCharArray(), - TypeBinding.NoParameters, cud.scope); + MethodBinding noArgCtor = type.getExactMethod("<init>".toCharArray(), + TypeBinding.NoParameters, cud.scope); if (noArgCtor == null) { problemReporter.abortDueToInternalError("Rebind result '" + typeName - + "' has no default (zero argument) constructors."); + + "' has no default (zero argument) constructors."); return; } } @@ -249,10 +251,6 @@ return null; } - - public HashSet resolved = new HashSet(); - - private Set cuds; } private class ICompilerRequestorImpl implements ICompilerRequestor { @@ -281,10 +279,9 @@ msg = msg.substring(msg.indexOf(' ')); if (error.getID() >= IProblem.InvalidUsageOfTypeParameters - && error.getID() <= IProblem.InvalidUsageOfAnnotationDeclarations) { + && error.getID() <= IProblem.InvalidUsageOfAnnotationDeclarations) { // this error involves 5.0 compliance, use a custom message - msg = - "GWT does not yet support the Java 5.0 language enhancements; only 1.4 compatible source may be used"; + msg = "GWT does not yet support the Java 5.0 language enhancements; only 1.4 compatible source may be used"; } // Append 'Line #: msg' to the error message. @@ -326,12 +323,10 @@ // CompilationUnitDeclarations than needed. String qname = CharOperation.toString(compoundTypeName); if (nameEnvironmentAnswerForTypeName.containsKey(qname)) { - return (NameEnvironmentAnswer) (nameEnvironmentAnswerForTypeName - .get(qname)); + return (NameEnvironmentAnswer) (nameEnvironmentAnswerForTypeName.get(qname)); } - TreeLogger logger = - threadLogger.branch(TreeLogger.SPAM, "Compiler is asking about '" - + qname + "'", null); + TreeLogger logger = threadLogger.branch(TreeLogger.SPAM, + "Compiler is asking about '" + qname + "'", null); if (sourceOracle.isPackage(qname)) { logger.log(TreeLogger.SPAM, "Found to be a package", null); @@ -373,7 +368,7 @@ cup = sourceOracle.findCompilationUnit(logger, qname); if (cup != null) { logger.log(TreeLogger.SPAM, "Found type in compilation unit: " - + cup.getLocation(), null); + + cup.getLocation(), null); ICompilationUnitAdapter unit = new ICompilationUnitAdapter(cup); NameEnvironmentAnswer out = new NameEnvironmentAnswer(unit, null); nameEnvironmentAnswerForTypeName.put(qname, out); @@ -411,39 +406,52 @@ } } + private final CompilerImpl compiler; + + private final boolean doGenerateBytes; + + private final Set knownPackages = new HashSet(); + + private final Map nameEnvironmentAnswerForTypeName = new HashMap(); + + private final SourceOracle sourceOracle; + + private final ThreadLocalTreeLoggerProxy threadLogger = new ThreadLocalTreeLoggerProxy(); + + private final Map unitsByTypeName = new HashMap(); + protected AbstractCompiler(SourceOracle sourceOracle, boolean doGenerateBytes) { this.sourceOracle = sourceOracle; this.doGenerateBytes = doGenerateBytes; rememberPackage(""); INameEnvironment env = new INameEnvironmentImpl(); - IErrorHandlingPolicy pol = - DefaultErrorHandlingPolicies.proceedWithAllProblems(); + IErrorHandlingPolicy pol = DefaultErrorHandlingPolicies.proceedWithAllProblems(); IProblemFactory probFact = new DefaultProblemFactory(Locale.getDefault()); ICompilerRequestor req = new ICompilerRequestorImpl(); Map settings = new HashMap(); settings.put(CompilerOptions.OPTION_LineNumberAttribute, - CompilerOptions.GENERATE); + CompilerOptions.GENERATE); settings.put(CompilerOptions.OPTION_SourceFileAttribute, - CompilerOptions.GENERATE); + CompilerOptions.GENERATE); /* * Tricks like "boolean stopHere = true;" depend on this setting to work in * hosted mode. In web mode, our compiler should optimize them out once we * do real data flow. */ settings.put(CompilerOptions.OPTION_PreserveUnusedLocal, - CompilerOptions.PRESERVE); + CompilerOptions.PRESERVE); settings.put(CompilerOptions.OPTION_ReportDeprecation, - CompilerOptions.IGNORE); + CompilerOptions.IGNORE); settings.put(CompilerOptions.OPTION_LocalVariableAttribute, - CompilerOptions.GENERATE); + CompilerOptions.GENERATE); settings.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_4); settings.put(CompilerOptions.OPTION_TargetPlatform, - CompilerOptions.VERSION_1_4); + CompilerOptions.VERSION_1_4); // This is needed by TypeOracleBuilder to parse metadata. settings.put(CompilerOptions.OPTION_DocCommentSupport, - CompilerOptions.ENABLED); + CompilerOptions.ENABLED); compiler = new CompilerImpl(env, pol, settings, req, probFact); } @@ -472,8 +480,7 @@ Set cuds = new HashSet(); compiler.compile(units, cuds); int size = cuds.size(); - CompilationUnitDeclaration[] cudArray = - new CompilationUnitDeclaration[size]; + CompilationUnitDeclaration[] cudArray = new CompilationUnitDeclaration[size]; return (CompilationUnitDeclaration[]) cuds.toArray(cudArray); } @@ -583,13 +590,4 @@ return binaryTypeName; } } - - private final CompilerImpl compiler; - private final boolean doGenerateBytes; - private final Set knownPackages = new HashSet(); - private final Map nameEnvironmentAnswerForTypeName = new HashMap(); - private final SourceOracle sourceOracle; - private final ThreadLocalTreeLoggerProxy threadLogger = - new ThreadLocalTreeLoggerProxy(); - private final Map unitsByTypeName = new HashMap(); }
diff --git a/dev/core/src/com/google/gwt/dev/jdt/AstCompiler.java b/dev/core/src/com/google/gwt/dev/jdt/AstCompiler.java index f96b201..73abbbb 100644 --- a/dev/core/src/com/google/gwt/dev/jdt/AstCompiler.java +++ b/dev/core/src/com/google/gwt/dev/jdt/AstCompiler.java
@@ -44,6 +44,10 @@ */ private class CompilationUnitDeclarationCache { + private final Map lastModified = new HashMap(); + + private final Map map = new HashMap(); + public void remove(String newLoc) { map.remove(newLoc); } @@ -73,12 +77,10 @@ List element = (List) iter.next(); outSet.addAll(element); } - CompilationUnitDeclaration[] out = - new CompilationUnitDeclaration[outSet.size()]; + CompilationUnitDeclaration[] out = new CompilationUnitDeclaration[outSet.size()]; int i = 0; for (Iterator iter = outSet.iterator(); iter.hasNext();) { - CompilationUnitDeclaration element = - (CompilationUnitDeclaration) iter.next(); + CompilationUnitDeclaration element = (CompilationUnitDeclaration) iter.next(); out[i] = element; i++; } @@ -88,11 +90,10 @@ private void removeAll(Collection c) { map.keySet().removeAll(c); } - - private final Map lastModified = new HashMap(); - private final Map map = new HashMap(); } + private final CompilationUnitDeclarationCache cachedResults = new CompilationUnitDeclarationCache(); + public AstCompiler(SourceOracle sourceOracle) { super(sourceOracle, false); } @@ -101,7 +102,7 @@ TreeLogger logger, ICompilationUnit[] units) { List allUnits = Arrays.asList(units); List newUnits = new ArrayList(); - + // Check for newer units that need to be processed. for (Iterator iter = allUnits.iterator(); iter.hasNext();) { ICompilationUnitAdapter adapter = (ICompilationUnitAdapter) iter.next(); @@ -114,7 +115,7 @@ ICompilationUnit[] toBeProcessed = new ICompilationUnit[newUnits.size()]; newUnits.toArray(toBeProcessed); CompilationUnitDeclaration[] newCuds = compile(logger, toBeProcessed); - + // Put new cuds into cache. for (int i = 0; i < newCuds.length; i++) { String newLoc = String.valueOf(newCuds[i].getFileName()); @@ -128,7 +129,4 @@ cachedResults.removeAll(changedFiles); invalidateUnitsInFiles(changedFiles, typeNames); } - - private final CompilationUnitDeclarationCache cachedResults = - new CompilationUnitDeclarationCache(); }
diff --git a/dev/core/src/com/google/gwt/dev/jdt/ByteCode.java b/dev/core/src/com/google/gwt/dev/jdt/ByteCode.java index 1034b35..f5b55c1 100644 --- a/dev/core/src/com/google/gwt/dev/jdt/ByteCode.java +++ b/dev/core/src/com/google/gwt/dev/jdt/ByteCode.java
@@ -21,11 +21,11 @@ public class ByteCode implements Serializable { - private static final String systemString = - System.getProperty("java.class.path", "."); + private static final String systemString = System.getProperty( + "java.class.path", "."); - private static final String systemStringAsIdentifier = - About.GWT_VERSION + "_" + systemString.hashCode(); + private static final String systemStringAsIdentifier = About.GWT_VERSION + + "_" + systemString.hashCode(); /** * This method returns the current system identifier, used to detect changes @@ -38,10 +38,21 @@ return systemStringAsIdentifier; } + private final String binaryTypeName; + + private final byte[] bytes; + + private final String location; + + private final String version; + + private final boolean isTransient; + /** * Specifies the bytecode for a given type. */ - public ByteCode(String binaryTypeName, byte[] bytes, String location, boolean isTransient) { + public ByteCode(String binaryTypeName, byte[] bytes, String location, + boolean isTransient) { this.binaryTypeName = binaryTypeName; this.bytes = bytes; this.location = location; @@ -65,13 +76,6 @@ return version; } - private final String binaryTypeName; - private final byte[] bytes; - private final String location; - private final String version; - - private final boolean isTransient; - public boolean isTransient() { return isTransient; }
diff --git a/dev/core/src/com/google/gwt/dev/jdt/ByteCodeCompiler.java b/dev/core/src/com/google/gwt/dev/jdt/ByteCodeCompiler.java index 62b5391..fb0ded9 100644 --- a/dev/core/src/com/google/gwt/dev/jdt/ByteCodeCompiler.java +++ b/dev/core/src/com/google/gwt/dev/jdt/ByteCodeCompiler.java
@@ -29,6 +29,8 @@ */ public class ByteCodeCompiler extends AbstractCompiler { + private final CacheManager cacheManager; + /** * Creates a bytecode compiler for use not in hosted mode. All bytecode will * be thrown away after reload. @@ -85,7 +87,7 @@ // a policy of always trying to recompile if we don't have it cached. // ICompilationUnit start = getCompilationUnitForType(logger, binaryTypeName); - compile(logger, new ICompilationUnit[]{start}); + compile(logger, new ICompilationUnit[] {start}); // Check the cache again. If it's there now, we succeeded. // If it isn't there now, we've already logged the error. @@ -148,14 +150,13 @@ String loc = String.valueOf(result.compilationUnit.getFileName()); boolean isTransient = true; if (result.compilationUnit instanceof ICompilationUnitAdapter) { - ICompilationUnitAdapter unit = - (ICompilationUnitAdapter) result.compilationUnit; + ICompilationUnitAdapter unit = (ICompilationUnitAdapter) result.compilationUnit; isTransient = unit.getCompilationUnitProvider().isTransient(); } ByteCode byteCode = new ByteCode(className, bytes, loc, isTransient); if (cacheManager.acceptIntoCache(logger, className, byteCode)) { logger.log(TreeLogger.SPAM, "Successfully compiled and cached '" - + className + "'", null); + + className + "'", null); } } } @@ -169,6 +170,4 @@ String binaryTypeName) { return cacheManager.getByteCode(logger, binaryTypeName); } - - private final CacheManager cacheManager; }
diff --git a/dev/core/src/com/google/gwt/dev/jdt/CacheManager.java b/dev/core/src/com/google/gwt/dev/jdt/CacheManager.java index cb4b2c2..8af2f0f 100644 --- a/dev/core/src/com/google/gwt/dev/jdt/CacheManager.java +++ b/dev/core/src/com/google/gwt/dev/jdt/CacheManager.java
@@ -55,6 +55,8 @@ * Maps SourceTypeBindings to their associated types. */ static class Mapper { + private final Map map = new IdentityHashMap(); + public JClassType get(SourceTypeBinding binding) { JClassType type = (JClassType) map.get(binding); return type; @@ -68,14 +70,14 @@ public void reset() { map.clear(); } - - private final Map map = new IdentityHashMap(); } /** * This class is a very simple multi-valued map. */ private static class Dependencies { + private Map map = new HashMap(); + /** * This method adds <code>item</code> to the list stored under * <code>key</code>. @@ -128,33 +130,6 @@ } } } - - private Map map = new HashMap(); - } - - // This method must be outside of DiskCache because of the restruction against - // defining static methods in inner classes. - private static String possiblyAddTmpExtension(Object className) { - String fileName = className.toString(); - if (fileName.indexOf("-") == -1) { - int hashCode = fileName.hashCode(); - String hashCodeStr = Integer.toHexString(hashCode); - while (hashCodeStr.length() < 8) { - hashCodeStr = '0' + hashCodeStr; - } - fileName = fileName + "-" + hashCodeStr + ".tmp"; - } - return fileName; - } - - // This method must be outside of DiskCache because of the restruction against - // defining static methods in inner classes. - private static String possiblyRemoveTmpExtension(Object fileName) { - String className = fileName.toString(); - if (className.indexOf("-") != -1) { - className = className.split("-")[0]; - } - return className; } /** @@ -165,6 +140,8 @@ private class FileEntry implements Map.Entry { + private File file; + private FileEntry(File file) { this.file = file; } @@ -225,10 +202,14 @@ private long lastModified() { return file.lastModified(); } - - private File file; } + private final Map cache = new HashMap(); + + // May be set to null after the fact if the cache directory becomes + // unusable. + private File directory; + public DiskCache(File dirName) { if (dirName != null) { directory = dirName; @@ -238,27 +219,6 @@ } } - /** - * This is used to ensure that if something wicked happens to the cache - * directory while we are running, we do not crash. - */ - private void possiblyCreateCacheDirectory() { - directory.mkdirs(); - if (!(directory.exists() && directory.canWrite())) { - markCacheDirectoryUnusable(); - } - } - - /** - * This method marks the cache directory as being invalid, so we do not - * try to use it. - */ - private void markCacheDirectoryUnusable() { - System.err.println("The directory " + directory.getAbsolutePath() - + " is not usable as a cache directory"); - directory = null; - } - public void clear() { cache.clear(); if (directory != null) { @@ -271,8 +231,7 @@ public Set entrySet() { Set out = new HashSet() { public boolean remove(Object o) { - boolean removed = - (DiskCache.this.remove(((Entry) o).getKey())) != null; + boolean removed = (DiskCache.this.remove(((Entry) o).getKey())) != null; super.remove(o); return removed; } @@ -350,6 +309,27 @@ return new FileEntry(key).lastModified(); } + /** + * This method marks the cache directory as being invalid, so we do not try + * to use it. + */ + private void markCacheDirectoryUnusable() { + System.err.println("The directory " + directory.getAbsolutePath() + + " is not usable as a cache directory"); + directory = null; + } + + /** + * This is used to ensure that if something wicked happens to the cache + * directory while we are running, we do not crash. + */ + private void possiblyCreateCacheDirectory() { + directory.mkdirs(); + if (!(directory.exists() && directory.canWrite())) { + markCacheDirectoryUnusable(); + } + } + private Object put(Object key, Object value, boolean persist) { Object out = get(key); @@ -364,20 +344,14 @@ cache.put(key, value); return out; } - - private final Map cache = new HashMap(); - // May be set to null after the fact if the cache directory becomes - // unusable. - private File directory; } /** * The set of all classes whose bytecode needs to exist as bootstrap bytecode * to be taken as given by the bytecode compiler. */ - public static final Class[] BOOTSTRAP_CLASSES = - new Class[]{ - JavaScriptHost.class, ShellJavaScriptHost.class, ShellGWT.class}; + public static final Class[] BOOTSTRAP_CLASSES = new Class[] { + JavaScriptHost.class, ShellJavaScriptHost.class, ShellGWT.class}; /** * The set of bootstrap classes, which are marked transient, but are @@ -385,6 +359,68 @@ */ private static final Set TRANSIENT_CLASS_NAMES; + static { + TRANSIENT_CLASS_NAMES = new HashSet(BOOTSTRAP_CLASSES.length + 3); + for (int i = 0; i < BOOTSTRAP_CLASSES.length; i++) { + TRANSIENT_CLASS_NAMES.add(BOOTSTRAP_CLASSES[i].getName()); + } + } + + // This method must be outside of DiskCache because of the restruction against + // defining static methods in inner classes. + private static String possiblyAddTmpExtension(Object className) { + String fileName = className.toString(); + if (fileName.indexOf("-") == -1) { + int hashCode = fileName.hashCode(); + String hashCodeStr = Integer.toHexString(hashCode); + while (hashCodeStr.length() < 8) { + hashCodeStr = '0' + hashCodeStr; + } + fileName = fileName + "-" + hashCodeStr + ".tmp"; + } + return fileName; + } + + // This method must be outside of DiskCache because of the restruction against + // defining static methods in inner classes. + private static String possiblyRemoveTmpExtension(Object fileName) { + String className = fileName.toString(); + if (className.indexOf("-") != -1) { + className = className.split("-")[0]; + } + return className; + } + + private final Set addedCups = new HashSet(); + + private final AstCompiler astCompiler; + + private final DiskCache byteCodeCache; + + private final File cacheDir; + + private final Set changedFiles; + + private final Map cudsByFileName; + + private final Map cupsByLocation = new HashMap(); + + private boolean firstTime = true; + + private final Mapper identityMapper = new Mapper(); + + private final Set invalidatedTypes = new HashSet(); + + private final TypeOracle oracle; + + private final Map timesByLocation = new HashMap(); + + private boolean typeOracleBuilderFirstTime = true; + + private final Map unitsByCup = new HashMap(); + + private final Set volatileFiles = new HashSet(); + /** * Creates a new <code>CacheManager</code>, creating a new * <code>TypeOracle</code>. This constructor does not specify a cache @@ -481,11 +517,11 @@ if (getByteCode(logger, binaryTypeName) == null) { byteCodeCache.put(binaryTypeName, byteCode, (!byteCode.isTransient())); logger.log(TreeLogger.SPAM, "Cached bytecode for " + binaryTypeName, - null); + null); return true; } else { logger.log(TreeLogger.SPAM, "Bytecode not re-cached for " - + binaryTypeName, null); + + binaryTypeName, null); return false; } } @@ -531,8 +567,7 @@ // is referenced must also be treated as changed. // String referencedFn = String.valueOf(referencedType.getFileName()); - CompilationUnitDeclaration referencedCup = - (CompilationUnitDeclaration) cudsByFileName.get(referencedFn); + CompilationUnitDeclaration referencedCup = (CompilationUnitDeclaration) cudsByFileName.get(referencedFn); String fileName = String.valueOf(unitOfReferrer.getFileName()); dependencies.add(fileName, referencedFn); }; @@ -579,9 +614,8 @@ // we do not want bytecode created with a different classpath or os or // version of GWT. if ((byteCode != null) - && byteCode.getSystemIdentifier() != null - && (!(byteCode.getSystemIdentifier().equals(ByteCode - .getCurrentSystemIdentifier())))) { + && byteCode.getSystemIdentifier() != null + && (!(byteCode.getSystemIdentifier().equals(ByteCode.getCurrentSystemIdentifier())))) { byteCodeCache.remove(binaryTypeName); byteCode = null; } @@ -647,13 +681,13 @@ addDependentsToChangedFiles(); for (Iterator iter = changedFiles.iterator(); iter.hasNext();) { String location = (String) iter.next(); - CompilationUnitProvider cup = - (CompilationUnitProvider) getCupsByLocation().get(location); + CompilationUnitProvider cup = (CompilationUnitProvider) getCupsByLocation().get( + location); unitsByCup.remove(location); Util.invokeInaccessableMethod(TypeOracle.class, - "invalidateTypesInCompilationUnit", - new Class[]{CompilationUnitProvider.class}, typeOracle, - new Object[]{cup}); + "invalidateTypesInCompilationUnit", + new Class[] {CompilationUnitProvider.class}, typeOracle, + new Object[] {cup}); } astCompiler.invalidateChangedFiles(changedFiles, invalidatedTypes); } else { @@ -669,7 +703,7 @@ Long oldTime = (Long) getCupLastUpdateTime(cup); if (oldTime != null) { if (oldTime.longValue() >= lastModified.longValue() - && (!cup.isTransient())) { + && (!cup.isTransient())) { return true; } } @@ -690,12 +724,12 @@ synchronized (byteCodeCache) { if (getByteCode(logger, binaryTypeName) == null) { logger.log(TreeLogger.SPAM, "Bytecode for " + binaryTypeName - + " was not cached, so not removing", null); + + " was not cached, so not removing", null); return false; } else { byteCodeCache.remove(binaryTypeName); logger.log(TreeLogger.SPAM, "Bytecode not re-cached for " - + binaryTypeName, null); + + binaryTypeName, null); return false; } } @@ -735,8 +769,7 @@ continue; } String fileName = Util.findFileName(location); - CompilationUnitDeclaration compilationUnitDeclaration = - ((CompilationUnitDeclaration) cudsByFileName.get(location)); + CompilationUnitDeclaration compilationUnitDeclaration = ((CompilationUnitDeclaration) cudsByFileName.get(location)); if (compilationUnitDeclaration == null) { changedFiles.add(location); continue; @@ -783,9 +816,8 @@ AbstractCompiler compiler) { Set invalidTypes = new HashSet(); if (logger.isLoggable(TreeLogger.TRACE)) { - TreeLogger branch = - logger.branch(TreeLogger.TRACE, - "The following compilation units have changed since " + TreeLogger branch = logger.branch(TreeLogger.TRACE, + "The following compilation units have changed since " + "the last compilation to bytecode", null); for (Iterator iter = changedFiles.iterator(); iter.hasNext();) { String filename = (String) iter.next(); @@ -823,27 +855,4 @@ return false; } } - - static { - TRANSIENT_CLASS_NAMES = new HashSet(BOOTSTRAP_CLASSES.length + 3); - for (int i = 0; i < BOOTSTRAP_CLASSES.length; i++) { - TRANSIENT_CLASS_NAMES.add(BOOTSTRAP_CLASSES[i].getName()); - } - } - - private final Set addedCups = new HashSet(); - private final AstCompiler astCompiler; - private final DiskCache byteCodeCache; - private final File cacheDir; - private final Set changedFiles; - private final Map cudsByFileName; - private final Map cupsByLocation = new HashMap(); - private boolean firstTime = true; - private final Mapper identityMapper = new Mapper(); - private final Set invalidatedTypes = new HashSet(); - private final TypeOracle oracle; - private final Map timesByLocation = new HashMap(); - private boolean typeOracleBuilderFirstTime = true; - private final Map unitsByCup = new HashMap(); - private final Set volatileFiles = new HashSet(); }
diff --git a/dev/core/src/com/google/gwt/dev/jdt/CompilationUnitProviderWithAlternateSource.java b/dev/core/src/com/google/gwt/dev/jdt/CompilationUnitProviderWithAlternateSource.java index df13bad..0b0bc5a 100644 --- a/dev/core/src/com/google/gwt/dev/jdt/CompilationUnitProviderWithAlternateSource.java +++ b/dev/core/src/com/google/gwt/dev/jdt/CompilationUnitProviderWithAlternateSource.java
@@ -20,6 +20,10 @@ public class CompilationUnitProviderWithAlternateSource implements CompilationUnitProvider { + private final CompilationUnitProvider cup; + + private final char[] source; + public CompilationUnitProviderWithAlternateSource( CompilationUnitProvider cup, char[] source) { this.cup = cup; @@ -45,7 +49,4 @@ public boolean isTransient() { return cup.isTransient(); } - - private final CompilationUnitProvider cup; - private final char[] source; }
diff --git a/dev/core/src/com/google/gwt/dev/jdt/FindDeferredBindingSitesVisitor.java b/dev/core/src/com/google/gwt/dev/jdt/FindDeferredBindingSitesVisitor.java index 9798f69..ba25f9e 100644 --- a/dev/core/src/com/google/gwt/dev/jdt/FindDeferredBindingSitesVisitor.java +++ b/dev/core/src/com/google/gwt/dev/jdt/FindDeferredBindingSitesVisitor.java
@@ -36,6 +36,8 @@ public static final String REBIND_MAGIC_CLASS = "com.google.gwt.core.client.GWT"; public static final String REBIND_MAGIC_METHOD = "create"; + private final Set results; + public FindDeferredBindingSitesVisitor(Set results) { this.results = results; } @@ -66,15 +68,15 @@ Expression[] args = messageSend.arguments; if (args.length != 1) { problemReporter.abortDueToInternalError( - "GWT.create() should take exactly one argument", messageSend); + "GWT.create() should take exactly one argument", messageSend); return; } Expression arg = args[0]; if (!(arg instanceof ClassLiteralAccess)) { problemReporter.abortDueToInternalError( - "Only class literals may be used as arguments to GWT.create()", - messageSend); + "Only class literals may be used as arguments to GWT.create()", + messageSend); return; } @@ -82,6 +84,4 @@ String typeName = String.valueOf(cla.targetType.readableName()); results.add(typeName); } - - private final Set results; }
diff --git a/dev/core/src/com/google/gwt/dev/jdt/FindJsniRefVisitor.java b/dev/core/src/com/google/gwt/dev/jdt/FindJsniRefVisitor.java index 173ba95..1ecb5f1 100644 --- a/dev/core/src/com/google/gwt/dev/jdt/FindJsniRefVisitor.java +++ b/dev/core/src/com/google/gwt/dev/jdt/FindJsniRefVisitor.java
@@ -34,11 +34,11 @@ public class FindJsniRefVisitor extends ASTVisitor { - private final Set/*<String>*/ jsniClasses; + private final Set/* <String> */jsniClasses; private final JsParser jsParser = new JsParser(); private final JsProgram jsProgram = new JsProgram(); - public FindJsniRefVisitor(Set/*<String>*/ jsniClasses) { + public FindJsniRefVisitor(Set/* <String> */jsniClasses) { this.jsniClasses = jsniClasses; } @@ -48,10 +48,9 @@ } // Handle JSNI block - char[] source = methodDeclaration.compilationResult().getCompilationUnit() - .getContents(); + char[] source = methodDeclaration.compilationResult().getCompilationUnit().getContents(); String jsniCode = String.valueOf(source, methodDeclaration.bodyStart, - methodDeclaration.bodyEnd - methodDeclaration.bodyStart + 1); + methodDeclaration.bodyEnd - methodDeclaration.bodyStart + 1); int startPos = jsniCode.indexOf("/*-{"); int endPos = jsniCode.lastIndexOf("}-*/"); if (startPos < 0 || endPos < 0) { @@ -92,7 +91,7 @@ }); } catch (IOException e) { throw new InternalCompilerException( - "Internal error searching for JSNI references", e); + "Internal error searching for JSNI references", e); } catch (JsParserException e) { // ignore, we only care about finding valid references }
diff --git a/dev/core/src/com/google/gwt/dev/jdt/ICompilationUnitAdapter.java b/dev/core/src/com/google/gwt/dev/jdt/ICompilationUnitAdapter.java index 3bd92b5..21cb5c9 100644 --- a/dev/core/src/com/google/gwt/dev/jdt/ICompilationUnitAdapter.java +++ b/dev/core/src/com/google/gwt/dev/jdt/ICompilationUnitAdapter.java
@@ -23,6 +23,8 @@ public class ICompilationUnitAdapter implements ICompilationUnit { + private final CompilationUnitProvider cup; + public ICompilationUnitAdapter(CompilationUnitProvider cup) { assert (cup != null); this.cup = cup; @@ -54,6 +56,4 @@ final char[][] pkgParts = CharOperation.splitOn('.', pkg); return pkgParts; } - - private final CompilationUnitProvider cup; }
diff --git a/dev/core/src/com/google/gwt/dev/jdt/Shared.java b/dev/core/src/com/google/gwt/dev/jdt/Shared.java index 22f0615..b7de772 100644 --- a/dev/core/src/com/google/gwt/dev/jdt/Shared.java +++ b/dev/core/src/com/google/gwt/dev/jdt/Shared.java
@@ -53,6 +53,41 @@ static final String[][] NO_STRING_ARR_ARR = new String[0][]; static final String[] NO_STRINGS = new String[0]; + public static int bindingToModifierBits(FieldBinding binding) { + int bits = 0; + bits |= (binding.isPublic() ? MOD_PUBLIC : 0); + bits |= (binding.isPrivate() ? MOD_PRIVATE : 0); + bits |= (binding.isProtected() ? MOD_PROTECTED : 0); + bits |= (binding.isStatic() ? MOD_STATIC : 0); + bits |= (binding.isTransient() ? MOD_TRANSIENT : 0); + bits |= (binding.isFinal() ? MOD_FINAL : 0); + bits |= (binding.isVolatile() ? MOD_VOLATILE : 0); + return bits; + } + + public static int bindingToModifierBits(MethodBinding binding) { + int bits = 0; + bits |= (binding.isPublic() ? MOD_PUBLIC : 0); + bits |= (binding.isPrivate() ? MOD_PRIVATE : 0); + bits |= (binding.isProtected() ? MOD_PROTECTED : 0); + bits |= (binding.isStatic() ? MOD_STATIC : 0); + bits |= (binding.isFinal() ? MOD_FINAL : 0); + bits |= (binding.isNative() ? MOD_NATIVE : 0); + bits |= (binding.isAbstract() ? MOD_ABSTRACT : 0); + return bits; + } + + public static int bindingToModifierBits(ReferenceBinding binding) { + int bits = 0; + bits |= (binding.isPublic() ? MOD_PUBLIC : 0); + bits |= (binding.isPrivate() ? MOD_PRIVATE : 0); + bits |= (binding.isProtected() ? MOD_PROTECTED : 0); + bits |= (binding.isStatic() ? MOD_STATIC : 0); + bits |= (binding.isFinal() ? MOD_FINAL : 0); + bits |= (binding.isAbstract() ? MOD_ABSTRACT : 0); + return bits; + } + static String[] modifierBitsToNames(int bits) { List strings = new ArrayList(); @@ -85,7 +120,7 @@ if (0 != (bits & MOD_NATIVE)) { strings.add("native"); } - + if (0 != (bits & MOD_TRANSIENT)) { strings.add("transient"); } @@ -97,39 +132,4 @@ return (String[]) strings.toArray(NO_STRINGS); } - public static int bindingToModifierBits(ReferenceBinding binding) { - int bits = 0; - bits |= (binding.isPublic() ? MOD_PUBLIC : 0); - bits |= (binding.isPrivate() ? MOD_PRIVATE : 0); - bits |= (binding.isProtected() ? MOD_PROTECTED : 0); - bits |= (binding.isStatic() ? MOD_STATIC : 0); - bits |= (binding.isFinal() ? MOD_FINAL : 0); - bits |= (binding.isAbstract() ? MOD_ABSTRACT : 0); - return bits; - } - - public static int bindingToModifierBits(FieldBinding binding) { - int bits = 0; - bits |= (binding.isPublic() ? MOD_PUBLIC : 0); - bits |= (binding.isPrivate() ? MOD_PRIVATE : 0); - bits |= (binding.isProtected() ? MOD_PROTECTED : 0); - bits |= (binding.isStatic() ? MOD_STATIC : 0); - bits |= (binding.isTransient() ? MOD_TRANSIENT : 0); - bits |= (binding.isFinal() ? MOD_FINAL : 0); - bits |= (binding.isVolatile() ? MOD_VOLATILE : 0); - return bits; - } - - public static int bindingToModifierBits(MethodBinding binding) { - int bits = 0; - bits |= (binding.isPublic() ? MOD_PUBLIC : 0); - bits |= (binding.isPrivate() ? MOD_PRIVATE : 0); - bits |= (binding.isProtected() ? MOD_PROTECTED : 0); - bits |= (binding.isStatic() ? MOD_STATIC : 0); - bits |= (binding.isFinal() ? MOD_FINAL : 0); - bits |= (binding.isNative() ? MOD_NATIVE : 0); - bits |= (binding.isAbstract() ? MOD_ABSTRACT : 0); - return bits; - } - }
diff --git a/dev/core/src/com/google/gwt/dev/jdt/SourceOracleOnTypeOracle.java b/dev/core/src/com/google/gwt/dev/jdt/SourceOracleOnTypeOracle.java index 9a35568..9e9c371 100644 --- a/dev/core/src/com/google/gwt/dev/jdt/SourceOracleOnTypeOracle.java +++ b/dev/core/src/com/google/gwt/dev/jdt/SourceOracleOnTypeOracle.java
@@ -22,6 +22,8 @@ public class SourceOracleOnTypeOracle implements SourceOracle { + private final TypeOracle typeOracle; + public SourceOracleOnTypeOracle(TypeOracle typeOracle) { this.typeOracle = typeOracle; } @@ -42,6 +44,4 @@ return false; } } - - private final TypeOracle typeOracle; }
diff --git a/dev/core/src/com/google/gwt/dev/jdt/StandardSourceOracle.java b/dev/core/src/com/google/gwt/dev/jdt/StandardSourceOracle.java index 926945f..e9c923e 100644 --- a/dev/core/src/com/google/gwt/dev/jdt/StandardSourceOracle.java +++ b/dev/core/src/com/google/gwt/dev/jdt/StandardSourceOracle.java
@@ -37,6 +37,12 @@ */ public class StandardSourceOracle implements SourceOracle { + private final Map cupsByTypeName = new HashMap(); + + private final Set knownPackages = new HashSet(); + + private final TypeOracle typeOracle; + /** * @param typeOracle answers questions about compilation unit locations * @param genDir for compilation units whose location does not correspond to a @@ -59,8 +65,7 @@ // Check the cache first. // - CompilationUnitProvider cup = - (CompilationUnitProvider) cupsByTypeName.get(typeName); + CompilationUnitProvider cup = (CompilationUnitProvider) cupsByTypeName.get(typeName); if (cup != null) { // Found in cache. @@ -83,8 +88,8 @@ // if (cup != null) { try { - CompilationUnitProvider specialCup = - doFilterCompilationUnit(logger, typeName, cup); + CompilationUnitProvider specialCup = doFilterCompilationUnit(logger, + typeName, cup); if (specialCup != null) { // Use the cup that the subclass returned instead. Note that even @@ -119,10 +124,6 @@ return typeOracle; } - void invalidateCups(Set typeNames) { - cupsByTypeName.keySet().removeAll(typeNames); - } - /** * Determines whether or not a particular name is a package name. */ @@ -180,6 +181,10 @@ return null; } + void invalidateCups(Set typeNames) { + cupsByTypeName.keySet().removeAll(typeNames); + } + /** * Remember that this package was added. Used for generated packages. */ @@ -192,8 +197,4 @@ } knownPackages.add(packageName); } - - private final Map cupsByTypeName = new HashMap(); - private final Set knownPackages = new HashSet(); - private final TypeOracle typeOracle; }
diff --git a/dev/core/src/com/google/gwt/dev/jdt/StaticCompilationUnitProvider.java b/dev/core/src/com/google/gwt/dev/jdt/StaticCompilationUnitProvider.java index 013b343..673781e 100644 --- a/dev/core/src/com/google/gwt/dev/jdt/StaticCompilationUnitProvider.java +++ b/dev/core/src/com/google/gwt/dev/jdt/StaticCompilationUnitProvider.java
@@ -19,6 +19,12 @@ public class StaticCompilationUnitProvider implements CompilationUnitProvider { + private final String packageName; + + private final String simpleTypeName; + + private final char[] source; + /** * @param source if <code>null</code>, override this class and return * source from {@link #getSource()} @@ -63,8 +69,4 @@ public String toString() { return getLocation(); } - - private final String packageName; - private final String simpleTypeName; - private final char[] source; }
diff --git a/dev/core/src/com/google/gwt/dev/jdt/TypeOracleBuilder.java b/dev/core/src/com/google/gwt/dev/jdt/TypeOracleBuilder.java index cd408bb..7d3c0da 100644 --- a/dev/core/src/com/google/gwt/dev/jdt/TypeOracleBuilder.java +++ b/dev/core/src/com/google/gwt/dev/jdt/TypeOracleBuilder.java
@@ -106,23 +106,20 @@ // is referenced must also be removed. // String referencedFn = String.valueOf(referencedType.getFileName()); - CompilationUnitDeclaration referencedCud = - (CompilationUnitDeclaration) cudsByFileName.get(referencedFn); + CompilationUnitDeclaration referencedCud = (CompilationUnitDeclaration) cudsByFileName.get(referencedFn); if (referencedCud == null) { // This is a referenced to a bad or non-existent unit. // So, remove the referrer's unit if it hasn't been already. // String referrerFn = String.valueOf(unitOfReferrer.getFileName()); if (cudsByFileName.containsKey(referrerFn) - && !pendingRemovals.contains(referrerFn)) { - TreeLogger branch = - logger.branch(TreeLogger.TRACE, - "Cascaded removal of compilation unit '" + referrerFn + "'", - null); - final String badTypeName = - CharOperation.toString(referencedType.compoundName); + && !pendingRemovals.contains(referrerFn)) { + TreeLogger branch = logger.branch(TreeLogger.TRACE, + "Cascaded removal of compilation unit '" + referrerFn + "'", + null); + final String badTypeName = CharOperation.toString(referencedType.compoundName); branch.branch(TreeLogger.TRACE, - "Due to reference to unavailable type: " + badTypeName, null); + "Due to reference to unavailable type: " + badTypeName, null); pendingRemovals.add(referrerFn); } } @@ -145,8 +142,7 @@ // Find references to type in units that aren't valid. // for (Iterator iter = cudsByFileName.values().iterator(); iter.hasNext();) { - CompilationUnitDeclaration cud = - (CompilationUnitDeclaration) iter.next(); + CompilationUnitDeclaration cud = (CompilationUnitDeclaration) iter.next(); cud.traverse(trv, cud.scope); } } while (!pendingRemovals.isEmpty()); @@ -169,7 +165,7 @@ char[] source = cud.compilationResult.compilationUnit.getContents(); Util.maybeDumpSource(logger, fileName, source, null); logger.log(TreeLogger.TRACE, "Removing problematic compilation unit '" - + fileName + "'", null); + + fileName + "'", null); } } @@ -180,6 +176,8 @@ } } + private final CacheManager cacheManager; + /** * Constructs a default instance, with a default cacheManager. This is not to * be used in Hosted Mode, as caching will then not work. @@ -230,19 +228,17 @@ location = Util.findFileName(location); if (!(new File(location).exists() || cup.isTransient())) { iter.remove(); - logger - .log( + logger.log( TreeLogger.TRACE, "The file " - + location - + " was removed by the user. All types therein are now unavailable.", + + location + + " was removed by the user. All types therein are now unavailable.", null); } } } - CompilationUnitProvider[] cups = - (CompilationUnitProvider[]) Util.toArray(CompilationUnitProvider.class, - addedCups); + CompilationUnitProvider[] cups = (CompilationUnitProvider[]) Util.toArray( + CompilationUnitProvider.class, addedCups); Arrays.sort(cups, CompilationUnitProvider.LOCATION_COMPARATOR); // Make sure we can find the java.lang.Object compilation unit. @@ -265,9 +261,8 @@ throw new UnableToCompleteException(); } cacheManager.invalidateOnRefresh(oracle); - CompilationUnitDeclaration[] cuds = - cacheManager.getAstCompiler().getCompilationUnitDeclarations(logger, - units); + CompilationUnitDeclaration[] cuds = cacheManager.getAstCompiler().getCompilationUnitDeclarations( + logger, units); // Build a list that makes it easy to remove problems. // @@ -309,17 +304,13 @@ cud.traverse(new ASTVisitor() { public boolean visit(TypeDeclaration typeDecl, BlockScope scope) { - JClassType enclosingType = - identityMapper.get((SourceTypeBinding) typeDecl.binding - .enclosingType()); + JClassType enclosingType = identityMapper.get((SourceTypeBinding) typeDecl.binding.enclosingType()); processType(typeDecl, enclosingType, true); return true; } public boolean visit(TypeDeclaration typeDecl, ClassScope scope) { - JClassType enclosingType = - identityMapper.get((SourceTypeBinding) typeDecl.binding - .enclosingType()); + JClassType enclosingType = identityMapper.get((SourceTypeBinding) typeDecl.binding.enclosingType()); processType(typeDecl, enclosingType, false); return true; } @@ -338,8 +329,8 @@ CompilationUnitDeclaration cud = (CompilationUnitDeclaration) iter.next(); String loc = String.valueOf(cud.getFileName()); String processing = "Processing types in compilation unit: " + loc; - final TreeLogger cudLogger = - logger.branch(TreeLogger.SPAM, processing, null); + final TreeLogger cudLogger = logger.branch(TreeLogger.SPAM, processing, + null); final char[] source = cud.compilationResult.compilationUnit.getContents(); cud.traverse(new ASTVisitor() { @@ -373,7 +364,7 @@ }, cud.scope); } Util.invokeInaccessableMethod(TypeOracle.class, "refresh", - new Class[]{TreeLogger.class}, oracle, new Object[]{logger}); + new Class[] {TreeLogger.class}, oracle, new Object[] {logger}); return oracle; } @@ -393,8 +384,7 @@ } private String getPackage(TypeDeclaration typeDecl) { - final char[][] pkgParts = - typeDecl.compilationResult.compilationUnit.getPackageName(); + final char[][] pkgParts = typeDecl.compilationResult.compilationUnit.getPackageName(); return String.valueOf(CharOperation.concatWith(pkgParts, '.')); } @@ -542,9 +532,9 @@ int bodyStart = typeDecl.bodyStart; int bodyEnd = typeDecl.bodyEnd; - JClassType type = - new JClassType(oracle, cup, pkg, enclosingType, isLocalType, - jclassName, declStart, declEnd, bodyStart, bodyEnd, jclassIsIntf); + JClassType type = new JClassType(oracle, cup, pkg, enclosingType, + isLocalType, jclassName, declStart, declEnd, bodyStart, bodyEnd, + jclassIsIntf); cacheManager.setTypeForBinding(binding, type); } @@ -619,19 +609,16 @@ if (jmethod.isConstructor()) { name = String.valueOf(enclosingType.getSimpleSourceName()); - method = - new JConstructor(enclosingType, name, declStart, declEnd, bodyStart, - bodyEnd); + method = new JConstructor(enclosingType, name, declStart, declEnd, + bodyStart, bodyEnd); } else { name = String.valueOf(jmethod.binding.selector); - method = - new JMethod(enclosingType, name, declStart, declEnd, bodyStart, - bodyEnd); + method = new JMethod(enclosingType, name, declStart, declEnd, bodyStart, + bodyEnd); // Set the return type. // - TypeBinding jreturnType = - ((MethodDeclaration) jmethod).returnType.resolvedType; + TypeBinding jreturnType = ((MethodDeclaration) jmethod).returnType.resolvedType; JType returnType = resolveType(logger, jreturnType); if (returnType == null) { // Unresolved type. @@ -823,7 +810,7 @@ // if (binding instanceof BinaryTypeBinding) { logger.log(TreeLogger.WARN, - "Source not available for this type, so it cannot be resolved", null); + "Source not available for this type, so it cannot be resolved", null); } String name = String.valueOf(binding.readableName()); @@ -908,6 +895,4 @@ return true; } - private final CacheManager cacheManager; - }
diff --git a/dev/core/src/com/google/gwt/dev/jdt/TypeRefVisitor.java b/dev/core/src/com/google/gwt/dev/jdt/TypeRefVisitor.java index 40dc143..baeb129 100644 --- a/dev/core/src/com/google/gwt/dev/jdt/TypeRefVisitor.java +++ b/dev/core/src/com/google/gwt/dev/jdt/TypeRefVisitor.java
@@ -90,17 +90,8 @@ maybeDispatch(scope, x.resolvedType); } - private void maybeDispatch(Scope referencedFrom, TypeBinding binding) { - if (binding instanceof SourceTypeBinding) { - SourceTypeBinding type = (SourceTypeBinding) binding; - CompilationUnitScope from = findUnitScope(referencedFrom); - onTypeRef(type, from.referenceContext); - } else if (binding instanceof ArrayBinding) { - maybeDispatch(referencedFrom, ((ArrayBinding) binding).leafComponentType); - } else { - // We don't care about other cases. - } - } + protected abstract void onTypeRef(SourceTypeBinding referencedType, + CompilationUnitDeclaration unitOfReferrer); private CompilationUnitScope findUnitScope(Scope referencedFrom) { assert (referencedFrom != null); @@ -112,6 +103,15 @@ return (CompilationUnitScope) scope; } - protected abstract void onTypeRef(SourceTypeBinding referencedType, - CompilationUnitDeclaration unitOfReferrer); + private void maybeDispatch(Scope referencedFrom, TypeBinding binding) { + if (binding instanceof SourceTypeBinding) { + SourceTypeBinding type = (SourceTypeBinding) binding; + CompilationUnitScope from = findUnitScope(referencedFrom); + onTypeRef(type, from.referenceContext); + } else if (binding instanceof ArrayBinding) { + maybeDispatch(referencedFrom, ((ArrayBinding) binding).leafComponentType); + } else { + // We don't care about other cases. + } + } }
diff --git a/dev/core/src/com/google/gwt/dev/jdt/URLCompilationUnitProvider.java b/dev/core/src/com/google/gwt/dev/jdt/URLCompilationUnitProvider.java index cada895..6f2a218 100644 --- a/dev/core/src/com/google/gwt/dev/jdt/URLCompilationUnitProvider.java +++ b/dev/core/src/com/google/gwt/dev/jdt/URLCompilationUnitProvider.java
@@ -30,20 +30,33 @@ String s = url.toExternalForm(); File f = null; if (s.startsWith("file:")) { - // Strip the file: off, and use the result. If the result - // does not start with file, we cannot simplify. Using URI + // Strip the file: off, and use the result. If the result + // does not start with file, we cannot simplify. Using URI // to do the simplification fails for paths with spaces. // Any number of slashes at the beginning cause no problem for Java, so // if c:/windows exists so will ///////c:/windows. - f = new File(s.substring(5)); - if (!f.exists()) { - f = null; - } + f = new File(s.substring(5)); + if (!f.exists()) { + f = null; + } } else { f = null; } return f; } + + private final File file; + + private final String location; + + private final String packageName; + + private char[] source; + + private long sourceCurrentTime = Long.MIN_VALUE; + + private final URL url; + public URLCompilationUnitProvider(URL url, String packageName) { assert (url != null); assert (packageName != null); @@ -110,11 +123,4 @@ public String toString() { return location; } - - private final File file; - private final String location; - private final String packageName; - private char[] source; - private long sourceCurrentTime = Long.MIN_VALUE; - private final URL url; }
diff --git a/dev/core/src/com/google/gwt/dev/jdt/WebModeCompilerFrontEnd.java b/dev/core/src/com/google/gwt/dev/jdt/WebModeCompilerFrontEnd.java index 1a86026..27f31e7 100644 --- a/dev/core/src/com/google/gwt/dev/jdt/WebModeCompilerFrontEnd.java +++ b/dev/core/src/com/google/gwt/dev/jdt/WebModeCompilerFrontEnd.java
@@ -29,6 +29,8 @@ public class WebModeCompilerFrontEnd extends AstCompiler { + private final RebindPermutationOracle rebindPermOracle; + public WebModeCompilerFrontEnd(SourceOracle sourceOracle, RebindPermutationOracle rebindPermOracle) { super(sourceOracle); @@ -75,25 +77,23 @@ protected String[] doFindAdditionalTypesUsingRebinds(TreeLogger logger, CompilationUnitDeclaration cud) throws UnableToCompleteException { Set dependentTypeNames = new HashSet(); - + // Find all the deferred binding request types. // Set requestedTypes = new HashSet(); FindDeferredBindingSitesVisitor v = new FindDeferredBindingSitesVisitor( - requestedTypes); + requestedTypes); cud.traverse(v, cud.scope); - + // For each, ask the host for every possible deferred binding answer. // for (Iterator iter = requestedTypes.iterator(); iter.hasNext();) { String reqType = (String) iter.next(); String[] resultTypes = rebindPermOracle.getAllPossibleRebindAnswers( - getLogger(), reqType); - + getLogger(), reqType); + Util.addAll(dependentTypeNames, resultTypes); } return (String[]) dependentTypeNames.toArray(Empty.STRINGS); } - - private final RebindPermutationOracle rebindPermOracle; }