Auto format pass of some files before review

Review at http://gwt-code-reviews.appspot.com/1444802


git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@10177 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/dev/core/src/com/google/gwt/dev/javac/CachedCompilationUnit.java b/dev/core/src/com/google/gwt/dev/javac/CachedCompilationUnit.java
index 1b27534..fbf73d1 100644
--- a/dev/core/src/com/google/gwt/dev/javac/CachedCompilationUnit.java
+++ b/dev/core/src/com/google/gwt/dev/javac/CachedCompilationUnit.java
@@ -1,12 +1,12 @@
 /*
  * Copyright 2011 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
@@ -23,7 +23,7 @@
 import java.util.List;
 
 /**
- * This class provides a Convenient way to serialize a {@CompilationUnit}.
+ * A convenient way to serialize a {@CompilationUnit}.
  */
 public class CachedCompilationUnit extends CompilationUnit {
   private final DiskCacheToken astToken;
@@ -43,11 +43,14 @@
   private final DiskCacheToken sourceToken;
 
   /**
-   * Create a compilation unit that can be serialized from another {@link CompilationUnit}.
-   * 
+   * Create a compilation unit that can be serialized from another
+   * {@link CompilationUnit}.
+   *
    * @param unit A unit to copy
-   * @param sourceToken A valid {@DiskCache} token for this unit's source code.
-   * @param astToken A valid {@DiskCache} token for this unit's serialized AST types.
+   * @param sourceToken A valid {@DiskCache} token for this unit's
+   *          source code.
+   * @param astToken A valid {@DiskCache} token for this unit's
+   *          serialized AST types.
    */
   @SuppressWarnings("deprecation")
   CachedCompilationUnit(CompilationUnit unit, long sourceToken, long astToken) {
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 1d28d64..16ccd78 100644
--- a/dev/core/src/com/google/gwt/dev/javac/CompilationUnit.java
+++ b/dev/core/src/com/google/gwt/dev/javac/CompilationUnit.java
@@ -315,12 +315,10 @@
   public List<JDeclaredType> getTypes() {
     try {
       byte[] bytes = getTypesSerialized();
-      ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(
-          bytes));
+      ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(bytes));
       return JProgram.deserializeTypes(ois);
     } catch (IOException e) {
-      throw new RuntimeException("Unexpected IOException on in-memory stream",
-          e);
+      throw new RuntimeException("Unexpected IOException on in-memory stream", e);
     } catch (ClassNotFoundException e) {
       throw new RuntimeException("Unexpected error deserializing AST for '" + getTypeName() + "'",
           e);
diff --git a/dev/core/src/com/google/gwt/dev/javac/CompilationUnitBuilder.java b/dev/core/src/com/google/gwt/dev/javac/CompilationUnitBuilder.java
index 80bf41d..e8d7ad3 100644
--- a/dev/core/src/com/google/gwt/dev/javac/CompilationUnitBuilder.java
+++ b/dev/core/src/com/google/gwt/dev/javac/CompilationUnitBuilder.java
@@ -62,10 +62,10 @@
     @Override
     protected CompilationUnit makeUnit(List<CompiledClass> compiledClasses,
         List<JDeclaredType> types, Dependencies dependencies,
-        Collection<? extends JsniMethod> jsniMethods,
-        MethodArgNamesLookup methodArgs, CategorizedProblem[] problems) {
-      return new GeneratedCompilationUnit(generatedUnit, compiledClasses,
-          types, dependencies, jsniMethods, methodArgs, problems);
+        Collection<? extends JsniMethod> jsniMethods, MethodArgNamesLookup methodArgs,
+        CategorizedProblem[] problems) {
+      return new GeneratedCompilationUnit(generatedUnit, compiledClasses, types, dependencies,
+          jsniMethods, methodArgs, problems);
     }
 
     @Override
@@ -139,8 +139,7 @@
       try {
         Util.copy(in, out);
       } catch (IOException e) {
-        throw new RuntimeException("Unexpected error reading resource '"
-            + resource + "'", e);
+        throw new RuntimeException("Unexpected error reading resource '" + resource + "'", e);
       }
       byte[] content = out.toByteArray();
       contentId = new ContentId(getTypeName(), Util.computeStrongName(content));
@@ -150,25 +149,21 @@
     @Override
     protected CompilationUnit makeUnit(List<CompiledClass> compiledClasses,
         List<JDeclaredType> types, Dependencies dependencies,
-        Collection<? extends JsniMethod> jsniMethods,
-        MethodArgNamesLookup methodArgs, CategorizedProblem[] problems) {
-      return new SourceFileCompilationUnit(getResource(), contentId,
-          compiledClasses, types, dependencies, jsniMethods, methodArgs,
-          problems, getLastModified());
+        Collection<? extends JsniMethod> jsniMethods, MethodArgNamesLookup methodArgs,
+        CategorizedProblem[] problems) {
+      return new SourceFileCompilationUnit(getResource(), contentId, compiledClasses, types,
+          dependencies, jsniMethods, methodArgs, problems, getLastModified());
     }
   }
 
-  private static final class GeneratedCompilationUnit extends
-      CompilationUnitImpl {
+  private static final class GeneratedCompilationUnit extends CompilationUnitImpl {
     private final GeneratedUnit generatedUnit;
-    
+
     public GeneratedCompilationUnit(GeneratedUnit generatedUnit,
-        List<CompiledClass> compiledClasses, List<JDeclaredType> types,
-        Dependencies dependencies,
-        Collection<? extends JsniMethod> jsniMethods,
-        MethodArgNamesLookup methodArgs, CategorizedProblem[] problems) {
-      super(compiledClasses, types, dependencies, jsniMethods, methodArgs,
-          problems);
+        List<CompiledClass> compiledClasses, List<JDeclaredType> types, Dependencies dependencies,
+        Collection<? extends JsniMethod> jsniMethods, MethodArgNamesLookup methodArgs,
+        CategorizedProblem[] problems) {
+      super(compiledClasses, types, dependencies, jsniMethods, methodArgs, problems);
       this.generatedUnit = generatedUnit;
     }
 
@@ -268,8 +263,7 @@
     assert dependencies != null;
     assert jsniMethods != null;
     assert methodArgs != null;
-    return makeUnit(compiledClasses, types, dependencies, jsniMethods,
-        methodArgs, problems);
+    return makeUnit(compiledClasses, types, dependencies, jsniMethods, methodArgs, problems);
   }
 
   public abstract ContentId getContentId();
@@ -290,8 +284,7 @@
     return this;
   }
 
-  public CompilationUnitBuilder setCompiledClasses(
-      List<CompiledClass> compiledClasses) {
+  public CompilationUnitBuilder setCompiledClasses(List<CompiledClass> compiledClasses) {
     this.compiledClasses = compiledClasses;
     return this;
   }
@@ -301,8 +294,7 @@
     return this;
   }
 
-  public CompilationUnitBuilder setJsniMethods(
-      Collection<? extends JsniMethod> jsniMethods) {
+  public CompilationUnitBuilder setJsniMethods(Collection<? extends JsniMethod> jsniMethods) {
     this.jsniMethods = jsniMethods;
     return this;
   }
@@ -334,10 +326,10 @@
 
   protected abstract String doGetSource();
 
-  protected abstract CompilationUnit makeUnit(
-      List<CompiledClass> compiledClasses, List<JDeclaredType> types,
-      Dependencies dependencies, Collection<? extends JsniMethod> jsniMethods,
-      MethodArgNamesLookup methodArgs, CategorizedProblem[] errors);
+  protected abstract CompilationUnit makeUnit(List<CompiledClass> compiledClasses,
+      List<JDeclaredType> types, Dependencies dependencies,
+      Collection<? extends JsniMethod> jsniMethods, MethodArgNamesLookup methodArgs,
+      CategorizedProblem[] errors);
 
   /**
    * This only matters for {@link ArtificialRescueChecker}.
diff --git a/dev/core/src/com/google/gwt/dev/javac/PersistentUnitCache.java b/dev/core/src/com/google/gwt/dev/javac/PersistentUnitCache.java
index 1277409..d11de53 100644
--- a/dev/core/src/com/google/gwt/dev/javac/PersistentUnitCache.java
+++ b/dev/core/src/com/google/gwt/dev/javac/PersistentUnitCache.java
@@ -78,10 +78,10 @@
  * uses lots of heap and takes 5-10 seconds. Once the PersistentUnitCache is
  * created, it starts eagerly loading the cache in a background thread).</li>
  * 
- * <li>Although units logged to disk with the same resource path are
- * eventually cleaned up, the most recently compiled unit stays in the cache
- * forever. This means that stale units that are no longer referenced will never
- * be purged, unless by some external action (e.g. ant clean).</li>
+ * <li>Although units logged to disk with the same resource path are eventually
+ * cleaned up, the most recently compiled unit stays in the cache forever. This
+ * means that stale units that are no longer referenced will never be purged,
+ * unless by some external action (e.g. ant clean).</li>
  * 
  * <li>Unless ant builds are made aware of the cache directory, the cache will
  * persist if a user does an ant clean.</li>
@@ -122,7 +122,8 @@
       } finally {
         loadCompleteLatch.countDown();
         if (logger.isLoggable(TreeLogger.TRACE)) {
-          logger.log(TreeLogger.TRACE, "Loaded " + unitMap.size() + " units from persistent store.");
+          logger
+              .log(TreeLogger.TRACE, "Loaded " + unitMap.size() + " units from persistent store.");
         }
       }
     }
@@ -308,7 +309,7 @@
     this.cacheDirectory = new File(cacheDir, UNIT_CACHE_PREFIX);
     if (logger.isLoggable(TreeLogger.TRACE)) {
       logger.log(TreeLogger.TRACE, "Persistent unit cache dir set to: "
-        + this.cacheDirectory.getAbsolutePath());
+          + this.cacheDirectory.getAbsolutePath());
     }
 
     if (!cacheDirectory.isDirectory() && !cacheDirectory.mkdirs()) {
@@ -529,8 +530,9 @@
           }
         }
       } else {
-        logger.log(TreeLogger.TRACE,
-        "Starting with empty Cache: CompilationUnit cache directory does not exist or is not readable.");
+        logger
+            .log(TreeLogger.TRACE,
+                "Starting with empty Cache: CompilationUnit cache directory does not exist or is not readable.");
       }
     } finally {
       loadPersistentUnitEvent.end();
diff --git a/dev/core/src/com/google/gwt/dev/javac/SourceFileCompilationUnit.java b/dev/core/src/com/google/gwt/dev/javac/SourceFileCompilationUnit.java
index 7866424..1ee51e1 100644
--- a/dev/core/src/com/google/gwt/dev/javac/SourceFileCompilationUnit.java
+++ b/dev/core/src/com/google/gwt/dev/javac/SourceFileCompilationUnit.java
@@ -38,17 +38,17 @@
   private final Resource sourceFile;
 
   private final ContentId contentId;
-  
+
   private final long lastModified;
 
   public SourceFileCompilationUnit(Resource sourceFile, ContentId contentId,
-      List<CompiledClass> compiledClasses, List<JDeclaredType> types,
-      Dependencies dependencies, Collection<? extends JsniMethod> jsniMethods,
-      MethodArgNamesLookup methodArgs, CategorizedProblem[] problems, long lastModified) {
-    super(compiledClasses, types, dependencies, jsniMethods, methodArgs,
-        problems);
+      List<CompiledClass> compiledClasses, List<JDeclaredType> types, Dependencies dependencies,
+      Collection<? extends JsniMethod> jsniMethods, MethodArgNamesLookup methodArgs,
+      CategorizedProblem[] problems, long lastModified) {
+    super(compiledClasses, types, dependencies, jsniMethods, methodArgs, problems);
     this.sourceFile = sourceFile;
-    // The resource can be updated out from underneath, affecting future comparisons.
+    // The resource can be updated out from underneath, affecting future
+    // comparisons.
     this.lastModified = lastModified;
     this.contentId = contentId;
   }
diff --git a/dev/core/src/com/google/gwt/dev/javac/UnitCache.java b/dev/core/src/com/google/gwt/dev/javac/UnitCache.java
index 6b1c654..c25071e 100644
--- a/dev/core/src/com/google/gwt/dev/javac/UnitCache.java
+++ b/dev/core/src/com/google/gwt/dev/javac/UnitCache.java
@@ -40,7 +40,7 @@
   CompilationUnit find(ContentId contentId);
 
   /**
-   * Lookup a {@link CompilationUnit} by resource path. 
+   * Lookup a {@link CompilationUnit} by resource path.
    * 
    * @see {@link CompilationUnit#getResourcePath()}
    */
diff --git a/dev/core/src/com/google/gwt/dev/resource/Resource.java b/dev/core/src/com/google/gwt/dev/resource/Resource.java
index 94bfd51..cd91d9b 100644
--- a/dev/core/src/com/google/gwt/dev/resource/Resource.java
+++ b/dev/core/src/com/google/gwt/dev/resource/Resource.java
@@ -63,6 +63,7 @@
       return null;
     }
   }
+
   /**
    * Overridden to finalize; always returns identity hash code.
    */
diff --git a/dev/core/src/com/google/gwt/dev/resource/impl/ResourceOracleImpl.java b/dev/core/src/com/google/gwt/dev/resource/impl/ResourceOracleImpl.java
index 0cfb7e9..0ca45bb 100644
--- a/dev/core/src/com/google/gwt/dev/resource/impl/ResourceOracleImpl.java
+++ b/dev/core/src/com/google/gwt/dev/resource/impl/ResourceOracleImpl.java
@@ -1,12 +1,12 @@
 /*
  * 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
@@ -52,11 +52,12 @@
 public class ResourceOracleImpl implements ResourceOracle {
 
   private static class Messages {
-    static final Message1String EXAMINING_PATH_ROOT = new Message1String(
-        TreeLogger.DEBUG, "Searching for resources within $0");
-    static final Message1String IGNORING_SHADOWED_RESOURCE = new Message1String(
-        TreeLogger.DEBUG,
-        "Resource '$0' is being shadowed by another resource higher in the classpath having the same name; this one will not be used");
+    static final Message1String EXAMINING_PATH_ROOT = new Message1String(TreeLogger.DEBUG,
+        "Searching for resources within $0");
+    static final Message1String IGNORING_SHADOWED_RESOURCE =
+        new Message1String(
+            TreeLogger.DEBUG,
+            "Resource '$0' is being shadowed by another resource higher in the classpath having the same name; this one will not be used");
     static final Message0 REFRESHING_RESOURCES = new Message0(TreeLogger.TRACE,
         "Refreshing resources");
   }
@@ -109,8 +110,8 @@
     public final AbstractResource resource;
 
     public ResourceData(AbstractResource resource, PathPrefix pathPrefix) {
-      this.resource = pathPrefix.shouldReroot() ? new RerootedResource(
-          resource, pathPrefix) : resource;
+      this.resource =
+          pathPrefix.shouldReroot() ? new RerootedResource(resource, pathPrefix) : resource;
       this.pathPrefix = pathPrefix;
     }
 
@@ -168,7 +169,7 @@
         }
         if (logger.isLoggable(TreeLogger.TRACE)) {
           logger.log(TreeLogger.TRACE, "Unexpected entry in classpath; " + f
-            + " is neither a directory nor an archive (.jar or .zip)");
+              + " is neither a directory nor an archive (.jar or .zip)");
         }
         return null;
       }
@@ -189,8 +190,8 @@
    * Preinitializes the classpath for a given {@link ClassLoader}.
    */
   public static void preload(TreeLogger logger, ClassLoader classLoader) {
-    Event resourceOracle = SpeedTracerLogger.start(
-        CompilerEventType.RESOURCE_ORACLE, "phase", "preload");
+    Event resourceOracle =
+        SpeedTracerLogger.start(CompilerEventType.RESOURCE_ORACLE, "phase", "preload");
     List<ClassPathEntry> entries = getAllClassPathEntries(logger, classLoader);
     for (ClassPathEntry entry : entries) {
       // We only handle pre-indexing jars, the file system could change.
@@ -212,31 +213,28 @@
    * @param first At least one ResourceOracleImpl must be passed to refresh
    * @param rest Callers may optionally pass several oracles
    */
-  public static synchronized void refresh(
-      TreeLogger logger, ResourceOracleImpl first, ResourceOracleImpl... rest) {
+  public static synchronized void refresh(TreeLogger logger, ResourceOracleImpl first,
+      ResourceOracleImpl... rest) {
     int len = 1 + rest.length;
     ResourceOracleImpl[] oracles = new ResourceOracleImpl[1 + rest.length];
     oracles[0] = first;
     System.arraycopy(rest, 0, oracles, 1, rest.length);
-    
+
     Event resourceOracle =
         SpeedTracerLogger.start(CompilerEventType.RESOURCE_ORACLE, "phase", "refresh");
-    TreeLogger refreshBranch = Messages.REFRESHING_RESOURCES.branch(logger,
-        null);
+    TreeLogger refreshBranch = Messages.REFRESHING_RESOURCES.branch(logger, null);
 
     /*
      * Allocate fresh data structures in anticipation of needing to honor the
      * "new identity for the collections if anything changes" guarantee. Use a
      * LinkedHashMap because we do not want the order to change.
      */
-    List<Map<String, ResourceData>> resourceDataMaps = new ArrayList<
-        Map<String, ResourceData>>();
-    
+    List<Map<String, ResourceData>> resourceDataMaps = new ArrayList<Map<String, ResourceData>>();
+
     List<PathPrefixSet> pathPrefixSets = new ArrayList<PathPrefixSet>();
     for (ResourceOracleImpl oracle : oracles) {
       if (!oracle.classPath.equals(oracles[0].classPath)) {
-        throw new IllegalArgumentException(
-            "Refreshing multiple oracles with different classpaths");
+        throw new IllegalArgumentException("Refreshing multiple oracles with different classpaths");
       }
       resourceDataMaps.add(new LinkedHashMap<String, ResourceData>());
       pathPrefixSets.add(oracle.pathPrefixSet);
@@ -254,27 +252,23 @@
      * prefix wins.
      */
     for (ClassPathEntry pathRoot : oracles[0].classPath) {
-      TreeLogger branchForClassPathEntry = Messages.EXAMINING_PATH_ROOT.branch(
-          refreshBranch, pathRoot.getLocation(), null);
+      TreeLogger branchForClassPathEntry =
+          Messages.EXAMINING_PATH_ROOT.branch(refreshBranch, pathRoot.getLocation(), null);
 
-      List<Map<AbstractResource, PathPrefix>> resourceToPrefixMaps = pathRoot.findApplicableResources(
-          branchForClassPathEntry, pathPrefixSets);
+      List<Map<AbstractResource, PathPrefix>> resourceToPrefixMaps =
+          pathRoot.findApplicableResources(branchForClassPathEntry, pathPrefixSets);
       for (int i = 0; i < len; ++i) {
         Map<String, ResourceData> resourceDataMap = resourceDataMaps.get(i);
-        Map<AbstractResource, PathPrefix> resourceToPrefixMap = 
-          resourceToPrefixMaps.get(i);
-        for (Entry<AbstractResource, PathPrefix> entry :
-            resourceToPrefixMap.entrySet()) {
-          ResourceData newCpeData = new ResourceData(entry.getKey(),
-              entry.getValue());
+        Map<AbstractResource, PathPrefix> resourceToPrefixMap = resourceToPrefixMaps.get(i);
+        for (Entry<AbstractResource, PathPrefix> entry : resourceToPrefixMap.entrySet()) {
+          ResourceData newCpeData = new ResourceData(entry.getKey(), entry.getValue());
           String resourcePath = newCpeData.resource.getPath();
           ResourceData oldCpeData = resourceDataMap.get(resourcePath);
           // Old wins unless the new resource has higher priority.
           if (oldCpeData == null || oldCpeData.compareTo(newCpeData) < 0) {
             resourceDataMap.put(resourcePath, newCpeData);
           } else {
-            Messages.IGNORING_SHADOWED_RESOURCE.log(branchForClassPathEntry,
-                resourcePath, null);
+            Messages.IGNORING_SHADOWED_RESOURCE.log(branchForClassPathEntry, resourcePath, null);
           }
         }
       }
@@ -294,17 +288,17 @@
       // Update exposed collections with new (unmodifiable) data structures.
       oracles[i].exposedResources = Collections.unmodifiableSet(externalSet);
       oracles[i].exposedResourceMap = Collections.unmodifiableMap(externalMap);
-      oracles[i].exposedPathNames = Collections.unmodifiableSet(
-          externalMap.keySet());
+      oracles[i].exposedPathNames = Collections.unmodifiableSet(externalMap.keySet());
     }
-  
+
     resourceOracle.end();
   }
 
-  private static void addAllClassPathEntries(TreeLogger logger,
-      ClassLoader classLoader, List<ClassPathEntry> classPath) {
+  private static void addAllClassPathEntries(TreeLogger logger, ClassLoader classLoader,
+      List<ClassPathEntry> classPath) {
     // URL is expensive in collections, so we use URI instead
-    // See: http://michaelscharf.blogspot.com/2006/11/javaneturlequals-and-hashcode-make.html
+    // See:
+    // http://michaelscharf.blogspot.com/2006/11/javaneturlequals-and-hashcode-make.html
     Set<URI> seenEntries = new HashSet<URI>();
     for (; classLoader != null; classLoader = classLoader.getParent()) {
       if (classLoader instanceof URLClassLoader) {
@@ -315,8 +309,7 @@
           try {
             uri = url.toURI();
           } catch (URISyntaxException e) {
-            logger.log(TreeLogger.WARN, "Error processing classpath URL '"
-                + url + "'", e);
+            logger.log(TreeLogger.WARN, "Error processing classpath URL '" + url + "'", e);
             continue;
           }
           if (seenEntries.contains(uri)) {
@@ -332,8 +325,7 @@
             continue;
           } catch (AccessControlException e) {
             if (logger.isLoggable(TreeLogger.DEBUG)) {
-              logger.log(TreeLogger.DEBUG,
-                  "Skipping URL due to access restrictions: " + url);
+              logger.log(TreeLogger.DEBUG, "Skipping URL due to access restrictions: " + url);
             }
             continue;
           } catch (URISyntaxException e) {
@@ -341,15 +333,14 @@
           } catch (IOException e) {
             caught = e;
           }
-          logger.log(TreeLogger.WARN, "Error processing classpath URL '" + url
-              + "'", caught);
+          logger.log(TreeLogger.WARN, "Error processing classpath URL '" + url + "'", caught);
         }
       }
     }
   }
 
-  private static synchronized List<ClassPathEntry> getAllClassPathEntries(
-      TreeLogger logger, ClassLoader classLoader) {
+  private static synchronized List<ClassPathEntry> getAllClassPathEntries(TreeLogger logger,
+      ClassLoader classLoader) {
     List<ClassPathEntry> classPath = classPathCache.get(classLoader);
     if (classPath == null) {
       classPath = new ArrayList<ClassPathEntry>();