Fixing svn props on many java files where this was missing.



git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@6510 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/dev/core/src/com/google/gwt/core/linker/SoycReportLinker.java b/dev/core/src/com/google/gwt/core/linker/SoycReportLinker.java
index 2843250..5f40536 100644
--- a/dev/core/src/com/google/gwt/core/linker/SoycReportLinker.java
+++ b/dev/core/src/com/google/gwt/core/linker/SoycReportLinker.java
@@ -1,95 +1,95 @@
-/*

- * Copyright 2009 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.core.linker;

-

-import com.google.gwt.core.ext.Linker;

-import com.google.gwt.core.ext.LinkerContext;

-import com.google.gwt.core.ext.TreeLogger;

-import com.google.gwt.core.ext.UnableToCompleteException;

-import com.google.gwt.core.ext.linker.ArtifactSet;

-import com.google.gwt.core.ext.linker.CompilationResult;

-import com.google.gwt.core.ext.linker.LinkerOrder;

-import com.google.gwt.core.ext.linker.SelectionProperty;

-import com.google.gwt.core.ext.linker.SyntheticArtifact;

-import com.google.gwt.core.ext.linker.LinkerOrder.Order;

-import com.google.gwt.soyc.SoycDashboard;

-import com.google.gwt.soyc.io.ArtifactsOutputDirectory;

-

-import java.io.IOException;

-import java.util.Map;

-import java.util.TreeMap;

-

-/**

- * Generates the top-level report files for a compile report.

- */

-@LinkerOrder(Order.POST)

-public class SoycReportLinker extends Linker {

-

-  @Override

-  public String getDescription() {

-    return "Emit compile report artifacts";

-  }

-

-  @Override

-  public ArtifactSet link(TreeLogger logger, LinkerContext context,

-      ArtifactSet artifacts) throws UnableToCompleteException {

-    if (!includesReports(artifacts)) {

-      return artifacts;

-    }

-

-    ArtifactSet results = new ArtifactSet(artifacts);

-

-    // Run the final step of the dashboard to generate top-level files.

-    ArtifactsOutputDirectory out = new ArtifactsOutputDirectory();

-    try {

-      new SoycDashboard(out).generateCrossPermutationFiles(extractPermutationDescriptions(artifacts));

-    } catch (IOException e) {

-      logger.log(TreeLogger.ERROR,

-          "Error while generating a Story of Your Compile", e);

-    }

-    results.addAll(out.getArtifacts());

-

-    return results;

-  }

-

-  private Map<String, String> extractPermutationDescriptions(

-      ArtifactSet artifacts) {

-    Map<String, String> permDescriptions = new TreeMap<String, String>();

-

-    for (CompilationResult res : artifacts.find(CompilationResult.class)) {

-      String permId = Integer.toString(res.getPermutationId());

-      /*

-       * TODO(kprobst,spoon) support permutations that collapsed to the same

-       * compilation result

-       */

-      Map<SelectionProperty, String> propertyMap = res.getPropertyMap().iterator().next();

-      String permDesc = SymbolMapsLinker.propertyMapToString(propertyMap);

-      permDescriptions.put(permId, permDesc);

-    }

-

-    return permDescriptions;

-  }

-

-  private boolean includesReports(ArtifactSet artifacts) {

-    for (SyntheticArtifact art : artifacts.find(SyntheticArtifact.class)) {

-      if (art.getPartialPath().startsWith(

-          ArtifactsOutputDirectory.COMPILE_REPORT_DIRECTORY + "/")) {

-        return true;

-      }

-    }

-    return false;

-  }

-}

+/*
+ * Copyright 2009 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.core.linker;
+
+import com.google.gwt.core.ext.Linker;
+import com.google.gwt.core.ext.LinkerContext;
+import com.google.gwt.core.ext.TreeLogger;
+import com.google.gwt.core.ext.UnableToCompleteException;
+import com.google.gwt.core.ext.linker.ArtifactSet;
+import com.google.gwt.core.ext.linker.CompilationResult;
+import com.google.gwt.core.ext.linker.LinkerOrder;
+import com.google.gwt.core.ext.linker.SelectionProperty;
+import com.google.gwt.core.ext.linker.SyntheticArtifact;
+import com.google.gwt.core.ext.linker.LinkerOrder.Order;
+import com.google.gwt.soyc.SoycDashboard;
+import com.google.gwt.soyc.io.ArtifactsOutputDirectory;
+
+import java.io.IOException;
+import java.util.Map;
+import java.util.TreeMap;
+
+/**
+ * Generates the top-level report files for a compile report.
+ */
+@LinkerOrder(Order.POST)
+public class SoycReportLinker extends Linker {
+
+  @Override
+  public String getDescription() {
+    return "Emit compile report artifacts";
+  }
+
+  @Override
+  public ArtifactSet link(TreeLogger logger, LinkerContext context,
+      ArtifactSet artifacts) throws UnableToCompleteException {
+    if (!includesReports(artifacts)) {
+      return artifacts;
+    }
+
+    ArtifactSet results = new ArtifactSet(artifacts);
+
+    // Run the final step of the dashboard to generate top-level files.
+    ArtifactsOutputDirectory out = new ArtifactsOutputDirectory();
+    try {
+      new SoycDashboard(out).generateCrossPermutationFiles(extractPermutationDescriptions(artifacts));
+    } catch (IOException e) {
+      logger.log(TreeLogger.ERROR,
+          "Error while generating a Story of Your Compile", e);
+    }
+    results.addAll(out.getArtifacts());
+
+    return results;
+  }
+
+  private Map<String, String> extractPermutationDescriptions(
+      ArtifactSet artifacts) {
+    Map<String, String> permDescriptions = new TreeMap<String, String>();
+
+    for (CompilationResult res : artifacts.find(CompilationResult.class)) {
+      String permId = Integer.toString(res.getPermutationId());
+      /*
+       * TODO(kprobst,spoon) support permutations that collapsed to the same
+       * compilation result
+       */
+      Map<SelectionProperty, String> propertyMap = res.getPropertyMap().iterator().next();
+      String permDesc = SymbolMapsLinker.propertyMapToString(propertyMap);
+      permDescriptions.put(permId, permDesc);
+    }
+
+    return permDescriptions;
+  }
+
+  private boolean includesReports(ArtifactSet artifacts) {
+    for (SyntheticArtifact art : artifacts.find(SyntheticArtifact.class)) {
+      if (art.getPartialPath().startsWith(
+          ArtifactsOutputDirectory.COMPILE_REPORT_DIRECTORY + "/")) {
+        return true;
+      }
+    }
+    return false;
+  }
+}
diff --git a/dev/core/src/com/google/gwt/dev/ArgHandlerOutDirDeprecated.java b/dev/core/src/com/google/gwt/dev/ArgHandlerOutDirDeprecated.java
index 3f05a90..d007a93 100644
--- a/dev/core/src/com/google/gwt/dev/ArgHandlerOutDirDeprecated.java
+++ b/dev/core/src/com/google/gwt/dev/ArgHandlerOutDirDeprecated.java
@@ -1,60 +1,60 @@
-/*

- * 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;

-

-import com.google.gwt.dev.util.arg.OptionOutDir;

-import com.google.gwt.util.tools.ArgHandlerOutDir;

-

-import java.io.File;

-

-/**

- * Deprecated handler for -out options.

- */

-@Deprecated

-public class ArgHandlerOutDirDeprecated extends ArgHandlerOutDir {

-

-  OptionOutDir option;

-

-  public ArgHandlerOutDirDeprecated(OptionOutDir option) {

-    this.option = option;

-  }

-

-  /**

-   * Override the {@link ArgHandlerOutDir}'s default, which is to set and

-   * outDir for the current directory. We don't want a default outDir because we

-   * want a warDir to be the default if no options are specified.

-   */

-  @Override

-  public String[] getDefaultArgs() {

-    return null;

-  }

-

-  @Override

-  public String getPurpose() {

-    return super.getPurpose() + " (deprecated)";

-  }

-

-  @Override

-  public boolean isUndocumented() {

-    return true;

-  }

-

-  @Override

-  public void setDir(File dir) {

-    option.setOutDir(dir);

-  }

-

-}

+/*
+ * 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;
+
+import com.google.gwt.dev.util.arg.OptionOutDir;
+import com.google.gwt.util.tools.ArgHandlerOutDir;
+
+import java.io.File;
+
+/**
+ * Deprecated handler for -out options.
+ */
+@Deprecated
+public class ArgHandlerOutDirDeprecated extends ArgHandlerOutDir {
+
+  OptionOutDir option;
+
+  public ArgHandlerOutDirDeprecated(OptionOutDir option) {
+    this.option = option;
+  }
+
+  /**
+   * Override the {@link ArgHandlerOutDir}'s default, which is to set and
+   * outDir for the current directory. We don't want a default outDir because we
+   * want a warDir to be the default if no options are specified.
+   */
+  @Override
+  public String[] getDefaultArgs() {
+    return null;
+  }
+
+  @Override
+  public String getPurpose() {
+    return super.getPurpose() + " (deprecated)";
+  }
+
+  @Override
+  public boolean isUndocumented() {
+    return true;
+  }
+
+  @Override
+  public void setDir(File dir) {
+    option.setOutDir(dir);
+  }
+
+}
diff --git a/dev/core/src/com/google/gwt/dev/jjs/AbstractCompiler.java b/dev/core/src/com/google/gwt/dev/jjs/AbstractCompiler.java
index f1d94bb..6f1b0b6 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/AbstractCompiler.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/AbstractCompiler.java
@@ -1,49 +1,49 @@
-/*

- * Copyright 2009 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.jjs;

-

-import com.google.gwt.core.ext.TreeLogger;

-import com.google.gwt.core.ext.UnableToCompleteException;

-import com.google.gwt.dev.cfg.ModuleDef;

-import com.google.gwt.dev.jdt.RebindPermutationOracle;

-

-/**

- * A Compiler used to compile a GWT project into artifacts.

- */

-public interface AbstractCompiler {

-  /**

-   * Performs a precompilation, returning an object that can then be used to

-   * compile individual permutations..

-   * 

-   * @param logger the logger to use

-   * @param module the module to compile

-   * @param rpo the RebindPermutationOracle

-   * @param declEntryPts the set of entry classes declared in a GWT module;

-   *          these will be automatically rebound

-   * @param additionalRootTypes additional classes that should serve as code

-   *          roots; will not be rebound; may be <code>null</code>

-   * @param options the compiler options

-   * @param singlePermutation if true, do not pre-optimize the resulting AST or

-   *          allow serialization of the result

-   * @return the unified AST used to drive permutation compiles

-   * @throws UnableToCompleteException if an error other than

-   *           {@link OutOfMemoryError} occurs

-   */

-  UnifiedAst precompile(TreeLogger logger, ModuleDef module,

-      RebindPermutationOracle rpo, String[] declEntryPts,

-      String[] additionalRootTypes, JJSOptions options,

-      boolean singlePermutation) throws UnableToCompleteException;

-}

+/*
+ * Copyright 2009 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.jjs;
+
+import com.google.gwt.core.ext.TreeLogger;
+import com.google.gwt.core.ext.UnableToCompleteException;
+import com.google.gwt.dev.cfg.ModuleDef;
+import com.google.gwt.dev.jdt.RebindPermutationOracle;
+
+/**
+ * A Compiler used to compile a GWT project into artifacts.
+ */
+public interface AbstractCompiler {
+  /**
+   * Performs a precompilation, returning an object that can then be used to
+   * compile individual permutations..
+   * 
+   * @param logger the logger to use
+   * @param module the module to compile
+   * @param rpo the RebindPermutationOracle
+   * @param declEntryPts the set of entry classes declared in a GWT module;
+   *          these will be automatically rebound
+   * @param additionalRootTypes additional classes that should serve as code
+   *          roots; will not be rebound; may be <code>null</code>
+   * @param options the compiler options
+   * @param singlePermutation if true, do not pre-optimize the resulting AST or
+   *          allow serialization of the result
+   * @return the unified AST used to drive permutation compiles
+   * @throws UnableToCompleteException if an error other than
+   *           {@link OutOfMemoryError} occurs
+   */
+  UnifiedAst precompile(TreeLogger logger, ModuleDef module,
+      RebindPermutationOracle rpo, String[] declEntryPts,
+      String[] additionalRootTypes, JJSOptions options,
+      boolean singlePermutation) throws UnableToCompleteException;
+}
diff --git a/dev/core/src/com/google/gwt/dev/jjs/JavaScriptCompiler.java b/dev/core/src/com/google/gwt/dev/jjs/JavaScriptCompiler.java
index a3b9976..9968909 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/JavaScriptCompiler.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/JavaScriptCompiler.java
@@ -1,36 +1,36 @@
-/*

- * Copyright 2009 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.jjs;

-

-import com.google.gwt.core.ext.TreeLogger;

-import com.google.gwt.core.ext.UnableToCompleteException;

-import com.google.gwt.dev.cfg.ModuleDef;

-import com.google.gwt.dev.jdt.RebindPermutationOracle;

-

-/**

- * Uses the default compiler {@link JavaToJavaScriptCompiler}.

- */

-public class JavaScriptCompiler implements AbstractCompiler {

-

-  public UnifiedAst precompile(TreeLogger logger, ModuleDef module,

-      RebindPermutationOracle rpo, String[] declEntryPts,

-      String[] additionalRootTypes, JJSOptions options,

-      boolean singlePermutation) throws UnableToCompleteException {

-    return JavaToJavaScriptCompiler.precompile(logger, module, rpo,

-        declEntryPts, additionalRootTypes, options, singlePermutation);

-  }

-

-}

+/*
+ * Copyright 2009 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.jjs;
+
+import com.google.gwt.core.ext.TreeLogger;
+import com.google.gwt.core.ext.UnableToCompleteException;
+import com.google.gwt.dev.cfg.ModuleDef;
+import com.google.gwt.dev.jdt.RebindPermutationOracle;
+
+/**
+ * Uses the default compiler {@link JavaToJavaScriptCompiler}.
+ */
+public class JavaScriptCompiler implements AbstractCompiler {
+
+  public UnifiedAst precompile(TreeLogger logger, ModuleDef module,
+      RebindPermutationOracle rpo, String[] declEntryPts,
+      String[] additionalRootTypes, JJSOptions options,
+      boolean singlePermutation) throws UnableToCompleteException {
+    return JavaToJavaScriptCompiler.precompile(logger, module, rpo,
+        declEntryPts, additionalRootTypes, options, singlePermutation);
+  }
+
+}
diff --git a/dev/core/src/com/google/gwt/dev/util/BrowserInfo.java b/dev/core/src/com/google/gwt/dev/util/BrowserInfo.java
index 52ebc86..2e4cc9d 100644
--- a/dev/core/src/com/google/gwt/dev/util/BrowserInfo.java
+++ b/dev/core/src/com/google/gwt/dev/util/BrowserInfo.java
@@ -1,55 +1,55 @@
-/**

- * Copyright 2009 Google Inc.

- * 

- * Licensed under the Apache License, Version 2.0 (the "License"); you may not

- * use this file except in compliance with the License. You may obtain a copy of

- * the License at

- * 

- * http://www.apache.org/licenses/LICENSE-2.0

- * 

- * Unless required by applicable law or agreed to in writing, software

- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT

- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the

- * License for the specific language governing permissions and limitations under

- * the License.

- */

-package com.google.gwt.dev.util;

-

-/**

- * Holds information about the browser used in the UI.

- */

-public class BrowserInfo {

-

-  private static final String UNKNOWN = "Unknown";

-  private static final String FIREFOX = "FF";

-  private static final String SAFARI = "Safari";

-  private static final String OPERA = "Opera";

-  private static final String CHROME = "Chrome";

-  private static final String IE = "IE";

-

-  /**

-   * Retrieve a short name, suitable for use in a tab or filename, for a given

-   * user agent.

-   * 

-   * @param userAgent

-   * @return short name of user agent

-   */

-  public static String getShortName(String userAgent) {

-    String lcAgent = userAgent.toLowerCase();

-    if (lcAgent.contains("msie")) {

-      return IE;

-    } else if (lcAgent.contains("chrome")) {

-      return CHROME;

-    } else if (lcAgent.contains("opera")) {

-      return OPERA;

-    } else if (lcAgent.contains("webkit") || lcAgent.contains("safari")) {

-      return SAFARI;

-    } else if (lcAgent.contains("firefox")) {

-      return FIREFOX;

-    }

-    return UNKNOWN;

-  }

-

-  private BrowserInfo() {

-  }

+/**
+ * Copyright 2009 Google Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.dev.util;
+
+/**
+ * Holds information about the browser used in the UI.
+ */
+public class BrowserInfo {
+
+  private static final String UNKNOWN = "Unknown";
+  private static final String FIREFOX = "FF";
+  private static final String SAFARI = "Safari";
+  private static final String OPERA = "Opera";
+  private static final String CHROME = "Chrome";
+  private static final String IE = "IE";
+
+  /**
+   * Retrieve a short name, suitable for use in a tab or filename, for a given
+   * user agent.
+   * 
+   * @param userAgent
+   * @return short name of user agent
+   */
+  public static String getShortName(String userAgent) {
+    String lcAgent = userAgent.toLowerCase();
+    if (lcAgent.contains("msie")) {
+      return IE;
+    } else if (lcAgent.contains("chrome")) {
+      return CHROME;
+    } else if (lcAgent.contains("opera")) {
+      return OPERA;
+    } else if (lcAgent.contains("webkit") || lcAgent.contains("safari")) {
+      return SAFARI;
+    } else if (lcAgent.contains("firefox")) {
+      return FIREFOX;
+    }
+    return UNKNOWN;
+  }
+
+  private BrowserInfo() {
+  }
 }
\ No newline at end of file
diff --git a/dev/core/src/com/google/gwt/dev/util/DiskCache.java b/dev/core/src/com/google/gwt/dev/util/DiskCache.java
index 490ad70..250d08f 100644
--- a/dev/core/src/com/google/gwt/dev/util/DiskCache.java
+++ b/dev/core/src/com/google/gwt/dev/util/DiskCache.java
@@ -1,206 +1,206 @@
-/*

- * Copyright 2009 Google Inc.

- * 

- * Licensed under the Apache License, Version 2.0 (the "License"); you may not

- * use this file except in compliance with the License. You may obtain a copy of

- * the License at

- * 

- * http://www.apache.org/licenses/LICENSE-2.0

- * 

- * Unless required by applicable law or agreed to in writing, software

- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT

- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the

- * License for the specific language governing permissions and limitations under

- * the License.

- */

-package com.google.gwt.dev.util;

-

-import java.io.ByteArrayInputStream;

-import java.io.ByteArrayOutputStream;

-import java.io.File;

-import java.io.IOException;

-import java.io.OutputStream;

-import java.io.RandomAccessFile;

-import java.lang.ref.WeakReference;

-import java.util.ArrayList;

-import java.util.List;

-

-/**

- * A nifty class that lets you squirrel away data on the file system. Write

- * once, read many times. Instance of this are thread-safe by way of internal

- * synchronization.

- * 

- * Note that in the current implementation, the backing temp file will get

- * arbitrarily large as you continue adding things to it. There is no internal

- * GC or compaction.

- */

-public class DiskCache {

-  /**

-   * For future thought: if we used Object tokens instead of longs, we could

-   * actually track references and do GC/compaction on the underlying file.

-   * 

-   * I considered using memory mapping, but I didn't see any obvious way to make

-   * the map larger after the fact, which kind of defeats the infinite-append

-   * design. At any rate, I measured the current performance of this design to

-   * be so fast relative to what I'm using it for, I didn't pursue this further.

-   */

-

-  private static class Shutdown implements Runnable {

-    public void run() {

-      for (WeakReference<DiskCache> ref : shutdownList) {

-        try {

-          DiskCache diskCache = ref.get();

-          if (diskCache != null) {

-            diskCache.close();

-          }

-        } catch (Throwable e) {

-        }

-      }

-    }

-  }

-

-  private static List<WeakReference<DiskCache>> shutdownList;

-

-  private boolean atEnd = true;

-  private RandomAccessFile file;

-

-  public DiskCache() {

-    try {

-      File temp = File.createTempFile("gwt", "byte-cache");

-      temp.deleteOnExit();

-      file = new RandomAccessFile(temp, "rw");

-      file.setLength(0);

-      if (shutdownList == null) {

-        shutdownList = new ArrayList<WeakReference<DiskCache>>();

-        Runtime.getRuntime().addShutdownHook(new Thread(new Shutdown()));

-      }

-      shutdownList.add(new WeakReference<DiskCache>(this));

-    } catch (IOException e) {

-      throw new RuntimeException("Unable to initialize byte cache", e);

-    }

-  }

-

-  /**

-   * Read some bytes off disk.

-   * 

-   * @param token a handle previously returned from

-   *          {@link #writeByteArray(byte[])}

-   * @return the bytes that were written

-   */

-  public synchronized byte[] readByteArray(long token) {

-    try {

-      atEnd = false;

-      file.seek(token);

-      int length = file.readInt();

-      byte[] result = new byte[length];

-      file.readFully(result);

-      return result;

-    } catch (IOException e) {

-      throw new RuntimeException("Unable to read from byte cache", e);

-    }

-  }

-

-  public <T> T readObject(long token, Class<T> type) {

-    try {

-      byte[] bytes = readByteArray(token);

-      ByteArrayInputStream in = new ByteArrayInputStream(bytes);

-      return Util.readStreamAsObject(in, type);

-    } catch (ClassNotFoundException e) {

-      throw new RuntimeException(

-          "Unexpected exception deserializing from disk cache", e);

-    } catch (IOException e) {

-      throw new RuntimeException(

-          "Unexpected exception deserializing from disk cache", e);

-    }

-  }

-

-  /**

-   * Read a String from disk.

-   * 

-   * @param token a handle previously returned from {@link #writeString(String)}

-   * @return the String that was written

-   */

-  public String readString(long token) {

-    return Util.toString(readByteArray(token));

-  }

-

-  /**

-   * Write a byte array to disk.

-   * 

-   * @return a handle to retrieve it later

-   */

-  public synchronized long writeByteArray(byte[] bytes) {

-    try {

-      if (!atEnd) {

-        file.seek(file.length());

-      }

-      long position = file.getFilePointer();

-      file.writeInt(bytes.length);

-      file.write(bytes);

-      return position;

-    } catch (IOException e) {

-      throw new RuntimeException("Unable to write to byte cache", e);

-    }

-  }

-

-  public long writeObject(Object object) {

-    try {

-      ByteArrayOutputStream out = new ByteArrayOutputStream();

-      Util.writeObjectToStream(out, object);

-      return writeByteArray(out.toByteArray());

-    } catch (IOException e) {

-      throw new RuntimeException("Unexpected IOException on in-memory stream",

-          e);

-    }

-  }

-

-  /**

-   * Write a String to disk.

-   * 

-   * @return a handle to retrieve it later

-   */

-  public long writeString(String str) {

-    return writeByteArray(Util.getBytes(str));

-  }

-

-  /**

-   * Reads bytes of data back from disk and writes them into the specified

-   * output stream.

-   */

-  public synchronized void writeTo(long token, OutputStream out) {

-    byte[] buf = Util.takeThreadLocalBuf();

-    try {

-      atEnd = false;

-      file.seek(token);

-      int length = file.readInt();

-      int bufLen = buf.length;

-      while (length > bufLen) {

-        int read = file.read(buf, 0, bufLen);

-        length -= read;

-        out.write(buf, 0, read);

-      }

-      while (length > 0) {

-        int read = file.read(buf, 0, length);

-        length -= read;

-        out.write(buf, 0, read);

-      }

-    } catch (IOException e) {

-      throw new RuntimeException("Unable to read from byte cache", e);

-    } finally {

-      Util.releaseThreadLocalBuf(buf);

-    }

-  }

-

-  @Override

-  protected synchronized void finalize() throws Throwable {

-    close();

-  }

-

-  private void close() throws Throwable {

-    if (file != null) {

-      file.setLength(0);

-      file.close();

-      file = null;

-    }

-  }

+/*
+ * Copyright 2009 Google Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.dev.util;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.RandomAccessFile;
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * A nifty class that lets you squirrel away data on the file system. Write
+ * once, read many times. Instance of this are thread-safe by way of internal
+ * synchronization.
+ * 
+ * Note that in the current implementation, the backing temp file will get
+ * arbitrarily large as you continue adding things to it. There is no internal
+ * GC or compaction.
+ */
+public class DiskCache {
+  /**
+   * For future thought: if we used Object tokens instead of longs, we could
+   * actually track references and do GC/compaction on the underlying file.
+   * 
+   * I considered using memory mapping, but I didn't see any obvious way to make
+   * the map larger after the fact, which kind of defeats the infinite-append
+   * design. At any rate, I measured the current performance of this design to
+   * be so fast relative to what I'm using it for, I didn't pursue this further.
+   */
+
+  private static class Shutdown implements Runnable {
+    public void run() {
+      for (WeakReference<DiskCache> ref : shutdownList) {
+        try {
+          DiskCache diskCache = ref.get();
+          if (diskCache != null) {
+            diskCache.close();
+          }
+        } catch (Throwable e) {
+        }
+      }
+    }
+  }
+
+  private static List<WeakReference<DiskCache>> shutdownList;
+
+  private boolean atEnd = true;
+  private RandomAccessFile file;
+
+  public DiskCache() {
+    try {
+      File temp = File.createTempFile("gwt", "byte-cache");
+      temp.deleteOnExit();
+      file = new RandomAccessFile(temp, "rw");
+      file.setLength(0);
+      if (shutdownList == null) {
+        shutdownList = new ArrayList<WeakReference<DiskCache>>();
+        Runtime.getRuntime().addShutdownHook(new Thread(new Shutdown()));
+      }
+      shutdownList.add(new WeakReference<DiskCache>(this));
+    } catch (IOException e) {
+      throw new RuntimeException("Unable to initialize byte cache", e);
+    }
+  }
+
+  /**
+   * Read some bytes off disk.
+   * 
+   * @param token a handle previously returned from
+   *          {@link #writeByteArray(byte[])}
+   * @return the bytes that were written
+   */
+  public synchronized byte[] readByteArray(long token) {
+    try {
+      atEnd = false;
+      file.seek(token);
+      int length = file.readInt();
+      byte[] result = new byte[length];
+      file.readFully(result);
+      return result;
+    } catch (IOException e) {
+      throw new RuntimeException("Unable to read from byte cache", e);
+    }
+  }
+
+  public <T> T readObject(long token, Class<T> type) {
+    try {
+      byte[] bytes = readByteArray(token);
+      ByteArrayInputStream in = new ByteArrayInputStream(bytes);
+      return Util.readStreamAsObject(in, type);
+    } catch (ClassNotFoundException e) {
+      throw new RuntimeException(
+          "Unexpected exception deserializing from disk cache", e);
+    } catch (IOException e) {
+      throw new RuntimeException(
+          "Unexpected exception deserializing from disk cache", e);
+    }
+  }
+
+  /**
+   * Read a String from disk.
+   * 
+   * @param token a handle previously returned from {@link #writeString(String)}
+   * @return the String that was written
+   */
+  public String readString(long token) {
+    return Util.toString(readByteArray(token));
+  }
+
+  /**
+   * Write a byte array to disk.
+   * 
+   * @return a handle to retrieve it later
+   */
+  public synchronized long writeByteArray(byte[] bytes) {
+    try {
+      if (!atEnd) {
+        file.seek(file.length());
+      }
+      long position = file.getFilePointer();
+      file.writeInt(bytes.length);
+      file.write(bytes);
+      return position;
+    } catch (IOException e) {
+      throw new RuntimeException("Unable to write to byte cache", e);
+    }
+  }
+
+  public long writeObject(Object object) {
+    try {
+      ByteArrayOutputStream out = new ByteArrayOutputStream();
+      Util.writeObjectToStream(out, object);
+      return writeByteArray(out.toByteArray());
+    } catch (IOException e) {
+      throw new RuntimeException("Unexpected IOException on in-memory stream",
+          e);
+    }
+  }
+
+  /**
+   * Write a String to disk.
+   * 
+   * @return a handle to retrieve it later
+   */
+  public long writeString(String str) {
+    return writeByteArray(Util.getBytes(str));
+  }
+
+  /**
+   * Reads bytes of data back from disk and writes them into the specified
+   * output stream.
+   */
+  public synchronized void writeTo(long token, OutputStream out) {
+    byte[] buf = Util.takeThreadLocalBuf();
+    try {
+      atEnd = false;
+      file.seek(token);
+      int length = file.readInt();
+      int bufLen = buf.length;
+      while (length > bufLen) {
+        int read = file.read(buf, 0, bufLen);
+        length -= read;
+        out.write(buf, 0, read);
+      }
+      while (length > 0) {
+        int read = file.read(buf, 0, length);
+        length -= read;
+        out.write(buf, 0, read);
+      }
+    } catch (IOException e) {
+      throw new RuntimeException("Unable to read from byte cache", e);
+    } finally {
+      Util.releaseThreadLocalBuf(buf);
+    }
+  }
+
+  @Override
+  protected synchronized void finalize() throws Throwable {
+    close();
+  }
+
+  private void close() throws Throwable {
+    if (file != null) {
+      file.setLength(0);
+      file.close();
+      file = null;
+    }
+  }
 }
\ No newline at end of file
diff --git a/dev/core/src/com/google/gwt/dev/util/Memory.java b/dev/core/src/com/google/gwt/dev/util/Memory.java
index 4c7e295..912e0d6 100644
--- a/dev/core/src/com/google/gwt/dev/util/Memory.java
+++ b/dev/core/src/com/google/gwt/dev/util/Memory.java
@@ -1,103 +1,103 @@
-/*

- * Copyright 2009 Google Inc.

- * 

- * Licensed under the Apache License, Version 2.0 (the "License"); you may not

- * use this file except in compliance with the License. You may obtain a copy of

- * the License at

- * 

- * http://www.apache.org/licenses/LICENSE-2.0

- * 

- * Unless required by applicable law or agreed to in writing, software

- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT

- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the

- * License for the specific language governing permissions and limitations under

- * the License.

- */

-package com.google.gwt.dev.util;

-

-import java.io.File;

-import java.lang.management.ManagementFactory;

-import java.lang.reflect.Method;

-

-/**

- * Utility methods for dealing with VM memory.

- */

-public class Memory {

-

-  /**

-   * Number of times to call System.gc() before measuring the memory

-   * usage/dumping the heap. This value was arrived at through trial-and-error

-   * on the Sun JVM; memory usage seems to stabilize after 3 to 4 runs. We think

-   * the reason it requires multiple runs is due to the generational aspect of

-   * garbage collection.

-   */

-  private static final int NUM_GC_COLLECTIONS = 4;

-

-  /**

-   * Set this system property to a filename suffix to dump heaps into.

-   */

-  private static final String PROPERTY_DUMP_HEAP = "gwt.memory.dumpHeap";

-

-  /**

-   * Set this system property to dump memory usage at various points.

-   */

-  private static final String PROPERTY_DUMP_MEMORY = "gwt.memory.usage";

-

-  /**

-   * Time to start measuring since the last memory measurement/dump, or

-   * application startup.

-   */

-  private static long startTime;

-

-  public static void initialize() {

-    if (System.getProperty(PROPERTY_DUMP_MEMORY) != null) {

-      System.out.println("Will print mem usage");

-    }

-    if (System.getProperty(PROPERTY_DUMP_HEAP) != null) {

-      System.out.println("Will dump heap into: *-"

-          + System.getProperty(PROPERTY_DUMP_HEAP));

-    }

-    startTime = System.currentTimeMillis();

-  }

-

-  public static void main(String[] args) {

-    initialize();

-    System.setProperty(PROPERTY_DUMP_MEMORY, "");

-    maybeDumpMemory("test");

-  }

-

-  public static void maybeDumpMemory(String info) {

-    long elapsed = System.currentTimeMillis() - startTime;

-    if (System.getProperty(PROPERTY_DUMP_MEMORY) != null) {

-      for (int i = 0; i < NUM_GC_COLLECTIONS; ++i) {

-        System.gc();

-      }

-      long heap = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getUsed();

-      long nonHeap = ManagementFactory.getMemoryMXBean().getNonHeapMemoryUsage().getUsed();

-      String infoString = String.format("[%.18s]", info);

-      System.out.println(String.format(

-          "%-20s %10d heap, %10d nonheap, %10d total, %10.2fs", infoString,

-          heap, nonHeap, heap + nonHeap, (double) elapsed / 1000));

-    }

-    String dumpFile = System.getProperty(PROPERTY_DUMP_HEAP);

-    if (dumpFile != null) {

-      dumpFile = info + "-" + dumpFile;

-      new File(dumpFile).delete();

-      try {

-        Class<?> beanClass = Class.forName("com.sun.management.HotSpotDiagnosticMXBean");

-        Object bean = ManagementFactory.newPlatformMXBeanProxy(

-            ManagementFactory.getPlatformMBeanServer(),

-            "com.sun.management:type=HotSpotDiagnostic", beanClass);

-        Method dumpHeapMethod = beanClass.getDeclaredMethod("dumpHeap",

-            String.class, Boolean.TYPE);

-        dumpHeapMethod.invoke(bean, dumpFile, true);

-        System.out.println("(" + info + ") dumped heap into: " + dumpFile);

-      } catch (Throwable e) {

-        System.err.println("Unable to dump heap");

-        e.printStackTrace();

-      }

-    }

-    // Reset for next call

-    startTime = System.currentTimeMillis();

-  }

-}

+/*
+ * Copyright 2009 Google Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.dev.util;
+
+import java.io.File;
+import java.lang.management.ManagementFactory;
+import java.lang.reflect.Method;
+
+/**
+ * Utility methods for dealing with VM memory.
+ */
+public class Memory {
+
+  /**
+   * Number of times to call System.gc() before measuring the memory
+   * usage/dumping the heap. This value was arrived at through trial-and-error
+   * on the Sun JVM; memory usage seems to stabilize after 3 to 4 runs. We think
+   * the reason it requires multiple runs is due to the generational aspect of
+   * garbage collection.
+   */
+  private static final int NUM_GC_COLLECTIONS = 4;
+
+  /**
+   * Set this system property to a filename suffix to dump heaps into.
+   */
+  private static final String PROPERTY_DUMP_HEAP = "gwt.memory.dumpHeap";
+
+  /**
+   * Set this system property to dump memory usage at various points.
+   */
+  private static final String PROPERTY_DUMP_MEMORY = "gwt.memory.usage";
+
+  /**
+   * Time to start measuring since the last memory measurement/dump, or
+   * application startup.
+   */
+  private static long startTime;
+
+  public static void initialize() {
+    if (System.getProperty(PROPERTY_DUMP_MEMORY) != null) {
+      System.out.println("Will print mem usage");
+    }
+    if (System.getProperty(PROPERTY_DUMP_HEAP) != null) {
+      System.out.println("Will dump heap into: *-"
+          + System.getProperty(PROPERTY_DUMP_HEAP));
+    }
+    startTime = System.currentTimeMillis();
+  }
+
+  public static void main(String[] args) {
+    initialize();
+    System.setProperty(PROPERTY_DUMP_MEMORY, "");
+    maybeDumpMemory("test");
+  }
+
+  public static void maybeDumpMemory(String info) {
+    long elapsed = System.currentTimeMillis() - startTime;
+    if (System.getProperty(PROPERTY_DUMP_MEMORY) != null) {
+      for (int i = 0; i < NUM_GC_COLLECTIONS; ++i) {
+        System.gc();
+      }
+      long heap = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getUsed();
+      long nonHeap = ManagementFactory.getMemoryMXBean().getNonHeapMemoryUsage().getUsed();
+      String infoString = String.format("[%.18s]", info);
+      System.out.println(String.format(
+          "%-20s %10d heap, %10d nonheap, %10d total, %10.2fs", infoString,
+          heap, nonHeap, heap + nonHeap, (double) elapsed / 1000));
+    }
+    String dumpFile = System.getProperty(PROPERTY_DUMP_HEAP);
+    if (dumpFile != null) {
+      dumpFile = info + "-" + dumpFile;
+      new File(dumpFile).delete();
+      try {
+        Class<?> beanClass = Class.forName("com.sun.management.HotSpotDiagnosticMXBean");
+        Object bean = ManagementFactory.newPlatformMXBeanProxy(
+            ManagementFactory.getPlatformMBeanServer(),
+            "com.sun.management:type=HotSpotDiagnostic", beanClass);
+        Method dumpHeapMethod = beanClass.getDeclaredMethod("dumpHeap",
+            String.class, Boolean.TYPE);
+        dumpHeapMethod.invoke(bean, dumpFile, true);
+        System.out.println("(" + info + ") dumped heap into: " + dumpFile);
+      } catch (Throwable e) {
+        System.err.println("Unable to dump heap");
+        e.printStackTrace();
+      }
+    }
+    // Reset for next call
+    startTime = System.currentTimeMillis();
+  }
+}
diff --git a/dev/core/src/com/google/gwt/dev/util/collect/HashMap.java b/dev/core/src/com/google/gwt/dev/util/collect/HashMap.java
index 0e7845d..c02df9e 100644
--- a/dev/core/src/com/google/gwt/dev/util/collect/HashMap.java
+++ b/dev/core/src/com/google/gwt/dev/util/collect/HashMap.java
@@ -1,816 +1,816 @@
-/*

- * Copyright 2009 Google Inc.

- * 

- * Licensed under the Apache License, Version 2.0 (the "License"); you may not

- * use this file except in compliance with the License. You may obtain a copy of

- * the License at

- * 

- * http://www.apache.org/licenses/LICENSE-2.0

- * 

- * Unless required by applicable law or agreed to in writing, software

- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT

- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the

- * License for the specific language governing permissions and limitations under

- * the License.

- */

-package com.google.gwt.dev.util.collect;

-

-import java.io.IOException;

-import java.io.ObjectInputStream;

-import java.io.ObjectOutputStream;

-import java.io.Serializable;

-import java.util.AbstractCollection;

-import java.util.AbstractSet;

-import java.util.Collection;

-import java.util.Iterator;

-import java.util.Map;

-import java.util.NoSuchElementException;

-import java.util.Set;

-

-/**

- * A memory-efficient hash map.

- * 

- * @param <K> the key type

- * @param <V> the value type

- */

-public class HashMap<K, V> implements Map<K, V>, Serializable {

-

-  /**

-   * In the interest of memory-savings, we start with the smallest feasible

-   * power-of-two table size that can hold three items without rehashing. If we

-   * started with a size of 2, we'd have to expand as soon as the second item

-   * was added.

-   */

-  private static final int INITIAL_TABLE_SIZE = 4;

-

-  private class EntryIterator implements Iterator<Entry<K, V>> {

-    private int index = 0;

-    private int last = -1;

-

-    {

-      advanceToItem();

-    }

-

-    public boolean hasNext() {

-      return index < keys.length;

-    }

-

-    public Entry<K, V> next() {

-      if (!hasNext()) {

-        throw new NoSuchElementException();

-      }

-      last = index;

-      Entry<K, V> toReturn = new HashEntry(index++);

-      advanceToItem();

-      return toReturn;

-    }

-

-    public void remove() {

-      if (last < 0) {

-        throw new IllegalStateException();

-      }

-      internalRemove(last);

-      if (keys[last] != null) {

-        index = last;

-      }

-      last = -1;

-    }

-

-    private void advanceToItem() {

-      for (; index < keys.length; ++index) {

-        if (keys[index] != null) {

-          return;

-        }

-      }

-    }

-  }

-

-  private class EntrySet extends AbstractSet<Entry<K, V>> {

-    @Override

-    public boolean add(Entry<K, V> entry) {

-      boolean result = !HashMap.this.containsKey(entry.getKey());

-      HashMap.this.put(entry.getKey(), entry.getValue());

-      return result;

-    }

-

-    @Override

-    public boolean addAll(Collection<? extends Entry<K, V>> c) {

-      HashMap.this.ensureSizeFor(size() + c.size());

-      return super.addAll(c);

-    }

-

-    @Override

-    public void clear() {

-      HashMap.this.clear();

-    }

-

-    @Override

-    @SuppressWarnings("unchecked")

-    public boolean contains(Object o) {

-      if (!(o instanceof Entry)) {

-        return false;

-      }

-      Entry<K, V> entry = (Entry<K, V>) o;

-      V value = HashMap.this.get(entry.getKey());

-      return HashMap.this.valueEquals(value, entry.getValue());

-    }

-

-    @Override

-    public int hashCode() {

-      return HashMap.this.hashCode();

-    }

-

-    @Override

-    public Iterator<java.util.Map.Entry<K, V>> iterator() {

-      return new EntryIterator();

-    }

-

-    @Override

-    @SuppressWarnings("unchecked")

-    public boolean remove(Object o) {

-      if (!(o instanceof Entry)) {

-        return false;

-      }

-      Entry<K, V> entry = (Entry<K, V>) o;

-      int index = findKey(entry.getKey());

-      if (index >= 0 && valueEquals(values[index], entry.getValue())) {

-        internalRemove(index);

-        return true;

-      }

-      return false;

-    }

-

-    @Override

-    public boolean removeAll(Collection<?> c) {

-      boolean didRemove = false;

-      for (Object o : c) {

-        didRemove |= remove(o);

-      }

-      return didRemove;

-    }

-

-    @Override

-    public int size() {

-      return HashMap.this.size;

-    }

-  }

-

-  private class HashEntry implements Entry<K, V> {

-    private final int index;

-

-    public HashEntry(int index) {

-      this.index = index;

-    }

-

-    @Override

-    @SuppressWarnings("unchecked")

-    public boolean equals(Object o) {

-      if (!(o instanceof Entry)) {

-        return false;

-      }

-      Entry<K, V> entry = (Entry<K, V>) o;

-      return keyEquals(getKey(), entry.getKey())

-          && valueEquals(getValue(), entry.getValue());

-    }

-

-    @SuppressWarnings("unchecked")

-    public K getKey() {

-      return (K) unmaskNullKey(keys[index]);

-    }

-

-    @SuppressWarnings("unchecked")

-    public V getValue() {

-      return (V) values[index];

-    }

-

-    @Override

-    public int hashCode() {

-      return keyHashCode(getKey()) ^ valueHashCode(getValue());

-    }

-

-    @SuppressWarnings("unchecked")

-    public V setValue(V value) {

-      V previous = (V) values[index];

-      values[index] = value;

-      return previous;

-    }

-

-    @Override

-    public String toString() {

-      return getKey() + "=" + getValue();

-    }

-  }

-

-  private class KeyIterator implements Iterator<K> {

-    private int index = 0;

-    private int last = -1;

-

-    {

-      advanceToItem();

-    }

-

-    public boolean hasNext() {

-      return index < keys.length;

-    }

-

-    @SuppressWarnings("unchecked")

-    public K next() {

-      if (!hasNext()) {

-        throw new NoSuchElementException();

-      }

-      last = index;

-      Object toReturn = unmaskNullKey(keys[index++]);

-      advanceToItem();

-      return (K) toReturn;

-    }

-

-    public void remove() {

-      if (last < 0) {

-        throw new IllegalStateException();

-      }

-      internalRemove(last);

-      if (keys[last] != null) {

-        index = last;

-      }

-      last = -1;

-    }

-

-    private void advanceToItem() {

-      for (; index < keys.length; ++index) {

-        if (keys[index] != null) {

-          return;

-        }

-      }

-    }

-  }

-

-  private class KeySet extends AbstractSet<K> {

-    @Override

-    public void clear() {

-      HashMap.this.clear();

-    }

-

-    @Override

-    public boolean contains(Object o) {

-      return HashMap.this.containsKey(o);

-    }

-

-    @Override

-    public int hashCode() {

-      int result = 0;

-      for (int i = 0; i < keys.length; ++i) {

-        Object key = keys[i];

-        if (key != null) {

-          result += keyHashCode(unmaskNullKey(key));

-        }

-      }

-      return result;

-    }

-

-    @Override

-    public Iterator<K> iterator() {

-      return new KeyIterator();

-    }

-

-    @Override

-    public boolean remove(Object o) {

-      int index = findKey(o);

-      if (index >= 0) {

-        internalRemove(index);

-        return true;

-      }

-      return false;

-    }

-

-    @Override

-    public boolean removeAll(Collection<?> c) {

-      boolean didRemove = false;

-      for (Object o : c) {

-        didRemove |= remove(o);

-      }

-      return didRemove;

-    }

-

-    @Override

-    public int size() {

-      return HashMap.this.size;

-    }

-  }

-

-  private class ValueIterator implements Iterator<V> {

-    private int index = 0;

-    private int last = -1;

-

-    {

-      advanceToItem();

-    }

-

-    public boolean hasNext() {

-      return index < keys.length;

-    }

-

-    @SuppressWarnings("unchecked")

-    public V next() {

-      if (!hasNext()) {

-        throw new NoSuchElementException();

-      }

-      last = index;

-      Object toReturn = values[index++];

-      advanceToItem();

-      return (V) toReturn;

-    }

-

-    public void remove() {

-      if (last < 0) {

-        throw new IllegalStateException();

-      }

-      internalRemove(last);

-      if (keys[last] != null) {

-        index = last;

-      }

-      last = -1;

-    }

-

-    private void advanceToItem() {

-      for (; index < keys.length; ++index) {

-        if (keys[index] != null) {

-          return;

-        }

-      }

-    }

-  }

-

-  private class Values extends AbstractCollection<V> {

-    @Override

-    public void clear() {

-      HashMap.this.clear();

-    }

-

-    @Override

-    public boolean contains(Object o) {

-      return HashMap.this.containsValue(o);

-    }

-

-    @Override

-    public int hashCode() {

-      int result = 0;

-      for (int i = 0; i < keys.length; ++i) {

-        if (keys[i] != null) {

-          result += valueHashCode(values[i]);

-        }

-      }

-      return result;

-    }

-

-    @Override

-    public Iterator<V> iterator() {

-      return new ValueIterator();

-    }

-

-    @Override

-    public boolean remove(Object o) {

-      if (o == null) {

-        for (int i = 0; i < keys.length; ++i) {

-          if (keys[i] != null && values[i] == null) {

-            internalRemove(i);

-            return true;

-          }

-        }

-      } else {

-        for (int i = 0; i < keys.length; ++i) {

-          if (valueEquals(values[i], o)) {

-            internalRemove(i);

-            return true;

-          }

-        }

-      }

-      return false;

-    }

-

-    @Override

-    public boolean removeAll(Collection<?> c) {

-      boolean didRemove = false;

-      for (Object o : c) {

-        didRemove |= remove(o);

-      }

-      return didRemove;

-    }

-

-    @Override

-    public int size() {

-      return HashMap.this.size;

-    }

-  }

-

-  private static final Object NULL_KEY = new Serializable() {

-    Object readResolve() {

-      return NULL_KEY;

-    }

-  };

-

-  static Object maskNullKey(Object k) {

-    return (k == null) ? NULL_KEY : k;

-  }

-

-  static Object unmaskNullKey(Object k) {

-    return (k == NULL_KEY) ? null : k;

-  }

-

-  /**

-   * Backing store for all the keys; transient due to custom serialization.

-   * Default access to avoid synthetic accessors from inner classes.

-   */

-  transient Object[] keys;

-

-  /**

-   * Number of pairs in this set; transient due to custom serialization. Default

-   * access to avoid synthetic accessors from inner classes.

-   */

-  transient int size = 0;

-

-  /**

-   * Backing store for all the values; transient due to custom serialization.

-   * Default access to avoid synthetic accessors from inner classes.

-   */

-  transient Object[] values;

-

-  public HashMap() {

-    initTable(INITIAL_TABLE_SIZE);

-  }

-

-  public HashMap(Map<? extends K, ? extends V> m) {

-    int newCapacity = INITIAL_TABLE_SIZE;

-    int expectedSize = m.size();

-    while (newCapacity * 3 < expectedSize * 4) {

-      newCapacity <<= 1;

-    }

-

-    initTable(newCapacity);

-    internalPutAll(m);

-  }

-

-  public void clear() {

-    initTable(INITIAL_TABLE_SIZE);

-    size = 0;

-  }

-

-  public boolean containsKey(Object key) {

-    return findKey(key) >= 0;

-  }

-

-  public boolean containsValue(Object value) {

-    if (value == null) {

-      for (int i = 0; i < keys.length; ++i) {

-        if (keys[i] != null && values[i] == null) {

-          return true;

-        }

-      }

-    } else {

-      for (Object existing : values) {

-        if (valueEquals(existing, value)) {

-          return true;

-        }

-      }

-    }

-    return false;

-  }

-

-  public Set<Entry<K, V>> entrySet() {

-    return new EntrySet();

-  }

-

-  @Override

-  @SuppressWarnings("unchecked")

-  public boolean equals(Object o) {

-    if (!(o instanceof Map)) {

-      return false;

-    }

-    Map<K, V> other = (Map<K, V>) o;

-    return entrySet().equals(other.entrySet());

-  }

-

-  @SuppressWarnings("unchecked")

-  public V get(Object key) {

-    int index = findKey(key);

-    return (index < 0) ? null : (V) values[index];

-  }

-

-  @Override

-  public int hashCode() {

-    int result = 0;

-    for (int i = 0; i < keys.length; ++i) {

-      Object key = keys[i];

-      if (key != null) {

-        result += keyHashCode(unmaskNullKey(key)) ^ valueHashCode(values[i]);

-      }

-    }

-    return result;

-  }

-

-  public boolean isEmpty() {

-    return size == 0;

-  }

-

-  public Set<K> keySet() {

-    return new KeySet();

-  }

-

-  @SuppressWarnings("unchecked")

-  public V put(K key, V value) {

-    ensureSizeFor(size + 1);

-    int index = findKeyOrEmpty(key);

-    if (keys[index] == null) {

-      ++size;

-      keys[index] = maskNullKey(key);

-      values[index] = value;

-      return null;

-    } else {

-      Object previousValue = values[index];

-      values[index] = value;

-      return (V) previousValue;

-    }

-  }

-

-  public void putAll(Map<? extends K, ? extends V> m) {

-    ensureSizeFor(size + m.size());

-    internalPutAll(m);

-  }

-

-  @SuppressWarnings("unchecked")

-  public V remove(Object key) {

-    int index = findKey(key);

-    if (index < 0) {

-      return null;

-    }

-    Object previousValue = values[index];

-    internalRemove(index);

-    return (V) previousValue;

-  }

-

-  public int size() {

-    return size;

-  }

-

-  @Override

-  public String toString() {

-    if (size == 0) {

-      return "{}";

-    }

-    StringBuilder buf = new StringBuilder(32 * size());

-    buf.append('{');

-

-    boolean needComma = false;

-    for (int i = 0; i < keys.length; ++i) {

-      Object key = keys[i];

-      if (key != null) {

-        if (needComma) {

-          buf.append(',').append(' ');

-        }

-        key = unmaskNullKey(key);

-        Object value = values[i];

-        buf.append(key == this ? "(this Map)" : key).append('=').append(

-            value == this ? "(this Map)" : value);

-        needComma = true;

-      }

-    }

-    buf.append('}');

-    return buf.toString();

-  }

-

-  public Collection<V> values() {

-    return new Values();

-  }

-

-  /**

-   * Adapted from {@link org.apache.commons.collections.map.AbstractHashedMap}.

-   */

-  @SuppressWarnings("unchecked")

-  protected void doReadObject(ObjectInputStream in) throws IOException,

-      ClassNotFoundException {

-    int capacity = in.readInt();

-    initTable(capacity);

-    int items = in.readInt();

-    for (int i = 0; i < items; i++) {

-      Object key = in.readObject();

-      Object value = in.readObject();

-      put((K) key, (V) value);

-    }

-  }

-

-  /**

-   * Adapted from {@link org.apache.commons.collections.map.AbstractHashedMap}.

-   */

-  protected void doWriteObject(ObjectOutputStream out) throws IOException {

-    out.writeInt(keys.length);

-    out.writeInt(size);

-    for (int i = 0; i < keys.length; ++i) {

-      Object key = keys[i];

-      if (key != null) {

-        out.writeObject(unmaskNullKey(key));

-        out.writeObject(values[i]);

-      }

-    }

-  }

-

-  /**

-   * Returns whether two keys are equal for the purposes of this set.

-   */

-  protected boolean keyEquals(Object a, Object b) {

-    return (a == null) ? (b == null) : a.equals(b);

-  }

-

-  /**

-   * Returns the hashCode for a key.

-   */

-  protected int keyHashCode(Object k) {

-    return (k == null) ? 0 : k.hashCode();

-  }

-

-  /**

-   * Returns whether two values are equal for the purposes of this set.

-   */

-  protected boolean valueEquals(Object a, Object b) {

-    return (a == null) ? (b == null) : a.equals(b);

-  }

-

-  /**

-   * Returns the hashCode for a value.

-   */

-  protected int valueHashCode(Object v) {

-    return (v == null) ? 0 : v.hashCode();

-  }

-

-  /**

-   * Ensures the map is large enough to contain the specified number of entries.

-   * Default access to avoid synthetic accessors from inner classes.

-   */

-  void ensureSizeFor(int expectedSize) {

-    if (keys.length * 3 >= expectedSize * 4) {

-      return;

-    }

-

-    int newCapacity = keys.length << 1;

-    while (newCapacity * 3 < expectedSize * 4) {

-      newCapacity <<= 1;

-    }

-

-    Object[] oldKeys = keys;

-    Object[] oldValues = values;

-    initTable(newCapacity);

-    for (int i = 0; i < oldKeys.length; ++i) {

-      Object k = oldKeys[i];

-      if (k != null) {

-        int newIndex = getKeyIndex(unmaskNullKey(k));

-        while (keys[newIndex] != null) {

-          if (++newIndex == keys.length) {

-            newIndex = 0;

-          }

-        }

-        keys[newIndex] = k;

-        values[newIndex] = oldValues[i];

-      }

-    }

-  }

-

-  /**

-   * Returns the index in the key table at which a particular key resides, or -1

-   * if the key is not in the table. Default access to avoid synthetic accessors

-   * from inner classes.

-   */

-  int findKey(Object k) {

-    int index = getKeyIndex(k);

-    while (true) {

-      Object existing = keys[index];

-      if (existing == null) {

-        return -1;

-      }

-      if (keyEquals(k, unmaskNullKey(existing))) {

-        return index;

-      }

-      if (++index == keys.length) {

-        index = 0;

-      }

-    }

-  }

-

-  /**

-   * Returns the index in the key table at which a particular key resides, or

-   * the index of an empty slot in the table where this key should be inserted

-   * if it is not already in the table. Default access to avoid synthetic

-   * accessors from inner classes.

-   */

-  int findKeyOrEmpty(Object k) {

-    int index = getKeyIndex(k);

-    while (true) {

-      Object existing = keys[index];

-      if (existing == null) {

-        return index;

-      }

-      if (keyEquals(k, unmaskNullKey(existing))) {

-        return index;

-      }

-      if (++index == keys.length) {

-        index = 0;

-      }

-    }

-  }

-

-  /**

-   * Removes the entry at the specified index, and performs internal management

-   * to make sure we don't wind up with a hole in the table. Default access to

-   * avoid synthetic accessors from inner classes.

-   */

-  void internalRemove(int index) {

-    keys[index] = null;

-    values[index] = null;

-    --size;

-    plugHole(index);

-  }

-

-  private int getKeyIndex(Object k) {

-    int h = keyHashCode(k);

-    // Copied from Apache's AbstractHashedMap; prevents power-of-two collisions.

-    h += ~(h << 9);

-    h ^= (h >>> 14);

-    h += (h << 4);

-    h ^= (h >>> 10);

-    // Power of two trick.

-    return h & (keys.length - 1);

-  }

-

-  private void initTable(int capacity) {

-    keys = new Object[capacity];

-    values = new Object[capacity];

-  }

-

-  private void internalPutAll(Map<? extends K, ? extends V> m) {

-    for (Entry<? extends K, ? extends V> entry : m.entrySet()) {

-      K key = entry.getKey();

-      V value = entry.getValue();

-      int index = findKeyOrEmpty(key);

-      if (keys[index] == null) {

-        ++size;

-        keys[index] = maskNullKey(key);

-        values[index] = value;

-      } else {

-        values[index] = value;

-      }

-    }

-  }

-

-  /**

-   * Tricky, we left a hole in the map, which we have to fill. The only way to

-   * do this is to search forwards through the map shuffling back values that

-   * match this index until we hit a null.

-   */

-  private void plugHole(int hole) {

-    int index = hole + 1;

-    if (index == keys.length) {

-      index = 0;

-    }

-    while (keys[index] != null) {

-      int targetIndex = getKeyIndex(unmaskNullKey(keys[index]));

-      if (hole < index) {

-        /*

-         * "Normal" case, the index is past the hole and the "bad range" is from

-         * hole (exclusive) to index (inclusive).

-         */

-        if (!(hole < targetIndex && targetIndex <= index)) {

-          // Plug it!

-          keys[hole] = keys[index];

-          values[hole] = values[index];

-          keys[index] = null;

-          values[index] = null;

-          hole = index;

-        }

-      } else {

-        /*

-         * "Wrapped" case, the index is before the hole (we've wrapped) and the

-         * "good range" is from index (exclusive) to hole (inclusive).

-         */

-        if (index < targetIndex && targetIndex <= hole) {

-          // Plug it!

-          keys[hole] = keys[index];

-          values[hole] = values[index];

-          keys[index] = null;

-          values[index] = null;

-          hole = index;

-        }

-      }

-      if (++index == keys.length) {

-        index = 0;

-      }

-    }

-  }

-

-  private void readObject(ObjectInputStream in) throws IOException,

-      ClassNotFoundException {

-    in.defaultReadObject();

-    doReadObject(in);

-  }

-

-  private void writeObject(ObjectOutputStream out) throws IOException {

-    out.defaultWriteObject();

-    doWriteObject(out);

-  }

-}

+/*
+ * Copyright 2009 Google Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.dev.util.collect;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.AbstractCollection;
+import java.util.AbstractSet;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
+
+/**
+ * A memory-efficient hash map.
+ * 
+ * @param <K> the key type
+ * @param <V> the value type
+ */
+public class HashMap<K, V> implements Map<K, V>, Serializable {
+
+  /**
+   * In the interest of memory-savings, we start with the smallest feasible
+   * power-of-two table size that can hold three items without rehashing. If we
+   * started with a size of 2, we'd have to expand as soon as the second item
+   * was added.
+   */
+  private static final int INITIAL_TABLE_SIZE = 4;
+
+  private class EntryIterator implements Iterator<Entry<K, V>> {
+    private int index = 0;
+    private int last = -1;
+
+    {
+      advanceToItem();
+    }
+
+    public boolean hasNext() {
+      return index < keys.length;
+    }
+
+    public Entry<K, V> next() {
+      if (!hasNext()) {
+        throw new NoSuchElementException();
+      }
+      last = index;
+      Entry<K, V> toReturn = new HashEntry(index++);
+      advanceToItem();
+      return toReturn;
+    }
+
+    public void remove() {
+      if (last < 0) {
+        throw new IllegalStateException();
+      }
+      internalRemove(last);
+      if (keys[last] != null) {
+        index = last;
+      }
+      last = -1;
+    }
+
+    private void advanceToItem() {
+      for (; index < keys.length; ++index) {
+        if (keys[index] != null) {
+          return;
+        }
+      }
+    }
+  }
+
+  private class EntrySet extends AbstractSet<Entry<K, V>> {
+    @Override
+    public boolean add(Entry<K, V> entry) {
+      boolean result = !HashMap.this.containsKey(entry.getKey());
+      HashMap.this.put(entry.getKey(), entry.getValue());
+      return result;
+    }
+
+    @Override
+    public boolean addAll(Collection<? extends Entry<K, V>> c) {
+      HashMap.this.ensureSizeFor(size() + c.size());
+      return super.addAll(c);
+    }
+
+    @Override
+    public void clear() {
+      HashMap.this.clear();
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public boolean contains(Object o) {
+      if (!(o instanceof Entry)) {
+        return false;
+      }
+      Entry<K, V> entry = (Entry<K, V>) o;
+      V value = HashMap.this.get(entry.getKey());
+      return HashMap.this.valueEquals(value, entry.getValue());
+    }
+
+    @Override
+    public int hashCode() {
+      return HashMap.this.hashCode();
+    }
+
+    @Override
+    public Iterator<java.util.Map.Entry<K, V>> iterator() {
+      return new EntryIterator();
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public boolean remove(Object o) {
+      if (!(o instanceof Entry)) {
+        return false;
+      }
+      Entry<K, V> entry = (Entry<K, V>) o;
+      int index = findKey(entry.getKey());
+      if (index >= 0 && valueEquals(values[index], entry.getValue())) {
+        internalRemove(index);
+        return true;
+      }
+      return false;
+    }
+
+    @Override
+    public boolean removeAll(Collection<?> c) {
+      boolean didRemove = false;
+      for (Object o : c) {
+        didRemove |= remove(o);
+      }
+      return didRemove;
+    }
+
+    @Override
+    public int size() {
+      return HashMap.this.size;
+    }
+  }
+
+  private class HashEntry implements Entry<K, V> {
+    private final int index;
+
+    public HashEntry(int index) {
+      this.index = index;
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public boolean equals(Object o) {
+      if (!(o instanceof Entry)) {
+        return false;
+      }
+      Entry<K, V> entry = (Entry<K, V>) o;
+      return keyEquals(getKey(), entry.getKey())
+          && valueEquals(getValue(), entry.getValue());
+    }
+
+    @SuppressWarnings("unchecked")
+    public K getKey() {
+      return (K) unmaskNullKey(keys[index]);
+    }
+
+    @SuppressWarnings("unchecked")
+    public V getValue() {
+      return (V) values[index];
+    }
+
+    @Override
+    public int hashCode() {
+      return keyHashCode(getKey()) ^ valueHashCode(getValue());
+    }
+
+    @SuppressWarnings("unchecked")
+    public V setValue(V value) {
+      V previous = (V) values[index];
+      values[index] = value;
+      return previous;
+    }
+
+    @Override
+    public String toString() {
+      return getKey() + "=" + getValue();
+    }
+  }
+
+  private class KeyIterator implements Iterator<K> {
+    private int index = 0;
+    private int last = -1;
+
+    {
+      advanceToItem();
+    }
+
+    public boolean hasNext() {
+      return index < keys.length;
+    }
+
+    @SuppressWarnings("unchecked")
+    public K next() {
+      if (!hasNext()) {
+        throw new NoSuchElementException();
+      }
+      last = index;
+      Object toReturn = unmaskNullKey(keys[index++]);
+      advanceToItem();
+      return (K) toReturn;
+    }
+
+    public void remove() {
+      if (last < 0) {
+        throw new IllegalStateException();
+      }
+      internalRemove(last);
+      if (keys[last] != null) {
+        index = last;
+      }
+      last = -1;
+    }
+
+    private void advanceToItem() {
+      for (; index < keys.length; ++index) {
+        if (keys[index] != null) {
+          return;
+        }
+      }
+    }
+  }
+
+  private class KeySet extends AbstractSet<K> {
+    @Override
+    public void clear() {
+      HashMap.this.clear();
+    }
+
+    @Override
+    public boolean contains(Object o) {
+      return HashMap.this.containsKey(o);
+    }
+
+    @Override
+    public int hashCode() {
+      int result = 0;
+      for (int i = 0; i < keys.length; ++i) {
+        Object key = keys[i];
+        if (key != null) {
+          result += keyHashCode(unmaskNullKey(key));
+        }
+      }
+      return result;
+    }
+
+    @Override
+    public Iterator<K> iterator() {
+      return new KeyIterator();
+    }
+
+    @Override
+    public boolean remove(Object o) {
+      int index = findKey(o);
+      if (index >= 0) {
+        internalRemove(index);
+        return true;
+      }
+      return false;
+    }
+
+    @Override
+    public boolean removeAll(Collection<?> c) {
+      boolean didRemove = false;
+      for (Object o : c) {
+        didRemove |= remove(o);
+      }
+      return didRemove;
+    }
+
+    @Override
+    public int size() {
+      return HashMap.this.size;
+    }
+  }
+
+  private class ValueIterator implements Iterator<V> {
+    private int index = 0;
+    private int last = -1;
+
+    {
+      advanceToItem();
+    }
+
+    public boolean hasNext() {
+      return index < keys.length;
+    }
+
+    @SuppressWarnings("unchecked")
+    public V next() {
+      if (!hasNext()) {
+        throw new NoSuchElementException();
+      }
+      last = index;
+      Object toReturn = values[index++];
+      advanceToItem();
+      return (V) toReturn;
+    }
+
+    public void remove() {
+      if (last < 0) {
+        throw new IllegalStateException();
+      }
+      internalRemove(last);
+      if (keys[last] != null) {
+        index = last;
+      }
+      last = -1;
+    }
+
+    private void advanceToItem() {
+      for (; index < keys.length; ++index) {
+        if (keys[index] != null) {
+          return;
+        }
+      }
+    }
+  }
+
+  private class Values extends AbstractCollection<V> {
+    @Override
+    public void clear() {
+      HashMap.this.clear();
+    }
+
+    @Override
+    public boolean contains(Object o) {
+      return HashMap.this.containsValue(o);
+    }
+
+    @Override
+    public int hashCode() {
+      int result = 0;
+      for (int i = 0; i < keys.length; ++i) {
+        if (keys[i] != null) {
+          result += valueHashCode(values[i]);
+        }
+      }
+      return result;
+    }
+
+    @Override
+    public Iterator<V> iterator() {
+      return new ValueIterator();
+    }
+
+    @Override
+    public boolean remove(Object o) {
+      if (o == null) {
+        for (int i = 0; i < keys.length; ++i) {
+          if (keys[i] != null && values[i] == null) {
+            internalRemove(i);
+            return true;
+          }
+        }
+      } else {
+        for (int i = 0; i < keys.length; ++i) {
+          if (valueEquals(values[i], o)) {
+            internalRemove(i);
+            return true;
+          }
+        }
+      }
+      return false;
+    }
+
+    @Override
+    public boolean removeAll(Collection<?> c) {
+      boolean didRemove = false;
+      for (Object o : c) {
+        didRemove |= remove(o);
+      }
+      return didRemove;
+    }
+
+    @Override
+    public int size() {
+      return HashMap.this.size;
+    }
+  }
+
+  private static final Object NULL_KEY = new Serializable() {
+    Object readResolve() {
+      return NULL_KEY;
+    }
+  };
+
+  static Object maskNullKey(Object k) {
+    return (k == null) ? NULL_KEY : k;
+  }
+
+  static Object unmaskNullKey(Object k) {
+    return (k == NULL_KEY) ? null : k;
+  }
+
+  /**
+   * Backing store for all the keys; transient due to custom serialization.
+   * Default access to avoid synthetic accessors from inner classes.
+   */
+  transient Object[] keys;
+
+  /**
+   * Number of pairs in this set; transient due to custom serialization. Default
+   * access to avoid synthetic accessors from inner classes.
+   */
+  transient int size = 0;
+
+  /**
+   * Backing store for all the values; transient due to custom serialization.
+   * Default access to avoid synthetic accessors from inner classes.
+   */
+  transient Object[] values;
+
+  public HashMap() {
+    initTable(INITIAL_TABLE_SIZE);
+  }
+
+  public HashMap(Map<? extends K, ? extends V> m) {
+    int newCapacity = INITIAL_TABLE_SIZE;
+    int expectedSize = m.size();
+    while (newCapacity * 3 < expectedSize * 4) {
+      newCapacity <<= 1;
+    }
+
+    initTable(newCapacity);
+    internalPutAll(m);
+  }
+
+  public void clear() {
+    initTable(INITIAL_TABLE_SIZE);
+    size = 0;
+  }
+
+  public boolean containsKey(Object key) {
+    return findKey(key) >= 0;
+  }
+
+  public boolean containsValue(Object value) {
+    if (value == null) {
+      for (int i = 0; i < keys.length; ++i) {
+        if (keys[i] != null && values[i] == null) {
+          return true;
+        }
+      }
+    } else {
+      for (Object existing : values) {
+        if (valueEquals(existing, value)) {
+          return true;
+        }
+      }
+    }
+    return false;
+  }
+
+  public Set<Entry<K, V>> entrySet() {
+    return new EntrySet();
+  }
+
+  @Override
+  @SuppressWarnings("unchecked")
+  public boolean equals(Object o) {
+    if (!(o instanceof Map)) {
+      return false;
+    }
+    Map<K, V> other = (Map<K, V>) o;
+    return entrySet().equals(other.entrySet());
+  }
+
+  @SuppressWarnings("unchecked")
+  public V get(Object key) {
+    int index = findKey(key);
+    return (index < 0) ? null : (V) values[index];
+  }
+
+  @Override
+  public int hashCode() {
+    int result = 0;
+    for (int i = 0; i < keys.length; ++i) {
+      Object key = keys[i];
+      if (key != null) {
+        result += keyHashCode(unmaskNullKey(key)) ^ valueHashCode(values[i]);
+      }
+    }
+    return result;
+  }
+
+  public boolean isEmpty() {
+    return size == 0;
+  }
+
+  public Set<K> keySet() {
+    return new KeySet();
+  }
+
+  @SuppressWarnings("unchecked")
+  public V put(K key, V value) {
+    ensureSizeFor(size + 1);
+    int index = findKeyOrEmpty(key);
+    if (keys[index] == null) {
+      ++size;
+      keys[index] = maskNullKey(key);
+      values[index] = value;
+      return null;
+    } else {
+      Object previousValue = values[index];
+      values[index] = value;
+      return (V) previousValue;
+    }
+  }
+
+  public void putAll(Map<? extends K, ? extends V> m) {
+    ensureSizeFor(size + m.size());
+    internalPutAll(m);
+  }
+
+  @SuppressWarnings("unchecked")
+  public V remove(Object key) {
+    int index = findKey(key);
+    if (index < 0) {
+      return null;
+    }
+    Object previousValue = values[index];
+    internalRemove(index);
+    return (V) previousValue;
+  }
+
+  public int size() {
+    return size;
+  }
+
+  @Override
+  public String toString() {
+    if (size == 0) {
+      return "{}";
+    }
+    StringBuilder buf = new StringBuilder(32 * size());
+    buf.append('{');
+
+    boolean needComma = false;
+    for (int i = 0; i < keys.length; ++i) {
+      Object key = keys[i];
+      if (key != null) {
+        if (needComma) {
+          buf.append(',').append(' ');
+        }
+        key = unmaskNullKey(key);
+        Object value = values[i];
+        buf.append(key == this ? "(this Map)" : key).append('=').append(
+            value == this ? "(this Map)" : value);
+        needComma = true;
+      }
+    }
+    buf.append('}');
+    return buf.toString();
+  }
+
+  public Collection<V> values() {
+    return new Values();
+  }
+
+  /**
+   * Adapted from {@link org.apache.commons.collections.map.AbstractHashedMap}.
+   */
+  @SuppressWarnings("unchecked")
+  protected void doReadObject(ObjectInputStream in) throws IOException,
+      ClassNotFoundException {
+    int capacity = in.readInt();
+    initTable(capacity);
+    int items = in.readInt();
+    for (int i = 0; i < items; i++) {
+      Object key = in.readObject();
+      Object value = in.readObject();
+      put((K) key, (V) value);
+    }
+  }
+
+  /**
+   * Adapted from {@link org.apache.commons.collections.map.AbstractHashedMap}.
+   */
+  protected void doWriteObject(ObjectOutputStream out) throws IOException {
+    out.writeInt(keys.length);
+    out.writeInt(size);
+    for (int i = 0; i < keys.length; ++i) {
+      Object key = keys[i];
+      if (key != null) {
+        out.writeObject(unmaskNullKey(key));
+        out.writeObject(values[i]);
+      }
+    }
+  }
+
+  /**
+   * Returns whether two keys are equal for the purposes of this set.
+   */
+  protected boolean keyEquals(Object a, Object b) {
+    return (a == null) ? (b == null) : a.equals(b);
+  }
+
+  /**
+   * Returns the hashCode for a key.
+   */
+  protected int keyHashCode(Object k) {
+    return (k == null) ? 0 : k.hashCode();
+  }
+
+  /**
+   * Returns whether two values are equal for the purposes of this set.
+   */
+  protected boolean valueEquals(Object a, Object b) {
+    return (a == null) ? (b == null) : a.equals(b);
+  }
+
+  /**
+   * Returns the hashCode for a value.
+   */
+  protected int valueHashCode(Object v) {
+    return (v == null) ? 0 : v.hashCode();
+  }
+
+  /**
+   * Ensures the map is large enough to contain the specified number of entries.
+   * Default access to avoid synthetic accessors from inner classes.
+   */
+  void ensureSizeFor(int expectedSize) {
+    if (keys.length * 3 >= expectedSize * 4) {
+      return;
+    }
+
+    int newCapacity = keys.length << 1;
+    while (newCapacity * 3 < expectedSize * 4) {
+      newCapacity <<= 1;
+    }
+
+    Object[] oldKeys = keys;
+    Object[] oldValues = values;
+    initTable(newCapacity);
+    for (int i = 0; i < oldKeys.length; ++i) {
+      Object k = oldKeys[i];
+      if (k != null) {
+        int newIndex = getKeyIndex(unmaskNullKey(k));
+        while (keys[newIndex] != null) {
+          if (++newIndex == keys.length) {
+            newIndex = 0;
+          }
+        }
+        keys[newIndex] = k;
+        values[newIndex] = oldValues[i];
+      }
+    }
+  }
+
+  /**
+   * Returns the index in the key table at which a particular key resides, or -1
+   * if the key is not in the table. Default access to avoid synthetic accessors
+   * from inner classes.
+   */
+  int findKey(Object k) {
+    int index = getKeyIndex(k);
+    while (true) {
+      Object existing = keys[index];
+      if (existing == null) {
+        return -1;
+      }
+      if (keyEquals(k, unmaskNullKey(existing))) {
+        return index;
+      }
+      if (++index == keys.length) {
+        index = 0;
+      }
+    }
+  }
+
+  /**
+   * Returns the index in the key table at which a particular key resides, or
+   * the index of an empty slot in the table where this key should be inserted
+   * if it is not already in the table. Default access to avoid synthetic
+   * accessors from inner classes.
+   */
+  int findKeyOrEmpty(Object k) {
+    int index = getKeyIndex(k);
+    while (true) {
+      Object existing = keys[index];
+      if (existing == null) {
+        return index;
+      }
+      if (keyEquals(k, unmaskNullKey(existing))) {
+        return index;
+      }
+      if (++index == keys.length) {
+        index = 0;
+      }
+    }
+  }
+
+  /**
+   * Removes the entry at the specified index, and performs internal management
+   * to make sure we don't wind up with a hole in the table. Default access to
+   * avoid synthetic accessors from inner classes.
+   */
+  void internalRemove(int index) {
+    keys[index] = null;
+    values[index] = null;
+    --size;
+    plugHole(index);
+  }
+
+  private int getKeyIndex(Object k) {
+    int h = keyHashCode(k);
+    // Copied from Apache's AbstractHashedMap; prevents power-of-two collisions.
+    h += ~(h << 9);
+    h ^= (h >>> 14);
+    h += (h << 4);
+    h ^= (h >>> 10);
+    // Power of two trick.
+    return h & (keys.length - 1);
+  }
+
+  private void initTable(int capacity) {
+    keys = new Object[capacity];
+    values = new Object[capacity];
+  }
+
+  private void internalPutAll(Map<? extends K, ? extends V> m) {
+    for (Entry<? extends K, ? extends V> entry : m.entrySet()) {
+      K key = entry.getKey();
+      V value = entry.getValue();
+      int index = findKeyOrEmpty(key);
+      if (keys[index] == null) {
+        ++size;
+        keys[index] = maskNullKey(key);
+        values[index] = value;
+      } else {
+        values[index] = value;
+      }
+    }
+  }
+
+  /**
+   * Tricky, we left a hole in the map, which we have to fill. The only way to
+   * do this is to search forwards through the map shuffling back values that
+   * match this index until we hit a null.
+   */
+  private void plugHole(int hole) {
+    int index = hole + 1;
+    if (index == keys.length) {
+      index = 0;
+    }
+    while (keys[index] != null) {
+      int targetIndex = getKeyIndex(unmaskNullKey(keys[index]));
+      if (hole < index) {
+        /*
+         * "Normal" case, the index is past the hole and the "bad range" is from
+         * hole (exclusive) to index (inclusive).
+         */
+        if (!(hole < targetIndex && targetIndex <= index)) {
+          // Plug it!
+          keys[hole] = keys[index];
+          values[hole] = values[index];
+          keys[index] = null;
+          values[index] = null;
+          hole = index;
+        }
+      } else {
+        /*
+         * "Wrapped" case, the index is before the hole (we've wrapped) and the
+         * "good range" is from index (exclusive) to hole (inclusive).
+         */
+        if (index < targetIndex && targetIndex <= hole) {
+          // Plug it!
+          keys[hole] = keys[index];
+          values[hole] = values[index];
+          keys[index] = null;
+          values[index] = null;
+          hole = index;
+        }
+      }
+      if (++index == keys.length) {
+        index = 0;
+      }
+    }
+  }
+
+  private void readObject(ObjectInputStream in) throws IOException,
+      ClassNotFoundException {
+    in.defaultReadObject();
+    doReadObject(in);
+  }
+
+  private void writeObject(ObjectOutputStream out) throws IOException {
+    out.defaultWriteObject();
+    doWriteObject(out);
+  }
+}
diff --git a/dev/core/src/com/google/gwt/dev/util/collect/HashSet.java b/dev/core/src/com/google/gwt/dev/util/collect/HashSet.java
index 8387a35..6476e6d 100644
--- a/dev/core/src/com/google/gwt/dev/util/collect/HashSet.java
+++ b/dev/core/src/com/google/gwt/dev/util/collect/HashSet.java
@@ -1,398 +1,398 @@
-/*

- * Copyright 2009 Google Inc.

- * 

- * Licensed under the Apache License, Version 2.0 (the "License"); you may not

- * use this file except in compliance with the License. You may obtain a copy of

- * the License at

- * 

- * http://www.apache.org/licenses/LICENSE-2.0

- * 

- * Unless required by applicable law or agreed to in writing, software

- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT

- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the

- * License for the specific language governing permissions and limitations under

- * the License.

- */

-package com.google.gwt.dev.util.collect;

-

-import java.io.IOException;

-import java.io.ObjectInputStream;

-import java.io.ObjectOutputStream;

-import java.io.Serializable;

-import java.lang.reflect.Array;

-import java.util.AbstractSet;

-import java.util.Collection;

-import java.util.Iterator;

-import java.util.NoSuchElementException;

-

-/**

- * A memory-efficient hash set.

- * 

- * @param <E> the element type

- */

-public class HashSet<E> extends AbstractSet<E> implements Serializable {

-

-  private class SetIterator implements Iterator<E> {

-    private int index = 0;

-    private int last = -1;

-

-    public SetIterator() {

-      advanceToItem();

-    }

-

-    public boolean hasNext() {

-      return index < table.length;

-    }

-

-    @SuppressWarnings("unchecked")

-    public E next() {

-      if (!hasNext()) {

-        throw new NoSuchElementException();

-      }

-      last = index;

-      E toReturn = (E) unmaskNull(table[index++]);

-      advanceToItem();

-      return toReturn;

-    }

-

-    public void remove() {

-      if (last < 0) {

-        throw new IllegalStateException();

-      }

-      internalRemove(last);

-      if (table[last] != null) {

-        index = last;

-      }

-      last = -1;

-    }

-

-    private void advanceToItem() {

-      for (; index < table.length; ++index) {

-        if (table[index] != null) {

-          return;

-        }

-      }

-    }

-  }

-

-  /**

-   * In the interest of memory-savings, we start with the smallest feasible

-   * power-of-two table size that can hold three items without rehashing. If we

-   * started with a size of 2, we'd have to expand as soon as the second item

-   * was added.

-   */

-  private static final int INITIAL_TABLE_SIZE = 4;

-

-  private static final Object NULL_ITEM = new Serializable() {

-    Object readResolve() {

-      return NULL_ITEM;

-    }

-  };

-

-  static Object maskNull(Object o) {

-    return (o == null) ? NULL_ITEM : o;

-  }

-

-  static Object unmaskNull(Object o) {

-    return (o == NULL_ITEM) ? null : o;

-  }

-

-  /**

-   * Number of objects in this set; transient due to custom serialization.

-   * Default access to avoid synthetic accessors from inner classes.

-   */

-  transient int size = 0;

-

-  /**

-   * Backing store for all the objects; transient due to custom serialization.

-   * Default access to avoid synthetic accessors from inner classes.

-   */

-  transient Object[] table;

-

-  public HashSet() {

-    table = new Object[INITIAL_TABLE_SIZE];

-  }

-

-  public HashSet(Collection<? extends E> c) {

-    int newCapacity = INITIAL_TABLE_SIZE;

-    int expectedSize = c.size();

-    while (newCapacity * 3 < expectedSize * 4) {

-      newCapacity <<= 1;

-    }

-

-    table = new Object[newCapacity];

-    super.addAll(c);

-  }

-

-  @Override

-  public boolean add(E e) {

-    ensureSizeFor(size + 1);

-    int index = findOrEmpty(e);

-    if (table[index] == null) {

-      ++size;

-      table[index] = maskNull(e);

-      return true;

-    }

-    return false;

-  }

-

-  @Override

-  public boolean addAll(Collection<? extends E> c) {

-    ensureSizeFor(size + c.size());

-    return super.addAll(c);

-  }

-

-  @Override

-  public void clear() {

-    table = new Object[INITIAL_TABLE_SIZE];

-    size = 0;

-  }

-

-  @Override

-  public boolean contains(Object o) {

-    return find(o) >= 0;

-  }

-

-  @Override

-  public Iterator<E> iterator() {

-    return new SetIterator();

-  }

-

-  @Override

-  public boolean remove(Object o) {

-    int index = find(o);

-    if (index < 0) {

-      return false;

-    }

-    internalRemove(index);

-    return true;

-  }

-

-  @Override

-  public int size() {

-    return size;

-  }

-

-  @Override

-  public Object[] toArray() {

-    return toArray(new Object[size]);

-  }

-

-  @SuppressWarnings("unchecked")

-  @Override

-  public <T> T[] toArray(T[] a) {

-    if (a.length < size) {

-      a = (T[]) Array.newInstance(a.getClass().getComponentType(), size);

-    }

-    int index = 0;

-    for (int i = 0; i < table.length; ++i) {

-      Object e = table[i];

-      if (e != null) {

-        a[index++] = (T) unmaskNull(e);

-      }

-    }

-    while (index < a.length) {

-      a[index++] = null;

-    }

-    return a;

-  }

-

-  /**

-   * Adapted from {@link org.apache.commons.collections.map.AbstractHashedMap}.

-   */

-  @SuppressWarnings("unchecked")

-  protected void doReadObject(ObjectInputStream in) throws IOException,

-      ClassNotFoundException {

-    table = new Object[in.readInt()];

-    int items = in.readInt();

-    for (int i = 0; i < items; i++) {

-      add((E) in.readObject());

-    }

-  }

-

-  /**

-   * Adapted from {@link org.apache.commons.collections.map.AbstractHashedMap}.

-   */

-  protected void doWriteObject(ObjectOutputStream out) throws IOException {

-    out.writeInt(table.length);

-    out.writeInt(size);

-    for (int i = 0; i < table.length; ++i) {

-      Object e = table[i];

-      if (e != null) {

-        out.writeObject(unmaskNull(e));

-      }

-    }

-  }

-

-  /**

-   * Returns whether two items are equal for the purposes of this set.

-   */

-  protected boolean itemEquals(Object a, Object b) {

-    return (a == null) ? (b == null) : a.equals(b);

-  }

-

-  /**

-   * Return the hashCode for an item.

-   */

-  protected int itemHashCode(Object o) {

-    return (o == null) ? 0 : o.hashCode();

-  }

-

-  /**

-   * Works just like {@link #addAll(Collection)}, but for arrays. Used to avoid

-   * having to synthesize a collection in {@link Sets}.

-   */

-  void addAll(E[] elements) {

-    ensureSizeFor(size + elements.length);

-    for (E e : elements) {

-      int index = findOrEmpty(e);

-      if (table[index] == null) {

-        ++size;

-        table[index] = maskNull(e);

-      }

-    }

-  }

-

-  /**

-   * Removes the item at the specified index, and performs internal management

-   * to make sure we don't wind up with a hole in the table. Default access to

-   * avoid synthetic accessors from inner classes.

-   */

-  void internalRemove(int index) {

-    table[index] = null;

-    --size;

-    plugHole(index);

-  }

-

-  /**

-   * Ensures the set is large enough to contain the specified number of entries.

-   */

-  private void ensureSizeFor(int expectedSize) {

-    if (table.length * 3 >= expectedSize * 4) {

-      return;

-    }

-

-    int newCapacity = table.length << 1;

-    while (newCapacity * 3 < expectedSize * 4) {

-      newCapacity <<= 1;

-    }

-

-    Object[] oldTable = table;

-    table = new Object[newCapacity];

-    for (Object o : oldTable) {

-      if (o != null) {

-        int newIndex = getIndex(unmaskNull(o));

-        while (table[newIndex] != null) {

-          if (++newIndex == table.length) {

-            newIndex = 0;

-          }

-        }

-        table[newIndex] = o;

-      }

-    }

-  }

-

-  /**

-   * Returns the index in the table at which a particular item resides, or -1 if

-   * the item is not in the table.

-   */

-  private int find(Object o) {

-    int index = getIndex(o);

-    while (true) {

-      Object existing = table[index];

-      if (existing == null) {

-        return -1;

-      }

-      if (itemEquals(o, unmaskNull(existing))) {

-        return index;

-      }

-      if (++index == table.length) {

-        index = 0;

-      }

-    }

-  }

-

-  /**

-   * Returns the index in the table at which a particular item resides, or the

-   * index of an empty slot in the table where this item should be inserted if

-   * it is not already in the table.

-   */

-  private int findOrEmpty(Object o) {

-    int index = getIndex(o);

-    while (true) {

-      Object existing = table[index];

-      if (existing == null) {

-        return index;

-      }

-      if (itemEquals(o, unmaskNull(existing))) {

-        return index;

-      }

-      if (++index == table.length) {

-        index = 0;

-      }

-    }

-  }

-

-  private int getIndex(Object o) {

-    int h = itemHashCode(o);

-    // Copied from Apache's AbstractHashedMap; prevents power-of-two collisions.

-    h += ~(h << 9);

-    h ^= (h >>> 14);

-    h += (h << 4);

-    h ^= (h >>> 10);

-    // Power of two trick.

-    return h & (table.length - 1);

-  }

-

-  /**

-   * Tricky, we left a hole in the map, which we have to fill. The only way to

-   * do this is to search forwards through the map shuffling back values that

-   * match this index until we hit a null.

-   */

-  private void plugHole(int hole) {

-    int index = hole + 1;

-    if (index == table.length) {

-      index = 0;

-    }

-    while (table[index] != null) {

-      int targetIndex = getIndex(unmaskNull(table[index]));

-      if (hole < index) {

-        /*

-         * "Normal" case, the index is past the hole and the "bad range" is from

-         * hole (exclusive) to index (inclusive).

-         */

-        if (!(hole < targetIndex && targetIndex <= index)) {

-          // Plug it!

-          table[hole] = table[index];

-          table[index] = null;

-          hole = index;

-        }

-      } else {

-        /*

-         * "Wrapped" case, the index is before the hole (we've wrapped) and the

-         * "good range" is from index (exclusive) to hole (inclusive).

-         */

-        if (index < targetIndex && targetIndex <= hole) {

-          // Plug it!

-          table[hole] = table[index];

-          table[index] = null;

-          hole = index;

-        }

-      }

-      if (++index == table.length) {

-        index = 0;

-      }

-    }

-  }

-

-  private void readObject(ObjectInputStream in) throws IOException,

-      ClassNotFoundException {

-    in.defaultReadObject();

-    doReadObject(in);

-  }

-

-  private void writeObject(ObjectOutputStream out) throws IOException {

-    out.defaultWriteObject();

-    doWriteObject(out);

-  }

-}

+/*
+ * Copyright 2009 Google Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.dev.util.collect;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.lang.reflect.Array;
+import java.util.AbstractSet;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
+/**
+ * A memory-efficient hash set.
+ * 
+ * @param <E> the element type
+ */
+public class HashSet<E> extends AbstractSet<E> implements Serializable {
+
+  private class SetIterator implements Iterator<E> {
+    private int index = 0;
+    private int last = -1;
+
+    public SetIterator() {
+      advanceToItem();
+    }
+
+    public boolean hasNext() {
+      return index < table.length;
+    }
+
+    @SuppressWarnings("unchecked")
+    public E next() {
+      if (!hasNext()) {
+        throw new NoSuchElementException();
+      }
+      last = index;
+      E toReturn = (E) unmaskNull(table[index++]);
+      advanceToItem();
+      return toReturn;
+    }
+
+    public void remove() {
+      if (last < 0) {
+        throw new IllegalStateException();
+      }
+      internalRemove(last);
+      if (table[last] != null) {
+        index = last;
+      }
+      last = -1;
+    }
+
+    private void advanceToItem() {
+      for (; index < table.length; ++index) {
+        if (table[index] != null) {
+          return;
+        }
+      }
+    }
+  }
+
+  /**
+   * In the interest of memory-savings, we start with the smallest feasible
+   * power-of-two table size that can hold three items without rehashing. If we
+   * started with a size of 2, we'd have to expand as soon as the second item
+   * was added.
+   */
+  private static final int INITIAL_TABLE_SIZE = 4;
+
+  private static final Object NULL_ITEM = new Serializable() {
+    Object readResolve() {
+      return NULL_ITEM;
+    }
+  };
+
+  static Object maskNull(Object o) {
+    return (o == null) ? NULL_ITEM : o;
+  }
+
+  static Object unmaskNull(Object o) {
+    return (o == NULL_ITEM) ? null : o;
+  }
+
+  /**
+   * Number of objects in this set; transient due to custom serialization.
+   * Default access to avoid synthetic accessors from inner classes.
+   */
+  transient int size = 0;
+
+  /**
+   * Backing store for all the objects; transient due to custom serialization.
+   * Default access to avoid synthetic accessors from inner classes.
+   */
+  transient Object[] table;
+
+  public HashSet() {
+    table = new Object[INITIAL_TABLE_SIZE];
+  }
+
+  public HashSet(Collection<? extends E> c) {
+    int newCapacity = INITIAL_TABLE_SIZE;
+    int expectedSize = c.size();
+    while (newCapacity * 3 < expectedSize * 4) {
+      newCapacity <<= 1;
+    }
+
+    table = new Object[newCapacity];
+    super.addAll(c);
+  }
+
+  @Override
+  public boolean add(E e) {
+    ensureSizeFor(size + 1);
+    int index = findOrEmpty(e);
+    if (table[index] == null) {
+      ++size;
+      table[index] = maskNull(e);
+      return true;
+    }
+    return false;
+  }
+
+  @Override
+  public boolean addAll(Collection<? extends E> c) {
+    ensureSizeFor(size + c.size());
+    return super.addAll(c);
+  }
+
+  @Override
+  public void clear() {
+    table = new Object[INITIAL_TABLE_SIZE];
+    size = 0;
+  }
+
+  @Override
+  public boolean contains(Object o) {
+    return find(o) >= 0;
+  }
+
+  @Override
+  public Iterator<E> iterator() {
+    return new SetIterator();
+  }
+
+  @Override
+  public boolean remove(Object o) {
+    int index = find(o);
+    if (index < 0) {
+      return false;
+    }
+    internalRemove(index);
+    return true;
+  }
+
+  @Override
+  public int size() {
+    return size;
+  }
+
+  @Override
+  public Object[] toArray() {
+    return toArray(new Object[size]);
+  }
+
+  @SuppressWarnings("unchecked")
+  @Override
+  public <T> T[] toArray(T[] a) {
+    if (a.length < size) {
+      a = (T[]) Array.newInstance(a.getClass().getComponentType(), size);
+    }
+    int index = 0;
+    for (int i = 0; i < table.length; ++i) {
+      Object e = table[i];
+      if (e != null) {
+        a[index++] = (T) unmaskNull(e);
+      }
+    }
+    while (index < a.length) {
+      a[index++] = null;
+    }
+    return a;
+  }
+
+  /**
+   * Adapted from {@link org.apache.commons.collections.map.AbstractHashedMap}.
+   */
+  @SuppressWarnings("unchecked")
+  protected void doReadObject(ObjectInputStream in) throws IOException,
+      ClassNotFoundException {
+    table = new Object[in.readInt()];
+    int items = in.readInt();
+    for (int i = 0; i < items; i++) {
+      add((E) in.readObject());
+    }
+  }
+
+  /**
+   * Adapted from {@link org.apache.commons.collections.map.AbstractHashedMap}.
+   */
+  protected void doWriteObject(ObjectOutputStream out) throws IOException {
+    out.writeInt(table.length);
+    out.writeInt(size);
+    for (int i = 0; i < table.length; ++i) {
+      Object e = table[i];
+      if (e != null) {
+        out.writeObject(unmaskNull(e));
+      }
+    }
+  }
+
+  /**
+   * Returns whether two items are equal for the purposes of this set.
+   */
+  protected boolean itemEquals(Object a, Object b) {
+    return (a == null) ? (b == null) : a.equals(b);
+  }
+
+  /**
+   * Return the hashCode for an item.
+   */
+  protected int itemHashCode(Object o) {
+    return (o == null) ? 0 : o.hashCode();
+  }
+
+  /**
+   * Works just like {@link #addAll(Collection)}, but for arrays. Used to avoid
+   * having to synthesize a collection in {@link Sets}.
+   */
+  void addAll(E[] elements) {
+    ensureSizeFor(size + elements.length);
+    for (E e : elements) {
+      int index = findOrEmpty(e);
+      if (table[index] == null) {
+        ++size;
+        table[index] = maskNull(e);
+      }
+    }
+  }
+
+  /**
+   * Removes the item at the specified index, and performs internal management
+   * to make sure we don't wind up with a hole in the table. Default access to
+   * avoid synthetic accessors from inner classes.
+   */
+  void internalRemove(int index) {
+    table[index] = null;
+    --size;
+    plugHole(index);
+  }
+
+  /**
+   * Ensures the set is large enough to contain the specified number of entries.
+   */
+  private void ensureSizeFor(int expectedSize) {
+    if (table.length * 3 >= expectedSize * 4) {
+      return;
+    }
+
+    int newCapacity = table.length << 1;
+    while (newCapacity * 3 < expectedSize * 4) {
+      newCapacity <<= 1;
+    }
+
+    Object[] oldTable = table;
+    table = new Object[newCapacity];
+    for (Object o : oldTable) {
+      if (o != null) {
+        int newIndex = getIndex(unmaskNull(o));
+        while (table[newIndex] != null) {
+          if (++newIndex == table.length) {
+            newIndex = 0;
+          }
+        }
+        table[newIndex] = o;
+      }
+    }
+  }
+
+  /**
+   * Returns the index in the table at which a particular item resides, or -1 if
+   * the item is not in the table.
+   */
+  private int find(Object o) {
+    int index = getIndex(o);
+    while (true) {
+      Object existing = table[index];
+      if (existing == null) {
+        return -1;
+      }
+      if (itemEquals(o, unmaskNull(existing))) {
+        return index;
+      }
+      if (++index == table.length) {
+        index = 0;
+      }
+    }
+  }
+
+  /**
+   * Returns the index in the table at which a particular item resides, or the
+   * index of an empty slot in the table where this item should be inserted if
+   * it is not already in the table.
+   */
+  private int findOrEmpty(Object o) {
+    int index = getIndex(o);
+    while (true) {
+      Object existing = table[index];
+      if (existing == null) {
+        return index;
+      }
+      if (itemEquals(o, unmaskNull(existing))) {
+        return index;
+      }
+      if (++index == table.length) {
+        index = 0;
+      }
+    }
+  }
+
+  private int getIndex(Object o) {
+    int h = itemHashCode(o);
+    // Copied from Apache's AbstractHashedMap; prevents power-of-two collisions.
+    h += ~(h << 9);
+    h ^= (h >>> 14);
+    h += (h << 4);
+    h ^= (h >>> 10);
+    // Power of two trick.
+    return h & (table.length - 1);
+  }
+
+  /**
+   * Tricky, we left a hole in the map, which we have to fill. The only way to
+   * do this is to search forwards through the map shuffling back values that
+   * match this index until we hit a null.
+   */
+  private void plugHole(int hole) {
+    int index = hole + 1;
+    if (index == table.length) {
+      index = 0;
+    }
+    while (table[index] != null) {
+      int targetIndex = getIndex(unmaskNull(table[index]));
+      if (hole < index) {
+        /*
+         * "Normal" case, the index is past the hole and the "bad range" is from
+         * hole (exclusive) to index (inclusive).
+         */
+        if (!(hole < targetIndex && targetIndex <= index)) {
+          // Plug it!
+          table[hole] = table[index];
+          table[index] = null;
+          hole = index;
+        }
+      } else {
+        /*
+         * "Wrapped" case, the index is before the hole (we've wrapped) and the
+         * "good range" is from index (exclusive) to hole (inclusive).
+         */
+        if (index < targetIndex && targetIndex <= hole) {
+          // Plug it!
+          table[hole] = table[index];
+          table[index] = null;
+          hole = index;
+        }
+      }
+      if (++index == table.length) {
+        index = 0;
+      }
+    }
+  }
+
+  private void readObject(ObjectInputStream in) throws IOException,
+      ClassNotFoundException {
+    in.defaultReadObject();
+    doReadObject(in);
+  }
+
+  private void writeObject(ObjectOutputStream out) throws IOException {
+    out.defaultWriteObject();
+    doWriteObject(out);
+  }
+}
diff --git a/dev/core/src/com/google/gwt/dev/util/collect/IdentityHashMap.java b/dev/core/src/com/google/gwt/dev/util/collect/IdentityHashMap.java
index 89d690d..dd44e40 100644
--- a/dev/core/src/com/google/gwt/dev/util/collect/IdentityHashMap.java
+++ b/dev/core/src/com/google/gwt/dev/util/collect/IdentityHashMap.java
@@ -1,68 +1,68 @@
-/*

- * Copyright 2009 Google Inc.

- * 

- * Licensed under the Apache License, Version 2.0 (the "License"); you may not

- * use this file except in compliance with the License. You may obtain a copy of

- * the License at

- * 

- * http://www.apache.org/licenses/LICENSE-2.0

- * 

- * Unless required by applicable law or agreed to in writing, software

- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT

- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the

- * License for the specific language governing permissions and limitations under

- * the License.

- */

-package com.google.gwt.dev.util.collect;

-

-import java.io.IOException;

-import java.io.ObjectInputStream;

-import java.io.ObjectOutputStream;

-import java.util.Map;

-

-/**

- * A memory-efficient identity hash map.

- * 

- * @param <K> the key type

- * @param <V> the value type

- */

-public class IdentityHashMap<K, V> extends HashMap<K, V> {

-

-  public IdentityHashMap() {

-  }

-

-  public IdentityHashMap(Map<? extends K, ? extends V> m) {

-    super(m);

-  }

-

-  @Override

-  protected boolean keyEquals(Object a, Object b) {

-    return a == b;

-  }

-

-  @Override

-  protected int keyHashCode(Object k) {

-    return System.identityHashCode(k);

-  }

-

-  @Override

-  protected boolean valueEquals(Object a, Object b) {

-    return a == b;

-  }

-

-  @Override

-  protected int valueHashCode(Object k) {

-    return System.identityHashCode(k);

-  }

-

-  private void readObject(ObjectInputStream in) throws IOException,

-      ClassNotFoundException {

-    in.defaultReadObject();

-    doReadObject(in);

-  }

-

-  private void writeObject(ObjectOutputStream out) throws IOException {

-    out.defaultWriteObject();

-    doWriteObject(out);

-  }

-}

+/*
+ * Copyright 2009 Google Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.dev.util.collect;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.Map;
+
+/**
+ * A memory-efficient identity hash map.
+ * 
+ * @param <K> the key type
+ * @param <V> the value type
+ */
+public class IdentityHashMap<K, V> extends HashMap<K, V> {
+
+  public IdentityHashMap() {
+  }
+
+  public IdentityHashMap(Map<? extends K, ? extends V> m) {
+    super(m);
+  }
+
+  @Override
+  protected boolean keyEquals(Object a, Object b) {
+    return a == b;
+  }
+
+  @Override
+  protected int keyHashCode(Object k) {
+    return System.identityHashCode(k);
+  }
+
+  @Override
+  protected boolean valueEquals(Object a, Object b) {
+    return a == b;
+  }
+
+  @Override
+  protected int valueHashCode(Object k) {
+    return System.identityHashCode(k);
+  }
+
+  private void readObject(ObjectInputStream in) throws IOException,
+      ClassNotFoundException {
+    in.defaultReadObject();
+    doReadObject(in);
+  }
+
+  private void writeObject(ObjectOutputStream out) throws IOException {
+    out.defaultWriteObject();
+    doWriteObject(out);
+  }
+}
diff --git a/dev/core/src/com/google/gwt/dev/util/collect/IdentityHashSet.java b/dev/core/src/com/google/gwt/dev/util/collect/IdentityHashSet.java
index 13b71a8..bdf673d 100644
--- a/dev/core/src/com/google/gwt/dev/util/collect/IdentityHashSet.java
+++ b/dev/core/src/com/google/gwt/dev/util/collect/IdentityHashSet.java
@@ -1,56 +1,56 @@
-/*

- * Copyright 2009 Google Inc.

- * 

- * Licensed under the Apache License, Version 2.0 (the "License"); you may not

- * use this file except in compliance with the License. You may obtain a copy of

- * the License at

- * 

- * http://www.apache.org/licenses/LICENSE-2.0

- * 

- * Unless required by applicable law or agreed to in writing, software

- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT

- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the

- * License for the specific language governing permissions and limitations under

- * the License.

- */

-package com.google.gwt.dev.util.collect;

-

-import java.io.IOException;

-import java.io.ObjectInputStream;

-import java.io.ObjectOutputStream;

-import java.util.Collection;

-

-/**

- * A memory-efficient identity hash set.

- * 

- * @param <E> the element type

- */

-public class IdentityHashSet<E> extends HashSet<E> {

-  public IdentityHashSet() {

-  }

-

-  public IdentityHashSet(Collection<? extends E> c) {

-    super(c);

-  }

-

-  @Override

-  protected boolean itemEquals(Object a, Object b) {

-    return a == b;

-  }

-

-  @Override

-  protected int itemHashCode(Object o) {

-    return System.identityHashCode(o);

-  }

-

-  private void readObject(ObjectInputStream in) throws IOException,

-      ClassNotFoundException {

-    in.defaultReadObject();

-    doReadObject(in);

-  }

-

-  private void writeObject(ObjectOutputStream out) throws IOException {

-    out.defaultWriteObject();

-    doWriteObject(out);

-  }

-}

+/*
+ * Copyright 2009 Google Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.dev.util.collect;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.Collection;
+
+/**
+ * A memory-efficient identity hash set.
+ * 
+ * @param <E> the element type
+ */
+public class IdentityHashSet<E> extends HashSet<E> {
+  public IdentityHashSet() {
+  }
+
+  public IdentityHashSet(Collection<? extends E> c) {
+    super(c);
+  }
+
+  @Override
+  protected boolean itemEquals(Object a, Object b) {
+    return a == b;
+  }
+
+  @Override
+  protected int itemHashCode(Object o) {
+    return System.identityHashCode(o);
+  }
+
+  private void readObject(ObjectInputStream in) throws IOException,
+      ClassNotFoundException {
+    in.defaultReadObject();
+    doReadObject(in);
+  }
+
+  private void writeObject(ObjectOutputStream out) throws IOException {
+    out.defaultWriteObject();
+    doWriteObject(out);
+  }
+}
diff --git a/dev/core/src/com/google/gwt/dev/util/collect/IdentityMaps.java b/dev/core/src/com/google/gwt/dev/util/collect/IdentityMaps.java
index dd8d81e..3cdbee1 100644
--- a/dev/core/src/com/google/gwt/dev/util/collect/IdentityMaps.java
+++ b/dev/core/src/com/google/gwt/dev/util/collect/IdentityMaps.java
@@ -1,142 +1,142 @@
-/*

- * Copyright 2009 Google Inc.

- * 

- * Licensed under the Apache License, Version 2.0 (the "License"); you may not

- * use this file except in compliance with the License. You may obtain a copy of

- * the License at

- * 

- * http://www.apache.org/licenses/LICENSE-2.0

- * 

- * Unless required by applicable law or agreed to in writing, software

- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT

- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the

- * License for the specific language governing permissions and limitations under

- * the License.

- */

-package com.google.gwt.dev.util.collect;

-

-import java.util.Collections;

-import java.util.Map;

-

-/**

- * Utility methods for operating on memory-efficient maps. All maps of size 0 or

- * 1 are assumed to be immutable. All maps of size greater than 1 are assumed to

- * be mutable.

- */

-public class IdentityMaps {

-

-  private static final Class<?> MULTI_MAP_CLASS = IdentityHashMap.class;

-

-  private static final Class<?> SINGLETON_MAP_CLASS = IdentitySingletonMap.class;

-

-  public static <K, V> Map<K, V> create() {

-    return Collections.emptyMap();

-  }

-

-  public static <K, V> Map<K, V> create(K key, V value) {

-    return new IdentitySingletonMap<K, V>(key, value);

-  }

-

-  public static <K, V> Map<K, V> normalize(Map<K, V> map) {

-    switch (map.size()) {

-      case 0:

-        return create();

-      case 1: {

-        if (map.getClass() == SINGLETON_MAP_CLASS) {

-          return map;

-        }

-        K key = map.keySet().iterator().next();

-        return create(key, map.get(key));

-      }

-      default:

-        if (map.getClass() == MULTI_MAP_CLASS) {

-          return map;

-        }

-        return new IdentityHashMap<K, V>(map);

-    }

-  }

-

-  public static <K, V> Map<K, V> normalizeUnmodifiable(Map<K, V> map) {

-    if (map.size() < 2) {

-      return normalize(map);

-    } else {

-      // TODO: implement an UnmodifiableIdentityHashMap?

-      return Collections.unmodifiableMap(normalize(map));

-    }

-  }

-

-  public static <K, V> Map<K, V> put(Map<K, V> map, K key, V value) {

-    switch (map.size()) {

-      case 0:

-        // Empty -> Singleton

-        return create(key, value);

-      case 1: {

-        // Singleton -> IdentityHashMap

-        Map<K, V> result = new IdentityHashMap<K, V>();

-        result.put(map.keySet().iterator().next(),

-            map.values().iterator().next());

-        result.put(key, value);

-        return result;

-      }

-      default:

-        // IdentityHashMap

-        map.put(key, value);

-        return map;

-    }

-  }

-

-  public static <K, V> Map<K, V> putAll(Map<K, V> map, Map<K, V> toAdd) {

-    switch (toAdd.size()) {

-      case 0:

-        // No-op.

-        return map;

-      case 1: {

-        // Add one element.

-        K key = toAdd.keySet().iterator().next();

-        return put(map, key, toAdd.get(key));

-      }

-      default:

-        // True list merge, result >= 2.

-        switch (map.size()) {

-          case 0:

-            return new IdentityHashMap<K, V>(toAdd);

-          case 1: {

-            IdentityHashMap<K, V> result = new IdentityHashMap<K, V>();

-            K key = map.keySet().iterator().next();

-            result.put(key, map.get(key));

-            result.putAll(toAdd);

-            return result;

-          }

-          default:

-            map.putAll(toAdd);

-            return map;

-        }

-    }

-  }

-

-  public static <K, V> Map<K, V> remove(Map<K, V> map, K key) {

-    switch (map.size()) {

-      case 0:

-        // Empty

-        return map;

-      case 1:

-        // Singleton -> Empty

-        if (map.containsKey(key)) {

-          return create();

-        }

-        return map;

-      case 2:

-        // IdentityHashMap -> Singleton

-        if (map.containsKey(key)) {

-          map.remove(key);

-          key = map.keySet().iterator().next();

-          return create(key, map.get(key));

-        }

-        return map;

-      default:

-        // IdentityHashMap

-        map.remove(key);

-        return map;

-    }

-  }

-}

+/*
+ * Copyright 2009 Google Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.dev.util.collect;
+
+import java.util.Collections;
+import java.util.Map;
+
+/**
+ * Utility methods for operating on memory-efficient maps. All maps of size 0 or
+ * 1 are assumed to be immutable. All maps of size greater than 1 are assumed to
+ * be mutable.
+ */
+public class IdentityMaps {
+
+  private static final Class<?> MULTI_MAP_CLASS = IdentityHashMap.class;
+
+  private static final Class<?> SINGLETON_MAP_CLASS = IdentitySingletonMap.class;
+
+  public static <K, V> Map<K, V> create() {
+    return Collections.emptyMap();
+  }
+
+  public static <K, V> Map<K, V> create(K key, V value) {
+    return new IdentitySingletonMap<K, V>(key, value);
+  }
+
+  public static <K, V> Map<K, V> normalize(Map<K, V> map) {
+    switch (map.size()) {
+      case 0:
+        return create();
+      case 1: {
+        if (map.getClass() == SINGLETON_MAP_CLASS) {
+          return map;
+        }
+        K key = map.keySet().iterator().next();
+        return create(key, map.get(key));
+      }
+      default:
+        if (map.getClass() == MULTI_MAP_CLASS) {
+          return map;
+        }
+        return new IdentityHashMap<K, V>(map);
+    }
+  }
+
+  public static <K, V> Map<K, V> normalizeUnmodifiable(Map<K, V> map) {
+    if (map.size() < 2) {
+      return normalize(map);
+    } else {
+      // TODO: implement an UnmodifiableIdentityHashMap?
+      return Collections.unmodifiableMap(normalize(map));
+    }
+  }
+
+  public static <K, V> Map<K, V> put(Map<K, V> map, K key, V value) {
+    switch (map.size()) {
+      case 0:
+        // Empty -> Singleton
+        return create(key, value);
+      case 1: {
+        // Singleton -> IdentityHashMap
+        Map<K, V> result = new IdentityHashMap<K, V>();
+        result.put(map.keySet().iterator().next(),
+            map.values().iterator().next());
+        result.put(key, value);
+        return result;
+      }
+      default:
+        // IdentityHashMap
+        map.put(key, value);
+        return map;
+    }
+  }
+
+  public static <K, V> Map<K, V> putAll(Map<K, V> map, Map<K, V> toAdd) {
+    switch (toAdd.size()) {
+      case 0:
+        // No-op.
+        return map;
+      case 1: {
+        // Add one element.
+        K key = toAdd.keySet().iterator().next();
+        return put(map, key, toAdd.get(key));
+      }
+      default:
+        // True list merge, result >= 2.
+        switch (map.size()) {
+          case 0:
+            return new IdentityHashMap<K, V>(toAdd);
+          case 1: {
+            IdentityHashMap<K, V> result = new IdentityHashMap<K, V>();
+            K key = map.keySet().iterator().next();
+            result.put(key, map.get(key));
+            result.putAll(toAdd);
+            return result;
+          }
+          default:
+            map.putAll(toAdd);
+            return map;
+        }
+    }
+  }
+
+  public static <K, V> Map<K, V> remove(Map<K, V> map, K key) {
+    switch (map.size()) {
+      case 0:
+        // Empty
+        return map;
+      case 1:
+        // Singleton -> Empty
+        if (map.containsKey(key)) {
+          return create();
+        }
+        return map;
+      case 2:
+        // IdentityHashMap -> Singleton
+        if (map.containsKey(key)) {
+          map.remove(key);
+          key = map.keySet().iterator().next();
+          return create(key, map.get(key));
+        }
+        return map;
+      default:
+        // IdentityHashMap
+        map.remove(key);
+        return map;
+    }
+  }
+}
diff --git a/dev/core/src/com/google/gwt/dev/util/collect/IdentitySets.java b/dev/core/src/com/google/gwt/dev/util/collect/IdentitySets.java
index 8791f28..0985ee3 100644
--- a/dev/core/src/com/google/gwt/dev/util/collect/IdentitySets.java
+++ b/dev/core/src/com/google/gwt/dev/util/collect/IdentitySets.java
@@ -1,204 +1,204 @@
-/*

- * Copyright 2009 Google Inc.

- * 

- * Licensed under the Apache License, Version 2.0 (the "License"); you may not

- * use this file except in compliance with the License. You may obtain a copy of

- * the License at

- * 

- * http://www.apache.org/licenses/LICENSE-2.0

- * 

- * Unless required by applicable law or agreed to in writing, software

- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT

- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the

- * License for the specific language governing permissions and limitations under

- * the License.

- */

-package com.google.gwt.dev.util.collect;

-

-import java.io.Serializable;

-import java.lang.reflect.Array;

-import java.util.AbstractSet;

-import java.util.Collections;

-import java.util.Iterator;

-import java.util.NoSuchElementException;

-import java.util.Set;

-

-/**

- * Utility methods for operating on memory-efficient identity sets. All sets of

- * size 0 or 1 are assumed to be immutable. All sets of size greater than 1 are

- * assumed to be mutable.

- */

-public class IdentitySets {

-

-  private static class IdentitySingletonSet<E> extends AbstractSet<E> implements

-      Serializable {

-

-    private final E item;

-

-    IdentitySingletonSet(E item) {

-      this.item = item;

-    }

-

-    public boolean contains(Object o) {

-      return o == item;

-    }

-

-    public Iterator<E> iterator() {

-      return new SingletonIterator<E>(item);

-    }

-

-    public int size() {

-      return 1;

-    }

-

-    @Override

-    public Object[] toArray() {

-      return toArray(new Object[1]);

-    }

-

-    @SuppressWarnings("unchecked")

-    @Override

-    public <T> T[] toArray(T[] a) {

-      if (a.length < 1) {

-        a = (T[]) Array.newInstance(a.getClass().getComponentType(), 1);

-      }

-      a[0] = (T) item;

-      int i = 1;

-      while (i < a.length) {

-        a[i++] = null;

-      }

-      return a;

-    }

-  }

-  private static final class SingletonIterator<T> implements Iterator<T> {

-

-    /**

-     * Sentinel value to mark that this iterator's single item was consumed.

-     */

-    private static final Object EMPTY = new Object();

-

-    private T item;

-

-    SingletonIterator(T item) {

-      this.item = item;

-    }

-

-    public boolean hasNext() {

-      return item != EMPTY;

-    }

-

-    @SuppressWarnings("unchecked")

-    public T next() {

-      if (!hasNext()) {

-        throw new NoSuchElementException();

-      }

-      T toReturn = item;

-      item = (T) EMPTY;

-      return toReturn;

-    }

-

-    public void remove() {

-      throw new UnsupportedOperationException();

-    }

-  }

-

-  private static final Class<?> MULTI_SET_CLASS = IdentityHashSet.class;

-

-  private static final Class<?> SINGLETON_SET_CLASS = IdentitySingletonSet.class;

-

-  public static <T> Set<T> add(Set<T> set, T toAdd) {

-    switch (set.size()) {

-      case 0:

-        // Empty -> Singleton

-        return new IdentitySingletonSet<T>(toAdd);

-      case 1: {

-        if (set.contains(toAdd)) {

-          return set;

-        }

-        // Singleton -> IdentityHashSet

-        Set<T> result = new IdentityHashSet<T>();

-        result.add(set.iterator().next());

-        result.add(toAdd);

-        return result;

-      }

-      default:

-        // IdentityHashSet

-        set.add(toAdd);

-        return set;

-    }

-  }

-

-  public static <T> Set<T> create() {

-    return Collections.emptySet();

-  }

-

-  public static <T> Set<T> create(T item) {

-    return new IdentitySingletonSet<T>(item);

-  }

-

-  public static <T> Set<T> create(T... items) {

-    switch (items.length) {

-      case 0:

-        return create();

-      case 1:

-        return create(items[0]);

-      default:

-        IdentityHashSet<T> result = new IdentityHashSet<T>();

-        result.addAll(items);

-        return result;

-    }

-  }

-

-  public static <T> Set<T> normalize(Set<T> set) {

-    switch (set.size()) {

-      case 0:

-        return create();

-      case 1: {

-        if (set.getClass() == SINGLETON_SET_CLASS) {

-          return set;

-        }

-        return create(set.iterator().next());

-      }

-      default:

-        if (set.getClass() == MULTI_SET_CLASS) {

-          return set;

-        }

-        IdentityHashSet<T> result = new IdentityHashSet<T>();

-        result.addAll(set);

-        return result;

-    }

-  }

-

-  public static <T> Set<T> normalizeUnmodifiable(Set<T> set) {

-    if (set.size() < 2) {

-      return normalize(set);

-    } else {

-      // TODO: implement an UnmodifiableIdentityHashSet?

-      return Collections.unmodifiableSet(normalize(set));

-    }

-  }

-

-  public static <T> Set<T> remove(Set<T> set, T toRemove) {

-    switch (set.size()) {

-      case 0:

-        // Empty

-        return set;

-      case 1:

-        // Singleton -> Empty

-        if (set.contains(toRemove)) {

-          return create();

-        }

-        return set;

-      case 2:

-        // IdentityHashSet -> Singleton

-        if (set.remove(toRemove)) {

-          return create(set.iterator().next());

-        }

-        return set;

-      default:

-        // IdentityHashSet

-        set.remove(toRemove);

-        return set;

-    }

-  }

-}

+/*
+ * Copyright 2009 Google Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.dev.util.collect;
+
+import java.io.Serializable;
+import java.lang.reflect.Array;
+import java.util.AbstractSet;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+import java.util.Set;
+
+/**
+ * Utility methods for operating on memory-efficient identity sets. All sets of
+ * size 0 or 1 are assumed to be immutable. All sets of size greater than 1 are
+ * assumed to be mutable.
+ */
+public class IdentitySets {
+
+  private static class IdentitySingletonSet<E> extends AbstractSet<E> implements
+      Serializable {
+
+    private final E item;
+
+    IdentitySingletonSet(E item) {
+      this.item = item;
+    }
+
+    public boolean contains(Object o) {
+      return o == item;
+    }
+
+    public Iterator<E> iterator() {
+      return new SingletonIterator<E>(item);
+    }
+
+    public int size() {
+      return 1;
+    }
+
+    @Override
+    public Object[] toArray() {
+      return toArray(new Object[1]);
+    }
+
+    @SuppressWarnings("unchecked")
+    @Override
+    public <T> T[] toArray(T[] a) {
+      if (a.length < 1) {
+        a = (T[]) Array.newInstance(a.getClass().getComponentType(), 1);
+      }
+      a[0] = (T) item;
+      int i = 1;
+      while (i < a.length) {
+        a[i++] = null;
+      }
+      return a;
+    }
+  }
+  private static final class SingletonIterator<T> implements Iterator<T> {
+
+    /**
+     * Sentinel value to mark that this iterator's single item was consumed.
+     */
+    private static final Object EMPTY = new Object();
+
+    private T item;
+
+    SingletonIterator(T item) {
+      this.item = item;
+    }
+
+    public boolean hasNext() {
+      return item != EMPTY;
+    }
+
+    @SuppressWarnings("unchecked")
+    public T next() {
+      if (!hasNext()) {
+        throw new NoSuchElementException();
+      }
+      T toReturn = item;
+      item = (T) EMPTY;
+      return toReturn;
+    }
+
+    public void remove() {
+      throw new UnsupportedOperationException();
+    }
+  }
+
+  private static final Class<?> MULTI_SET_CLASS = IdentityHashSet.class;
+
+  private static final Class<?> SINGLETON_SET_CLASS = IdentitySingletonSet.class;
+
+  public static <T> Set<T> add(Set<T> set, T toAdd) {
+    switch (set.size()) {
+      case 0:
+        // Empty -> Singleton
+        return new IdentitySingletonSet<T>(toAdd);
+      case 1: {
+        if (set.contains(toAdd)) {
+          return set;
+        }
+        // Singleton -> IdentityHashSet
+        Set<T> result = new IdentityHashSet<T>();
+        result.add(set.iterator().next());
+        result.add(toAdd);
+        return result;
+      }
+      default:
+        // IdentityHashSet
+        set.add(toAdd);
+        return set;
+    }
+  }
+
+  public static <T> Set<T> create() {
+    return Collections.emptySet();
+  }
+
+  public static <T> Set<T> create(T item) {
+    return new IdentitySingletonSet<T>(item);
+  }
+
+  public static <T> Set<T> create(T... items) {
+    switch (items.length) {
+      case 0:
+        return create();
+      case 1:
+        return create(items[0]);
+      default:
+        IdentityHashSet<T> result = new IdentityHashSet<T>();
+        result.addAll(items);
+        return result;
+    }
+  }
+
+  public static <T> Set<T> normalize(Set<T> set) {
+    switch (set.size()) {
+      case 0:
+        return create();
+      case 1: {
+        if (set.getClass() == SINGLETON_SET_CLASS) {
+          return set;
+        }
+        return create(set.iterator().next());
+      }
+      default:
+        if (set.getClass() == MULTI_SET_CLASS) {
+          return set;
+        }
+        IdentityHashSet<T> result = new IdentityHashSet<T>();
+        result.addAll(set);
+        return result;
+    }
+  }
+
+  public static <T> Set<T> normalizeUnmodifiable(Set<T> set) {
+    if (set.size() < 2) {
+      return normalize(set);
+    } else {
+      // TODO: implement an UnmodifiableIdentityHashSet?
+      return Collections.unmodifiableSet(normalize(set));
+    }
+  }
+
+  public static <T> Set<T> remove(Set<T> set, T toRemove) {
+    switch (set.size()) {
+      case 0:
+        // Empty
+        return set;
+      case 1:
+        // Singleton -> Empty
+        if (set.contains(toRemove)) {
+          return create();
+        }
+        return set;
+      case 2:
+        // IdentityHashSet -> Singleton
+        if (set.remove(toRemove)) {
+          return create(set.iterator().next());
+        }
+        return set;
+      default:
+        // IdentityHashSet
+        set.remove(toRemove);
+        return set;
+    }
+  }
+}
diff --git a/dev/core/src/com/google/gwt/dev/util/collect/IdentitySingletonMap.java b/dev/core/src/com/google/gwt/dev/util/collect/IdentitySingletonMap.java
index b276872..bbd50f3 100644
--- a/dev/core/src/com/google/gwt/dev/util/collect/IdentitySingletonMap.java
+++ b/dev/core/src/com/google/gwt/dev/util/collect/IdentitySingletonMap.java
@@ -1,148 +1,148 @@
-/*

- * Copyright 2009 Google Inc.

- * 

- * Licensed under the Apache License, Version 2.0 (the "License"); you may not

- * use this file except in compliance with the License. You may obtain a copy of

- * the License at

- * 

- * http://www.apache.org/licenses/LICENSE-2.0

- * 

- * Unless required by applicable law or agreed to in writing, software

- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT

- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the

- * License for the specific language governing permissions and limitations under

- * the License.

- */

-package com.google.gwt.dev.util.collect;

-

-import java.io.Serializable;

-import java.util.Collection;

-import java.util.Map;

-import java.util.Set;

-

-class IdentitySingletonMap<K, V> implements Map<K, V>, Serializable {

-

-  private class IdentityEntry implements Entry<K, V> {

-

-    @Override

-    public boolean equals(Object o) {

-      if (!(o instanceof Entry)) {

-        return false;

-      }

-      Entry<?, ?> entry = (Entry<?, ?>) o;

-      return key == entry.getKey() && value == entry.getValue();

-    }

-

-    public K getKey() {

-      return key;

-    }

-

-    public V getValue() {

-      return value;

-    }

-

-    @Override

-    public int hashCode() {

-      return System.identityHashCode(key) ^ System.identityHashCode(value);

-    }

-

-    public V setValue(V value) {

-      throw new UnsupportedOperationException();

-    }

-

-    @Override

-    public String toString() {

-      return key + "=" + value;

-    }

-  }

-

-  /**

-   * The key for the single entry. Default access to avoid synthetic accessors

-   * from inner classes.

-   */

-  final K key;

-

-  /**

-   * The value for the single entry. Default access to avoid synthetic accessors

-   * from inner classes.

-   */

-  final V value;

-

-  public IdentitySingletonMap(K key, V value) {

-    this.key = key;

-    this.value = value;

-  }

-

-  public void clear() {

-    throw new UnsupportedOperationException();

-  }

-

-  public boolean containsKey(Object k) {

-    return key == k;

-  }

-

-  public boolean containsValue(Object v) {

-    return value == v;

-  }

-

-  public Set<Entry<K, V>> entrySet() {

-    return Sets.<Entry<K, V>> create(new IdentityEntry());

-  }

-

-  @Override

-  @SuppressWarnings("unchecked")

-  public boolean equals(Object o) {

-    if (!(o instanceof Map)) {

-      return false;

-    }

-    Map<K, V> other = (Map<K, V>) o;

-    return entrySet().equals(other.entrySet());

-  }

-

-  public V get(Object k) {

-    return (key == k) ? value : null;

-  }

-

-  @Override

-  public int hashCode() {

-    return System.identityHashCode(key) ^ System.identityHashCode(value);

-  }

-

-  public boolean isEmpty() {

-    return false;

-  }

-

-  public Set<K> keySet() {

-    return Sets.create(key);

-  }

-

-  public V put(K key, V value) {

-    throw new UnsupportedOperationException();

-  }

-

-  public void putAll(Map<? extends K, ? extends V> m) {

-    throw new UnsupportedOperationException();

-  }

-

-  public V remove(Object key) {

-    throw new UnsupportedOperationException();

-  }

-

-  public int size() {

-    return 1;

-  }

-

-  @Override

-  public String toString() {

-    StringBuilder buf = new StringBuilder(32 * size());

-    buf.append('{');

-    buf.append(key == this ? "(this Map)" : key).append('=').append(

-        value == this ? "(this Map)" : value);

-    buf.append('}');

-    return buf.toString();

-  }

-

-  public Collection<V> values() {

-    return Sets.create(value);

-  }

-}

+/*
+ * Copyright 2009 Google Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.dev.util.collect;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+
+class IdentitySingletonMap<K, V> implements Map<K, V>, Serializable {
+
+  private class IdentityEntry implements Entry<K, V> {
+
+    @Override
+    public boolean equals(Object o) {
+      if (!(o instanceof Entry)) {
+        return false;
+      }
+      Entry<?, ?> entry = (Entry<?, ?>) o;
+      return key == entry.getKey() && value == entry.getValue();
+    }
+
+    public K getKey() {
+      return key;
+    }
+
+    public V getValue() {
+      return value;
+    }
+
+    @Override
+    public int hashCode() {
+      return System.identityHashCode(key) ^ System.identityHashCode(value);
+    }
+
+    public V setValue(V value) {
+      throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public String toString() {
+      return key + "=" + value;
+    }
+  }
+
+  /**
+   * The key for the single entry. Default access to avoid synthetic accessors
+   * from inner classes.
+   */
+  final K key;
+
+  /**
+   * The value for the single entry. Default access to avoid synthetic accessors
+   * from inner classes.
+   */
+  final V value;
+
+  public IdentitySingletonMap(K key, V value) {
+    this.key = key;
+    this.value = value;
+  }
+
+  public void clear() {
+    throw new UnsupportedOperationException();
+  }
+
+  public boolean containsKey(Object k) {
+    return key == k;
+  }
+
+  public boolean containsValue(Object v) {
+    return value == v;
+  }
+
+  public Set<Entry<K, V>> entrySet() {
+    return Sets.<Entry<K, V>> create(new IdentityEntry());
+  }
+
+  @Override
+  @SuppressWarnings("unchecked")
+  public boolean equals(Object o) {
+    if (!(o instanceof Map)) {
+      return false;
+    }
+    Map<K, V> other = (Map<K, V>) o;
+    return entrySet().equals(other.entrySet());
+  }
+
+  public V get(Object k) {
+    return (key == k) ? value : null;
+  }
+
+  @Override
+  public int hashCode() {
+    return System.identityHashCode(key) ^ System.identityHashCode(value);
+  }
+
+  public boolean isEmpty() {
+    return false;
+  }
+
+  public Set<K> keySet() {
+    return Sets.create(key);
+  }
+
+  public V put(K key, V value) {
+    throw new UnsupportedOperationException();
+  }
+
+  public void putAll(Map<? extends K, ? extends V> m) {
+    throw new UnsupportedOperationException();
+  }
+
+  public V remove(Object key) {
+    throw new UnsupportedOperationException();
+  }
+
+  public int size() {
+    return 1;
+  }
+
+  @Override
+  public String toString() {
+    StringBuilder buf = new StringBuilder(32 * size());
+    buf.append('{');
+    buf.append(key == this ? "(this Map)" : key).append('=').append(
+        value == this ? "(this Map)" : value);
+    buf.append('}');
+    return buf.toString();
+  }
+
+  public Collection<V> values() {
+    return Sets.create(value);
+  }
+}
diff --git a/dev/core/src/com/google/gwt/dev/util/collect/Lists.java b/dev/core/src/com/google/gwt/dev/util/collect/Lists.java
index 131163b..5d7cff6 100644
--- a/dev/core/src/com/google/gwt/dev/util/collect/Lists.java
+++ b/dev/core/src/com/google/gwt/dev/util/collect/Lists.java
@@ -1,281 +1,281 @@
-/*

- * Copyright 2009 Google Inc.

- * 

- * Licensed under the Apache License, Version 2.0 (the "License"); you may not

- * use this file except in compliance with the License. You may obtain a copy of

- * the License at

- * 

- * http://www.apache.org/licenses/LICENSE-2.0

- * 

- * Unless required by applicable law or agreed to in writing, software

- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT

- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the

- * License for the specific language governing permissions and limitations under

- * the License.

- */

-package com.google.gwt.dev.util.collect;

-

-import java.util.ArrayList;

-import java.util.Arrays;

-import java.util.Collections;

-import java.util.Comparator;

-import java.util.List;

-

-/**

- * Utility methods for operating on memory-efficient lists. All lists of size 0

- * or 1 are assumed to be immutable. All lists of size greater than 1 are

- * assumed to be mutable.

- */

-public class Lists {

-

-  private static final Class<?> MULTI_LIST_CLASS = ArrayList.class;

-  private static final Class<?> SINGLETON_LIST_CLASS = Collections.singletonList(

-      null).getClass();

-

-  public static <T> List<T> add(List<T> list, int index, T toAdd) {

-    switch (list.size()) {

-      case 0:

-        // Empty -> Singleton

-        if (index != 0) {

-          throw newIndexOutOfBounds(list, index);

-        }

-        return Collections.singletonList(toAdd);

-      case 1: {

-        // Singleton -> ArrayList

-        List<T> result = new ArrayList<T>(2);

-        switch (index) {

-          case 0:

-            result.add(toAdd);

-            result.add(list.get(0));

-            return result;

-          case 1:

-            result.add(list.get(0));

-            result.add(toAdd);

-            return result;

-          default:

-            throw newIndexOutOfBounds(list, index);

-        }

-      }

-      default:

-        // ArrayList

-        list.add(index, toAdd);

-        return list;

-    }

-  }

-

-  public static <T> List<T> add(List<T> list, T toAdd) {

-    switch (list.size()) {

-      case 0:

-        // Empty -> Singleton

-        return Collections.singletonList(toAdd);

-      case 1: {

-        // Singleton -> ArrayList

-        List<T> result = new ArrayList<T>(2);

-        result.add(list.get(0));

-        result.add(toAdd);

-        return result;

-      }

-      default:

-        // ArrayList

-        list.add(toAdd);

-        return list;

-    }

-  }

-

-  public static <T> List<T> addAll(List<T> list, int index, List<T> toAdd) {

-    switch (toAdd.size()) {

-      case 0:

-        // No-op.

-        return list;

-      case 1:

-        // Add one element.

-        return add(list, index, toAdd.get(0));

-      default:

-        // True list merge, result >= 2.

-        switch (list.size()) {

-          case 0:

-            if (index != 0) {

-              throw newIndexOutOfBounds(list, index);

-            }

-            return new ArrayList<T>(toAdd);

-          case 1: {

-            List<T> result = new ArrayList<T>(1 + toAdd.size());

-            switch (index) {

-              case 0:

-                result.addAll(toAdd);

-                result.add(list.get(0));

-                return result;

-              case 1:

-                result.add(list.get(0));

-                result.addAll(toAdd);

-                return result;

-              default:

-                throw newIndexOutOfBounds(list, index);

-            }

-          }

-          default:

-            list.addAll(index, toAdd);

-            return list;

-        }

-    }

-  }

-

-  public static <T> List<T> addAll(List<T> list, List<T> toAdd) {

-    switch (toAdd.size()) {

-      case 0:

-        // No-op.

-        return list;

-      case 1:

-        // Add one element.

-        return add(list, toAdd.get(0));

-      default:

-        // True list merge, result >= 2.

-        switch (list.size()) {

-          case 0:

-            return new ArrayList<T>(toAdd);

-          case 1: {

-            List<T> result = new ArrayList<T>(1 + toAdd.size());

-            result.add(list.get(0));

-            result.addAll(toAdd);

-            return result;

-          }

-          default:

-            list.addAll(toAdd);

-            return list;

-        }

-    }

-  }

-

-  public static <T> List<T> addAll(List<T> list, T... toAdd) {

-    switch (toAdd.length) {

-      case 0:

-        // No-op.

-        return list;

-      case 1:

-        // Add one element.

-        return add(list, toAdd[0]);

-      default:

-        // True list merge, result >= 2.

-        switch (list.size()) {

-          case 0:

-            return new ArrayList<T>(Arrays.asList(toAdd));

-          case 1: {

-            List<T> result = new ArrayList<T>(1 + toAdd.length);

-            result.add(list.get(0));

-            result.addAll(Arrays.asList(toAdd));

-            return result;

-          }

-          default:

-            list.addAll(Arrays.asList(toAdd));

-            return list;

-        }

-    }

-  }

-

-  public static <T> List<T> create() {

-    return Collections.emptyList();

-  }

-

-  public static <T> List<T> create(T item) {

-    return Collections.singletonList(item);

-  }

-

-  public static <T> List<T> create(T... items) {

-    switch (items.length) {

-      case 0:

-        return create();

-      case 1:

-        return create(items[0]);

-      default:

-        return new ArrayList<T>(Arrays.asList(items));

-    }

-  }

-

-  public static <T> List<T> normalize(List<T> list) {

-    switch (list.size()) {

-      case 0:

-        return create();

-      case 1: {

-        if (list.getClass() == SINGLETON_LIST_CLASS) {

-          return list;

-        }

-        return create(list.get(0));

-      }

-      default:

-        if (list.getClass() == MULTI_LIST_CLASS) {

-          return list;

-        }

-        return new ArrayList<T>(list);

-    }

-  }

-

-  @SuppressWarnings("unchecked")

-  public static <T> List<T> normalizeUnmodifiable(List<T> list) {

-    if (list.size() < 2) {

-      return normalize(list);

-    } else {

-      return (List<T>) Arrays.asList(list.toArray());

-    }

-  }

-

-  public static <T> List<T> remove(List<T> list, int toRemove) {

-    switch (list.size()) {

-      case 0:

-        // Empty

-        throw newIndexOutOfBounds(list, toRemove);

-      case 1:

-        // Singleton -> Empty

-        if (toRemove == 0) {

-          return Collections.emptyList();

-        } else {

-          throw newIndexOutOfBounds(list, toRemove);

-        }

-      case 2:

-        // ArrayList -> Singleton

-        switch (toRemove) {

-          case 0:

-            return Collections.singletonList(list.get(1));

-          case 1:

-            return Collections.singletonList(list.get(0));

-          default:

-            throw newIndexOutOfBounds(list, toRemove);

-        }

-      default:

-        // ArrayList

-        list.remove(toRemove);

-        return list;

-    }

-  }

-

-  public static <T> List<T> set(List<T> list, int index, T e) {

-    switch (list.size()) {

-      case 0:

-        // Empty

-        throw newIndexOutOfBounds(list, index);

-      case 1:

-        // Singleton

-        if (index == 0) {

-          return Collections.singletonList(e);

-        } else {

-          throw newIndexOutOfBounds(list, index);

-        }

-      default:

-        // ArrayList

-        list.set(index, e);

-        return list;

-    }

-  }

-

-  public static <T> List<T> sort(List<T> list, Comparator<? super T> sort) {

-    if (list.size() > 1) {

-      Collections.sort(list, sort);

-    }

-    return list;

-  }

-

-  private static <T> IndexOutOfBoundsException newIndexOutOfBounds(

-      List<T> list, int index) {

-    return new IndexOutOfBoundsException("Index: " + index + ", Size: "

-        + list.size());

-  }

-}

+/*
+ * Copyright 2009 Google Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.dev.util.collect;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+/**
+ * Utility methods for operating on memory-efficient lists. All lists of size 0
+ * or 1 are assumed to be immutable. All lists of size greater than 1 are
+ * assumed to be mutable.
+ */
+public class Lists {
+
+  private static final Class<?> MULTI_LIST_CLASS = ArrayList.class;
+  private static final Class<?> SINGLETON_LIST_CLASS = Collections.singletonList(
+      null).getClass();
+
+  public static <T> List<T> add(List<T> list, int index, T toAdd) {
+    switch (list.size()) {
+      case 0:
+        // Empty -> Singleton
+        if (index != 0) {
+          throw newIndexOutOfBounds(list, index);
+        }
+        return Collections.singletonList(toAdd);
+      case 1: {
+        // Singleton -> ArrayList
+        List<T> result = new ArrayList<T>(2);
+        switch (index) {
+          case 0:
+            result.add(toAdd);
+            result.add(list.get(0));
+            return result;
+          case 1:
+            result.add(list.get(0));
+            result.add(toAdd);
+            return result;
+          default:
+            throw newIndexOutOfBounds(list, index);
+        }
+      }
+      default:
+        // ArrayList
+        list.add(index, toAdd);
+        return list;
+    }
+  }
+
+  public static <T> List<T> add(List<T> list, T toAdd) {
+    switch (list.size()) {
+      case 0:
+        // Empty -> Singleton
+        return Collections.singletonList(toAdd);
+      case 1: {
+        // Singleton -> ArrayList
+        List<T> result = new ArrayList<T>(2);
+        result.add(list.get(0));
+        result.add(toAdd);
+        return result;
+      }
+      default:
+        // ArrayList
+        list.add(toAdd);
+        return list;
+    }
+  }
+
+  public static <T> List<T> addAll(List<T> list, int index, List<T> toAdd) {
+    switch (toAdd.size()) {
+      case 0:
+        // No-op.
+        return list;
+      case 1:
+        // Add one element.
+        return add(list, index, toAdd.get(0));
+      default:
+        // True list merge, result >= 2.
+        switch (list.size()) {
+          case 0:
+            if (index != 0) {
+              throw newIndexOutOfBounds(list, index);
+            }
+            return new ArrayList<T>(toAdd);
+          case 1: {
+            List<T> result = new ArrayList<T>(1 + toAdd.size());
+            switch (index) {
+              case 0:
+                result.addAll(toAdd);
+                result.add(list.get(0));
+                return result;
+              case 1:
+                result.add(list.get(0));
+                result.addAll(toAdd);
+                return result;
+              default:
+                throw newIndexOutOfBounds(list, index);
+            }
+          }
+          default:
+            list.addAll(index, toAdd);
+            return list;
+        }
+    }
+  }
+
+  public static <T> List<T> addAll(List<T> list, List<T> toAdd) {
+    switch (toAdd.size()) {
+      case 0:
+        // No-op.
+        return list;
+      case 1:
+        // Add one element.
+        return add(list, toAdd.get(0));
+      default:
+        // True list merge, result >= 2.
+        switch (list.size()) {
+          case 0:
+            return new ArrayList<T>(toAdd);
+          case 1: {
+            List<T> result = new ArrayList<T>(1 + toAdd.size());
+            result.add(list.get(0));
+            result.addAll(toAdd);
+            return result;
+          }
+          default:
+            list.addAll(toAdd);
+            return list;
+        }
+    }
+  }
+
+  public static <T> List<T> addAll(List<T> list, T... toAdd) {
+    switch (toAdd.length) {
+      case 0:
+        // No-op.
+        return list;
+      case 1:
+        // Add one element.
+        return add(list, toAdd[0]);
+      default:
+        // True list merge, result >= 2.
+        switch (list.size()) {
+          case 0:
+            return new ArrayList<T>(Arrays.asList(toAdd));
+          case 1: {
+            List<T> result = new ArrayList<T>(1 + toAdd.length);
+            result.add(list.get(0));
+            result.addAll(Arrays.asList(toAdd));
+            return result;
+          }
+          default:
+            list.addAll(Arrays.asList(toAdd));
+            return list;
+        }
+    }
+  }
+
+  public static <T> List<T> create() {
+    return Collections.emptyList();
+  }
+
+  public static <T> List<T> create(T item) {
+    return Collections.singletonList(item);
+  }
+
+  public static <T> List<T> create(T... items) {
+    switch (items.length) {
+      case 0:
+        return create();
+      case 1:
+        return create(items[0]);
+      default:
+        return new ArrayList<T>(Arrays.asList(items));
+    }
+  }
+
+  public static <T> List<T> normalize(List<T> list) {
+    switch (list.size()) {
+      case 0:
+        return create();
+      case 1: {
+        if (list.getClass() == SINGLETON_LIST_CLASS) {
+          return list;
+        }
+        return create(list.get(0));
+      }
+      default:
+        if (list.getClass() == MULTI_LIST_CLASS) {
+          return list;
+        }
+        return new ArrayList<T>(list);
+    }
+  }
+
+  @SuppressWarnings("unchecked")
+  public static <T> List<T> normalizeUnmodifiable(List<T> list) {
+    if (list.size() < 2) {
+      return normalize(list);
+    } else {
+      return (List<T>) Arrays.asList(list.toArray());
+    }
+  }
+
+  public static <T> List<T> remove(List<T> list, int toRemove) {
+    switch (list.size()) {
+      case 0:
+        // Empty
+        throw newIndexOutOfBounds(list, toRemove);
+      case 1:
+        // Singleton -> Empty
+        if (toRemove == 0) {
+          return Collections.emptyList();
+        } else {
+          throw newIndexOutOfBounds(list, toRemove);
+        }
+      case 2:
+        // ArrayList -> Singleton
+        switch (toRemove) {
+          case 0:
+            return Collections.singletonList(list.get(1));
+          case 1:
+            return Collections.singletonList(list.get(0));
+          default:
+            throw newIndexOutOfBounds(list, toRemove);
+        }
+      default:
+        // ArrayList
+        list.remove(toRemove);
+        return list;
+    }
+  }
+
+  public static <T> List<T> set(List<T> list, int index, T e) {
+    switch (list.size()) {
+      case 0:
+        // Empty
+        throw newIndexOutOfBounds(list, index);
+      case 1:
+        // Singleton
+        if (index == 0) {
+          return Collections.singletonList(e);
+        } else {
+          throw newIndexOutOfBounds(list, index);
+        }
+      default:
+        // ArrayList
+        list.set(index, e);
+        return list;
+    }
+  }
+
+  public static <T> List<T> sort(List<T> list, Comparator<? super T> sort) {
+    if (list.size() > 1) {
+      Collections.sort(list, sort);
+    }
+    return list;
+  }
+
+  private static <T> IndexOutOfBoundsException newIndexOutOfBounds(
+      List<T> list, int index) {
+    return new IndexOutOfBoundsException("Index: " + index + ", Size: "
+        + list.size());
+  }
+}
diff --git a/dev/core/src/com/google/gwt/dev/util/collect/Maps.java b/dev/core/src/com/google/gwt/dev/util/collect/Maps.java
index 0d083a3..f86783d 100644
--- a/dev/core/src/com/google/gwt/dev/util/collect/Maps.java
+++ b/dev/core/src/com/google/gwt/dev/util/collect/Maps.java
@@ -1,172 +1,172 @@
-/*

- * Copyright 2009 Google Inc.

- * 

- * Licensed under the Apache License, Version 2.0 (the "License"); you may not

- * use this file except in compliance with the License. You may obtain a copy of

- * the License at

- * 

- * http://www.apache.org/licenses/LICENSE-2.0

- * 

- * Unless required by applicable law or agreed to in writing, software

- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT

- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the

- * License for the specific language governing permissions and limitations under

- * the License.

- */

-package com.google.gwt.dev.util.collect;

-

-import java.util.Collections;

-import java.util.Map;

-import java.util.LinkedHashMap;

-

-/**

- * Utility methods for operating on memory-efficient maps. All maps of size 0 or

- * 1 are assumed to be immutable. All maps of size greater than 1 are assumed to

- * be mutable.

- */

-public class Maps {

-

-  private static final Class<?> MULTI_MAP_CLASS = HashMap.class;

-  private static final Class<?> SINGLETON_MAP_CLASS = Collections.singletonMap(

-      null, null).getClass();

-

-  public static <K, V> Map<K, V> create() {

-    return Collections.emptyMap();

-  }

-

-  public static <K, V> Map<K, V> create(K key, V value) {

-    return Collections.singletonMap(key, value);

-  }

-

-  public static <K, V> Map<K, V> normalize(Map<K, V> map) {

-    switch (map.size()) {

-      case 0:

-        return create();

-      case 1: {

-        if (map.getClass() == SINGLETON_MAP_CLASS) {

-          return map;

-        }

-        K key = map.keySet().iterator().next();

-        return create(key, map.get(key));

-      }

-      default:

-        if (map.getClass() == MULTI_MAP_CLASS) {

-          return map;

-        }

-        return new HashMap<K, V>(map);

-    }

-  }

-

-  public static <K, V> Map<K, V> normalizeUnmodifiable(Map<K, V> map) {

-    if (map.size() < 2) {

-      return normalize(map);

-    } else {

-      // TODO: implement an UnmodifiableHashMap?

-      return Collections.unmodifiableMap(normalize(map));

-    }

-  }

-

-  public static <K, V> Map<K, V> put(Map<K, V> map, K key, V value) {

-    switch (map.size()) {

-      case 0:

-        // Empty -> Singleton

-        return Collections.singletonMap(key, value);

-      case 1: {

-        if (map.containsKey(key)) {

-          return create(key, value);

-        }

-        // Singleton -> HashMap

-        Map<K, V> result = new HashMap<K, V>();

-        result.put(map.keySet().iterator().next(),

-            map.values().iterator().next());

-        result.put(key, value);

-        return result;

-      }

-      default:

-        // HashMap

-        map.put(key, value);

-        return map;

-    }

-  }

-

-  public static <K, V> Map<K, V> putAll(Map<K, V> map, Map<K, V> toAdd) {

-    switch (toAdd.size()) {

-      case 0:

-        // No-op.

-        return map;

-      case 1: {

-        // Add one element.

-        K key = toAdd.keySet().iterator().next();

-        return put(map, key, toAdd.get(key));

-      }

-      default:

-        // True list merge, result >= 2.

-        switch (map.size()) {

-          case 0:

-            return new HashMap<K, V>(toAdd);

-          case 1: {

-            HashMap<K, V> result = new HashMap<K, V>();

-            K key = map.keySet().iterator().next();

-            result.put(key, map.get(key));

-            result.putAll(toAdd);

-            return result;

-          }

-          default:

-            map.putAll(toAdd);

-            return map;

-        }

-    }

-  }

-

-  /**

-   * A variation of the put method which uses a LinkedHashMap.

-   */

-  public static <K, V> Map<K, V> putOrdered(Map<K, V> map, K key, V value) {

-    switch (map.size()) {

-      case 0:

-        // Empty -> Singleton

-        return Collections.singletonMap(key, value);

-      case 1: {

-        if (map.containsKey(key)) {

-          return create(key, value);

-        }

-        // Singleton -> LinkedHashMap

-        Map<K, V> result = new LinkedHashMap<K, V>();

-        result.put(map.keySet().iterator().next(),

-            map.values().iterator().next());

-        result.put(key, value);

-        return result;

-      }

-      default:

-        // LinkedHashMap

-        map.put(key, value);

-        return map;

-    }

-  }

-

-  public static <K, V> Map<K, V> remove(Map<K, V> map, K key) {

-    switch (map.size()) {

-      case 0:

-        // Empty

-        return map;

-      case 1:

-        // Singleton -> Empty

-        if (map.containsKey(key)) {

-          return create();

-        }

-        return map;

-      case 2:

-        // HashMap -> Singleton

-        if (map.containsKey(key)) {

-          map.remove(key);

-          key = map.keySet().iterator().next();

-          return create(key, map.get(key));

-        }

-        return map;

-      default:

-        // IdentityHashMap

-        map.remove(key);

-        return map;

-    }

-  }

-}

+/*
+ * Copyright 2009 Google Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.dev.util.collect;
+
+import java.util.Collections;
+import java.util.Map;
+import java.util.LinkedHashMap;
+
+/**
+ * Utility methods for operating on memory-efficient maps. All maps of size 0 or
+ * 1 are assumed to be immutable. All maps of size greater than 1 are assumed to
+ * be mutable.
+ */
+public class Maps {
+
+  private static final Class<?> MULTI_MAP_CLASS = HashMap.class;
+  private static final Class<?> SINGLETON_MAP_CLASS = Collections.singletonMap(
+      null, null).getClass();
+
+  public static <K, V> Map<K, V> create() {
+    return Collections.emptyMap();
+  }
+
+  public static <K, V> Map<K, V> create(K key, V value) {
+    return Collections.singletonMap(key, value);
+  }
+
+  public static <K, V> Map<K, V> normalize(Map<K, V> map) {
+    switch (map.size()) {
+      case 0:
+        return create();
+      case 1: {
+        if (map.getClass() == SINGLETON_MAP_CLASS) {
+          return map;
+        }
+        K key = map.keySet().iterator().next();
+        return create(key, map.get(key));
+      }
+      default:
+        if (map.getClass() == MULTI_MAP_CLASS) {
+          return map;
+        }
+        return new HashMap<K, V>(map);
+    }
+  }
+
+  public static <K, V> Map<K, V> normalizeUnmodifiable(Map<K, V> map) {
+    if (map.size() < 2) {
+      return normalize(map);
+    } else {
+      // TODO: implement an UnmodifiableHashMap?
+      return Collections.unmodifiableMap(normalize(map));
+    }
+  }
+
+  public static <K, V> Map<K, V> put(Map<K, V> map, K key, V value) {
+    switch (map.size()) {
+      case 0:
+        // Empty -> Singleton
+        return Collections.singletonMap(key, value);
+      case 1: {
+        if (map.containsKey(key)) {
+          return create(key, value);
+        }
+        // Singleton -> HashMap
+        Map<K, V> result = new HashMap<K, V>();
+        result.put(map.keySet().iterator().next(),
+            map.values().iterator().next());
+        result.put(key, value);
+        return result;
+      }
+      default:
+        // HashMap
+        map.put(key, value);
+        return map;
+    }
+  }
+
+  public static <K, V> Map<K, V> putAll(Map<K, V> map, Map<K, V> toAdd) {
+    switch (toAdd.size()) {
+      case 0:
+        // No-op.
+        return map;
+      case 1: {
+        // Add one element.
+        K key = toAdd.keySet().iterator().next();
+        return put(map, key, toAdd.get(key));
+      }
+      default:
+        // True list merge, result >= 2.
+        switch (map.size()) {
+          case 0:
+            return new HashMap<K, V>(toAdd);
+          case 1: {
+            HashMap<K, V> result = new HashMap<K, V>();
+            K key = map.keySet().iterator().next();
+            result.put(key, map.get(key));
+            result.putAll(toAdd);
+            return result;
+          }
+          default:
+            map.putAll(toAdd);
+            return map;
+        }
+    }
+  }
+
+  /**
+   * A variation of the put method which uses a LinkedHashMap.
+   */
+  public static <K, V> Map<K, V> putOrdered(Map<K, V> map, K key, V value) {
+    switch (map.size()) {
+      case 0:
+        // Empty -> Singleton
+        return Collections.singletonMap(key, value);
+      case 1: {
+        if (map.containsKey(key)) {
+          return create(key, value);
+        }
+        // Singleton -> LinkedHashMap
+        Map<K, V> result = new LinkedHashMap<K, V>();
+        result.put(map.keySet().iterator().next(),
+            map.values().iterator().next());
+        result.put(key, value);
+        return result;
+      }
+      default:
+        // LinkedHashMap
+        map.put(key, value);
+        return map;
+    }
+  }
+
+  public static <K, V> Map<K, V> remove(Map<K, V> map, K key) {
+    switch (map.size()) {
+      case 0:
+        // Empty
+        return map;
+      case 1:
+        // Singleton -> Empty
+        if (map.containsKey(key)) {
+          return create();
+        }
+        return map;
+      case 2:
+        // HashMap -> Singleton
+        if (map.containsKey(key)) {
+          map.remove(key);
+          key = map.keySet().iterator().next();
+          return create(key, map.get(key));
+        }
+        return map;
+      default:
+        // IdentityHashMap
+        map.remove(key);
+        return map;
+    }
+  }
+}
diff --git a/dev/core/src/com/google/gwt/dev/util/collect/Sets.java b/dev/core/src/com/google/gwt/dev/util/collect/Sets.java
index b5179f8..8cb8064 100644
--- a/dev/core/src/com/google/gwt/dev/util/collect/Sets.java
+++ b/dev/core/src/com/google/gwt/dev/util/collect/Sets.java
@@ -1,154 +1,154 @@
-/*

- * Copyright 2009 Google Inc.

- * 

- * Licensed under the Apache License, Version 2.0 (the "License"); you may not

- * use this file except in compliance with the License. You may obtain a copy of

- * the License at

- * 

- * http://www.apache.org/licenses/LICENSE-2.0

- * 

- * Unless required by applicable law or agreed to in writing, software

- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT

- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the

- * License for the specific language governing permissions and limitations under

- * the License.

- */

-package com.google.gwt.dev.util.collect;

-

-import java.util.Collection;

-import java.util.Collections;

-import java.util.Set;

-

-/**

- * Utility methods for operating on memory-efficient sets. All sets of size 0 or

- * 1 are assumed to be immutable. All sets of size greater than 1 are assumed to

- * be mutable.

- */

-public class Sets {

-

-  private static final Class<?> MULTI_SET_CLASS = HashSet.class;

-  private static final Class<?> SINGLETON_SET_CLASS = Collections.singleton(

-      null).getClass();

-

-  public static <T> Set<T> add(Set<T> set, T toAdd) {

-    switch (set.size()) {

-      case 0:

-        // Empty -> Singleton

-        return create(toAdd);

-      case 1: {

-        if (set.contains(toAdd)) {

-          return set;

-        }

-        // Singleton -> HashSet

-        Set<T> result = new HashSet<T>();

-        result.add(set.iterator().next());

-        result.add(toAdd);

-        return result;

-      }

-      default:

-        // HashSet

-        set.add(toAdd);

-        return set;

-    }

-  }

-

-  public static <T> Set<T> addAll(Set<T> set, Collection<T> toAdd) {

-    switch (toAdd.size()) {

-      case 0:

-        return set;

-      case 1:

-        return add(set, toAdd.iterator().next());

-    }

-

-    switch (set.size()) {

-      case 0:

-        // Empty -> HashSet

-        return new HashSet<T>(toAdd);

-      case 1: {

-        // Singleton -> HashSet

-        Set<T> result = new HashSet<T>();

-        result.add(set.iterator().next());

-        result.addAll(toAdd);

-        return result;

-      }

-      default:

-        // HashSet

-        set.addAll(toAdd);

-        return set;

-    }

-  }

-

-  public static <T> Set<T> create() {

-    return Collections.emptySet();

-  }

-

-  public static <T> Set<T> create(T item) {

-    return Collections.singleton(item);

-  }

-

-  public static <T> Set<T> create(T... items) {

-    switch (items.length) {

-      case 0:

-        return create();

-      case 1:

-        return create(items[0]);

-      default:

-        HashSet<T> result = new HashSet<T>();

-        result.addAll(items);

-        return result;

-    }

-  }

-

-  public static <T> Set<T> normalize(Set<T> set) {

-    switch (set.size()) {

-      case 0:

-        return create();

-      case 1: {

-        if (set.getClass() == SINGLETON_SET_CLASS) {

-          return set;

-        }

-        return create(set.iterator().next());

-      }

-      default:

-        if (set.getClass() == MULTI_SET_CLASS) {

-          return set;

-        }

-        HashSet<T> result = new HashSet<T>();

-        result.addAll(set);

-        return result;

-    }

-  }

-

-  public static <T> Set<T> normalizeUnmodifiable(Set<T> set) {

-    if (set.size() < 2) {

-      return normalize(set);

-    } else {

-      // TODO: implement an UnmodifiableHashSet?

-      return Collections.unmodifiableSet(normalize(set));

-    }

-  }

-

-  public static <T> Set<T> remove(Set<T> set, T toRemove) {

-    switch (set.size()) {

-      case 0:

-        // Empty

-        return set;

-      case 1:

-        // Singleton -> Empty

-        if (set.contains(toRemove)) {

-          return create();

-        }

-        return set;

-      case 2:

-        // HashSet -> Singleton

-        if (set.remove(toRemove)) {

-          return create(set.iterator().next());

-        }

-        return set;

-      default:

-        // HashSet

-        set.remove(toRemove);

-        return set;

-    }

-  }

-}

+/*
+ * Copyright 2009 Google Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.dev.util.collect;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Set;
+
+/**
+ * Utility methods for operating on memory-efficient sets. All sets of size 0 or
+ * 1 are assumed to be immutable. All sets of size greater than 1 are assumed to
+ * be mutable.
+ */
+public class Sets {
+
+  private static final Class<?> MULTI_SET_CLASS = HashSet.class;
+  private static final Class<?> SINGLETON_SET_CLASS = Collections.singleton(
+      null).getClass();
+
+  public static <T> Set<T> add(Set<T> set, T toAdd) {
+    switch (set.size()) {
+      case 0:
+        // Empty -> Singleton
+        return create(toAdd);
+      case 1: {
+        if (set.contains(toAdd)) {
+          return set;
+        }
+        // Singleton -> HashSet
+        Set<T> result = new HashSet<T>();
+        result.add(set.iterator().next());
+        result.add(toAdd);
+        return result;
+      }
+      default:
+        // HashSet
+        set.add(toAdd);
+        return set;
+    }
+  }
+
+  public static <T> Set<T> addAll(Set<T> set, Collection<T> toAdd) {
+    switch (toAdd.size()) {
+      case 0:
+        return set;
+      case 1:
+        return add(set, toAdd.iterator().next());
+    }
+
+    switch (set.size()) {
+      case 0:
+        // Empty -> HashSet
+        return new HashSet<T>(toAdd);
+      case 1: {
+        // Singleton -> HashSet
+        Set<T> result = new HashSet<T>();
+        result.add(set.iterator().next());
+        result.addAll(toAdd);
+        return result;
+      }
+      default:
+        // HashSet
+        set.addAll(toAdd);
+        return set;
+    }
+  }
+
+  public static <T> Set<T> create() {
+    return Collections.emptySet();
+  }
+
+  public static <T> Set<T> create(T item) {
+    return Collections.singleton(item);
+  }
+
+  public static <T> Set<T> create(T... items) {
+    switch (items.length) {
+      case 0:
+        return create();
+      case 1:
+        return create(items[0]);
+      default:
+        HashSet<T> result = new HashSet<T>();
+        result.addAll(items);
+        return result;
+    }
+  }
+
+  public static <T> Set<T> normalize(Set<T> set) {
+    switch (set.size()) {
+      case 0:
+        return create();
+      case 1: {
+        if (set.getClass() == SINGLETON_SET_CLASS) {
+          return set;
+        }
+        return create(set.iterator().next());
+      }
+      default:
+        if (set.getClass() == MULTI_SET_CLASS) {
+          return set;
+        }
+        HashSet<T> result = new HashSet<T>();
+        result.addAll(set);
+        return result;
+    }
+  }
+
+  public static <T> Set<T> normalizeUnmodifiable(Set<T> set) {
+    if (set.size() < 2) {
+      return normalize(set);
+    } else {
+      // TODO: implement an UnmodifiableHashSet?
+      return Collections.unmodifiableSet(normalize(set));
+    }
+  }
+
+  public static <T> Set<T> remove(Set<T> set, T toRemove) {
+    switch (set.size()) {
+      case 0:
+        // Empty
+        return set;
+      case 1:
+        // Singleton -> Empty
+        if (set.contains(toRemove)) {
+          return create();
+        }
+        return set;
+      case 2:
+        // HashSet -> Singleton
+        if (set.remove(toRemove)) {
+          return create(set.iterator().next());
+        }
+        return set;
+      default:
+        // HashSet
+        set.remove(toRemove);
+        return set;
+    }
+  }
+}
diff --git a/dev/core/src/com/google/gwt/dev/util/log/CompositeTreeLogger.java b/dev/core/src/com/google/gwt/dev/util/log/CompositeTreeLogger.java
index c88f461..7c70c01 100644
--- a/dev/core/src/com/google/gwt/dev/util/log/CompositeTreeLogger.java
+++ b/dev/core/src/com/google/gwt/dev/util/log/CompositeTreeLogger.java
@@ -1,60 +1,60 @@
-/**

- * 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.util.log;

-

-/**

- * Forks logging over two child loggers.  This provides the graphics + file

- * logging of HostedModeBase's -logfile option.

- */

-public class CompositeTreeLogger extends AbstractTreeLogger {

-

-  private AbstractTreeLogger[] loggers;

-  

-  public CompositeTreeLogger(AbstractTreeLogger... loggers) {

-    this.loggers = loggers;

-  }

-

-  @Override

-  protected AbstractTreeLogger doBranch() {

-    AbstractTreeLogger children[] = new AbstractTreeLogger[loggers.length];

-    for (int i = 0; i < loggers.length; i++) {

-      children[i] = loggers[i].doBranch();      

-      children[i].indexWithinMyParent = loggers[i].allocateNextChildIndex();

-      children[i].parent = loggers[i];

-      children[i].logLevel = loggers[i].logLevel;

-    }

-    return new CompositeTreeLogger(children);

-  }

-

-  @Override

-  protected void doCommitBranch(AbstractTreeLogger childBeingCommitted,

-      Type type, String msg, Throwable caught, HelpInfo helpInfo) {

-    CompositeTreeLogger child = (CompositeTreeLogger) childBeingCommitted;

-    assert loggers.length == child.loggers.length;

-    for (int i = 0; i < loggers.length; i++) {

-      loggers[i].doCommitBranch(child.loggers[i], type, msg, caught, helpInfo);      

-    }

-  }

-

-  @Override

-  protected void doLog(int indexOfLogEntryWithinParentLogger, Type type,

-      String msg, Throwable caught, HelpInfo helpInfo) {

-    for (AbstractTreeLogger logger : loggers) {

-      logger.doLog(indexOfLogEntryWithinParentLogger, type, msg, caught,

-          helpInfo);

-    }

-  }

-}

+/**
+ * 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.util.log;
+
+/**
+ * Forks logging over two child loggers.  This provides the graphics + file
+ * logging of HostedModeBase's -logfile option.
+ */
+public class CompositeTreeLogger extends AbstractTreeLogger {
+
+  private AbstractTreeLogger[] loggers;
+  
+  public CompositeTreeLogger(AbstractTreeLogger... loggers) {
+    this.loggers = loggers;
+  }
+
+  @Override
+  protected AbstractTreeLogger doBranch() {
+    AbstractTreeLogger children[] = new AbstractTreeLogger[loggers.length];
+    for (int i = 0; i < loggers.length; i++) {
+      children[i] = loggers[i].doBranch();      
+      children[i].indexWithinMyParent = loggers[i].allocateNextChildIndex();
+      children[i].parent = loggers[i];
+      children[i].logLevel = loggers[i].logLevel;
+    }
+    return new CompositeTreeLogger(children);
+  }
+
+  @Override
+  protected void doCommitBranch(AbstractTreeLogger childBeingCommitted,
+      Type type, String msg, Throwable caught, HelpInfo helpInfo) {
+    CompositeTreeLogger child = (CompositeTreeLogger) childBeingCommitted;
+    assert loggers.length == child.loggers.length;
+    for (int i = 0; i < loggers.length; i++) {
+      loggers[i].doCommitBranch(child.loggers[i], type, msg, caught, helpInfo);      
+    }
+  }
+
+  @Override
+  protected void doLog(int indexOfLogEntryWithinParentLogger, Type type,
+      String msg, Throwable caught, HelpInfo helpInfo) {
+    for (AbstractTreeLogger logger : loggers) {
+      logger.doLog(indexOfLogEntryWithinParentLogger, type, msg, caught,
+          helpInfo);
+    }
+  }
+}
diff --git a/dev/core/src/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java b/dev/core/src/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java
index 8a19cba..4c52753 100644
--- a/dev/core/src/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java
+++ b/dev/core/src/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java
@@ -1,1672 +1,1672 @@
-/*******************************************************************************

- * Copyright (c) 2000, 2008 IBM Corporation and others.

- * All rights reserved. This program and the accompanying materials

- * are made available under the terms of the Eclipse Public License v1.0

- * which accompanies this distribution, and is available at

- * http://www.eclipse.org/legal/epl-v10.html

- *

- * Contributors:

- *     IBM Corporation - initial API and implementation

- *******************************************************************************/

-package org.eclipse.jdt.internal.compiler.lookup;

-

-import com.google.gwt.dev.util.collect.HashMap;

-

-import org.eclipse.jdt.core.compiler.CharOperation;

-import org.eclipse.jdt.internal.compiler.ast.ASTNode;

-import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;

-import org.eclipse.jdt.internal.compiler.ast.AbstractVariableDeclaration;

-import org.eclipse.jdt.internal.compiler.ast.Argument;

-import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration;

-import org.eclipse.jdt.internal.compiler.ast.MethodDeclaration;

-import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;

-import org.eclipse.jdt.internal.compiler.ast.TypeParameter;

-import org.eclipse.jdt.internal.compiler.ast.TypeReference;

-import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;

-import org.eclipse.jdt.internal.compiler.impl.Constant;

-import org.eclipse.jdt.internal.compiler.util.SimpleLookupTable;

-import org.eclipse.jdt.internal.compiler.util.Util;

-

-import java.util.Hashtable;

-import java.util.Iterator;

-

-public class SourceTypeBinding extends ReferenceBinding {

-  public ReferenceBinding superclass;

-  public ReferenceBinding[] superInterfaces;

-  private FieldBinding[] fields;

-  private MethodBinding[] methods;

-  public ReferenceBinding[] memberTypes;

-  public TypeVariableBinding[] typeVariables;

-

-  public ClassScope scope;

-

-  // Synthetics are separated into 5 categories: methods, super methods, fields, class literals, changed declaring type bindings and bridge methods

-  // if a new category is added, also increment MAX_SYNTHETICS

-  private final static int METHOD_EMUL = 0;

-  private final static int FIELD_EMUL = 1;

-  private final static int CLASS_LITERAL_EMUL = 2;

-  private final static int RECEIVER_TYPE_EMUL = 3;

-  

-  private final static int MAX_SYNTHETICS = 4;

-

-  HashMap[] synthetics;

-  char[] genericReferenceTypeSignature;

-

-  private SimpleLookupTable storedAnnotations = null; // keys are this ReferenceBinding & its fields and methods, value is an AnnotationHolder

-

-public SourceTypeBinding(char[][] compoundName, PackageBinding fPackage, ClassScope scope) {

-  this.compoundName = compoundName;

-  this.fPackage = fPackage;

-  this.fileName = scope.referenceCompilationUnit().getFileName();

-  this.modifiers = scope.referenceContext.modifiers;

-  this.sourceName = scope.referenceContext.name;

-  this.scope = scope;

-

-  // expect the fields & methods to be initialized correctly later

-  this.fields = Binding.UNINITIALIZED_FIELDS;

-  this.methods = Binding.UNINITIALIZED_METHODS;

-

-  computeId();

-}

-

-private void addDefaultAbstractMethods() {

-  if ((this.tagBits & TagBits.KnowsDefaultAbstractMethods) != 0) return;

-

-  this.tagBits |= TagBits.KnowsDefaultAbstractMethods;

-  if (isClass() && isAbstract()) {

-    if (this.scope.compilerOptions().targetJDK >= ClassFileConstants.JDK1_2)

-      return; // no longer added for post 1.2 targets

-

-    ReferenceBinding[] itsInterfaces = superInterfaces();

-    if (itsInterfaces != Binding.NO_SUPERINTERFACES) {

-      MethodBinding[] defaultAbstracts = null;

-      int defaultAbstractsCount = 0;

-      ReferenceBinding[] interfacesToVisit = itsInterfaces;

-      int nextPosition = interfacesToVisit.length;

-      for (int i = 0; i < nextPosition; i++) {

-        ReferenceBinding superType = interfacesToVisit[i];

-        if (superType.isValidBinding()) {

-          MethodBinding[] superMethods = superType.methods();

-          nextAbstractMethod: for (int m = superMethods.length; --m >= 0;) {

-            MethodBinding method = superMethods[m];

-            // explicitly implemented ?

-            if (implementsMethod(method))

-              continue nextAbstractMethod;

-            if (defaultAbstractsCount == 0) {

-              defaultAbstracts = new MethodBinding[5];

-            } else {

-              // already added as default abstract ?

-              for (int k = 0; k < defaultAbstractsCount; k++) {

-                MethodBinding alreadyAdded = defaultAbstracts[k];

-                if (CharOperation.equals(alreadyAdded.selector, method.selector) && alreadyAdded.areParametersEqual(method))

-                  continue nextAbstractMethod;

-              }

-            }

-            MethodBinding defaultAbstract = new MethodBinding(

-                method.modifiers | ExtraCompilerModifiers.AccDefaultAbstract | ClassFileConstants.AccSynthetic,

-                method.selector,

-                method.returnType,

-                method.parameters,

-                method.thrownExceptions,

-                this);

-            if (defaultAbstractsCount == defaultAbstracts.length)

-              System.arraycopy(defaultAbstracts, 0, defaultAbstracts = new MethodBinding[2 * defaultAbstractsCount], 0, defaultAbstractsCount);

-            defaultAbstracts[defaultAbstractsCount++] = defaultAbstract;

-          }

-

-          if ((itsInterfaces = superType.superInterfaces()) != Binding.NO_SUPERINTERFACES) {

-            int itsLength = itsInterfaces.length;

-            if (nextPosition + itsLength >= interfacesToVisit.length)

-              System.arraycopy(interfacesToVisit, 0, interfacesToVisit = new ReferenceBinding[nextPosition + itsLength + 5], 0, nextPosition);

-            nextInterface : for (int a = 0; a < itsLength; a++) {

-              ReferenceBinding next = itsInterfaces[a];

-              for (int b = 0; b < nextPosition; b++)

-                if (next == interfacesToVisit[b]) continue nextInterface;

-              interfacesToVisit[nextPosition++] = next;

-            }

-          }

-        }

-      }

-      if (defaultAbstractsCount > 0) {

-        int length = this.methods.length;

-        System.arraycopy(this.methods, 0, this.methods = new MethodBinding[length + defaultAbstractsCount], 0, length);

-        System.arraycopy(defaultAbstracts, 0, this.methods, length, defaultAbstractsCount);

-        // re-sort methods

-        length = length + defaultAbstractsCount;

-        if (length > 1)

-          ReferenceBinding.sortMethods(this.methods, 0, length);

-        // this.tagBits |= TagBits.AreMethodsSorted; -- already set in #methods()

-      }

-    }

-  }

-}

-/* Add a new synthetic field for <actualOuterLocalVariable>.

-* Answer the new field or the existing field if one already existed.

-*/

-public FieldBinding addSyntheticFieldForInnerclass(LocalVariableBinding actualOuterLocalVariable) {

-  if (this.synthetics == null)

-    this.synthetics = new HashMap[MAX_SYNTHETICS];

-  if (this.synthetics[SourceTypeBinding.FIELD_EMUL] == null)

-    this.synthetics[SourceTypeBinding.FIELD_EMUL] = new HashMap();

-  

-  FieldBinding synthField = (FieldBinding) this.synthetics[SourceTypeBinding.FIELD_EMUL].get(actualOuterLocalVariable);

-  if (synthField == null) {

-    synthField = new SyntheticFieldBinding(

-      CharOperation.concat(TypeConstants.SYNTHETIC_OUTER_LOCAL_PREFIX, actualOuterLocalVariable.name), 

-      actualOuterLocalVariable.type, 

-      ClassFileConstants.AccPrivate | ClassFileConstants.AccFinal | ClassFileConstants.AccSynthetic, 

-      this, 

-      Constant.NotAConstant,

-      this.synthetics[SourceTypeBinding.FIELD_EMUL].size());

-    this.synthetics[SourceTypeBinding.FIELD_EMUL].put(actualOuterLocalVariable, synthField);

-  }

-

-  // ensure there is not already such a field defined by the user

-  boolean needRecheck;

-  int index = 1;

-  do {

-    needRecheck = false;

-    FieldBinding existingField;

-    if ((existingField = this.getField(synthField.name, true /*resolve*/)) != null) {

-      TypeDeclaration typeDecl = this.scope.referenceContext;

-      for (int i = 0, max = typeDecl.fields.length; i < max; i++) {

-        FieldDeclaration fieldDecl = typeDecl.fields[i];

-        if (fieldDecl.binding == existingField) {

-          synthField.name = CharOperation.concat(

-            TypeConstants.SYNTHETIC_OUTER_LOCAL_PREFIX,

-            actualOuterLocalVariable.name,

-            ("$" + String.valueOf(index++)).toCharArray()); //$NON-NLS-1$

-          needRecheck = true;

-          break;

-        }

-      }

-    }

-  } while (needRecheck);

-  return synthField;

-}

-/* Add a new synthetic field for <enclosingType>.

-* Answer the new field or the existing field if one already existed.

-*/

-public FieldBinding addSyntheticFieldForInnerclass(ReferenceBinding enclosingType) {

-  if (this.synthetics == null)

-    this.synthetics = new HashMap[MAX_SYNTHETICS];

-  if (this.synthetics[SourceTypeBinding.FIELD_EMUL] == null)

-    this.synthetics[SourceTypeBinding.FIELD_EMUL] = new HashMap();

-

-  FieldBinding synthField = (FieldBinding) this.synthetics[SourceTypeBinding.FIELD_EMUL].get(enclosingType);

-  if (synthField == null) {

-    synthField = new SyntheticFieldBinding(

-      CharOperation.concat(

-        TypeConstants.SYNTHETIC_ENCLOSING_INSTANCE_PREFIX,

-        String.valueOf(enclosingType.depth()).toCharArray()),

-      enclosingType,

-      ClassFileConstants.AccDefault | ClassFileConstants.AccFinal | ClassFileConstants.AccSynthetic,

-      this,

-      Constant.NotAConstant,

-      this.synthetics[SourceTypeBinding.FIELD_EMUL].size());

-    this.synthetics[SourceTypeBinding.FIELD_EMUL].put(enclosingType, synthField);

-  }

-  // ensure there is not already such a field defined by the user

-  boolean needRecheck;

-  do {

-    needRecheck = false;

-    FieldBinding existingField;

-    if ((existingField = this.getField(synthField.name, true /*resolve*/)) != null) {

-      TypeDeclaration typeDecl = this.scope.referenceContext;

-      for (int i = 0, max = typeDecl.fields.length; i < max; i++) {

-        FieldDeclaration fieldDecl = typeDecl.fields[i];

-        if (fieldDecl.binding == existingField) {

-          if (this.scope.compilerOptions().complianceLevel >= ClassFileConstants.JDK1_5) {

-            synthField.name = CharOperation.concat(

-              synthField.name,

-              "$".toCharArray()); //$NON-NLS-1$

-            needRecheck = true;

-          } else {

-            this.scope.problemReporter().duplicateFieldInType(this, fieldDecl);

-          }

-          break;

-        }

-      }

-    }

-  } while (needRecheck);

-  return synthField;

-}

-/* Add a new synthetic field for a class literal access.

-* Answer the new field or the existing field if one already existed.

-*/

-public FieldBinding addSyntheticFieldForClassLiteral(TypeBinding targetType, BlockScope blockScope) {

-  if (this.synthetics == null)

-    this.synthetics = new HashMap[MAX_SYNTHETICS];

-  if (this.synthetics[SourceTypeBinding.CLASS_LITERAL_EMUL] == null)

-    this.synthetics[SourceTypeBinding.CLASS_LITERAL_EMUL] = new HashMap();

-

-  // use a different table than FIELDS, given there might be a collision between emulation of X.this$0 and X.class.

-  FieldBinding synthField = (FieldBinding) this.synthetics[SourceTypeBinding.CLASS_LITERAL_EMUL].get(targetType);

-  if (synthField == null) {

-    synthField = new SyntheticFieldBinding(

-      CharOperation.concat(

-        TypeConstants.SYNTHETIC_CLASS,

-        String.valueOf(this.synthetics[SourceTypeBinding.CLASS_LITERAL_EMUL].size()).toCharArray()),

-      blockScope.getJavaLangClass(),

-      ClassFileConstants.AccDefault | ClassFileConstants.AccStatic | ClassFileConstants.AccSynthetic,

-      this,

-      Constant.NotAConstant,

-      this.synthetics[SourceTypeBinding.CLASS_LITERAL_EMUL].size());

-    this.synthetics[SourceTypeBinding.CLASS_LITERAL_EMUL].put(targetType, synthField);

-  }

-  // ensure there is not already such a field defined by the user

-  FieldBinding existingField;

-  if ((existingField = this.getField(synthField.name, true /*resolve*/)) != null) {

-    TypeDeclaration typeDecl = blockScope.referenceType();

-    for (int i = 0, max = typeDecl.fields.length; i < max; i++) {

-      FieldDeclaration fieldDecl = typeDecl.fields[i];

-      if (fieldDecl.binding == existingField) {

-        blockScope.problemReporter().duplicateFieldInType(this, fieldDecl);

-        break;

-      }

-    }

-  }   

-  return synthField;

-}

-/* Add a new synthetic field for the emulation of the assert statement.

-* Answer the new field or the existing field if one already existed.

-*/

-public FieldBinding addSyntheticFieldForAssert(BlockScope blockScope) {

-  if (this.synthetics == null)

-    this.synthetics = new HashMap[MAX_SYNTHETICS];

-  if (this.synthetics[SourceTypeBinding.FIELD_EMUL] == null)

-    this.synthetics[SourceTypeBinding.FIELD_EMUL] = new HashMap();

-

-  FieldBinding synthField = (FieldBinding) this.synthetics[SourceTypeBinding.FIELD_EMUL].get("assertionEmulation"); //$NON-NLS-1$

-  if (synthField == null) {

-    synthField = new SyntheticFieldBinding(

-      TypeConstants.SYNTHETIC_ASSERT_DISABLED,

-      TypeBinding.BOOLEAN,

-      ClassFileConstants.AccDefault | ClassFileConstants.AccStatic | ClassFileConstants.AccSynthetic | ClassFileConstants.AccFinal,

-      this,

-      Constant.NotAConstant,

-      this.synthetics[SourceTypeBinding.FIELD_EMUL].size());

-    this.synthetics[SourceTypeBinding.FIELD_EMUL].put("assertionEmulation", synthField); //$NON-NLS-1$

-  }

-  // ensure there is not already such a field defined by the user

-  // ensure there is not already such a field defined by the user

-  boolean needRecheck;

-  int index = 0;

-  do {

-    needRecheck = false;

-    FieldBinding existingField;

-    if ((existingField = this.getField(synthField.name, true /*resolve*/)) != null) {

-      TypeDeclaration typeDecl = this.scope.referenceContext;

-      for (int i = 0, max = typeDecl.fields.length; i < max; i++) {

-        FieldDeclaration fieldDecl = typeDecl.fields[i];

-        if (fieldDecl.binding == existingField) {

-          synthField.name = CharOperation.concat(

-            TypeConstants.SYNTHETIC_ASSERT_DISABLED,

-            ("_" + String.valueOf(index++)).toCharArray()); //$NON-NLS-1$

-          needRecheck = true;

-          break;

-        }

-      }

-    }

-  } while (needRecheck);

-  return synthField;

-}

-/* Add a new synthetic field for recording all enum constant values

-* Answer the new field or the existing field if one already existed.

-*/

-public FieldBinding addSyntheticFieldForEnumValues() {

-  if (this.synthetics == null)

-    this.synthetics = new HashMap[MAX_SYNTHETICS];

-  if (this.synthetics[SourceTypeBinding.FIELD_EMUL] == null)

-    this.synthetics[SourceTypeBinding.FIELD_EMUL] = new HashMap();

-

-  FieldBinding synthField = (FieldBinding) this.synthetics[SourceTypeBinding.FIELD_EMUL].get("enumConstantValues"); //$NON-NLS-1$

-  if (synthField == null) {

-    synthField = new SyntheticFieldBinding(

-      TypeConstants.SYNTHETIC_ENUM_VALUES,

-      this.scope.createArrayType(this,1),

-      ClassFileConstants.AccPrivate | ClassFileConstants.AccStatic | ClassFileConstants.AccSynthetic | ClassFileConstants.AccFinal,

-      this,

-      Constant.NotAConstant,

-      this.synthetics[SourceTypeBinding.FIELD_EMUL].size());

-    this.synthetics[SourceTypeBinding.FIELD_EMUL].put("enumConstantValues", synthField); //$NON-NLS-1$

-  }

-  // ensure there is not already such a field defined by the user

-  // ensure there is not already such a field defined by the user

-  boolean needRecheck;

-  int index = 0;

-  do {

-    needRecheck = false;

-    FieldBinding existingField;

-    if ((existingField = this.getField(synthField.name, true /*resolve*/)) != null) {

-      TypeDeclaration typeDecl = this.scope.referenceContext;

-      for (int i = 0, max = typeDecl.fields.length; i < max; i++) {

-        FieldDeclaration fieldDecl = typeDecl.fields[i];

-        if (fieldDecl.binding == existingField) {

-          synthField.name = CharOperation.concat(

-            TypeConstants.SYNTHETIC_ENUM_VALUES,

-            ("_" + String.valueOf(index++)).toCharArray()); //$NON-NLS-1$

-          needRecheck = true;

-          break;

-        }

-      }

-    }

-  } while (needRecheck);

-  return synthField;

-}

-/* Add a new synthetic access method for read/write access to <targetField>.

-  Answer the new method or the existing method if one already existed.

-*/

-public SyntheticMethodBinding addSyntheticMethod(FieldBinding targetField, boolean isReadAccess) {

-  if (this.synthetics == null)

-    this.synthetics = new HashMap[MAX_SYNTHETICS];

-  if (this.synthetics[SourceTypeBinding.METHOD_EMUL] == null)

-    this.synthetics[SourceTypeBinding.METHOD_EMUL] = new HashMap();

-

-  SyntheticMethodBinding accessMethod = null;

-  SyntheticMethodBinding[] accessors = (SyntheticMethodBinding[]) this.synthetics[SourceTypeBinding.METHOD_EMUL].get(targetField);

-  if (accessors == null) {

-    accessMethod = new SyntheticMethodBinding(targetField, isReadAccess, this);

-    this.synthetics[SourceTypeBinding.METHOD_EMUL].put(targetField, accessors = new SyntheticMethodBinding[2]);

-    accessors[isReadAccess ? 0 : 1] = accessMethod;   

-  } else {

-    if ((accessMethod = accessors[isReadAccess ? 0 : 1]) == null) {

-      accessMethod = new SyntheticMethodBinding(targetField, isReadAccess, this);

-      accessors[isReadAccess ? 0 : 1] = accessMethod;

-    }

-  }

-  return accessMethod;

-}

-/* Add a new synthetic method the enum type. Selector can either be 'values' or 'valueOf'.

- * char[] constants from TypeConstants must be used: TypeConstants.VALUES/VALUEOF

-*/

-public SyntheticMethodBinding addSyntheticEnumMethod(char[] selector) {

-  if (this.synthetics == null)

-    this.synthetics = new HashMap[MAX_SYNTHETICS];

-  if (this.synthetics[SourceTypeBinding.METHOD_EMUL] == null)

-    this.synthetics[SourceTypeBinding.METHOD_EMUL] = new HashMap();

-

-  SyntheticMethodBinding accessMethod = null;

-  SyntheticMethodBinding[] accessors = (SyntheticMethodBinding[]) this.synthetics[SourceTypeBinding.METHOD_EMUL].get(selector);

-  if (accessors == null) {

-    accessMethod = new SyntheticMethodBinding(this, selector);

-    this.synthetics[SourceTypeBinding.METHOD_EMUL].put(selector, accessors = new SyntheticMethodBinding[2]);

-    accessors[0] = accessMethod;    

-  } else {

-    if ((accessMethod = accessors[0]) == null) {

-      accessMethod = new SyntheticMethodBinding(this, selector);

-      accessors[0] = accessMethod;

-    }

-  }

-  return accessMethod;

-}

-/*

- * Add a synthetic field to handle the cache of the switch translation table for the corresponding enum type 

- */

-public SyntheticFieldBinding addSyntheticFieldForSwitchEnum(char[] fieldName, String key) {

-  if (this.synthetics == null)

-    this.synthetics = new HashMap[MAX_SYNTHETICS];

-  if (this.synthetics[SourceTypeBinding.FIELD_EMUL] == null)

-    this.synthetics[SourceTypeBinding.FIELD_EMUL] = new HashMap();

-

-  SyntheticFieldBinding synthField = (SyntheticFieldBinding) this.synthetics[SourceTypeBinding.FIELD_EMUL].get(key);

-  if (synthField == null) {

-    synthField = new SyntheticFieldBinding(

-      fieldName,

-      this.scope.createArrayType(TypeBinding.INT,1),

-      ClassFileConstants.AccPrivate | ClassFileConstants.AccStatic | ClassFileConstants.AccSynthetic,

-      this,

-      Constant.NotAConstant,

-      this.synthetics[SourceTypeBinding.FIELD_EMUL].size());

-    this.synthetics[SourceTypeBinding.FIELD_EMUL].put(key, synthField);

-  }

-  // ensure there is not already such a field defined by the user

-  boolean needRecheck;

-  int index = 0;

-  do {

-    needRecheck = false;

-    FieldBinding existingField;

-    if ((existingField = this.getField(synthField.name, true /*resolve*/)) != null) {

-      TypeDeclaration typeDecl = this.scope.referenceContext;

-      for (int i = 0, max = typeDecl.fields.length; i < max; i++) {

-        FieldDeclaration fieldDecl = typeDecl.fields[i];

-        if (fieldDecl.binding == existingField) {

-          synthField.name = CharOperation.concat(

-            fieldName,

-            ("_" + String.valueOf(index++)).toCharArray()); //$NON-NLS-1$

-          needRecheck = true;

-          break;

-        }

-      }

-    }

-  } while (needRecheck);

-  return synthField;

-}

-/* Add a new synthetic method the enum type. Selector can either be 'values' or 'valueOf'.

- * char[] constants from TypeConstants must be used: TypeConstants.VALUES/VALUEOF

-*/

-public SyntheticMethodBinding addSyntheticMethodForSwitchEnum(TypeBinding enumBinding) {

-  if (this.synthetics == null)

-    this.synthetics = new HashMap[MAX_SYNTHETICS];

-  if (this.synthetics[SourceTypeBinding.METHOD_EMUL] == null)

-    this.synthetics[SourceTypeBinding.METHOD_EMUL] = new HashMap();

-

-  SyntheticMethodBinding accessMethod = null;

-  char[] selector = CharOperation.concat(TypeConstants.SYNTHETIC_SWITCH_ENUM_TABLE, enumBinding.constantPoolName());

-  CharOperation.replace(selector, '/', '$');

-  final String key = new String(selector);

-  SyntheticMethodBinding[] accessors = (SyntheticMethodBinding[]) this.synthetics[SourceTypeBinding.METHOD_EMUL].get(key);

-  // first add the corresponding synthetic field

-  if (accessors == null) {

-    // then create the synthetic method

-    final SyntheticFieldBinding fieldBinding = this.addSyntheticFieldForSwitchEnum(selector, key);

-    accessMethod = new SyntheticMethodBinding(fieldBinding, this, enumBinding, selector);

-    this.synthetics[SourceTypeBinding.METHOD_EMUL].put(key, accessors = new SyntheticMethodBinding[2]);

-    accessors[0] = accessMethod;

-  } else {

-    if ((accessMethod = accessors[0]) == null) {

-      final SyntheticFieldBinding fieldBinding = this.addSyntheticFieldForSwitchEnum(selector, key);

-      accessMethod = new SyntheticMethodBinding(fieldBinding, this, enumBinding, selector);

-      accessors[0] = accessMethod;

-    }

-  }

-  return accessMethod;

-}

-/* Add a new synthetic access method for access to <targetMethod>.

- * Must distinguish access method used for super access from others (need to use invokespecial bytecode)

-  Answer the new method or the existing method if one already existed.

-*/

-public SyntheticMethodBinding addSyntheticMethod(MethodBinding targetMethod, boolean isSuperAccess) {

-  if (this.synthetics == null)

-    this.synthetics = new HashMap[MAX_SYNTHETICS];

-  if (this.synthetics[SourceTypeBinding.METHOD_EMUL] == null)

-    this.synthetics[SourceTypeBinding.METHOD_EMUL] = new HashMap();

-

-  SyntheticMethodBinding accessMethod = null;

-  SyntheticMethodBinding[] accessors = (SyntheticMethodBinding[]) this.synthetics[SourceTypeBinding.METHOD_EMUL].get(targetMethod);

-  if (accessors == null) {

-    accessMethod = new SyntheticMethodBinding(targetMethod, isSuperAccess, this);

-    this.synthetics[SourceTypeBinding.METHOD_EMUL].put(targetMethod, accessors = new SyntheticMethodBinding[2]);

-    accessors[isSuperAccess ? 0 : 1] = accessMethod;    

-  } else {

-    if ((accessMethod = accessors[isSuperAccess ? 0 : 1]) == null) {

-      accessMethod = new SyntheticMethodBinding(targetMethod, isSuperAccess, this);

-      accessors[isSuperAccess ? 0 : 1] = accessMethod;

-    }

-  }

-  return accessMethod;

-}

-/* 

- * Record the fact that bridge methods need to be generated to override certain inherited methods

- */

-public SyntheticMethodBinding addSyntheticBridgeMethod(MethodBinding inheritedMethodToBridge, MethodBinding targetMethod) {

-  if (isInterface()) return null; // only classes & enums get bridge methods

-  // targetMethod may be inherited

-  if (inheritedMethodToBridge.returnType.erasure() == targetMethod.returnType.erasure()

-    && inheritedMethodToBridge.areParameterErasuresEqual(targetMethod)) {

-      return null; // do not need bridge method

-  }

-  if (this.synthetics == null)

-    this.synthetics = new HashMap[MAX_SYNTHETICS];

-  if (this.synthetics[SourceTypeBinding.METHOD_EMUL] == null) {

-    this.synthetics[SourceTypeBinding.METHOD_EMUL] = new HashMap();

-  } else {

-    // check to see if there is another equivalent inheritedMethod already added

-    Iterator synthMethods = this.synthetics[SourceTypeBinding.METHOD_EMUL].keySet().iterator();

-    while (synthMethods.hasNext()) {

-      Object synthetic = synthMethods.next();

-      if (synthetic instanceof MethodBinding) {

-        MethodBinding method = (MethodBinding) synthetic;

-        if (CharOperation.equals(inheritedMethodToBridge.selector, method.selector)

-          && inheritedMethodToBridge.returnType.erasure() == method.returnType.erasure()

-          && inheritedMethodToBridge.areParameterErasuresEqual(method)) {

-            return null;

-        }

-      }

-    }

-  }

-

-  SyntheticMethodBinding accessMethod = null;

-  SyntheticMethodBinding[] accessors = (SyntheticMethodBinding[]) this.synthetics[SourceTypeBinding.METHOD_EMUL].get(inheritedMethodToBridge);

-  if (accessors == null) {

-    accessMethod = new SyntheticMethodBinding(inheritedMethodToBridge, targetMethod, this);

-    this.synthetics[SourceTypeBinding.METHOD_EMUL].put(inheritedMethodToBridge, accessors = new SyntheticMethodBinding[2]);

-    accessors[1] = accessMethod;    

-  } else {

-    if ((accessMethod = accessors[1]) == null) {

-      accessMethod = new SyntheticMethodBinding(inheritedMethodToBridge, targetMethod, this);

-      accessors[1] = accessMethod;

-    }

-  }

-  return accessMethod;

-}

-boolean areFieldsInitialized() {

-  return this.fields != Binding.UNINITIALIZED_FIELDS;

-}

-boolean areMethodsInitialized() {

-  return this.methods != Binding.UNINITIALIZED_METHODS;

-}

-public int kind() {

-  if (this.typeVariables != Binding.NO_TYPE_VARIABLES) return Binding.GENERIC_TYPE;

-  return Binding.TYPE;

-}

-

-public char[] computeUniqueKey(boolean isLeaf) {

-  char[] uniqueKey = super.computeUniqueKey(isLeaf);

-  if (uniqueKey.length == 2) return uniqueKey; // problem type's unique key is "L;"

-  if (Util.isClassFileName(this.fileName)) return uniqueKey; // no need to insert compilation unit name for a .class file

-  

-  // insert compilation unit name if the type name is not the main type name

-  int end = CharOperation.lastIndexOf('.', this.fileName);

-  if (end != -1) {

-    int start = CharOperation.lastIndexOf('/', this.fileName) + 1;

-    char[] mainTypeName = CharOperation.subarray(this.fileName, start, end);

-    start = CharOperation.lastIndexOf('/', uniqueKey) + 1;

-    if (start == 0)

-      start = 1; // start after L

-    end = CharOperation.indexOf('$', uniqueKey, start);

-    if (end == -1)

-      end = CharOperation.indexOf('<', uniqueKey, start);

-    if (end == -1)

-      end = CharOperation.indexOf(';', uniqueKey, start);

-    char[] topLevelType = CharOperation.subarray(uniqueKey, start, end);

-    if (!CharOperation.equals(topLevelType, mainTypeName)) {

-      StringBuffer buffer = new StringBuffer();

-      buffer.append(uniqueKey, 0, start);

-      buffer.append(mainTypeName);

-      buffer.append('~');

-      buffer.append(topLevelType);

-      buffer.append(uniqueKey, end, uniqueKey.length - end);

-      int length = buffer.length();

-      uniqueKey = new char[length];

-      buffer.getChars(0, length, uniqueKey, 0);

-      return uniqueKey;

-    }

-  }

-  return uniqueKey;

-}

-

-void faultInTypesForFieldsAndMethods() {

-  // check @Deprecated annotation

-  getAnnotationTagBits(); // marks as deprecated by side effect

-  ReferenceBinding enclosingType = this.enclosingType();

-  if (enclosingType != null && enclosingType.isViewedAsDeprecated() && !this.isDeprecated())

-    this.modifiers |= ExtraCompilerModifiers.AccDeprecatedImplicitly;

-  fields();

-  methods();

-

-  for (int i = 0, length = this.memberTypes.length; i < length; i++)

-    ((SourceTypeBinding) this.memberTypes[i]).faultInTypesForFieldsAndMethods();

-}

-// NOTE: the type of each field of a source type is resolved when needed

-public FieldBinding[] fields() {

-  if ((this.tagBits & TagBits.AreFieldsComplete) != 0)

-    return this.fields; 

-

-  int failed = 0;

-  FieldBinding[] resolvedFields = this.fields;

-  try {

-    // lazily sort fields

-    if ((this.tagBits & TagBits.AreFieldsSorted) == 0) {

-      int length = this.fields.length;

-      if (length > 1)

-        ReferenceBinding.sortFields(this.fields, 0, length);

-      this.tagBits |= TagBits.AreFieldsSorted;

-    }

-    for (int i = 0, length = this.fields.length; i < length; i++) {

-      if (resolveTypeFor(this.fields[i]) == null) {

-        // do not alter original field array until resolution is over, due to reentrance (143259)

-        if (resolvedFields == this.fields) {

-          System.arraycopy(this.fields, 0, resolvedFields = new FieldBinding[length], 0, length);

-        }

-        resolvedFields[i] = null;

-        failed++;

-      }

-    }

-  } finally {

-    if (failed > 0) {

-      // ensure fields are consistent reqardless of the error

-      int newSize = resolvedFields.length - failed;

-      if (newSize == 0)

-        return this.fields = Binding.NO_FIELDS;

-

-      FieldBinding[] newFields = new FieldBinding[newSize];

-      for (int i = 0, j = 0, length = resolvedFields.length; i < length; i++) {

-        if (resolvedFields[i] != null)

-          newFields[j++] = resolvedFields[i];

-      }

-      this.fields = newFields;

-    }

-  }

-  this.tagBits |= TagBits.AreFieldsComplete;

-  return this.fields;

-}

-/**

- * @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#genericTypeSignature()

- */

-public char[] genericTypeSignature() {

-    if (this.genericReferenceTypeSignature == null)

-      this.genericReferenceTypeSignature = computeGenericTypeSignature(this.typeVariables);

-    return this.genericReferenceTypeSignature;

-}

-/**

- * <param1 ... paramN>superclass superinterface1 ... superinterfaceN

- * <T:LY<TT;>;U:Ljava/lang/Object;V::Ljava/lang/Runnable;:Ljava/lang/Cloneable;:Ljava/util/Map;>Ljava/lang/Exception;Ljava/lang/Runnable;

- */

-public char[] genericSignature() {

-    StringBuffer sig = null;

-  if (this.typeVariables != Binding.NO_TYPE_VARIABLES) {

-      sig = new StringBuffer(10);

-      sig.append('<');

-      for (int i = 0, length = this.typeVariables.length; i < length; i++)

-          sig.append(this.typeVariables[i].genericSignature());

-      sig.append('>');

-  } else {

-      // could still need a signature if any of supertypes is parameterized

-      noSignature: if (this.superclass == null || !this.superclass.isParameterizedType()) {

-        for (int i = 0, length = this.superInterfaces.length; i < length; i++)

-            if (this.superInterfaces[i].isParameterizedType())

-          break noSignature;

-          return null;

-      }

-      sig = new StringBuffer(10);

-  }

-  if (this.superclass != null)

-    sig.append(this.superclass.genericTypeSignature());

-  else // interface scenario only (as Object cannot be generic) - 65953

-    sig.append(this.scope.getJavaLangObject().genericTypeSignature());

-    for (int i = 0, length = this.superInterfaces.length; i < length; i++)

-        sig.append(this.superInterfaces[i].genericTypeSignature());

-  return sig.toString().toCharArray();

-}

-

-/**

- * Compute the tagbits for standard annotations. For source types, these could require

- * lazily resolving corresponding annotation nodes, in case of forward references.

- * @see org.eclipse.jdt.internal.compiler.lookup.Binding#getAnnotationTagBits()

- */

-public long getAnnotationTagBits() {

-  if ((this.tagBits & TagBits.AnnotationResolved) == 0 && this.scope != null) {

-    TypeDeclaration typeDecl = this.scope.referenceContext;

-    boolean old = typeDecl.staticInitializerScope.insideTypeAnnotation;

-    try {

-      typeDecl.staticInitializerScope.insideTypeAnnotation = true;

-      ASTNode.resolveAnnotations(typeDecl.staticInitializerScope, typeDecl.annotations, this);

-    } finally {

-      typeDecl.staticInitializerScope.insideTypeAnnotation = old;

-    }

-    if ((this.tagBits & TagBits.AnnotationDeprecated) != 0)

-      this.modifiers |= ClassFileConstants.AccDeprecated;

-  }

-  return this.tagBits;

-}

-public MethodBinding[] getDefaultAbstractMethods() {

-  int count = 0;

-  for (int i = this.methods.length; --i >= 0;)

-    if (this.methods[i].isDefaultAbstract())

-      count++;

-  if (count == 0) return Binding.NO_METHODS;

-

-  MethodBinding[] result = new MethodBinding[count];

-  count = 0;

-  for (int i = this.methods.length; --i >= 0;)

-    if (this.methods[i].isDefaultAbstract())

-      result[count++] = this.methods[i];

-  return result;

-}

-// NOTE: the return type, arg & exception types of each method of a source type are resolved when needed

-public MethodBinding getExactConstructor(TypeBinding[] argumentTypes) {

-  int argCount = argumentTypes.length;

-  if ((this.tagBits & TagBits.AreMethodsComplete) != 0) { // have resolved all arg types & return type of the methods

-    long range;

-    if ((range = ReferenceBinding.binarySearch(TypeConstants.INIT, this.methods)) >= 0) {

-      nextMethod: for (int imethod = (int)range, end = (int)(range >> 32); imethod <= end; imethod++) {

-        MethodBinding method = this.methods[imethod];

-        if (method.parameters.length == argCount) {

-          TypeBinding[] toMatch = method.parameters;

-          for (int iarg = 0; iarg < argCount; iarg++)

-            if (toMatch[iarg] != argumentTypes[iarg])

-              continue nextMethod;

-          return method;

-        }

-      }

-    }

-  } else {

-    // lazily sort methods

-    if ((this.tagBits & TagBits.AreMethodsSorted) == 0) {

-      int length = this.methods.length;

-      if (length > 1)

-        ReferenceBinding.sortMethods(this.methods, 0, length);

-      this.tagBits |= TagBits.AreMethodsSorted;

-    }   

-    long range;

-    if ((range = ReferenceBinding.binarySearch(TypeConstants.INIT, this.methods)) >= 0) {

-      nextMethod: for (int imethod = (int)range, end = (int)(range >> 32); imethod <= end; imethod++) {

-        MethodBinding method = this.methods[imethod];

-        if (resolveTypesFor(method) == null || method.returnType == null) {

-          methods();

-          return getExactConstructor(argumentTypes);  // try again since the problem methods have been removed

-        }

-        if (method.parameters.length == argCount) {

-          TypeBinding[] toMatch = method.parameters;

-          for (int iarg = 0; iarg < argCount; iarg++)

-            if (toMatch[iarg] != argumentTypes[iarg])

-              continue nextMethod;

-          return method;

-        }

-      }

-    }

-  } 

-  return null;

-}

-

-//NOTE: the return type, arg & exception types of each method of a source type are resolved when needed

-//searches up the hierarchy as long as no potential (but not exact) match was found.

-public MethodBinding getExactMethod(char[] selector, TypeBinding[] argumentTypes, CompilationUnitScope refScope) {

-  // sender from refScope calls recordTypeReference(this)

-  int argCount = argumentTypes.length;

-  boolean foundNothing = true;

-

-  if ((this.tagBits & TagBits.AreMethodsComplete) != 0) { // have resolved all arg types & return type of the methods

-    long range;

-    if ((range = ReferenceBinding.binarySearch(selector, this.methods)) >= 0) {

-      nextMethod: for (int imethod = (int)range, end = (int)(range >> 32); imethod <= end; imethod++) {

-        MethodBinding method = this.methods[imethod];

-        foundNothing = false; // inner type lookups must know that a method with this name exists

-        if (method.parameters.length == argCount) {

-          TypeBinding[] toMatch = method.parameters;

-          for (int iarg = 0; iarg < argCount; iarg++)

-            if (toMatch[iarg] != argumentTypes[iarg])

-              continue nextMethod;

-          return method;

-        }

-      }

-    }

-  } else {

-    // lazily sort methods

-    if ((this.tagBits & TagBits.AreMethodsSorted) == 0) {

-      int length = this.methods.length;

-      if (length > 1)

-        ReferenceBinding.sortMethods(this.methods, 0, length);

-      this.tagBits |= TagBits.AreMethodsSorted;

-    }

-    

-    long range;

-    if ((range = ReferenceBinding.binarySearch(selector, this.methods)) >= 0) {

-      // check unresolved method

-      int start = (int) range, end = (int) (range >> 32);

-      for (int imethod = start; imethod <= end; imethod++) {

-        MethodBinding method = this.methods[imethod];     

-        if (resolveTypesFor(method) == null || method.returnType == null) {

-          methods();

-          return getExactMethod(selector, argumentTypes, refScope); // try again since the problem methods have been removed

-        }

-      }

-      // check dup collisions

-      boolean isSource15 = this.scope.compilerOptions().sourceLevel >= ClassFileConstants.JDK1_5;

-      for (int i = start; i <= end; i++) {

-        MethodBinding method1 = this.methods[i];

-        for (int j = end; j > i; j--) {

-          MethodBinding method2 = this.methods[j];

-          boolean paramsMatch = isSource15

-            ? method1.areParameterErasuresEqual(method2)

-            : method1.areParametersEqual(method2);

-          if (paramsMatch) {

-            methods();

-            return getExactMethod(selector, argumentTypes, refScope); // try again since the problem methods have been removed

-          }

-        }

-      }

-      nextMethod: for (int imethod = start; imethod <= end; imethod++) {

-        MethodBinding method = this.methods[imethod];           

-        TypeBinding[] toMatch = method.parameters;

-        if (toMatch.length == argCount) {

-          for (int iarg = 0; iarg < argCount; iarg++)

-            if (toMatch[iarg] != argumentTypes[iarg])

-              continue nextMethod;

-          return method;

-        }

-      }       

-    }

-  }

-

-  if (foundNothing) {

-    if (isInterface()) {

-       if (this.superInterfaces.length == 1) {

-        if (refScope != null)

-          refScope.recordTypeReference(this.superInterfaces[0]);

-        return this.superInterfaces[0].getExactMethod(selector, argumentTypes, refScope);

-       }

-    } else if (this.superclass != null) {

-      if (refScope != null)

-        refScope.recordTypeReference(this.superclass);

-      return this.superclass.getExactMethod(selector, argumentTypes, refScope);

-    }

-  }

-  return null;

-}

-

-//NOTE: the type of a field of a source type is resolved when needed

-public FieldBinding getField(char[] fieldName, boolean needResolve) {

-  

-  if ((this.tagBits & TagBits.AreFieldsComplete) != 0)

-    return ReferenceBinding.binarySearch(fieldName, this.fields);

-

-  // lazily sort fields

-  if ((this.tagBits & TagBits.AreFieldsSorted) == 0) {

-    int length = this.fields.length;

-    if (length > 1)

-      ReferenceBinding.sortFields(this.fields, 0, length);

-    this.tagBits |= TagBits.AreFieldsSorted;

-  }   

-  // always resolve anyway on source types

-  FieldBinding field = ReferenceBinding.binarySearch(fieldName, this.fields);

-  if (field != null) {

-    FieldBinding result = null;

-    try {

-      result = resolveTypeFor(field);

-      return result;

-    } finally {

-      if (result == null) {

-        // ensure fields are consistent reqardless of the error

-        int newSize = this.fields.length - 1;

-        if (newSize == 0) {

-          this.fields = Binding.NO_FIELDS;

-        } else {

-          FieldBinding[] newFields = new FieldBinding[newSize];

-          int index = 0;

-          for (int i = 0, length = this.fields.length; i < length; i++) {

-            FieldBinding f = this.fields[i];

-            if (f == field) continue;

-            newFields[index++] = f;

-          }

-          this.fields = newFields;

-        }

-      }

-    }

-  }

-  return null;

-}

-

-// NOTE: the return type, arg & exception types of each method of a source type are resolved when needed

-public MethodBinding[] getMethods(char[] selector) {

-  if ((this.tagBits & TagBits.AreMethodsComplete) != 0) {

-    long range;

-    if ((range = ReferenceBinding.binarySearch(selector, this.methods)) >= 0) {

-      int start = (int) range, end = (int) (range >> 32);

-      int length = end - start + 1;

-      MethodBinding[] result;

-      System.arraycopy(this.methods, start, result = new MethodBinding[length], 0, length);

-      return result;

-    } else {

-      return Binding.NO_METHODS;      

-    }

-  }

-  // lazily sort methods

-  if ((this.tagBits & TagBits.AreMethodsSorted) == 0) {

-    int length = this.methods.length;

-    if (length > 1)

-      ReferenceBinding.sortMethods(this.methods, 0, length);

-    this.tagBits |= TagBits.AreMethodsSorted;

-  }

-  MethodBinding[] result; 

-  long range;

-  if ((range = ReferenceBinding.binarySearch(selector, this.methods)) >= 0) {

-    int start = (int) range, end = (int) (range >> 32);

-    for (int i = start; i <= end; i++) {

-      MethodBinding method = this.methods[i];

-      if (resolveTypesFor(method) == null || method.returnType == null) {

-        methods();

-        return getMethods(selector); // try again since the problem methods have been removed

-      }

-    }

-    int length = end - start + 1;

-    System.arraycopy(this.methods, start, result = new MethodBinding[length], 0, length);

-  } else {

-    return Binding.NO_METHODS;

-  }

-  boolean isSource15 = this.scope.compilerOptions().sourceLevel >= ClassFileConstants.JDK1_5;

-  for (int i = 0, length = result.length - 1; i < length; i++) {

-    MethodBinding method = result[i];

-    for (int j = length; j > i; j--) {

-      boolean paramsMatch = isSource15

-        ? method.areParameterErasuresEqual(result[j])

-        : method.areParametersEqual(result[j]);

-      if (paramsMatch) {

-        methods();

-        return getMethods(selector); // try again since the duplicate methods have been removed

-      }

-    }

-  }

-  return result;

-}

-/* Answer the synthetic field for <actualOuterLocalVariable>

-* or null if one does not exist.

-*/

-public FieldBinding getSyntheticField(LocalVariableBinding actualOuterLocalVariable) {

-  if (this.synthetics == null || this.synthetics[SourceTypeBinding.FIELD_EMUL] == null) return null;

-  return (FieldBinding) this.synthetics[SourceTypeBinding.FIELD_EMUL].get(actualOuterLocalVariable);

-}

-/* Answer the synthetic field for <targetEnclosingType>

-* or null if one does not exist.

-*/

-public FieldBinding getSyntheticField(ReferenceBinding targetEnclosingType, boolean onlyExactMatch) {

-

-  if (this.synthetics == null || this.synthetics[SourceTypeBinding.FIELD_EMUL] == null) return null;

-  FieldBinding field = (FieldBinding) this.synthetics[SourceTypeBinding.FIELD_EMUL].get(targetEnclosingType);

-  if (field != null) return field;

-

-  // type compatibility : to handle cases such as

-  // class T { class M{}}

-  // class S extends T { class N extends M {}} --> need to use S as a default enclosing instance for the super constructor call in N().

-  if (!onlyExactMatch){

-    Iterator accessFields = this.synthetics[SourceTypeBinding.FIELD_EMUL].values().iterator();

-    while (accessFields.hasNext()) {

-      field = (FieldBinding) accessFields.next();

-      if (CharOperation.prefixEquals(TypeConstants.SYNTHETIC_ENCLOSING_INSTANCE_PREFIX, field.name)

-        && field.type.findSuperTypeOriginatingFrom(targetEnclosingType) != null)

-          return field;

-    }

-  }

-  return null;

-}

-/* 

- * Answer the bridge method associated for an  inherited methods or null if one does not exist

- */

-public SyntheticMethodBinding getSyntheticBridgeMethod(MethodBinding inheritedMethodToBridge) {

-  if (this.synthetics == null) return null;

-  if (this.synthetics[SourceTypeBinding.METHOD_EMUL] == null) return null;

-  SyntheticMethodBinding[] accessors = (SyntheticMethodBinding[]) this.synthetics[SourceTypeBinding.METHOD_EMUL].get(inheritedMethodToBridge);

-  if (accessors == null) return null;

-  return accessors[1];

-}

-

-/**

- * @see org.eclipse.jdt.internal.compiler.lookup.Binding#initializeDeprecatedAnnotationTagBits()

- */

-public void initializeDeprecatedAnnotationTagBits() {

-  if ((this.tagBits & TagBits.DeprecatedAnnotationResolved) == 0) {

-    TypeDeclaration typeDecl = this.scope.referenceContext;

-    boolean old = typeDecl.staticInitializerScope.insideTypeAnnotation;

-    try {

-      typeDecl.staticInitializerScope.insideTypeAnnotation = true;

-      ASTNode.resolveDeprecatedAnnotations(typeDecl.staticInitializerScope, typeDecl.annotations, this);

-      this.tagBits |= TagBits.DeprecatedAnnotationResolved;

-    } finally {

-      typeDecl.staticInitializerScope.insideTypeAnnotation = old;

-    }

-    if ((this.tagBits & TagBits.AnnotationDeprecated) != 0) {

-      this.modifiers |= ClassFileConstants.AccDeprecated;

-    }

-  }

-}

-

-// ensure the receiver knows its hierarchy & fields/methods so static imports can be resolved correctly

-// see bug 230026

-void initializeForStaticImports() {

-  if (this.scope == null) return; // already initialized

-

-  if (this.superInterfaces == null)

-    this.scope.connectTypeHierarchy();

-  this.scope.buildFields();

-  this.scope.buildMethods();

-}

-

-/**

- * Returns true if a type is identical to another one,

- * or for generic types, true if compared to its raw type.

- */

-public boolean isEquivalentTo(TypeBinding otherType) {

-

-  if (this == otherType) return true;

-  if (otherType == null) return false;

-  switch(otherType.kind()) {

-

-    case Binding.WILDCARD_TYPE :

-    case Binding.INTERSECTION_TYPE:

-      return ((WildcardBinding) otherType).boundCheck(this);

-

-    case Binding.PARAMETERIZED_TYPE :

-      if ((otherType.tagBits & TagBits.HasDirectWildcard) == 0 && (!this.isMemberType() || !otherType.isMemberType())) 

-        return false; // should have been identical

-      ParameterizedTypeBinding otherParamType = (ParameterizedTypeBinding) otherType;

-      if (this != otherParamType.genericType()) 

-        return false;

-      if (!isStatic()) { // static member types do not compare their enclosing

-              ReferenceBinding enclosing = enclosingType();

-              if (enclosing != null) {

-                ReferenceBinding otherEnclosing = otherParamType.enclosingType();

-                if (otherEnclosing == null) return false;

-                if ((otherEnclosing.tagBits & TagBits.HasDirectWildcard) == 0) {

-            if (enclosing != otherEnclosing) return false;

-                } else {

-                  if (!enclosing.isEquivalentTo(otherParamType.enclosingType())) return false;

-                }

-              }       

-      }

-      int length = this.typeVariables == null ? 0 : this.typeVariables.length;

-      TypeBinding[] otherArguments = otherParamType.arguments;

-      int otherLength = otherArguments == null ? 0 : otherArguments.length;

-      if (otherLength != length) 

-        return false;

-      for (int i = 0; i < length; i++)

-        if (!this.typeVariables[i].isTypeArgumentContainedBy(otherArguments[i]))

-          return false;

-      return true;

-

-    case Binding.RAW_TYPE :

-          return otherType.erasure() == this;

-  }

-  return false;

-}

-public boolean isGenericType() {

-    return this.typeVariables != Binding.NO_TYPE_VARIABLES;

-}

-public ReferenceBinding[] memberTypes() {

-  return this.memberTypes;

-}

-public FieldBinding getUpdatedFieldBinding(FieldBinding targetField, ReferenceBinding newDeclaringClass) {

-  if (this.synthetics == null)

-    this.synthetics = new HashMap[MAX_SYNTHETICS];

-  if (this.synthetics[SourceTypeBinding.RECEIVER_TYPE_EMUL] == null)

-    this.synthetics[SourceTypeBinding.RECEIVER_TYPE_EMUL] = new HashMap();

-

-  Hashtable fieldMap = (Hashtable) this.synthetics[SourceTypeBinding.RECEIVER_TYPE_EMUL].get(targetField);

-  if (fieldMap == null) {

-    fieldMap = new Hashtable(5);

-    this.synthetics[SourceTypeBinding.RECEIVER_TYPE_EMUL].put(targetField, fieldMap);

-  }

-  FieldBinding updatedField = (FieldBinding) fieldMap.get(newDeclaringClass);

-  if (updatedField == null){

-    updatedField = new FieldBinding(targetField, newDeclaringClass);

-    fieldMap.put(newDeclaringClass, updatedField);

-  }

-  return updatedField;

-}

-public MethodBinding getUpdatedMethodBinding(MethodBinding targetMethod, ReferenceBinding newDeclaringClass) {

-  if (this.synthetics == null)

-    this.synthetics = new HashMap[MAX_SYNTHETICS];

-  if (this.synthetics[SourceTypeBinding.RECEIVER_TYPE_EMUL] == null)

-    this.synthetics[SourceTypeBinding.RECEIVER_TYPE_EMUL] = new HashMap();

-

-  Hashtable methodMap = (Hashtable) this.synthetics[SourceTypeBinding.RECEIVER_TYPE_EMUL].get(targetMethod);

-  if (methodMap == null) {

-    methodMap = new Hashtable(5);

-    this.synthetics[SourceTypeBinding.RECEIVER_TYPE_EMUL].put(targetMethod, methodMap);

-  }

-  MethodBinding updatedMethod = (MethodBinding) methodMap.get(newDeclaringClass);

-  if (updatedMethod == null){

-    updatedMethod = new MethodBinding(targetMethod, newDeclaringClass);

-    methodMap.put(newDeclaringClass, updatedMethod);

-  }

-  return updatedMethod;

-}

-public boolean hasMemberTypes() {

-    return this.memberTypes.length > 0;

-}

-// NOTE: the return type, arg & exception types of each method of a source type are resolved when needed

-public MethodBinding[] methods() {

-  if ((this.tagBits & TagBits.AreMethodsComplete) != 0)

-    return this.methods;

-  

-  // lazily sort methods

-  if ((this.tagBits & TagBits.AreMethodsSorted) == 0) {

-    int length = this.methods.length;

-    if (length > 1)

-      ReferenceBinding.sortMethods(this.methods, 0, length);

-    this.tagBits |= TagBits.AreMethodsSorted;

-  }

-

-  int failed = 0;

-  MethodBinding[] resolvedMethods = this.methods;

-  try {

-    for (int i = 0, length = this.methods.length; i < length; i++) {

-      if (resolveTypesFor(this.methods[i]) == null) {

-        // do not alter original method array until resolution is over, due to reentrance (143259)

-        if (resolvedMethods == this.methods) {

-          System.arraycopy(this.methods, 0, resolvedMethods = new MethodBinding[length], 0, length);

-        }       

-        resolvedMethods[i] = null; // unable to resolve parameters

-        failed++;

-      }

-    }

-

-    // find & report collision cases

-    boolean complyTo15 = this.scope.compilerOptions().sourceLevel >= ClassFileConstants.JDK1_5;

-    for (int i = 0, length = this.methods.length; i < length; i++) {

-      MethodBinding method = resolvedMethods[i];

-      if (method == null) 

-        continue;

-      char[] selector = method.selector;

-      AbstractMethodDeclaration methodDecl = null;

-      nextSibling: for (int j = i + 1; j < length; j++) {

-        MethodBinding method2 = resolvedMethods[j];

-        if (method2 == null)

-          continue nextSibling;

-        if (!CharOperation.equals(selector, method2.selector)) 

-          break nextSibling; // methods with same selector are contiguous

-

-        if (complyTo15 && method.returnType != null && method2.returnType != null) {

-          // 8.4.2, for collision to be detected between m1 and m2:

-          // signature(m1) == signature(m2) i.e. same arity, same type parameter count, can be substituted

-          // signature(m1) == erasure(signature(m2)) or erasure(signature(m1)) == signature(m2)

-          TypeBinding[] params1 = method.parameters;

-          TypeBinding[] params2 = method2.parameters;

-          int pLength = params1.length;

-          if (pLength != params2.length)

-            continue nextSibling;

-

-          TypeVariableBinding[] vars = method.typeVariables;

-          TypeVariableBinding[] vars2 = method2.typeVariables;

-          boolean equalTypeVars = vars == vars2;

-          MethodBinding subMethod = method2;

-          if (!equalTypeVars) {

-            MethodBinding temp = method.computeSubstitutedMethod(method2, this.scope.environment());

-            if (temp != null) {

-              equalTypeVars = true;

-              subMethod = temp;

-            }

-          }

-          boolean equalParams = method.areParametersEqual(subMethod);

-          if (equalParams && equalTypeVars) {

-            // duplicates regardless of return types

-          } else if (method.returnType.erasure() == subMethod.returnType.erasure() && (equalParams || method.areParameterErasuresEqual(method2))) {

-            // name clash for sure if not duplicates, report as duplicates

-          } else if (!equalTypeVars && vars != Binding.NO_TYPE_VARIABLES && vars2 != Binding.NO_TYPE_VARIABLES) {

-            // type variables are different so we can distinguish between methods

-            continue nextSibling;

-          } else if (pLength > 0) {

-            // check to see if the erasure of either method is equal to the other

-            int index = pLength;

-            for (; --index >= 0;) {

-              if (params1[index] != params2[index].erasure())

-                break;

-              if (params1[index] == params2[index]) {

-                TypeBinding type = params1[index].leafComponentType();

-                if (type instanceof SourceTypeBinding && type.typeVariables() != Binding.NO_TYPE_VARIABLES) {

-                  index = pLength; // handle comparing identical source types like X<T>... its erasure is itself BUT we need to answer false

-                  break;

-                }

-              }

-            }

-            if (index >= 0 && index < pLength) {

-              for (index = pLength; --index >= 0;)

-                if (params1[index].erasure() != params2[index])

-                  break;

-            }

-            if (index >= 0)

-              continue nextSibling;

-          }

-        } else if (!method.areParametersEqual(method2)) { // prior to 1.5, parameter identity meant a collision case

-          continue nextSibling;

-        }

-        boolean isEnumSpecialMethod = isEnum() && (CharOperation.equals(selector,TypeConstants.VALUEOF) || CharOperation.equals(selector,TypeConstants.VALUES));

-        // report duplicate

-        if (methodDecl == null) {

-          methodDecl = method.sourceMethod(); // cannot be retrieved after binding is lost & may still be null if method is special

-          if (methodDecl != null && methodDecl.binding != null) { // ensure its a valid user defined method

-            if (isEnumSpecialMethod) {

-              this.scope.problemReporter().duplicateEnumSpecialMethod(this, methodDecl);

-            } else {

-              this.scope.problemReporter().duplicateMethodInType(this, methodDecl, method.areParametersEqual(method2));

-            }

-            methodDecl.binding = null;

-            // do not alter original method array until resolution is over, due to reentrance (143259)

-            if (resolvedMethods == this.methods) {

-              System.arraycopy(this.methods, 0, resolvedMethods = new MethodBinding[length], 0, length);

-            }               

-            resolvedMethods[i] = null;

-            failed++;

-          }

-        }

-        AbstractMethodDeclaration method2Decl = method2.sourceMethod();

-        if (method2Decl != null && method2Decl.binding != null) { // ensure its a valid user defined method

-          if (isEnumSpecialMethod) {

-            this.scope.problemReporter().duplicateEnumSpecialMethod(this, method2Decl);

-          } else {

-            this.scope.problemReporter().duplicateMethodInType(this, method2Decl, method.areParametersEqual(method2));

-          }

-          method2Decl.binding = null;

-          // do not alter original method array until resolution is over, due to reentrance (143259)

-          if (resolvedMethods == this.methods) {

-            System.arraycopy(this.methods, 0, resolvedMethods = new MethodBinding[length], 0, length);

-          }             

-          resolvedMethods[j] = null;

-          failed++;

-        }

-      }

-      if (method.returnType == null && methodDecl == null) { // forget method with invalid return type... was kept to detect possible collisions

-        methodDecl = method.sourceMethod();

-        if (methodDecl != null) {

-          methodDecl.binding = null;

-        }

-        // do not alter original method array until resolution is over, due to reentrance (143259)

-        if (resolvedMethods == this.methods) {

-          System.arraycopy(this.methods, 0, resolvedMethods = new MethodBinding[length], 0, length);

-        }           

-        resolvedMethods[i] = null;

-        failed++;

-      }

-    }

-  } finally {

-    if (failed > 0) {

-      int newSize = resolvedMethods.length - failed;

-      if (newSize == 0) {

-        this.methods = Binding.NO_METHODS;

-      } else {

-        MethodBinding[] newMethods = new MethodBinding[newSize];

-        for (int i = 0, j = 0, length = resolvedMethods.length; i < length; i++)

-          if (resolvedMethods[i] != null)

-            newMethods[j++] = resolvedMethods[i];

-        this.methods = newMethods;

-      }

-    }

-

-    // handle forward references to potential default abstract methods

-    addDefaultAbstractMethods();

-    this.tagBits |= TagBits.AreMethodsComplete;

-  }   

-  return this.methods;

-}

-private FieldBinding resolveTypeFor(FieldBinding field) {

-  if ((field.modifiers & ExtraCompilerModifiers.AccUnresolved) == 0)

-    return field;

-

-  if (this.scope.compilerOptions().sourceLevel >= ClassFileConstants.JDK1_5) {

-    if ((field.getAnnotationTagBits() & TagBits.AnnotationDeprecated) != 0)

-      field.modifiers |= ClassFileConstants.AccDeprecated;

-  }

-  if (isViewedAsDeprecated() && !field.isDeprecated())

-    field.modifiers |= ExtraCompilerModifiers.AccDeprecatedImplicitly;  

-  if (hasRestrictedAccess())

-    field.modifiers |= ExtraCompilerModifiers.AccRestrictedAccess;

-  FieldDeclaration[] fieldDecls = this.scope.referenceContext.fields;

-  for (int f = 0, length = fieldDecls.length; f < length; f++) {

-    if (fieldDecls[f].binding != field)

-      continue;

-

-      MethodScope initializationScope = field.isStatic() 

-        ? this.scope.referenceContext.staticInitializerScope 

-        : this.scope.referenceContext.initializerScope;

-      FieldBinding previousField = initializationScope.initializedField;

-      try {

-        initializationScope.initializedField = field;

-        FieldDeclaration fieldDecl = fieldDecls[f];

-        TypeBinding fieldType = 

-          fieldDecl.getKind() == AbstractVariableDeclaration.ENUM_CONSTANT

-            ? initializationScope.environment().convertToRawType(this, false /*do not force conversion of enclosing types*/) // enum constant is implicitly of declaring enum type

-            : fieldDecl.type.resolveType(initializationScope, true /* check bounds*/);

-        field.type = fieldType;

-        field.modifiers &= ~ExtraCompilerModifiers.AccUnresolved;

-        if (fieldType == null) {

-          fieldDecl.binding = null;

-          return null;

-        }

-        if (fieldType == TypeBinding.VOID) {

-          this.scope.problemReporter().variableTypeCannotBeVoid(fieldDecl);

-          fieldDecl.binding = null;

-          return null;

-        }

-        if (fieldType.isArrayType() && ((ArrayBinding) fieldType).leafComponentType == TypeBinding.VOID) {

-          this.scope.problemReporter().variableTypeCannotBeVoidArray(fieldDecl);

-          fieldDecl.binding = null;

-          return null;

-        }

-        if ((fieldType.tagBits & TagBits.HasMissingType) != 0) {

-          field.tagBits |= TagBits.HasMissingType;

-        }           

-        TypeBinding leafType = fieldType.leafComponentType();

-        if (leafType instanceof ReferenceBinding && (((ReferenceBinding)leafType).modifiers & ExtraCompilerModifiers.AccGenericSignature) != 0) {

-          field.modifiers |= ExtraCompilerModifiers.AccGenericSignature;

-        }       

-      } finally {

-          initializationScope.initializedField = previousField;

-      }

-    return field;

-  }

-  return null; // should never reach this point

-}

-public MethodBinding resolveTypesFor(MethodBinding method) {

-  if ((method.modifiers & ExtraCompilerModifiers.AccUnresolved) == 0)

-    return method;

-

-  if (this.scope.compilerOptions().sourceLevel >= ClassFileConstants.JDK1_5) {

-    if ((method.getAnnotationTagBits() & TagBits.AnnotationDeprecated) != 0)

-      method.modifiers |= ClassFileConstants.AccDeprecated;

-  }

-  if (isViewedAsDeprecated() && !method.isDeprecated())

-    method.modifiers |= ExtraCompilerModifiers.AccDeprecatedImplicitly;

-  if (hasRestrictedAccess())

-    method.modifiers |= ExtraCompilerModifiers.AccRestrictedAccess;

-

-  AbstractMethodDeclaration methodDecl = method.sourceMethod();

-  if (methodDecl == null) return null; // method could not be resolved in previous iteration

-

-  TypeParameter[] typeParameters = methodDecl.typeParameters();

-  if (typeParameters != null) {

-    methodDecl.scope.connectTypeVariables(typeParameters, true);

-    // Perform deferred bound checks for type variables (only done after type variable hierarchy is connected)

-    for (int i = 0, paramLength = typeParameters.length; i < paramLength; i++)

-      typeParameters[i].checkBounds(methodDecl.scope);

-  }

-  TypeReference[] exceptionTypes = methodDecl.thrownExceptions;

-  if (exceptionTypes != null) {

-    int size = exceptionTypes.length;

-    method.thrownExceptions = new ReferenceBinding[size];

-    int count = 0;

-    ReferenceBinding resolvedExceptionType;

-    for (int i = 0; i < size; i++) {

-      resolvedExceptionType = (ReferenceBinding) exceptionTypes[i].resolveType(methodDecl.scope, true /* check bounds*/);

-      if (resolvedExceptionType == null)

-        continue;

-      if (resolvedExceptionType.isBoundParameterizedType()) {

-        methodDecl.scope.problemReporter().invalidParameterizedExceptionType(resolvedExceptionType, exceptionTypes[i]);

-        continue;

-      }

-      if (resolvedExceptionType.findSuperTypeOriginatingFrom(TypeIds.T_JavaLangThrowable, true) == null) {

-        if (resolvedExceptionType.isValidBinding()) {

-          methodDecl.scope.problemReporter().cannotThrowType(exceptionTypes[i], resolvedExceptionType);

-          continue;

-        }

-      }

-      if ((resolvedExceptionType.tagBits & TagBits.HasMissingType) != 0) {

-        method.tagBits |= TagBits.HasMissingType;

-      }           

-      method.modifiers |= (resolvedExceptionType.modifiers & ExtraCompilerModifiers.AccGenericSignature);

-      method.thrownExceptions[count++] = resolvedExceptionType;

-    }

-    if (count < size)

-      System.arraycopy(method.thrownExceptions, 0, method.thrownExceptions = new ReferenceBinding[count], 0, count);

-  }

-

-  boolean foundArgProblem = false;

-  Argument[] arguments = methodDecl.arguments;

-  if (arguments != null) {

-    int size = arguments.length;

-    method.parameters = Binding.NO_PARAMETERS;

-    TypeBinding[] newParameters = new TypeBinding[size];

-    for (int i = 0; i < size; i++) {

-      Argument arg = arguments[i];

-      if (arg.annotations != null) {

-        method.tagBits |= TagBits.HasParameterAnnotations;

-      }

-      TypeBinding parameterType = arg.type.resolveType(methodDecl.scope, true /* check bounds*/);

-      if (parameterType == null) {

-        foundArgProblem = true;

-      } else if (parameterType == TypeBinding.VOID) {

-        methodDecl.scope.problemReporter().argumentTypeCannotBeVoid(this, methodDecl, arg);

-        foundArgProblem = true;

-      } else {

-        if ((parameterType.tagBits & TagBits.HasMissingType) != 0) {

-          method.tagBits |= TagBits.HasMissingType;

-        }           

-        TypeBinding leafType = parameterType.leafComponentType();

-        if (leafType instanceof ReferenceBinding && (((ReferenceBinding) leafType).modifiers & ExtraCompilerModifiers.AccGenericSignature) != 0)

-          method.modifiers |= ExtraCompilerModifiers.AccGenericSignature;

-        newParameters[i] = parameterType;

-        arg.binding = new LocalVariableBinding(arg, parameterType, arg.modifiers, true);

-      }

-    }

-    // only assign parameters if no problems are found

-    if (!foundArgProblem) {

-      method.parameters = newParameters;

-    }

-  }

-

-  boolean foundReturnTypeProblem = false;

-  if (!method.isConstructor()) {

-    TypeReference returnType = methodDecl instanceof MethodDeclaration

-      ? ((MethodDeclaration) methodDecl).returnType

-      : null;

-    if (returnType == null) {

-      methodDecl.scope.problemReporter().missingReturnType(methodDecl);

-      method.returnType = null;

-      foundReturnTypeProblem = true;

-    } else {

-      TypeBinding methodType = returnType.resolveType(methodDecl.scope, true /* check bounds*/);

-      if (methodType == null) {

-        foundReturnTypeProblem = true;

-      } else if (methodType.isArrayType() && ((ArrayBinding) methodType).leafComponentType == TypeBinding.VOID) {

-        methodDecl.scope.problemReporter().returnTypeCannotBeVoidArray((MethodDeclaration) methodDecl);

-        foundReturnTypeProblem = true;

-      } else {

-        if ((methodType.tagBits & TagBits.HasMissingType) != 0) {

-          method.tagBits |= TagBits.HasMissingType;

-        }         

-        method.returnType = methodType;

-        TypeBinding leafType = methodType.leafComponentType();

-        if (leafType instanceof ReferenceBinding && (((ReferenceBinding) leafType).modifiers & ExtraCompilerModifiers.AccGenericSignature) != 0)

-          method.modifiers |= ExtraCompilerModifiers.AccGenericSignature;

-      }

-    }

-  }

-  if (foundArgProblem) {

-    methodDecl.binding = null;

-    method.parameters = Binding.NO_PARAMETERS; // see 107004

-    // nullify type parameter bindings as well as they have a backpointer to the method binding

-    // (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=81134)

-    if (typeParameters != null)

-      for (int i = 0, length = typeParameters.length; i < length; i++)

-        typeParameters[i].binding = null;

-    return null;

-  }

-  if (foundReturnTypeProblem)

-    return method; // but its still unresolved with a null return type & is still connected to its method declaration

-

-  method.modifiers &= ~ExtraCompilerModifiers.AccUnresolved;

-  return method;

-}

-public AnnotationHolder retrieveAnnotationHolder(Binding binding, boolean forceInitialization) {

-  if (forceInitialization)

-    binding.getAnnotationTagBits(); // ensure annotations are up to date

-  return super.retrieveAnnotationHolder(binding, false);

-}

-public void setFields(FieldBinding[] fields) {

-  this.fields = fields;

-}

-public void setMethods(MethodBinding[] methods) {

-  this.methods = methods;

-}

-public final int sourceEnd() {

-  return this.scope.referenceContext.sourceEnd;

-}

-public final int sourceStart() {

-  return this.scope.referenceContext.sourceStart;

-}

-SimpleLookupTable storedAnnotations(boolean forceInitialize) {

-  if (forceInitialize && this.storedAnnotations == null && this.scope != null) { // scope null when no annotation cached, and type got processed fully (159631)

-    this.scope.referenceCompilationUnit().compilationResult.hasAnnotations = true;

-    if (!this.scope.environment().globalOptions.storeAnnotations)

-      return null; // not supported during this compile

-    this.storedAnnotations = new SimpleLookupTable(3);

-  }

-  return this.storedAnnotations;

-}

-public ReferenceBinding superclass() {

-  return this.superclass;

-}

-public ReferenceBinding[] superInterfaces() {

-  return this.superInterfaces;

-}

-// TODO (philippe) could be a performance issue since some senders are building the list just to count them

-public SyntheticMethodBinding[] syntheticMethods() {

-  

-  if (this.synthetics == null || this.synthetics[SourceTypeBinding.METHOD_EMUL] == null || this.synthetics[SourceTypeBinding.METHOD_EMUL].size() == 0) return null;

-

-  // difficult to compute size up front because of the embedded arrays so assume there is only 1

-  int index = 0;

-  SyntheticMethodBinding[] bindings = new SyntheticMethodBinding[1];

-  Iterator fieldsOrMethods = this.synthetics[SourceTypeBinding.METHOD_EMUL].keySet().iterator();

-  while (fieldsOrMethods.hasNext()) {

-

-    Object fieldOrMethod = fieldsOrMethods.next();

-

-    if (fieldOrMethod instanceof MethodBinding) {

-

-      SyntheticMethodBinding[] methodAccessors = (SyntheticMethodBinding[]) this.synthetics[SourceTypeBinding.METHOD_EMUL].get(fieldOrMethod);

-      int numberOfAccessors = 0;

-      if (methodAccessors[0] != null) numberOfAccessors++;

-      if (methodAccessors[1] != null) numberOfAccessors++;

-      if (index + numberOfAccessors > bindings.length)

-        System.arraycopy(bindings, 0, (bindings = new SyntheticMethodBinding[index + numberOfAccessors]), 0, index);

-      if (methodAccessors[0] != null) 

-        bindings[index++] = methodAccessors[0]; // super access 

-      if (methodAccessors[1] != null) 

-        bindings[index++] = methodAccessors[1]; // normal access or bridge

-

-    } else {

-

-      SyntheticMethodBinding[] fieldAccessors = (SyntheticMethodBinding[]) this.synthetics[SourceTypeBinding.METHOD_EMUL].get(fieldOrMethod);

-      int numberOfAccessors = 0;

-      if (fieldAccessors[0] != null) numberOfAccessors++;

-      if (fieldAccessors[1] != null) numberOfAccessors++;

-      if (index + numberOfAccessors > bindings.length)

-        System.arraycopy(bindings, 0, (bindings = new SyntheticMethodBinding[index + numberOfAccessors]), 0, index);

-      if (fieldAccessors[0] != null) 

-        bindings[index++] = fieldAccessors[0]; // read access

-      if (fieldAccessors[1] != null) 

-        bindings[index++] = fieldAccessors[1]; // write access

-    }

-  }

-

-  // sort them in according to their own indexes

-  int length;

-  SyntheticMethodBinding[] sortedBindings = new SyntheticMethodBinding[length = bindings.length];

-  for (int i = 0; i < length; i++){

-    SyntheticMethodBinding binding = bindings[i];

-    sortedBindings[binding.index] = binding;

-  }

-  return sortedBindings;

-}

-/**

- * Answer the collection of synthetic fields to append into the classfile

- */

-public FieldBinding[] syntheticFields() {

-  

-  if (this.synthetics == null) return null;

-

-  int fieldSize = this.synthetics[SourceTypeBinding.FIELD_EMUL] == null ? 0 : this.synthetics[SourceTypeBinding.FIELD_EMUL].size();

-  int literalSize = this.synthetics[SourceTypeBinding.CLASS_LITERAL_EMUL] == null ? 0 :this.synthetics[SourceTypeBinding.CLASS_LITERAL_EMUL].size();

-  int totalSize = fieldSize + literalSize;

-  if (totalSize == 0) return null;

-  FieldBinding[] bindings = new FieldBinding[totalSize];

-

-  // add innerclass synthetics

-  if (this.synthetics[SourceTypeBinding.FIELD_EMUL] != null){

-    Iterator elements = this.synthetics[SourceTypeBinding.FIELD_EMUL].values().iterator();

-    for (int i = 0; i < fieldSize; i++) {

-      SyntheticFieldBinding synthBinding = (SyntheticFieldBinding) elements.next();

-      bindings[synthBinding.index] = synthBinding;

-    }

-  }

-  // add class literal synthetics

-  if (this.synthetics[SourceTypeBinding.CLASS_LITERAL_EMUL] != null){

-    Iterator elements = this.synthetics[SourceTypeBinding.CLASS_LITERAL_EMUL].values().iterator();

-    for (int i = 0; i < literalSize; i++) {

-      SyntheticFieldBinding synthBinding = (SyntheticFieldBinding) elements.next();

-      bindings[fieldSize+synthBinding.index] = synthBinding;

-    }

-  }

-  return bindings;

-}

-public String toString() {

-    StringBuffer buffer = new StringBuffer(30);

-    buffer.append("(id="); //$NON-NLS-1$

-    if (this.id == TypeIds.NoId) 

-        buffer.append("NoId"); //$NON-NLS-1$

-    else 

-        buffer.append(this.id);

-    buffer.append(")\n"); //$NON-NLS-1$

-  if (isDeprecated()) buffer.append("deprecated "); //$NON-NLS-1$

-  if (isPublic()) buffer.append("public "); //$NON-NLS-1$

-  if (isProtected()) buffer.append("protected "); //$NON-NLS-1$

-  if (isPrivate()) buffer.append("private "); //$NON-NLS-1$

-  if (isAbstract() && isClass()) buffer.append("abstract "); //$NON-NLS-1$

-  if (isStatic() && isNestedType()) buffer.append("static "); //$NON-NLS-1$

-  if (isFinal()) buffer.append("final "); //$NON-NLS-1$

-

-  if (isEnum()) buffer.append("enum "); //$NON-NLS-1$

-  else if (isAnnotationType()) buffer.append("@interface "); //$NON-NLS-1$

-  else if (isClass()) buffer.append("class "); //$NON-NLS-1$

-  else buffer.append("interface "); //$NON-NLS-1$

-  buffer.append((this.compoundName != null) ? CharOperation.toString(this.compoundName) : "UNNAMED TYPE"); //$NON-NLS-1$

-

-  if (this.typeVariables == null) {

-    buffer.append("<NULL TYPE VARIABLES>"); //$NON-NLS-1$

-  } else if (this.typeVariables != Binding.NO_TYPE_VARIABLES) {

-    buffer.append("<"); //$NON-NLS-1$

-    for (int i = 0, length = this.typeVariables.length; i < length; i++) {

-      if (i  > 0) buffer.append(", "); //$NON-NLS-1$

-      if (this.typeVariables[i] == null) {

-        buffer.append("NULL TYPE VARIABLE"); //$NON-NLS-1$

-        continue;

-      }

-      char[] varChars = this.typeVariables[i].toString().toCharArray();

-      buffer.append(varChars, 1, varChars.length - 2);

-    }

-    buffer.append(">"); //$NON-NLS-1$

-  }

-  buffer.append("\n\textends "); //$NON-NLS-1$

-  buffer.append((this.superclass != null) ? this.superclass.debugName() : "NULL TYPE"); //$NON-NLS-1$

-

-  if (this.superInterfaces != null) {

-    if (this.superInterfaces != Binding.NO_SUPERINTERFACES) {

-      buffer.append("\n\timplements : "); //$NON-NLS-1$

-      for (int i = 0, length = this.superInterfaces.length; i < length; i++) {

-        if (i  > 0)

-          buffer.append(", "); //$NON-NLS-1$

-        buffer.append((this.superInterfaces[i] != null) ? this.superInterfaces[i].debugName() : "NULL TYPE"); //$NON-NLS-1$

-      }

-    }

-  } else {

-    buffer.append("NULL SUPERINTERFACES"); //$NON-NLS-1$

-  }

-

-  if (enclosingType() != null) {

-    buffer.append("\n\tenclosing type : "); //$NON-NLS-1$

-    buffer.append(enclosingType().debugName());

-  }

-

-  if (this.fields != null) {

-    if (this.fields != Binding.NO_FIELDS) {

-      buffer.append("\n/*   fields   */"); //$NON-NLS-1$

-      for (int i = 0, length = this.fields.length; i < length; i++)

-          buffer.append('\n').append((this.fields[i] != null) ? this.fields[i].toString() : "NULL FIELD"); //$NON-NLS-1$ 

-    }

-  } else {

-    buffer.append("NULL FIELDS"); //$NON-NLS-1$

-  }

-

-  if (this.methods != null) {

-    if (this.methods != Binding.NO_METHODS) {

-      buffer.append("\n/*   methods   */"); //$NON-NLS-1$

-      for (int i = 0, length = this.methods.length; i < length; i++)

-        buffer.append('\n').append((this.methods[i] != null) ? this.methods[i].toString() : "NULL METHOD"); //$NON-NLS-1$

-    }

-  } else {

-    buffer.append("NULL METHODS"); //$NON-NLS-1$

-  }

-

-  if (this.memberTypes != null) {

-    if (this.memberTypes != Binding.NO_MEMBER_TYPES) {

-      buffer.append("\n/*   members   */"); //$NON-NLS-1$

-      for (int i = 0, length = this.memberTypes.length; i < length; i++)

-        buffer.append('\n').append((this.memberTypes[i] != null) ? this.memberTypes[i].toString() : "NULL TYPE"); //$NON-NLS-1$

-    }

-  } else {

-    buffer.append("NULL MEMBER TYPES"); //$NON-NLS-1$

-  }

-

-  buffer.append("\n\n"); //$NON-NLS-1$

-  return buffer.toString();

-}

-public TypeVariableBinding[] typeVariables() {

-  return this.typeVariables;

-}

-void verifyMethods(MethodVerifier verifier) {

-  verifier.verify(this);

-

-  for (int i = this.memberTypes.length; --i >= 0;)

-     ((SourceTypeBinding) this.memberTypes[i]).verifyMethods(verifier);

-}

-}

+/*******************************************************************************
+ * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.internal.compiler.lookup;
+
+import com.google.gwt.dev.util.collect.HashMap;
+
+import org.eclipse.jdt.core.compiler.CharOperation;
+import org.eclipse.jdt.internal.compiler.ast.ASTNode;
+import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
+import org.eclipse.jdt.internal.compiler.ast.AbstractVariableDeclaration;
+import org.eclipse.jdt.internal.compiler.ast.Argument;
+import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration;
+import org.eclipse.jdt.internal.compiler.ast.MethodDeclaration;
+import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
+import org.eclipse.jdt.internal.compiler.ast.TypeParameter;
+import org.eclipse.jdt.internal.compiler.ast.TypeReference;
+import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
+import org.eclipse.jdt.internal.compiler.impl.Constant;
+import org.eclipse.jdt.internal.compiler.util.SimpleLookupTable;
+import org.eclipse.jdt.internal.compiler.util.Util;
+
+import java.util.Hashtable;
+import java.util.Iterator;
+
+public class SourceTypeBinding extends ReferenceBinding {
+  public ReferenceBinding superclass;
+  public ReferenceBinding[] superInterfaces;
+  private FieldBinding[] fields;
+  private MethodBinding[] methods;
+  public ReferenceBinding[] memberTypes;
+  public TypeVariableBinding[] typeVariables;
+
+  public ClassScope scope;
+
+  // Synthetics are separated into 5 categories: methods, super methods, fields, class literals, changed declaring type bindings and bridge methods
+  // if a new category is added, also increment MAX_SYNTHETICS
+  private final static int METHOD_EMUL = 0;
+  private final static int FIELD_EMUL = 1;
+  private final static int CLASS_LITERAL_EMUL = 2;
+  private final static int RECEIVER_TYPE_EMUL = 3;
+  
+  private final static int MAX_SYNTHETICS = 4;
+
+  HashMap[] synthetics;
+  char[] genericReferenceTypeSignature;
+
+  private SimpleLookupTable storedAnnotations = null; // keys are this ReferenceBinding & its fields and methods, value is an AnnotationHolder
+
+public SourceTypeBinding(char[][] compoundName, PackageBinding fPackage, ClassScope scope) {
+  this.compoundName = compoundName;
+  this.fPackage = fPackage;
+  this.fileName = scope.referenceCompilationUnit().getFileName();
+  this.modifiers = scope.referenceContext.modifiers;
+  this.sourceName = scope.referenceContext.name;
+  this.scope = scope;
+
+  // expect the fields & methods to be initialized correctly later
+  this.fields = Binding.UNINITIALIZED_FIELDS;
+  this.methods = Binding.UNINITIALIZED_METHODS;
+
+  computeId();
+}
+
+private void addDefaultAbstractMethods() {
+  if ((this.tagBits & TagBits.KnowsDefaultAbstractMethods) != 0) return;
+
+  this.tagBits |= TagBits.KnowsDefaultAbstractMethods;
+  if (isClass() && isAbstract()) {
+    if (this.scope.compilerOptions().targetJDK >= ClassFileConstants.JDK1_2)
+      return; // no longer added for post 1.2 targets
+
+    ReferenceBinding[] itsInterfaces = superInterfaces();
+    if (itsInterfaces != Binding.NO_SUPERINTERFACES) {
+      MethodBinding[] defaultAbstracts = null;
+      int defaultAbstractsCount = 0;
+      ReferenceBinding[] interfacesToVisit = itsInterfaces;
+      int nextPosition = interfacesToVisit.length;
+      for (int i = 0; i < nextPosition; i++) {
+        ReferenceBinding superType = interfacesToVisit[i];
+        if (superType.isValidBinding()) {
+          MethodBinding[] superMethods = superType.methods();
+          nextAbstractMethod: for (int m = superMethods.length; --m >= 0;) {
+            MethodBinding method = superMethods[m];
+            // explicitly implemented ?
+            if (implementsMethod(method))
+              continue nextAbstractMethod;
+            if (defaultAbstractsCount == 0) {
+              defaultAbstracts = new MethodBinding[5];
+            } else {
+              // already added as default abstract ?
+              for (int k = 0; k < defaultAbstractsCount; k++) {
+                MethodBinding alreadyAdded = defaultAbstracts[k];
+                if (CharOperation.equals(alreadyAdded.selector, method.selector) && alreadyAdded.areParametersEqual(method))
+                  continue nextAbstractMethod;
+              }
+            }
+            MethodBinding defaultAbstract = new MethodBinding(
+                method.modifiers | ExtraCompilerModifiers.AccDefaultAbstract | ClassFileConstants.AccSynthetic,
+                method.selector,
+                method.returnType,
+                method.parameters,
+                method.thrownExceptions,
+                this);
+            if (defaultAbstractsCount == defaultAbstracts.length)
+              System.arraycopy(defaultAbstracts, 0, defaultAbstracts = new MethodBinding[2 * defaultAbstractsCount], 0, defaultAbstractsCount);
+            defaultAbstracts[defaultAbstractsCount++] = defaultAbstract;
+          }
+
+          if ((itsInterfaces = superType.superInterfaces()) != Binding.NO_SUPERINTERFACES) {
+            int itsLength = itsInterfaces.length;
+            if (nextPosition + itsLength >= interfacesToVisit.length)
+              System.arraycopy(interfacesToVisit, 0, interfacesToVisit = new ReferenceBinding[nextPosition + itsLength + 5], 0, nextPosition);
+            nextInterface : for (int a = 0; a < itsLength; a++) {
+              ReferenceBinding next = itsInterfaces[a];
+              for (int b = 0; b < nextPosition; b++)
+                if (next == interfacesToVisit[b]) continue nextInterface;
+              interfacesToVisit[nextPosition++] = next;
+            }
+          }
+        }
+      }
+      if (defaultAbstractsCount > 0) {
+        int length = this.methods.length;
+        System.arraycopy(this.methods, 0, this.methods = new MethodBinding[length + defaultAbstractsCount], 0, length);
+        System.arraycopy(defaultAbstracts, 0, this.methods, length, defaultAbstractsCount);
+        // re-sort methods
+        length = length + defaultAbstractsCount;
+        if (length > 1)
+          ReferenceBinding.sortMethods(this.methods, 0, length);
+        // this.tagBits |= TagBits.AreMethodsSorted; -- already set in #methods()
+      }
+    }
+  }
+}
+/* Add a new synthetic field for <actualOuterLocalVariable>.
+* Answer the new field or the existing field if one already existed.
+*/
+public FieldBinding addSyntheticFieldForInnerclass(LocalVariableBinding actualOuterLocalVariable) {
+  if (this.synthetics == null)
+    this.synthetics = new HashMap[MAX_SYNTHETICS];
+  if (this.synthetics[SourceTypeBinding.FIELD_EMUL] == null)
+    this.synthetics[SourceTypeBinding.FIELD_EMUL] = new HashMap();
+  
+  FieldBinding synthField = (FieldBinding) this.synthetics[SourceTypeBinding.FIELD_EMUL].get(actualOuterLocalVariable);
+  if (synthField == null) {
+    synthField = new SyntheticFieldBinding(
+      CharOperation.concat(TypeConstants.SYNTHETIC_OUTER_LOCAL_PREFIX, actualOuterLocalVariable.name), 
+      actualOuterLocalVariable.type, 
+      ClassFileConstants.AccPrivate | ClassFileConstants.AccFinal | ClassFileConstants.AccSynthetic, 
+      this, 
+      Constant.NotAConstant,
+      this.synthetics[SourceTypeBinding.FIELD_EMUL].size());
+    this.synthetics[SourceTypeBinding.FIELD_EMUL].put(actualOuterLocalVariable, synthField);
+  }
+
+  // ensure there is not already such a field defined by the user
+  boolean needRecheck;
+  int index = 1;
+  do {
+    needRecheck = false;
+    FieldBinding existingField;
+    if ((existingField = this.getField(synthField.name, true /*resolve*/)) != null) {
+      TypeDeclaration typeDecl = this.scope.referenceContext;
+      for (int i = 0, max = typeDecl.fields.length; i < max; i++) {
+        FieldDeclaration fieldDecl = typeDecl.fields[i];
+        if (fieldDecl.binding == existingField) {
+          synthField.name = CharOperation.concat(
+            TypeConstants.SYNTHETIC_OUTER_LOCAL_PREFIX,
+            actualOuterLocalVariable.name,
+            ("$" + String.valueOf(index++)).toCharArray()); //$NON-NLS-1$
+          needRecheck = true;
+          break;
+        }
+      }
+    }
+  } while (needRecheck);
+  return synthField;
+}
+/* Add a new synthetic field for <enclosingType>.
+* Answer the new field or the existing field if one already existed.
+*/
+public FieldBinding addSyntheticFieldForInnerclass(ReferenceBinding enclosingType) {
+  if (this.synthetics == null)
+    this.synthetics = new HashMap[MAX_SYNTHETICS];
+  if (this.synthetics[SourceTypeBinding.FIELD_EMUL] == null)
+    this.synthetics[SourceTypeBinding.FIELD_EMUL] = new HashMap();
+
+  FieldBinding synthField = (FieldBinding) this.synthetics[SourceTypeBinding.FIELD_EMUL].get(enclosingType);
+  if (synthField == null) {
+    synthField = new SyntheticFieldBinding(
+      CharOperation.concat(
+        TypeConstants.SYNTHETIC_ENCLOSING_INSTANCE_PREFIX,
+        String.valueOf(enclosingType.depth()).toCharArray()),
+      enclosingType,
+      ClassFileConstants.AccDefault | ClassFileConstants.AccFinal | ClassFileConstants.AccSynthetic,
+      this,
+      Constant.NotAConstant,
+      this.synthetics[SourceTypeBinding.FIELD_EMUL].size());
+    this.synthetics[SourceTypeBinding.FIELD_EMUL].put(enclosingType, synthField);
+  }
+  // ensure there is not already such a field defined by the user
+  boolean needRecheck;
+  do {
+    needRecheck = false;
+    FieldBinding existingField;
+    if ((existingField = this.getField(synthField.name, true /*resolve*/)) != null) {
+      TypeDeclaration typeDecl = this.scope.referenceContext;
+      for (int i = 0, max = typeDecl.fields.length; i < max; i++) {
+        FieldDeclaration fieldDecl = typeDecl.fields[i];
+        if (fieldDecl.binding == existingField) {
+          if (this.scope.compilerOptions().complianceLevel >= ClassFileConstants.JDK1_5) {
+            synthField.name = CharOperation.concat(
+              synthField.name,
+              "$".toCharArray()); //$NON-NLS-1$
+            needRecheck = true;
+          } else {
+            this.scope.problemReporter().duplicateFieldInType(this, fieldDecl);
+          }
+          break;
+        }
+      }
+    }
+  } while (needRecheck);
+  return synthField;
+}
+/* Add a new synthetic field for a class literal access.
+* Answer the new field or the existing field if one already existed.
+*/
+public FieldBinding addSyntheticFieldForClassLiteral(TypeBinding targetType, BlockScope blockScope) {
+  if (this.synthetics == null)
+    this.synthetics = new HashMap[MAX_SYNTHETICS];
+  if (this.synthetics[SourceTypeBinding.CLASS_LITERAL_EMUL] == null)
+    this.synthetics[SourceTypeBinding.CLASS_LITERAL_EMUL] = new HashMap();
+
+  // use a different table than FIELDS, given there might be a collision between emulation of X.this$0 and X.class.
+  FieldBinding synthField = (FieldBinding) this.synthetics[SourceTypeBinding.CLASS_LITERAL_EMUL].get(targetType);
+  if (synthField == null) {
+    synthField = new SyntheticFieldBinding(
+      CharOperation.concat(
+        TypeConstants.SYNTHETIC_CLASS,
+        String.valueOf(this.synthetics[SourceTypeBinding.CLASS_LITERAL_EMUL].size()).toCharArray()),
+      blockScope.getJavaLangClass(),
+      ClassFileConstants.AccDefault | ClassFileConstants.AccStatic | ClassFileConstants.AccSynthetic,
+      this,
+      Constant.NotAConstant,
+      this.synthetics[SourceTypeBinding.CLASS_LITERAL_EMUL].size());
+    this.synthetics[SourceTypeBinding.CLASS_LITERAL_EMUL].put(targetType, synthField);
+  }
+  // ensure there is not already such a field defined by the user
+  FieldBinding existingField;
+  if ((existingField = this.getField(synthField.name, true /*resolve*/)) != null) {
+    TypeDeclaration typeDecl = blockScope.referenceType();
+    for (int i = 0, max = typeDecl.fields.length; i < max; i++) {
+      FieldDeclaration fieldDecl = typeDecl.fields[i];
+      if (fieldDecl.binding == existingField) {
+        blockScope.problemReporter().duplicateFieldInType(this, fieldDecl);
+        break;
+      }
+    }
+  }   
+  return synthField;
+}
+/* Add a new synthetic field for the emulation of the assert statement.
+* Answer the new field or the existing field if one already existed.
+*/
+public FieldBinding addSyntheticFieldForAssert(BlockScope blockScope) {
+  if (this.synthetics == null)
+    this.synthetics = new HashMap[MAX_SYNTHETICS];
+  if (this.synthetics[SourceTypeBinding.FIELD_EMUL] == null)
+    this.synthetics[SourceTypeBinding.FIELD_EMUL] = new HashMap();
+
+  FieldBinding synthField = (FieldBinding) this.synthetics[SourceTypeBinding.FIELD_EMUL].get("assertionEmulation"); //$NON-NLS-1$
+  if (synthField == null) {
+    synthField = new SyntheticFieldBinding(
+      TypeConstants.SYNTHETIC_ASSERT_DISABLED,
+      TypeBinding.BOOLEAN,
+      ClassFileConstants.AccDefault | ClassFileConstants.AccStatic | ClassFileConstants.AccSynthetic | ClassFileConstants.AccFinal,
+      this,
+      Constant.NotAConstant,
+      this.synthetics[SourceTypeBinding.FIELD_EMUL].size());
+    this.synthetics[SourceTypeBinding.FIELD_EMUL].put("assertionEmulation", synthField); //$NON-NLS-1$
+  }
+  // ensure there is not already such a field defined by the user
+  // ensure there is not already such a field defined by the user
+  boolean needRecheck;
+  int index = 0;
+  do {
+    needRecheck = false;
+    FieldBinding existingField;
+    if ((existingField = this.getField(synthField.name, true /*resolve*/)) != null) {
+      TypeDeclaration typeDecl = this.scope.referenceContext;
+      for (int i = 0, max = typeDecl.fields.length; i < max; i++) {
+        FieldDeclaration fieldDecl = typeDecl.fields[i];
+        if (fieldDecl.binding == existingField) {
+          synthField.name = CharOperation.concat(
+            TypeConstants.SYNTHETIC_ASSERT_DISABLED,
+            ("_" + String.valueOf(index++)).toCharArray()); //$NON-NLS-1$
+          needRecheck = true;
+          break;
+        }
+      }
+    }
+  } while (needRecheck);
+  return synthField;
+}
+/* Add a new synthetic field for recording all enum constant values
+* Answer the new field or the existing field if one already existed.
+*/
+public FieldBinding addSyntheticFieldForEnumValues() {
+  if (this.synthetics == null)
+    this.synthetics = new HashMap[MAX_SYNTHETICS];
+  if (this.synthetics[SourceTypeBinding.FIELD_EMUL] == null)
+    this.synthetics[SourceTypeBinding.FIELD_EMUL] = new HashMap();
+
+  FieldBinding synthField = (FieldBinding) this.synthetics[SourceTypeBinding.FIELD_EMUL].get("enumConstantValues"); //$NON-NLS-1$
+  if (synthField == null) {
+    synthField = new SyntheticFieldBinding(
+      TypeConstants.SYNTHETIC_ENUM_VALUES,
+      this.scope.createArrayType(this,1),
+      ClassFileConstants.AccPrivate | ClassFileConstants.AccStatic | ClassFileConstants.AccSynthetic | ClassFileConstants.AccFinal,
+      this,
+      Constant.NotAConstant,
+      this.synthetics[SourceTypeBinding.FIELD_EMUL].size());
+    this.synthetics[SourceTypeBinding.FIELD_EMUL].put("enumConstantValues", synthField); //$NON-NLS-1$
+  }
+  // ensure there is not already such a field defined by the user
+  // ensure there is not already such a field defined by the user
+  boolean needRecheck;
+  int index = 0;
+  do {
+    needRecheck = false;
+    FieldBinding existingField;
+    if ((existingField = this.getField(synthField.name, true /*resolve*/)) != null) {
+      TypeDeclaration typeDecl = this.scope.referenceContext;
+      for (int i = 0, max = typeDecl.fields.length; i < max; i++) {
+        FieldDeclaration fieldDecl = typeDecl.fields[i];
+        if (fieldDecl.binding == existingField) {
+          synthField.name = CharOperation.concat(
+            TypeConstants.SYNTHETIC_ENUM_VALUES,
+            ("_" + String.valueOf(index++)).toCharArray()); //$NON-NLS-1$
+          needRecheck = true;
+          break;
+        }
+      }
+    }
+  } while (needRecheck);
+  return synthField;
+}
+/* Add a new synthetic access method for read/write access to <targetField>.
+  Answer the new method or the existing method if one already existed.
+*/
+public SyntheticMethodBinding addSyntheticMethod(FieldBinding targetField, boolean isReadAccess) {
+  if (this.synthetics == null)
+    this.synthetics = new HashMap[MAX_SYNTHETICS];
+  if (this.synthetics[SourceTypeBinding.METHOD_EMUL] == null)
+    this.synthetics[SourceTypeBinding.METHOD_EMUL] = new HashMap();
+
+  SyntheticMethodBinding accessMethod = null;
+  SyntheticMethodBinding[] accessors = (SyntheticMethodBinding[]) this.synthetics[SourceTypeBinding.METHOD_EMUL].get(targetField);
+  if (accessors == null) {
+    accessMethod = new SyntheticMethodBinding(targetField, isReadAccess, this);
+    this.synthetics[SourceTypeBinding.METHOD_EMUL].put(targetField, accessors = new SyntheticMethodBinding[2]);
+    accessors[isReadAccess ? 0 : 1] = accessMethod;   
+  } else {
+    if ((accessMethod = accessors[isReadAccess ? 0 : 1]) == null) {
+      accessMethod = new SyntheticMethodBinding(targetField, isReadAccess, this);
+      accessors[isReadAccess ? 0 : 1] = accessMethod;
+    }
+  }
+  return accessMethod;
+}
+/* Add a new synthetic method the enum type. Selector can either be 'values' or 'valueOf'.
+ * char[] constants from TypeConstants must be used: TypeConstants.VALUES/VALUEOF
+*/
+public SyntheticMethodBinding addSyntheticEnumMethod(char[] selector) {
+  if (this.synthetics == null)
+    this.synthetics = new HashMap[MAX_SYNTHETICS];
+  if (this.synthetics[SourceTypeBinding.METHOD_EMUL] == null)
+    this.synthetics[SourceTypeBinding.METHOD_EMUL] = new HashMap();
+
+  SyntheticMethodBinding accessMethod = null;
+  SyntheticMethodBinding[] accessors = (SyntheticMethodBinding[]) this.synthetics[SourceTypeBinding.METHOD_EMUL].get(selector);
+  if (accessors == null) {
+    accessMethod = new SyntheticMethodBinding(this, selector);
+    this.synthetics[SourceTypeBinding.METHOD_EMUL].put(selector, accessors = new SyntheticMethodBinding[2]);
+    accessors[0] = accessMethod;    
+  } else {
+    if ((accessMethod = accessors[0]) == null) {
+      accessMethod = new SyntheticMethodBinding(this, selector);
+      accessors[0] = accessMethod;
+    }
+  }
+  return accessMethod;
+}
+/*
+ * Add a synthetic field to handle the cache of the switch translation table for the corresponding enum type 
+ */
+public SyntheticFieldBinding addSyntheticFieldForSwitchEnum(char[] fieldName, String key) {
+  if (this.synthetics == null)
+    this.synthetics = new HashMap[MAX_SYNTHETICS];
+  if (this.synthetics[SourceTypeBinding.FIELD_EMUL] == null)
+    this.synthetics[SourceTypeBinding.FIELD_EMUL] = new HashMap();
+
+  SyntheticFieldBinding synthField = (SyntheticFieldBinding) this.synthetics[SourceTypeBinding.FIELD_EMUL].get(key);
+  if (synthField == null) {
+    synthField = new SyntheticFieldBinding(
+      fieldName,
+      this.scope.createArrayType(TypeBinding.INT,1),
+      ClassFileConstants.AccPrivate | ClassFileConstants.AccStatic | ClassFileConstants.AccSynthetic,
+      this,
+      Constant.NotAConstant,
+      this.synthetics[SourceTypeBinding.FIELD_EMUL].size());
+    this.synthetics[SourceTypeBinding.FIELD_EMUL].put(key, synthField);
+  }
+  // ensure there is not already such a field defined by the user
+  boolean needRecheck;
+  int index = 0;
+  do {
+    needRecheck = false;
+    FieldBinding existingField;
+    if ((existingField = this.getField(synthField.name, true /*resolve*/)) != null) {
+      TypeDeclaration typeDecl = this.scope.referenceContext;
+      for (int i = 0, max = typeDecl.fields.length; i < max; i++) {
+        FieldDeclaration fieldDecl = typeDecl.fields[i];
+        if (fieldDecl.binding == existingField) {
+          synthField.name = CharOperation.concat(
+            fieldName,
+            ("_" + String.valueOf(index++)).toCharArray()); //$NON-NLS-1$
+          needRecheck = true;
+          break;
+        }
+      }
+    }
+  } while (needRecheck);
+  return synthField;
+}
+/* Add a new synthetic method the enum type. Selector can either be 'values' or 'valueOf'.
+ * char[] constants from TypeConstants must be used: TypeConstants.VALUES/VALUEOF
+*/
+public SyntheticMethodBinding addSyntheticMethodForSwitchEnum(TypeBinding enumBinding) {
+  if (this.synthetics == null)
+    this.synthetics = new HashMap[MAX_SYNTHETICS];
+  if (this.synthetics[SourceTypeBinding.METHOD_EMUL] == null)
+    this.synthetics[SourceTypeBinding.METHOD_EMUL] = new HashMap();
+
+  SyntheticMethodBinding accessMethod = null;
+  char[] selector = CharOperation.concat(TypeConstants.SYNTHETIC_SWITCH_ENUM_TABLE, enumBinding.constantPoolName());
+  CharOperation.replace(selector, '/', '$');
+  final String key = new String(selector);
+  SyntheticMethodBinding[] accessors = (SyntheticMethodBinding[]) this.synthetics[SourceTypeBinding.METHOD_EMUL].get(key);
+  // first add the corresponding synthetic field
+  if (accessors == null) {
+    // then create the synthetic method
+    final SyntheticFieldBinding fieldBinding = this.addSyntheticFieldForSwitchEnum(selector, key);
+    accessMethod = new SyntheticMethodBinding(fieldBinding, this, enumBinding, selector);
+    this.synthetics[SourceTypeBinding.METHOD_EMUL].put(key, accessors = new SyntheticMethodBinding[2]);
+    accessors[0] = accessMethod;
+  } else {
+    if ((accessMethod = accessors[0]) == null) {
+      final SyntheticFieldBinding fieldBinding = this.addSyntheticFieldForSwitchEnum(selector, key);
+      accessMethod = new SyntheticMethodBinding(fieldBinding, this, enumBinding, selector);
+      accessors[0] = accessMethod;
+    }
+  }
+  return accessMethod;
+}
+/* Add a new synthetic access method for access to <targetMethod>.
+ * Must distinguish access method used for super access from others (need to use invokespecial bytecode)
+  Answer the new method or the existing method if one already existed.
+*/
+public SyntheticMethodBinding addSyntheticMethod(MethodBinding targetMethod, boolean isSuperAccess) {
+  if (this.synthetics == null)
+    this.synthetics = new HashMap[MAX_SYNTHETICS];
+  if (this.synthetics[SourceTypeBinding.METHOD_EMUL] == null)
+    this.synthetics[SourceTypeBinding.METHOD_EMUL] = new HashMap();
+
+  SyntheticMethodBinding accessMethod = null;
+  SyntheticMethodBinding[] accessors = (SyntheticMethodBinding[]) this.synthetics[SourceTypeBinding.METHOD_EMUL].get(targetMethod);
+  if (accessors == null) {
+    accessMethod = new SyntheticMethodBinding(targetMethod, isSuperAccess, this);
+    this.synthetics[SourceTypeBinding.METHOD_EMUL].put(targetMethod, accessors = new SyntheticMethodBinding[2]);
+    accessors[isSuperAccess ? 0 : 1] = accessMethod;    
+  } else {
+    if ((accessMethod = accessors[isSuperAccess ? 0 : 1]) == null) {
+      accessMethod = new SyntheticMethodBinding(targetMethod, isSuperAccess, this);
+      accessors[isSuperAccess ? 0 : 1] = accessMethod;
+    }
+  }
+  return accessMethod;
+}
+/* 
+ * Record the fact that bridge methods need to be generated to override certain inherited methods
+ */
+public SyntheticMethodBinding addSyntheticBridgeMethod(MethodBinding inheritedMethodToBridge, MethodBinding targetMethod) {
+  if (isInterface()) return null; // only classes & enums get bridge methods
+  // targetMethod may be inherited
+  if (inheritedMethodToBridge.returnType.erasure() == targetMethod.returnType.erasure()
+    && inheritedMethodToBridge.areParameterErasuresEqual(targetMethod)) {
+      return null; // do not need bridge method
+  }
+  if (this.synthetics == null)
+    this.synthetics = new HashMap[MAX_SYNTHETICS];
+  if (this.synthetics[SourceTypeBinding.METHOD_EMUL] == null) {
+    this.synthetics[SourceTypeBinding.METHOD_EMUL] = new HashMap();
+  } else {
+    // check to see if there is another equivalent inheritedMethod already added
+    Iterator synthMethods = this.synthetics[SourceTypeBinding.METHOD_EMUL].keySet().iterator();
+    while (synthMethods.hasNext()) {
+      Object synthetic = synthMethods.next();
+      if (synthetic instanceof MethodBinding) {
+        MethodBinding method = (MethodBinding) synthetic;
+        if (CharOperation.equals(inheritedMethodToBridge.selector, method.selector)
+          && inheritedMethodToBridge.returnType.erasure() == method.returnType.erasure()
+          && inheritedMethodToBridge.areParameterErasuresEqual(method)) {
+            return null;
+        }
+      }
+    }
+  }
+
+  SyntheticMethodBinding accessMethod = null;
+  SyntheticMethodBinding[] accessors = (SyntheticMethodBinding[]) this.synthetics[SourceTypeBinding.METHOD_EMUL].get(inheritedMethodToBridge);
+  if (accessors == null) {
+    accessMethod = new SyntheticMethodBinding(inheritedMethodToBridge, targetMethod, this);
+    this.synthetics[SourceTypeBinding.METHOD_EMUL].put(inheritedMethodToBridge, accessors = new SyntheticMethodBinding[2]);
+    accessors[1] = accessMethod;    
+  } else {
+    if ((accessMethod = accessors[1]) == null) {
+      accessMethod = new SyntheticMethodBinding(inheritedMethodToBridge, targetMethod, this);
+      accessors[1] = accessMethod;
+    }
+  }
+  return accessMethod;
+}
+boolean areFieldsInitialized() {
+  return this.fields != Binding.UNINITIALIZED_FIELDS;
+}
+boolean areMethodsInitialized() {
+  return this.methods != Binding.UNINITIALIZED_METHODS;
+}
+public int kind() {
+  if (this.typeVariables != Binding.NO_TYPE_VARIABLES) return Binding.GENERIC_TYPE;
+  return Binding.TYPE;
+}
+
+public char[] computeUniqueKey(boolean isLeaf) {
+  char[] uniqueKey = super.computeUniqueKey(isLeaf);
+  if (uniqueKey.length == 2) return uniqueKey; // problem type's unique key is "L;"
+  if (Util.isClassFileName(this.fileName)) return uniqueKey; // no need to insert compilation unit name for a .class file
+  
+  // insert compilation unit name if the type name is not the main type name
+  int end = CharOperation.lastIndexOf('.', this.fileName);
+  if (end != -1) {
+    int start = CharOperation.lastIndexOf('/', this.fileName) + 1;
+    char[] mainTypeName = CharOperation.subarray(this.fileName, start, end);
+    start = CharOperation.lastIndexOf('/', uniqueKey) + 1;
+    if (start == 0)
+      start = 1; // start after L
+    end = CharOperation.indexOf('$', uniqueKey, start);
+    if (end == -1)
+      end = CharOperation.indexOf('<', uniqueKey, start);
+    if (end == -1)
+      end = CharOperation.indexOf(';', uniqueKey, start);
+    char[] topLevelType = CharOperation.subarray(uniqueKey, start, end);
+    if (!CharOperation.equals(topLevelType, mainTypeName)) {
+      StringBuffer buffer = new StringBuffer();
+      buffer.append(uniqueKey, 0, start);
+      buffer.append(mainTypeName);
+      buffer.append('~');
+      buffer.append(topLevelType);
+      buffer.append(uniqueKey, end, uniqueKey.length - end);
+      int length = buffer.length();
+      uniqueKey = new char[length];
+      buffer.getChars(0, length, uniqueKey, 0);
+      return uniqueKey;
+    }
+  }
+  return uniqueKey;
+}
+
+void faultInTypesForFieldsAndMethods() {
+  // check @Deprecated annotation
+  getAnnotationTagBits(); // marks as deprecated by side effect
+  ReferenceBinding enclosingType = this.enclosingType();
+  if (enclosingType != null && enclosingType.isViewedAsDeprecated() && !this.isDeprecated())
+    this.modifiers |= ExtraCompilerModifiers.AccDeprecatedImplicitly;
+  fields();
+  methods();
+
+  for (int i = 0, length = this.memberTypes.length; i < length; i++)
+    ((SourceTypeBinding) this.memberTypes[i]).faultInTypesForFieldsAndMethods();
+}
+// NOTE: the type of each field of a source type is resolved when needed
+public FieldBinding[] fields() {
+  if ((this.tagBits & TagBits.AreFieldsComplete) != 0)
+    return this.fields; 
+
+  int failed = 0;
+  FieldBinding[] resolvedFields = this.fields;
+  try {
+    // lazily sort fields
+    if ((this.tagBits & TagBits.AreFieldsSorted) == 0) {
+      int length = this.fields.length;
+      if (length > 1)
+        ReferenceBinding.sortFields(this.fields, 0, length);
+      this.tagBits |= TagBits.AreFieldsSorted;
+    }
+    for (int i = 0, length = this.fields.length; i < length; i++) {
+      if (resolveTypeFor(this.fields[i]) == null) {
+        // do not alter original field array until resolution is over, due to reentrance (143259)
+        if (resolvedFields == this.fields) {
+          System.arraycopy(this.fields, 0, resolvedFields = new FieldBinding[length], 0, length);
+        }
+        resolvedFields[i] = null;
+        failed++;
+      }
+    }
+  } finally {
+    if (failed > 0) {
+      // ensure fields are consistent reqardless of the error
+      int newSize = resolvedFields.length - failed;
+      if (newSize == 0)
+        return this.fields = Binding.NO_FIELDS;
+
+      FieldBinding[] newFields = new FieldBinding[newSize];
+      for (int i = 0, j = 0, length = resolvedFields.length; i < length; i++) {
+        if (resolvedFields[i] != null)
+          newFields[j++] = resolvedFields[i];
+      }
+      this.fields = newFields;
+    }
+  }
+  this.tagBits |= TagBits.AreFieldsComplete;
+  return this.fields;
+}
+/**
+ * @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#genericTypeSignature()
+ */
+public char[] genericTypeSignature() {
+    if (this.genericReferenceTypeSignature == null)
+      this.genericReferenceTypeSignature = computeGenericTypeSignature(this.typeVariables);
+    return this.genericReferenceTypeSignature;
+}
+/**
+ * <param1 ... paramN>superclass superinterface1 ... superinterfaceN
+ * <T:LY<TT;>;U:Ljava/lang/Object;V::Ljava/lang/Runnable;:Ljava/lang/Cloneable;:Ljava/util/Map;>Ljava/lang/Exception;Ljava/lang/Runnable;
+ */
+public char[] genericSignature() {
+    StringBuffer sig = null;
+  if (this.typeVariables != Binding.NO_TYPE_VARIABLES) {
+      sig = new StringBuffer(10);
+      sig.append('<');
+      for (int i = 0, length = this.typeVariables.length; i < length; i++)
+          sig.append(this.typeVariables[i].genericSignature());
+      sig.append('>');
+  } else {
+      // could still need a signature if any of supertypes is parameterized
+      noSignature: if (this.superclass == null || !this.superclass.isParameterizedType()) {
+        for (int i = 0, length = this.superInterfaces.length; i < length; i++)
+            if (this.superInterfaces[i].isParameterizedType())
+          break noSignature;
+          return null;
+      }
+      sig = new StringBuffer(10);
+  }
+  if (this.superclass != null)
+    sig.append(this.superclass.genericTypeSignature());
+  else // interface scenario only (as Object cannot be generic) - 65953
+    sig.append(this.scope.getJavaLangObject().genericTypeSignature());
+    for (int i = 0, length = this.superInterfaces.length; i < length; i++)
+        sig.append(this.superInterfaces[i].genericTypeSignature());
+  return sig.toString().toCharArray();
+}
+
+/**
+ * Compute the tagbits for standard annotations. For source types, these could require
+ * lazily resolving corresponding annotation nodes, in case of forward references.
+ * @see org.eclipse.jdt.internal.compiler.lookup.Binding#getAnnotationTagBits()
+ */
+public long getAnnotationTagBits() {
+  if ((this.tagBits & TagBits.AnnotationResolved) == 0 && this.scope != null) {
+    TypeDeclaration typeDecl = this.scope.referenceContext;
+    boolean old = typeDecl.staticInitializerScope.insideTypeAnnotation;
+    try {
+      typeDecl.staticInitializerScope.insideTypeAnnotation = true;
+      ASTNode.resolveAnnotations(typeDecl.staticInitializerScope, typeDecl.annotations, this);
+    } finally {
+      typeDecl.staticInitializerScope.insideTypeAnnotation = old;
+    }
+    if ((this.tagBits & TagBits.AnnotationDeprecated) != 0)
+      this.modifiers |= ClassFileConstants.AccDeprecated;
+  }
+  return this.tagBits;
+}
+public MethodBinding[] getDefaultAbstractMethods() {
+  int count = 0;
+  for (int i = this.methods.length; --i >= 0;)
+    if (this.methods[i].isDefaultAbstract())
+      count++;
+  if (count == 0) return Binding.NO_METHODS;
+
+  MethodBinding[] result = new MethodBinding[count];
+  count = 0;
+  for (int i = this.methods.length; --i >= 0;)
+    if (this.methods[i].isDefaultAbstract())
+      result[count++] = this.methods[i];
+  return result;
+}
+// NOTE: the return type, arg & exception types of each method of a source type are resolved when needed
+public MethodBinding getExactConstructor(TypeBinding[] argumentTypes) {
+  int argCount = argumentTypes.length;
+  if ((this.tagBits & TagBits.AreMethodsComplete) != 0) { // have resolved all arg types & return type of the methods
+    long range;
+    if ((range = ReferenceBinding.binarySearch(TypeConstants.INIT, this.methods)) >= 0) {
+      nextMethod: for (int imethod = (int)range, end = (int)(range >> 32); imethod <= end; imethod++) {
+        MethodBinding method = this.methods[imethod];
+        if (method.parameters.length == argCount) {
+          TypeBinding[] toMatch = method.parameters;
+          for (int iarg = 0; iarg < argCount; iarg++)
+            if (toMatch[iarg] != argumentTypes[iarg])
+              continue nextMethod;
+          return method;
+        }
+      }
+    }
+  } else {
+    // lazily sort methods
+    if ((this.tagBits & TagBits.AreMethodsSorted) == 0) {
+      int length = this.methods.length;
+      if (length > 1)
+        ReferenceBinding.sortMethods(this.methods, 0, length);
+      this.tagBits |= TagBits.AreMethodsSorted;
+    }   
+    long range;
+    if ((range = ReferenceBinding.binarySearch(TypeConstants.INIT, this.methods)) >= 0) {
+      nextMethod: for (int imethod = (int)range, end = (int)(range >> 32); imethod <= end; imethod++) {
+        MethodBinding method = this.methods[imethod];
+        if (resolveTypesFor(method) == null || method.returnType == null) {
+          methods();
+          return getExactConstructor(argumentTypes);  // try again since the problem methods have been removed
+        }
+        if (method.parameters.length == argCount) {
+          TypeBinding[] toMatch = method.parameters;
+          for (int iarg = 0; iarg < argCount; iarg++)
+            if (toMatch[iarg] != argumentTypes[iarg])
+              continue nextMethod;
+          return method;
+        }
+      }
+    }
+  } 
+  return null;
+}
+
+//NOTE: the return type, arg & exception types of each method of a source type are resolved when needed
+//searches up the hierarchy as long as no potential (but not exact) match was found.
+public MethodBinding getExactMethod(char[] selector, TypeBinding[] argumentTypes, CompilationUnitScope refScope) {
+  // sender from refScope calls recordTypeReference(this)
+  int argCount = argumentTypes.length;
+  boolean foundNothing = true;
+
+  if ((this.tagBits & TagBits.AreMethodsComplete) != 0) { // have resolved all arg types & return type of the methods
+    long range;
+    if ((range = ReferenceBinding.binarySearch(selector, this.methods)) >= 0) {
+      nextMethod: for (int imethod = (int)range, end = (int)(range >> 32); imethod <= end; imethod++) {
+        MethodBinding method = this.methods[imethod];
+        foundNothing = false; // inner type lookups must know that a method with this name exists
+        if (method.parameters.length == argCount) {
+          TypeBinding[] toMatch = method.parameters;
+          for (int iarg = 0; iarg < argCount; iarg++)
+            if (toMatch[iarg] != argumentTypes[iarg])
+              continue nextMethod;
+          return method;
+        }
+      }
+    }
+  } else {
+    // lazily sort methods
+    if ((this.tagBits & TagBits.AreMethodsSorted) == 0) {
+      int length = this.methods.length;
+      if (length > 1)
+        ReferenceBinding.sortMethods(this.methods, 0, length);
+      this.tagBits |= TagBits.AreMethodsSorted;
+    }
+    
+    long range;
+    if ((range = ReferenceBinding.binarySearch(selector, this.methods)) >= 0) {
+      // check unresolved method
+      int start = (int) range, end = (int) (range >> 32);
+      for (int imethod = start; imethod <= end; imethod++) {
+        MethodBinding method = this.methods[imethod];     
+        if (resolveTypesFor(method) == null || method.returnType == null) {
+          methods();
+          return getExactMethod(selector, argumentTypes, refScope); // try again since the problem methods have been removed
+        }
+      }
+      // check dup collisions
+      boolean isSource15 = this.scope.compilerOptions().sourceLevel >= ClassFileConstants.JDK1_5;
+      for (int i = start; i <= end; i++) {
+        MethodBinding method1 = this.methods[i];
+        for (int j = end; j > i; j--) {
+          MethodBinding method2 = this.methods[j];
+          boolean paramsMatch = isSource15
+            ? method1.areParameterErasuresEqual(method2)
+            : method1.areParametersEqual(method2);
+          if (paramsMatch) {
+            methods();
+            return getExactMethod(selector, argumentTypes, refScope); // try again since the problem methods have been removed
+          }
+        }
+      }
+      nextMethod: for (int imethod = start; imethod <= end; imethod++) {
+        MethodBinding method = this.methods[imethod];           
+        TypeBinding[] toMatch = method.parameters;
+        if (toMatch.length == argCount) {
+          for (int iarg = 0; iarg < argCount; iarg++)
+            if (toMatch[iarg] != argumentTypes[iarg])
+              continue nextMethod;
+          return method;
+        }
+      }       
+    }
+  }
+
+  if (foundNothing) {
+    if (isInterface()) {
+       if (this.superInterfaces.length == 1) {
+        if (refScope != null)
+          refScope.recordTypeReference(this.superInterfaces[0]);
+        return this.superInterfaces[0].getExactMethod(selector, argumentTypes, refScope);
+       }
+    } else if (this.superclass != null) {
+      if (refScope != null)
+        refScope.recordTypeReference(this.superclass);
+      return this.superclass.getExactMethod(selector, argumentTypes, refScope);
+    }
+  }
+  return null;
+}
+
+//NOTE: the type of a field of a source type is resolved when needed
+public FieldBinding getField(char[] fieldName, boolean needResolve) {
+  
+  if ((this.tagBits & TagBits.AreFieldsComplete) != 0)
+    return ReferenceBinding.binarySearch(fieldName, this.fields);
+
+  // lazily sort fields
+  if ((this.tagBits & TagBits.AreFieldsSorted) == 0) {
+    int length = this.fields.length;
+    if (length > 1)
+      ReferenceBinding.sortFields(this.fields, 0, length);
+    this.tagBits |= TagBits.AreFieldsSorted;
+  }   
+  // always resolve anyway on source types
+  FieldBinding field = ReferenceBinding.binarySearch(fieldName, this.fields);
+  if (field != null) {
+    FieldBinding result = null;
+    try {
+      result = resolveTypeFor(field);
+      return result;
+    } finally {
+      if (result == null) {
+        // ensure fields are consistent reqardless of the error
+        int newSize = this.fields.length - 1;
+        if (newSize == 0) {
+          this.fields = Binding.NO_FIELDS;
+        } else {
+          FieldBinding[] newFields = new FieldBinding[newSize];
+          int index = 0;
+          for (int i = 0, length = this.fields.length; i < length; i++) {
+            FieldBinding f = this.fields[i];
+            if (f == field) continue;
+            newFields[index++] = f;
+          }
+          this.fields = newFields;
+        }
+      }
+    }
+  }
+  return null;
+}
+
+// NOTE: the return type, arg & exception types of each method of a source type are resolved when needed
+public MethodBinding[] getMethods(char[] selector) {
+  if ((this.tagBits & TagBits.AreMethodsComplete) != 0) {
+    long range;
+    if ((range = ReferenceBinding.binarySearch(selector, this.methods)) >= 0) {
+      int start = (int) range, end = (int) (range >> 32);
+      int length = end - start + 1;
+      MethodBinding[] result;
+      System.arraycopy(this.methods, start, result = new MethodBinding[length], 0, length);
+      return result;
+    } else {
+      return Binding.NO_METHODS;      
+    }
+  }
+  // lazily sort methods
+  if ((this.tagBits & TagBits.AreMethodsSorted) == 0) {
+    int length = this.methods.length;
+    if (length > 1)
+      ReferenceBinding.sortMethods(this.methods, 0, length);
+    this.tagBits |= TagBits.AreMethodsSorted;
+  }
+  MethodBinding[] result; 
+  long range;
+  if ((range = ReferenceBinding.binarySearch(selector, this.methods)) >= 0) {
+    int start = (int) range, end = (int) (range >> 32);
+    for (int i = start; i <= end; i++) {
+      MethodBinding method = this.methods[i];
+      if (resolveTypesFor(method) == null || method.returnType == null) {
+        methods();
+        return getMethods(selector); // try again since the problem methods have been removed
+      }
+    }
+    int length = end - start + 1;
+    System.arraycopy(this.methods, start, result = new MethodBinding[length], 0, length);
+  } else {
+    return Binding.NO_METHODS;
+  }
+  boolean isSource15 = this.scope.compilerOptions().sourceLevel >= ClassFileConstants.JDK1_5;
+  for (int i = 0, length = result.length - 1; i < length; i++) {
+    MethodBinding method = result[i];
+    for (int j = length; j > i; j--) {
+      boolean paramsMatch = isSource15
+        ? method.areParameterErasuresEqual(result[j])
+        : method.areParametersEqual(result[j]);
+      if (paramsMatch) {
+        methods();
+        return getMethods(selector); // try again since the duplicate methods have been removed
+      }
+    }
+  }
+  return result;
+}
+/* Answer the synthetic field for <actualOuterLocalVariable>
+* or null if one does not exist.
+*/
+public FieldBinding getSyntheticField(LocalVariableBinding actualOuterLocalVariable) {
+  if (this.synthetics == null || this.synthetics[SourceTypeBinding.FIELD_EMUL] == null) return null;
+  return (FieldBinding) this.synthetics[SourceTypeBinding.FIELD_EMUL].get(actualOuterLocalVariable);
+}
+/* Answer the synthetic field for <targetEnclosingType>
+* or null if one does not exist.
+*/
+public FieldBinding getSyntheticField(ReferenceBinding targetEnclosingType, boolean onlyExactMatch) {
+
+  if (this.synthetics == null || this.synthetics[SourceTypeBinding.FIELD_EMUL] == null) return null;
+  FieldBinding field = (FieldBinding) this.synthetics[SourceTypeBinding.FIELD_EMUL].get(targetEnclosingType);
+  if (field != null) return field;
+
+  // type compatibility : to handle cases such as
+  // class T { class M{}}
+  // class S extends T { class N extends M {}} --> need to use S as a default enclosing instance for the super constructor call in N().
+  if (!onlyExactMatch){
+    Iterator accessFields = this.synthetics[SourceTypeBinding.FIELD_EMUL].values().iterator();
+    while (accessFields.hasNext()) {
+      field = (FieldBinding) accessFields.next();
+      if (CharOperation.prefixEquals(TypeConstants.SYNTHETIC_ENCLOSING_INSTANCE_PREFIX, field.name)
+        && field.type.findSuperTypeOriginatingFrom(targetEnclosingType) != null)
+          return field;
+    }
+  }
+  return null;
+}
+/* 
+ * Answer the bridge method associated for an  inherited methods or null if one does not exist
+ */
+public SyntheticMethodBinding getSyntheticBridgeMethod(MethodBinding inheritedMethodToBridge) {
+  if (this.synthetics == null) return null;
+  if (this.synthetics[SourceTypeBinding.METHOD_EMUL] == null) return null;
+  SyntheticMethodBinding[] accessors = (SyntheticMethodBinding[]) this.synthetics[SourceTypeBinding.METHOD_EMUL].get(inheritedMethodToBridge);
+  if (accessors == null) return null;
+  return accessors[1];
+}
+
+/**
+ * @see org.eclipse.jdt.internal.compiler.lookup.Binding#initializeDeprecatedAnnotationTagBits()
+ */
+public void initializeDeprecatedAnnotationTagBits() {
+  if ((this.tagBits & TagBits.DeprecatedAnnotationResolved) == 0) {
+    TypeDeclaration typeDecl = this.scope.referenceContext;
+    boolean old = typeDecl.staticInitializerScope.insideTypeAnnotation;
+    try {
+      typeDecl.staticInitializerScope.insideTypeAnnotation = true;
+      ASTNode.resolveDeprecatedAnnotations(typeDecl.staticInitializerScope, typeDecl.annotations, this);
+      this.tagBits |= TagBits.DeprecatedAnnotationResolved;
+    } finally {
+      typeDecl.staticInitializerScope.insideTypeAnnotation = old;
+    }
+    if ((this.tagBits & TagBits.AnnotationDeprecated) != 0) {
+      this.modifiers |= ClassFileConstants.AccDeprecated;
+    }
+  }
+}
+
+// ensure the receiver knows its hierarchy & fields/methods so static imports can be resolved correctly
+// see bug 230026
+void initializeForStaticImports() {
+  if (this.scope == null) return; // already initialized
+
+  if (this.superInterfaces == null)
+    this.scope.connectTypeHierarchy();
+  this.scope.buildFields();
+  this.scope.buildMethods();
+}
+
+/**
+ * Returns true if a type is identical to another one,
+ * or for generic types, true if compared to its raw type.
+ */
+public boolean isEquivalentTo(TypeBinding otherType) {
+
+  if (this == otherType) return true;
+  if (otherType == null) return false;
+  switch(otherType.kind()) {
+
+    case Binding.WILDCARD_TYPE :
+    case Binding.INTERSECTION_TYPE:
+      return ((WildcardBinding) otherType).boundCheck(this);
+
+    case Binding.PARAMETERIZED_TYPE :
+      if ((otherType.tagBits & TagBits.HasDirectWildcard) == 0 && (!this.isMemberType() || !otherType.isMemberType())) 
+        return false; // should have been identical
+      ParameterizedTypeBinding otherParamType = (ParameterizedTypeBinding) otherType;
+      if (this != otherParamType.genericType()) 
+        return false;
+      if (!isStatic()) { // static member types do not compare their enclosing
+              ReferenceBinding enclosing = enclosingType();
+              if (enclosing != null) {
+                ReferenceBinding otherEnclosing = otherParamType.enclosingType();
+                if (otherEnclosing == null) return false;
+                if ((otherEnclosing.tagBits & TagBits.HasDirectWildcard) == 0) {
+            if (enclosing != otherEnclosing) return false;
+                } else {
+                  if (!enclosing.isEquivalentTo(otherParamType.enclosingType())) return false;
+                }
+              }       
+      }
+      int length = this.typeVariables == null ? 0 : this.typeVariables.length;
+      TypeBinding[] otherArguments = otherParamType.arguments;
+      int otherLength = otherArguments == null ? 0 : otherArguments.length;
+      if (otherLength != length) 
+        return false;
+      for (int i = 0; i < length; i++)
+        if (!this.typeVariables[i].isTypeArgumentContainedBy(otherArguments[i]))
+          return false;
+      return true;
+
+    case Binding.RAW_TYPE :
+          return otherType.erasure() == this;
+  }
+  return false;
+}
+public boolean isGenericType() {
+    return this.typeVariables != Binding.NO_TYPE_VARIABLES;
+}
+public ReferenceBinding[] memberTypes() {
+  return this.memberTypes;
+}
+public FieldBinding getUpdatedFieldBinding(FieldBinding targetField, ReferenceBinding newDeclaringClass) {
+  if (this.synthetics == null)
+    this.synthetics = new HashMap[MAX_SYNTHETICS];
+  if (this.synthetics[SourceTypeBinding.RECEIVER_TYPE_EMUL] == null)
+    this.synthetics[SourceTypeBinding.RECEIVER_TYPE_EMUL] = new HashMap();
+
+  Hashtable fieldMap = (Hashtable) this.synthetics[SourceTypeBinding.RECEIVER_TYPE_EMUL].get(targetField);
+  if (fieldMap == null) {
+    fieldMap = new Hashtable(5);
+    this.synthetics[SourceTypeBinding.RECEIVER_TYPE_EMUL].put(targetField, fieldMap);
+  }
+  FieldBinding updatedField = (FieldBinding) fieldMap.get(newDeclaringClass);
+  if (updatedField == null){
+    updatedField = new FieldBinding(targetField, newDeclaringClass);
+    fieldMap.put(newDeclaringClass, updatedField);
+  }
+  return updatedField;
+}
+public MethodBinding getUpdatedMethodBinding(MethodBinding targetMethod, ReferenceBinding newDeclaringClass) {
+  if (this.synthetics == null)
+    this.synthetics = new HashMap[MAX_SYNTHETICS];
+  if (this.synthetics[SourceTypeBinding.RECEIVER_TYPE_EMUL] == null)
+    this.synthetics[SourceTypeBinding.RECEIVER_TYPE_EMUL] = new HashMap();
+
+  Hashtable methodMap = (Hashtable) this.synthetics[SourceTypeBinding.RECEIVER_TYPE_EMUL].get(targetMethod);
+  if (methodMap == null) {
+    methodMap = new Hashtable(5);
+    this.synthetics[SourceTypeBinding.RECEIVER_TYPE_EMUL].put(targetMethod, methodMap);
+  }
+  MethodBinding updatedMethod = (MethodBinding) methodMap.get(newDeclaringClass);
+  if (updatedMethod == null){
+    updatedMethod = new MethodBinding(targetMethod, newDeclaringClass);
+    methodMap.put(newDeclaringClass, updatedMethod);
+  }
+  return updatedMethod;
+}
+public boolean hasMemberTypes() {
+    return this.memberTypes.length > 0;
+}
+// NOTE: the return type, arg & exception types of each method of a source type are resolved when needed
+public MethodBinding[] methods() {
+  if ((this.tagBits & TagBits.AreMethodsComplete) != 0)
+    return this.methods;
+  
+  // lazily sort methods
+  if ((this.tagBits & TagBits.AreMethodsSorted) == 0) {
+    int length = this.methods.length;
+    if (length > 1)
+      ReferenceBinding.sortMethods(this.methods, 0, length);
+    this.tagBits |= TagBits.AreMethodsSorted;
+  }
+
+  int failed = 0;
+  MethodBinding[] resolvedMethods = this.methods;
+  try {
+    for (int i = 0, length = this.methods.length; i < length; i++) {
+      if (resolveTypesFor(this.methods[i]) == null) {
+        // do not alter original method array until resolution is over, due to reentrance (143259)
+        if (resolvedMethods == this.methods) {
+          System.arraycopy(this.methods, 0, resolvedMethods = new MethodBinding[length], 0, length);
+        }       
+        resolvedMethods[i] = null; // unable to resolve parameters
+        failed++;
+      }
+    }
+
+    // find & report collision cases
+    boolean complyTo15 = this.scope.compilerOptions().sourceLevel >= ClassFileConstants.JDK1_5;
+    for (int i = 0, length = this.methods.length; i < length; i++) {
+      MethodBinding method = resolvedMethods[i];
+      if (method == null) 
+        continue;
+      char[] selector = method.selector;
+      AbstractMethodDeclaration methodDecl = null;
+      nextSibling: for (int j = i + 1; j < length; j++) {
+        MethodBinding method2 = resolvedMethods[j];
+        if (method2 == null)
+          continue nextSibling;
+        if (!CharOperation.equals(selector, method2.selector)) 
+          break nextSibling; // methods with same selector are contiguous
+
+        if (complyTo15 && method.returnType != null && method2.returnType != null) {
+          // 8.4.2, for collision to be detected between m1 and m2:
+          // signature(m1) == signature(m2) i.e. same arity, same type parameter count, can be substituted
+          // signature(m1) == erasure(signature(m2)) or erasure(signature(m1)) == signature(m2)
+          TypeBinding[] params1 = method.parameters;
+          TypeBinding[] params2 = method2.parameters;
+          int pLength = params1.length;
+          if (pLength != params2.length)
+            continue nextSibling;
+
+          TypeVariableBinding[] vars = method.typeVariables;
+          TypeVariableBinding[] vars2 = method2.typeVariables;
+          boolean equalTypeVars = vars == vars2;
+          MethodBinding subMethod = method2;
+          if (!equalTypeVars) {
+            MethodBinding temp = method.computeSubstitutedMethod(method2, this.scope.environment());
+            if (temp != null) {
+              equalTypeVars = true;
+              subMethod = temp;
+            }
+          }
+          boolean equalParams = method.areParametersEqual(subMethod);
+          if (equalParams && equalTypeVars) {
+            // duplicates regardless of return types
+          } else if (method.returnType.erasure() == subMethod.returnType.erasure() && (equalParams || method.areParameterErasuresEqual(method2))) {
+            // name clash for sure if not duplicates, report as duplicates
+          } else if (!equalTypeVars && vars != Binding.NO_TYPE_VARIABLES && vars2 != Binding.NO_TYPE_VARIABLES) {
+            // type variables are different so we can distinguish between methods
+            continue nextSibling;
+          } else if (pLength > 0) {
+            // check to see if the erasure of either method is equal to the other
+            int index = pLength;
+            for (; --index >= 0;) {
+              if (params1[index] != params2[index].erasure())
+                break;
+              if (params1[index] == params2[index]) {
+                TypeBinding type = params1[index].leafComponentType();
+                if (type instanceof SourceTypeBinding && type.typeVariables() != Binding.NO_TYPE_VARIABLES) {
+                  index = pLength; // handle comparing identical source types like X<T>... its erasure is itself BUT we need to answer false
+                  break;
+                }
+              }
+            }
+            if (index >= 0 && index < pLength) {
+              for (index = pLength; --index >= 0;)
+                if (params1[index].erasure() != params2[index])
+                  break;
+            }
+            if (index >= 0)
+              continue nextSibling;
+          }
+        } else if (!method.areParametersEqual(method2)) { // prior to 1.5, parameter identity meant a collision case
+          continue nextSibling;
+        }
+        boolean isEnumSpecialMethod = isEnum() && (CharOperation.equals(selector,TypeConstants.VALUEOF) || CharOperation.equals(selector,TypeConstants.VALUES));
+        // report duplicate
+        if (methodDecl == null) {
+          methodDecl = method.sourceMethod(); // cannot be retrieved after binding is lost & may still be null if method is special
+          if (methodDecl != null && methodDecl.binding != null) { // ensure its a valid user defined method
+            if (isEnumSpecialMethod) {
+              this.scope.problemReporter().duplicateEnumSpecialMethod(this, methodDecl);
+            } else {
+              this.scope.problemReporter().duplicateMethodInType(this, methodDecl, method.areParametersEqual(method2));
+            }
+            methodDecl.binding = null;
+            // do not alter original method array until resolution is over, due to reentrance (143259)
+            if (resolvedMethods == this.methods) {
+              System.arraycopy(this.methods, 0, resolvedMethods = new MethodBinding[length], 0, length);
+            }               
+            resolvedMethods[i] = null;
+            failed++;
+          }
+        }
+        AbstractMethodDeclaration method2Decl = method2.sourceMethod();
+        if (method2Decl != null && method2Decl.binding != null) { // ensure its a valid user defined method
+          if (isEnumSpecialMethod) {
+            this.scope.problemReporter().duplicateEnumSpecialMethod(this, method2Decl);
+          } else {
+            this.scope.problemReporter().duplicateMethodInType(this, method2Decl, method.areParametersEqual(method2));
+          }
+          method2Decl.binding = null;
+          // do not alter original method array until resolution is over, due to reentrance (143259)
+          if (resolvedMethods == this.methods) {
+            System.arraycopy(this.methods, 0, resolvedMethods = new MethodBinding[length], 0, length);
+          }             
+          resolvedMethods[j] = null;
+          failed++;
+        }
+      }
+      if (method.returnType == null && methodDecl == null) { // forget method with invalid return type... was kept to detect possible collisions
+        methodDecl = method.sourceMethod();
+        if (methodDecl != null) {
+          methodDecl.binding = null;
+        }
+        // do not alter original method array until resolution is over, due to reentrance (143259)
+        if (resolvedMethods == this.methods) {
+          System.arraycopy(this.methods, 0, resolvedMethods = new MethodBinding[length], 0, length);
+        }           
+        resolvedMethods[i] = null;
+        failed++;
+      }
+    }
+  } finally {
+    if (failed > 0) {
+      int newSize = resolvedMethods.length - failed;
+      if (newSize == 0) {
+        this.methods = Binding.NO_METHODS;
+      } else {
+        MethodBinding[] newMethods = new MethodBinding[newSize];
+        for (int i = 0, j = 0, length = resolvedMethods.length; i < length; i++)
+          if (resolvedMethods[i] != null)
+            newMethods[j++] = resolvedMethods[i];
+        this.methods = newMethods;
+      }
+    }
+
+    // handle forward references to potential default abstract methods
+    addDefaultAbstractMethods();
+    this.tagBits |= TagBits.AreMethodsComplete;
+  }   
+  return this.methods;
+}
+private FieldBinding resolveTypeFor(FieldBinding field) {
+  if ((field.modifiers & ExtraCompilerModifiers.AccUnresolved) == 0)
+    return field;
+
+  if (this.scope.compilerOptions().sourceLevel >= ClassFileConstants.JDK1_5) {
+    if ((field.getAnnotationTagBits() & TagBits.AnnotationDeprecated) != 0)
+      field.modifiers |= ClassFileConstants.AccDeprecated;
+  }
+  if (isViewedAsDeprecated() && !field.isDeprecated())
+    field.modifiers |= ExtraCompilerModifiers.AccDeprecatedImplicitly;  
+  if (hasRestrictedAccess())
+    field.modifiers |= ExtraCompilerModifiers.AccRestrictedAccess;
+  FieldDeclaration[] fieldDecls = this.scope.referenceContext.fields;
+  for (int f = 0, length = fieldDecls.length; f < length; f++) {
+    if (fieldDecls[f].binding != field)
+      continue;
+
+      MethodScope initializationScope = field.isStatic() 
+        ? this.scope.referenceContext.staticInitializerScope 
+        : this.scope.referenceContext.initializerScope;
+      FieldBinding previousField = initializationScope.initializedField;
+      try {
+        initializationScope.initializedField = field;
+        FieldDeclaration fieldDecl = fieldDecls[f];
+        TypeBinding fieldType = 
+          fieldDecl.getKind() == AbstractVariableDeclaration.ENUM_CONSTANT
+            ? initializationScope.environment().convertToRawType(this, false /*do not force conversion of enclosing types*/) // enum constant is implicitly of declaring enum type
+            : fieldDecl.type.resolveType(initializationScope, true /* check bounds*/);
+        field.type = fieldType;
+        field.modifiers &= ~ExtraCompilerModifiers.AccUnresolved;
+        if (fieldType == null) {
+          fieldDecl.binding = null;
+          return null;
+        }
+        if (fieldType == TypeBinding.VOID) {
+          this.scope.problemReporter().variableTypeCannotBeVoid(fieldDecl);
+          fieldDecl.binding = null;
+          return null;
+        }
+        if (fieldType.isArrayType() && ((ArrayBinding) fieldType).leafComponentType == TypeBinding.VOID) {
+          this.scope.problemReporter().variableTypeCannotBeVoidArray(fieldDecl);
+          fieldDecl.binding = null;
+          return null;
+        }
+        if ((fieldType.tagBits & TagBits.HasMissingType) != 0) {
+          field.tagBits |= TagBits.HasMissingType;
+        }           
+        TypeBinding leafType = fieldType.leafComponentType();
+        if (leafType instanceof ReferenceBinding && (((ReferenceBinding)leafType).modifiers & ExtraCompilerModifiers.AccGenericSignature) != 0) {
+          field.modifiers |= ExtraCompilerModifiers.AccGenericSignature;
+        }       
+      } finally {
+          initializationScope.initializedField = previousField;
+      }
+    return field;
+  }
+  return null; // should never reach this point
+}
+public MethodBinding resolveTypesFor(MethodBinding method) {
+  if ((method.modifiers & ExtraCompilerModifiers.AccUnresolved) == 0)
+    return method;
+
+  if (this.scope.compilerOptions().sourceLevel >= ClassFileConstants.JDK1_5) {
+    if ((method.getAnnotationTagBits() & TagBits.AnnotationDeprecated) != 0)
+      method.modifiers |= ClassFileConstants.AccDeprecated;
+  }
+  if (isViewedAsDeprecated() && !method.isDeprecated())
+    method.modifiers |= ExtraCompilerModifiers.AccDeprecatedImplicitly;
+  if (hasRestrictedAccess())
+    method.modifiers |= ExtraCompilerModifiers.AccRestrictedAccess;
+
+  AbstractMethodDeclaration methodDecl = method.sourceMethod();
+  if (methodDecl == null) return null; // method could not be resolved in previous iteration
+
+  TypeParameter[] typeParameters = methodDecl.typeParameters();
+  if (typeParameters != null) {
+    methodDecl.scope.connectTypeVariables(typeParameters, true);
+    // Perform deferred bound checks for type variables (only done after type variable hierarchy is connected)
+    for (int i = 0, paramLength = typeParameters.length; i < paramLength; i++)
+      typeParameters[i].checkBounds(methodDecl.scope);
+  }
+  TypeReference[] exceptionTypes = methodDecl.thrownExceptions;
+  if (exceptionTypes != null) {
+    int size = exceptionTypes.length;
+    method.thrownExceptions = new ReferenceBinding[size];
+    int count = 0;
+    ReferenceBinding resolvedExceptionType;
+    for (int i = 0; i < size; i++) {
+      resolvedExceptionType = (ReferenceBinding) exceptionTypes[i].resolveType(methodDecl.scope, true /* check bounds*/);
+      if (resolvedExceptionType == null)
+        continue;
+      if (resolvedExceptionType.isBoundParameterizedType()) {
+        methodDecl.scope.problemReporter().invalidParameterizedExceptionType(resolvedExceptionType, exceptionTypes[i]);
+        continue;
+      }
+      if (resolvedExceptionType.findSuperTypeOriginatingFrom(TypeIds.T_JavaLangThrowable, true) == null) {
+        if (resolvedExceptionType.isValidBinding()) {
+          methodDecl.scope.problemReporter().cannotThrowType(exceptionTypes[i], resolvedExceptionType);
+          continue;
+        }
+      }
+      if ((resolvedExceptionType.tagBits & TagBits.HasMissingType) != 0) {
+        method.tagBits |= TagBits.HasMissingType;
+      }           
+      method.modifiers |= (resolvedExceptionType.modifiers & ExtraCompilerModifiers.AccGenericSignature);
+      method.thrownExceptions[count++] = resolvedExceptionType;
+    }
+    if (count < size)
+      System.arraycopy(method.thrownExceptions, 0, method.thrownExceptions = new ReferenceBinding[count], 0, count);
+  }
+
+  boolean foundArgProblem = false;
+  Argument[] arguments = methodDecl.arguments;
+  if (arguments != null) {
+    int size = arguments.length;
+    method.parameters = Binding.NO_PARAMETERS;
+    TypeBinding[] newParameters = new TypeBinding[size];
+    for (int i = 0; i < size; i++) {
+      Argument arg = arguments[i];
+      if (arg.annotations != null) {
+        method.tagBits |= TagBits.HasParameterAnnotations;
+      }
+      TypeBinding parameterType = arg.type.resolveType(methodDecl.scope, true /* check bounds*/);
+      if (parameterType == null) {
+        foundArgProblem = true;
+      } else if (parameterType == TypeBinding.VOID) {
+        methodDecl.scope.problemReporter().argumentTypeCannotBeVoid(this, methodDecl, arg);
+        foundArgProblem = true;
+      } else {
+        if ((parameterType.tagBits & TagBits.HasMissingType) != 0) {
+          method.tagBits |= TagBits.HasMissingType;
+        }           
+        TypeBinding leafType = parameterType.leafComponentType();
+        if (leafType instanceof ReferenceBinding && (((ReferenceBinding) leafType).modifiers & ExtraCompilerModifiers.AccGenericSignature) != 0)
+          method.modifiers |= ExtraCompilerModifiers.AccGenericSignature;
+        newParameters[i] = parameterType;
+        arg.binding = new LocalVariableBinding(arg, parameterType, arg.modifiers, true);
+      }
+    }
+    // only assign parameters if no problems are found
+    if (!foundArgProblem) {
+      method.parameters = newParameters;
+    }
+  }
+
+  boolean foundReturnTypeProblem = false;
+  if (!method.isConstructor()) {
+    TypeReference returnType = methodDecl instanceof MethodDeclaration
+      ? ((MethodDeclaration) methodDecl).returnType
+      : null;
+    if (returnType == null) {
+      methodDecl.scope.problemReporter().missingReturnType(methodDecl);
+      method.returnType = null;
+      foundReturnTypeProblem = true;
+    } else {
+      TypeBinding methodType = returnType.resolveType(methodDecl.scope, true /* check bounds*/);
+      if (methodType == null) {
+        foundReturnTypeProblem = true;
+      } else if (methodType.isArrayType() && ((ArrayBinding) methodType).leafComponentType == TypeBinding.VOID) {
+        methodDecl.scope.problemReporter().returnTypeCannotBeVoidArray((MethodDeclaration) methodDecl);
+        foundReturnTypeProblem = true;
+      } else {
+        if ((methodType.tagBits & TagBits.HasMissingType) != 0) {
+          method.tagBits |= TagBits.HasMissingType;
+        }         
+        method.returnType = methodType;
+        TypeBinding leafType = methodType.leafComponentType();
+        if (leafType instanceof ReferenceBinding && (((ReferenceBinding) leafType).modifiers & ExtraCompilerModifiers.AccGenericSignature) != 0)
+          method.modifiers |= ExtraCompilerModifiers.AccGenericSignature;
+      }
+    }
+  }
+  if (foundArgProblem) {
+    methodDecl.binding = null;
+    method.parameters = Binding.NO_PARAMETERS; // see 107004
+    // nullify type parameter bindings as well as they have a backpointer to the method binding
+    // (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=81134)
+    if (typeParameters != null)
+      for (int i = 0, length = typeParameters.length; i < length; i++)
+        typeParameters[i].binding = null;
+    return null;
+  }
+  if (foundReturnTypeProblem)
+    return method; // but its still unresolved with a null return type & is still connected to its method declaration
+
+  method.modifiers &= ~ExtraCompilerModifiers.AccUnresolved;
+  return method;
+}
+public AnnotationHolder retrieveAnnotationHolder(Binding binding, boolean forceInitialization) {
+  if (forceInitialization)
+    binding.getAnnotationTagBits(); // ensure annotations are up to date
+  return super.retrieveAnnotationHolder(binding, false);
+}
+public void setFields(FieldBinding[] fields) {
+  this.fields = fields;
+}
+public void setMethods(MethodBinding[] methods) {
+  this.methods = methods;
+}
+public final int sourceEnd() {
+  return this.scope.referenceContext.sourceEnd;
+}
+public final int sourceStart() {
+  return this.scope.referenceContext.sourceStart;
+}
+SimpleLookupTable storedAnnotations(boolean forceInitialize) {
+  if (forceInitialize && this.storedAnnotations == null && this.scope != null) { // scope null when no annotation cached, and type got processed fully (159631)
+    this.scope.referenceCompilationUnit().compilationResult.hasAnnotations = true;
+    if (!this.scope.environment().globalOptions.storeAnnotations)
+      return null; // not supported during this compile
+    this.storedAnnotations = new SimpleLookupTable(3);
+  }
+  return this.storedAnnotations;
+}
+public ReferenceBinding superclass() {
+  return this.superclass;
+}
+public ReferenceBinding[] superInterfaces() {
+  return this.superInterfaces;
+}
+// TODO (philippe) could be a performance issue since some senders are building the list just to count them
+public SyntheticMethodBinding[] syntheticMethods() {
+  
+  if (this.synthetics == null || this.synthetics[SourceTypeBinding.METHOD_EMUL] == null || this.synthetics[SourceTypeBinding.METHOD_EMUL].size() == 0) return null;
+
+  // difficult to compute size up front because of the embedded arrays so assume there is only 1
+  int index = 0;
+  SyntheticMethodBinding[] bindings = new SyntheticMethodBinding[1];
+  Iterator fieldsOrMethods = this.synthetics[SourceTypeBinding.METHOD_EMUL].keySet().iterator();
+  while (fieldsOrMethods.hasNext()) {
+
+    Object fieldOrMethod = fieldsOrMethods.next();
+
+    if (fieldOrMethod instanceof MethodBinding) {
+
+      SyntheticMethodBinding[] methodAccessors = (SyntheticMethodBinding[]) this.synthetics[SourceTypeBinding.METHOD_EMUL].get(fieldOrMethod);
+      int numberOfAccessors = 0;
+      if (methodAccessors[0] != null) numberOfAccessors++;
+      if (methodAccessors[1] != null) numberOfAccessors++;
+      if (index + numberOfAccessors > bindings.length)
+        System.arraycopy(bindings, 0, (bindings = new SyntheticMethodBinding[index + numberOfAccessors]), 0, index);
+      if (methodAccessors[0] != null) 
+        bindings[index++] = methodAccessors[0]; // super access 
+      if (methodAccessors[1] != null) 
+        bindings[index++] = methodAccessors[1]; // normal access or bridge
+
+    } else {
+
+      SyntheticMethodBinding[] fieldAccessors = (SyntheticMethodBinding[]) this.synthetics[SourceTypeBinding.METHOD_EMUL].get(fieldOrMethod);
+      int numberOfAccessors = 0;
+      if (fieldAccessors[0] != null) numberOfAccessors++;
+      if (fieldAccessors[1] != null) numberOfAccessors++;
+      if (index + numberOfAccessors > bindings.length)
+        System.arraycopy(bindings, 0, (bindings = new SyntheticMethodBinding[index + numberOfAccessors]), 0, index);
+      if (fieldAccessors[0] != null) 
+        bindings[index++] = fieldAccessors[0]; // read access
+      if (fieldAccessors[1] != null) 
+        bindings[index++] = fieldAccessors[1]; // write access
+    }
+  }
+
+  // sort them in according to their own indexes
+  int length;
+  SyntheticMethodBinding[] sortedBindings = new SyntheticMethodBinding[length = bindings.length];
+  for (int i = 0; i < length; i++){
+    SyntheticMethodBinding binding = bindings[i];
+    sortedBindings[binding.index] = binding;
+  }
+  return sortedBindings;
+}
+/**
+ * Answer the collection of synthetic fields to append into the classfile
+ */
+public FieldBinding[] syntheticFields() {
+  
+  if (this.synthetics == null) return null;
+
+  int fieldSize = this.synthetics[SourceTypeBinding.FIELD_EMUL] == null ? 0 : this.synthetics[SourceTypeBinding.FIELD_EMUL].size();
+  int literalSize = this.synthetics[SourceTypeBinding.CLASS_LITERAL_EMUL] == null ? 0 :this.synthetics[SourceTypeBinding.CLASS_LITERAL_EMUL].size();
+  int totalSize = fieldSize + literalSize;
+  if (totalSize == 0) return null;
+  FieldBinding[] bindings = new FieldBinding[totalSize];
+
+  // add innerclass synthetics
+  if (this.synthetics[SourceTypeBinding.FIELD_EMUL] != null){
+    Iterator elements = this.synthetics[SourceTypeBinding.FIELD_EMUL].values().iterator();
+    for (int i = 0; i < fieldSize; i++) {
+      SyntheticFieldBinding synthBinding = (SyntheticFieldBinding) elements.next();
+      bindings[synthBinding.index] = synthBinding;
+    }
+  }
+  // add class literal synthetics
+  if (this.synthetics[SourceTypeBinding.CLASS_LITERAL_EMUL] != null){
+    Iterator elements = this.synthetics[SourceTypeBinding.CLASS_LITERAL_EMUL].values().iterator();
+    for (int i = 0; i < literalSize; i++) {
+      SyntheticFieldBinding synthBinding = (SyntheticFieldBinding) elements.next();
+      bindings[fieldSize+synthBinding.index] = synthBinding;
+    }
+  }
+  return bindings;
+}
+public String toString() {
+    StringBuffer buffer = new StringBuffer(30);
+    buffer.append("(id="); //$NON-NLS-1$
+    if (this.id == TypeIds.NoId) 
+        buffer.append("NoId"); //$NON-NLS-1$
+    else 
+        buffer.append(this.id);
+    buffer.append(")\n"); //$NON-NLS-1$
+  if (isDeprecated()) buffer.append("deprecated "); //$NON-NLS-1$
+  if (isPublic()) buffer.append("public "); //$NON-NLS-1$
+  if (isProtected()) buffer.append("protected "); //$NON-NLS-1$
+  if (isPrivate()) buffer.append("private "); //$NON-NLS-1$
+  if (isAbstract() && isClass()) buffer.append("abstract "); //$NON-NLS-1$
+  if (isStatic() && isNestedType()) buffer.append("static "); //$NON-NLS-1$
+  if (isFinal()) buffer.append("final "); //$NON-NLS-1$
+
+  if (isEnum()) buffer.append("enum "); //$NON-NLS-1$
+  else if (isAnnotationType()) buffer.append("@interface "); //$NON-NLS-1$
+  else if (isClass()) buffer.append("class "); //$NON-NLS-1$
+  else buffer.append("interface "); //$NON-NLS-1$
+  buffer.append((this.compoundName != null) ? CharOperation.toString(this.compoundName) : "UNNAMED TYPE"); //$NON-NLS-1$
+
+  if (this.typeVariables == null) {
+    buffer.append("<NULL TYPE VARIABLES>"); //$NON-NLS-1$
+  } else if (this.typeVariables != Binding.NO_TYPE_VARIABLES) {
+    buffer.append("<"); //$NON-NLS-1$
+    for (int i = 0, length = this.typeVariables.length; i < length; i++) {
+      if (i  > 0) buffer.append(", "); //$NON-NLS-1$
+      if (this.typeVariables[i] == null) {
+        buffer.append("NULL TYPE VARIABLE"); //$NON-NLS-1$
+        continue;
+      }
+      char[] varChars = this.typeVariables[i].toString().toCharArray();
+      buffer.append(varChars, 1, varChars.length - 2);
+    }
+    buffer.append(">"); //$NON-NLS-1$
+  }
+  buffer.append("\n\textends "); //$NON-NLS-1$
+  buffer.append((this.superclass != null) ? this.superclass.debugName() : "NULL TYPE"); //$NON-NLS-1$
+
+  if (this.superInterfaces != null) {
+    if (this.superInterfaces != Binding.NO_SUPERINTERFACES) {
+      buffer.append("\n\timplements : "); //$NON-NLS-1$
+      for (int i = 0, length = this.superInterfaces.length; i < length; i++) {
+        if (i  > 0)
+          buffer.append(", "); //$NON-NLS-1$
+        buffer.append((this.superInterfaces[i] != null) ? this.superInterfaces[i].debugName() : "NULL TYPE"); //$NON-NLS-1$
+      }
+    }
+  } else {
+    buffer.append("NULL SUPERINTERFACES"); //$NON-NLS-1$
+  }
+
+  if (enclosingType() != null) {
+    buffer.append("\n\tenclosing type : "); //$NON-NLS-1$
+    buffer.append(enclosingType().debugName());
+  }
+
+  if (this.fields != null) {
+    if (this.fields != Binding.NO_FIELDS) {
+      buffer.append("\n/*   fields   */"); //$NON-NLS-1$
+      for (int i = 0, length = this.fields.length; i < length; i++)
+          buffer.append('\n').append((this.fields[i] != null) ? this.fields[i].toString() : "NULL FIELD"); //$NON-NLS-1$ 
+    }
+  } else {
+    buffer.append("NULL FIELDS"); //$NON-NLS-1$
+  }
+
+  if (this.methods != null) {
+    if (this.methods != Binding.NO_METHODS) {
+      buffer.append("\n/*   methods   */"); //$NON-NLS-1$
+      for (int i = 0, length = this.methods.length; i < length; i++)
+        buffer.append('\n').append((this.methods[i] != null) ? this.methods[i].toString() : "NULL METHOD"); //$NON-NLS-1$
+    }
+  } else {
+    buffer.append("NULL METHODS"); //$NON-NLS-1$
+  }
+
+  if (this.memberTypes != null) {
+    if (this.memberTypes != Binding.NO_MEMBER_TYPES) {
+      buffer.append("\n/*   members   */"); //$NON-NLS-1$
+      for (int i = 0, length = this.memberTypes.length; i < length; i++)
+        buffer.append('\n').append((this.memberTypes[i] != null) ? this.memberTypes[i].toString() : "NULL TYPE"); //$NON-NLS-1$
+    }
+  } else {
+    buffer.append("NULL MEMBER TYPES"); //$NON-NLS-1$
+  }
+
+  buffer.append("\n\n"); //$NON-NLS-1$
+  return buffer.toString();
+}
+public TypeVariableBinding[] typeVariables() {
+  return this.typeVariables;
+}
+void verifyMethods(MethodVerifier verifier) {
+  verifier.verify(this);
+
+  for (int i = this.memberTypes.length; --i >= 0;)
+     ((SourceTypeBinding) this.memberTypes[i]).verifyMethods(verifier);
+}
+}
diff --git a/dev/core/super/com/google/gwt/dev/jjs/intrinsic/com/google/gwt/lang/ClassLiteralHolder.java b/dev/core/super/com/google/gwt/dev/jjs/intrinsic/com/google/gwt/lang/ClassLiteralHolder.java
index 882c209..9224ff7 100644
--- a/dev/core/super/com/google/gwt/dev/jjs/intrinsic/com/google/gwt/lang/ClassLiteralHolder.java
+++ b/dev/core/super/com/google/gwt/dev/jjs/intrinsic/com/google/gwt/lang/ClassLiteralHolder.java
@@ -1,24 +1,24 @@
-/*

- * 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.lang;

-

-/**

- * This is a magic class the compiler uses to contain synthetic fields for all

- * class literals. NOTE: this is not a CODE GEN class because we want it to be

- * eagerly optimized.

- */

-final class ClassLiteralHolder {

-}

+/*
+ * 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.lang;
+
+/**
+ * This is a magic class the compiler uses to contain synthetic fields for all
+ * class literals. NOTE: this is not a CODE GEN class because we want it to be
+ * eagerly optimized.
+ */
+final class ClassLiteralHolder {
+}
diff --git a/dev/core/test/com/google/gwt/core/ext/linker/impl/StandardSelectionPropertyTest.java b/dev/core/test/com/google/gwt/core/ext/linker/impl/StandardSelectionPropertyTest.java
index 2fafd95..19a4cb9 100644
--- a/dev/core/test/com/google/gwt/core/ext/linker/impl/StandardSelectionPropertyTest.java
+++ b/dev/core/test/com/google/gwt/core/ext/linker/impl/StandardSelectionPropertyTest.java
@@ -1,65 +1,65 @@
-/*

- * Copyright 2009 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.core.ext.linker.impl;

-

-import com.google.gwt.dev.cfg.BindingProperty;

-import com.google.gwt.dev.cfg.PropertyProvider;

-

-import junit.framework.TestCase;

-

-/**

- * Tests for {@link StandardSelectionProperty}.

- */

-public class StandardSelectionPropertyTest extends TestCase {

-

-  private static final String FBV = "FBV";

-

-  private static final String PROVIDER_MULTIFALLBACK =

-      "provider text with fallback=/*-FALLBACK-*/, repeated /*-FALLBACK-*//*-FALLBACK-*/";

-  private static final String PROVIDER_MULTIFALLBACK_EMPTY =

-    "provider text with fallback=, repeated ";

-  private static final String PROVIDER_MULTIFALLBACK_FBV =

-    "provider text with fallback=FBV, repeated FBVFBV";

-

-  private static final String PROVIDER_NOFALLBACK = "provider text without fallback";

-

-  public void testNoFallback() {

-    BindingProperty bp = new BindingProperty("doesNotUseFallback");

-    PropertyProvider provider = new PropertyProvider(PROVIDER_NOFALLBACK);

-    bp.setProvider(provider);

-    StandardSelectionProperty property = new StandardSelectionProperty(bp);

-    assertEquals(PROVIDER_NOFALLBACK, property.getPropertyProvider());

-

-    provider = new PropertyProvider(PROVIDER_MULTIFALLBACK);

-    bp.setProvider(provider);

-    property = new StandardSelectionProperty(bp);

-    assertEquals(PROVIDER_MULTIFALLBACK_EMPTY, property.getPropertyProvider());

-  }

-

-  public void testWithFallback() {

-    BindingProperty bp = new BindingProperty("doesUseFallback");

-    bp.setFallback(FBV);

-    PropertyProvider provider = new PropertyProvider(PROVIDER_NOFALLBACK);

-    bp.setProvider(provider);

-    StandardSelectionProperty property = new StandardSelectionProperty(bp);

-    assertEquals(PROVIDER_NOFALLBACK, property.getPropertyProvider());

-

-    provider = new PropertyProvider(PROVIDER_MULTIFALLBACK);

-    bp.setProvider(provider);

-    property = new StandardSelectionProperty(bp);

-    assertEquals(PROVIDER_MULTIFALLBACK_FBV, property.getPropertyProvider());

-  }

-}

+/*
+ * Copyright 2009 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.core.ext.linker.impl;
+
+import com.google.gwt.dev.cfg.BindingProperty;
+import com.google.gwt.dev.cfg.PropertyProvider;
+
+import junit.framework.TestCase;
+
+/**
+ * Tests for {@link StandardSelectionProperty}.
+ */
+public class StandardSelectionPropertyTest extends TestCase {
+
+  private static final String FBV = "FBV";
+
+  private static final String PROVIDER_MULTIFALLBACK =
+      "provider text with fallback=/*-FALLBACK-*/, repeated /*-FALLBACK-*//*-FALLBACK-*/";
+  private static final String PROVIDER_MULTIFALLBACK_EMPTY =
+    "provider text with fallback=, repeated ";
+  private static final String PROVIDER_MULTIFALLBACK_FBV =
+    "provider text with fallback=FBV, repeated FBVFBV";
+
+  private static final String PROVIDER_NOFALLBACK = "provider text without fallback";
+
+  public void testNoFallback() {
+    BindingProperty bp = new BindingProperty("doesNotUseFallback");
+    PropertyProvider provider = new PropertyProvider(PROVIDER_NOFALLBACK);
+    bp.setProvider(provider);
+    StandardSelectionProperty property = new StandardSelectionProperty(bp);
+    assertEquals(PROVIDER_NOFALLBACK, property.getPropertyProvider());
+
+    provider = new PropertyProvider(PROVIDER_MULTIFALLBACK);
+    bp.setProvider(provider);
+    property = new StandardSelectionProperty(bp);
+    assertEquals(PROVIDER_MULTIFALLBACK_EMPTY, property.getPropertyProvider());
+  }
+
+  public void testWithFallback() {
+    BindingProperty bp = new BindingProperty("doesUseFallback");
+    bp.setFallback(FBV);
+    PropertyProvider provider = new PropertyProvider(PROVIDER_NOFALLBACK);
+    bp.setProvider(provider);
+    StandardSelectionProperty property = new StandardSelectionProperty(bp);
+    assertEquals(PROVIDER_NOFALLBACK, property.getPropertyProvider());
+
+    provider = new PropertyProvider(PROVIDER_MULTIFALLBACK);
+    bp.setProvider(provider);
+    property = new StandardSelectionProperty(bp);
+    assertEquals(PROVIDER_MULTIFALLBACK_FBV, property.getPropertyProvider());
+  }
+}
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 04bbf1a..6748ae3 100644
--- a/dev/core/test/com/google/gwt/dev/javac/CompilationUnitFileReferenceTest.java
+++ b/dev/core/test/com/google/gwt/dev/javac/CompilationUnitFileReferenceTest.java
@@ -1,265 +1,265 @@
-/*

- * Copyright 2009 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.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.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;

-

-import junit.framework.TestCase;

-

-import java.util.HashMap;

-import java.util.HashSet;

-import java.util.Map;

-import java.util.Set;

-

-/**

- * Test if all fileReferences in a compilationUnit are recorded correctly.

- */

-public class CompilationUnitFileReferenceTest extends TestCase {

-

-  public static final MockJavaResource MEMBER_INNER_SUBCLASS = new MockJavaResource(

-      "test.OuterSubclass") {

-    @Override

-    protected CharSequence getContent() {

-      StringBuffer code = new StringBuffer();

-      code.append("package test;\n");

-      code.append("public class OuterSubclass extends Outer {\n");

-      code.append("  public String value() { return \"OuterSubclass\"; }\n");

-      code.append("  public class MemberInnerSubclass extends MemberInner {\n");

-      code.append("    public String value() { return \"MemberInnerSubclass\"; }\n");

-      code.append("  }\n");

-      code.append("}\n");

-      return code;

-    }

-  };

-

-  public static final MockJavaResource OUTER = new MockJavaResource(

-      "test.Outer") {

-    @Override

-    protected CharSequence getContent() {

-      StringBuffer code = new StringBuffer();

-      code.append("package test;\n");

-      code.append("public class Outer {\n");

-      code.append("  public String value() { return \"Outer\"; }\n");

-      code.append("  public static class StaticInner {\n");

-      code.append("    public String value() { return \"StaticInner\"; }\n");

-      code.append("  }\n");

-      code.append("  public class MemberInner {\n");

-      code.append("    public String value() { return \"MemberInner\"; }\n");

-      code.append("  }\n");

-      code.append("}\n");

-      return code;

-    }

-  };

-

-  public static final MockJavaResource STATIC_INNER_SUBCLASS = new MockJavaResource(

-      "test.StaticInnerSubclass") {

-    @Override

-    protected CharSequence getContent() {

-      StringBuffer code = new StringBuffer();

-      code.append("package test;\n");

-      code.append("public class StaticInnerSubclass extends Outer.StaticInner {\n");

-      code.append("  public String value() { return \"StaticInnerSubclass\"; }\n");

-      code.append("}\n");

-      return code;

-    }

-  };

-

-  public static final MockJavaResource TOP = new MockJavaResource("test.Top") {

-    @Override

-    protected CharSequence getContent() {

-      StringBuffer code = new StringBuffer();

-      code.append("package test;\n");

-      code.append("public class Top {\n");

-      code.append("  public String value() { return \"Top\"; }\n");

-      code.append("}\n");

-      code.append("class Top2 extends Top {\n");

-      code.append("  public String value() { return \"Top2\"; }\n");

-      code.append("}\n");

-      return code;

-    }

-  };

-

-  public static final MockJavaResource TOP3 = new MockJavaResource("test.Top3") {

-    @Override

-    protected CharSequence getContent() {

-      StringBuffer code = new StringBuffer();

-      code.append("package test;\n");

-      code.append("public class Top3 extends Top2 {\n");

-      code.append("  public String value() { return \"Top3\"; }\n");

-      code.append("}\n");

-      return code;

-    }

-  };

-

-  /**

-   * This map contains the hand-computed set of references we expect each of the

-   * test compilation units to have. The actual set of references computed by

-   * {@link CompilationState} will be checked against this set.

-   */

-  private static final Map<String, Set<String>> EXPECTED_DEPENDENCIES = new HashMap<String, Set<String>>();

-

-  static {

-    // Setup EXPECTED_DEPENDENCIES with hand-computed data.

-    initializeExpectedDependency(JavaResourceBase.FOO, JavaResourceBase.STRING);

-    initializeExpectedDependency(JavaResourceBase.BAR, JavaResourceBase.STRING,

-        JavaResourceBase.FOO);

-

-    // TOP has a self-reference

-    initializeExpectedDependency(TOP, JavaResourceBase.STRING, TOP);

-    initializeExpectedDependency(TOP3, JavaResourceBase.STRING, TOP);

-

-    initializeExpectedDependency(OUTER, JavaResourceBase.STRING);

-    initializeExpectedDependency(MEMBER_INNER_SUBCLASS,

-        JavaResourceBase.STRING, OUTER);

-

-    initializeExpectedDependency(OUTER, JavaResourceBase.STRING);

-    initializeExpectedDependency(STATIC_INNER_SUBCLASS,

-        JavaResourceBase.STRING, OUTER);

-  }

-

-  /**

-   * Tweak this if you want to see the log output.

-   */

-  private static TreeLogger createTreeLogger() {

-    boolean reallyLog = false;

-    if (reallyLog) {

-      AbstractTreeLogger logger = new PrintWriterTreeLogger();

-      logger.setMaxDetail(TreeLogger.ALL);

-      return logger;

-    }

-    return TreeLogger.NULL;

-  }

-

-  private static void initializeExpectedDependency(Resource source,

-      Resource... targets) {

-    Set<String> targetSet = new HashSet<String>();

-    for (Resource target : targets) {

-      targetSet.add(target.getLocation());

-    }

-    EXPECTED_DEPENDENCIES.put(source.getLocation(), targetSet);

-  }

-

-  private MockResourceOracle oracle = new MockResourceOracle(

-      JavaResourceBase.getStandardResources());

-

-  private CompilationState state = new CompilationState(createTreeLogger(),

-      oracle);

-

-  public void testBinaryBindingsWithMemberInnerClass() {

-    testBinaryBindings(OUTER, MEMBER_INNER_SUBCLASS);

-  }

-

-  public void testBinaryBindingsWithMultipleTopLevelClasses() {

-    testBinaryBindings(TOP, TOP3);

-  }

-

-  public void testBinaryBindingsWithSimpleUnits() {

-    testBinaryBindings(JavaResourceBase.FOO, JavaResourceBase.BAR);

-  }

-

-  public void testBinaryBindingsWithStaticInnerClass() {

-    testBinaryBindings(OUTER, STATIC_INNER_SUBCLASS);

-  }

-

-  public void testSourceBindingsWithMemberInnerClass() {

-    testSourceBindings(OUTER, MEMBER_INNER_SUBCLASS);

-  }

-

-  public void testSourceBindingsWithMultipleTopLevelClasses() {

-    testSourceBindings(TOP, TOP3);

-  }

-

-  public void testSourceBindingsWithSimpleUnits() {

-    testSourceBindings(JavaResourceBase.FOO, JavaResourceBase.BAR);

-  }

-

-  public void testSourceBindingsWithStaticInnerClass() {

-    testSourceBindings(OUTER, STATIC_INNER_SUBCLASS);

-  }

-

-  public void testWithGeneratedUnits() {

-    state.addGeneratedCompilationUnits(createTreeLogger(),

-        copyAsGeneratedUnits(JavaResourceBase.BAR, JavaResourceBase.FOO));

-    assertRefsMatchExpectedRefs(JavaResourceBase.BAR, JavaResourceBase.FOO);

-  }

-

-  public void testWithMixedUnits() {

-    oracle.add(JavaResourceBase.FOO);

-    state.refresh(createTreeLogger());

-    state.addGeneratedCompilationUnits(createTreeLogger(),

-        copyAsGeneratedUnits(JavaResourceBase.BAR));

-    assertRefsMatchExpectedRefs(JavaResourceBase.BAR, JavaResourceBase.FOO);

-  }

-

-  private void assertRefsMatchExpectedRefs(Resource... files) {

-    for (Resource sourceFile : files) {

-      Set<String> sourceFileRefs = state.getCompilationUnitMap().get(

-          SourceFileCompilationUnit.getTypeName(sourceFile)).getFileNameRefs();

-      Set<String> expectedSourceFileRefs = EXPECTED_DEPENDENCIES.get(sourceFile.getLocation());

-      assertEquals(expectedSourceFileRefs, sourceFileRefs);

-    }

-  }

-

-  /**

-   * Returns copies of units as generated units for testing interactions with

-   * generated units.

-   */

-  private Set<CompilationUnit> copyAsGeneratedUnits(Resource... sourceFiles) {

-    Set<CompilationUnit> units = new HashSet<CompilationUnit>();

-    for (Resource sourceFile : sourceFiles) {

-      units.add(new SourceFileCompilationUnit(sourceFile) {

-        @Override

-        public boolean isGenerated() {

-          return true;

-        }

-      });

-    }

-    return units;

-  }

-

-  /**

-   * Independently compiles each file in order to force each subsequent unit to

-   * have only binary references to the previous unit(s). This tests the binary

-   * reference matching in {@link CompilationState}.

-   */

-  private void testBinaryBindings(Resource... files) {

-    for (Resource sourceFile : files) {

-      oracle.add(sourceFile);

-      state.refresh(createTreeLogger());

-    }

-    assertRefsMatchExpectedRefs(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(Resource... files) {

-    for (Resource sourceFile : files) {

-      oracle.add(sourceFile);

-    }

-    state.refresh(createTreeLogger());

-    assertRefsMatchExpectedRefs(files);

-  }

-}

+/*
+ * Copyright 2009 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.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.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;
+
+import junit.framework.TestCase;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Test if all fileReferences in a compilationUnit are recorded correctly.
+ */
+public class CompilationUnitFileReferenceTest extends TestCase {
+
+  public static final MockJavaResource MEMBER_INNER_SUBCLASS = new MockJavaResource(
+      "test.OuterSubclass") {
+    @Override
+    protected CharSequence getContent() {
+      StringBuffer code = new StringBuffer();
+      code.append("package test;\n");
+      code.append("public class OuterSubclass extends Outer {\n");
+      code.append("  public String value() { return \"OuterSubclass\"; }\n");
+      code.append("  public class MemberInnerSubclass extends MemberInner {\n");
+      code.append("    public String value() { return \"MemberInnerSubclass\"; }\n");
+      code.append("  }\n");
+      code.append("}\n");
+      return code;
+    }
+  };
+
+  public static final MockJavaResource OUTER = new MockJavaResource(
+      "test.Outer") {
+    @Override
+    protected CharSequence getContent() {
+      StringBuffer code = new StringBuffer();
+      code.append("package test;\n");
+      code.append("public class Outer {\n");
+      code.append("  public String value() { return \"Outer\"; }\n");
+      code.append("  public static class StaticInner {\n");
+      code.append("    public String value() { return \"StaticInner\"; }\n");
+      code.append("  }\n");
+      code.append("  public class MemberInner {\n");
+      code.append("    public String value() { return \"MemberInner\"; }\n");
+      code.append("  }\n");
+      code.append("}\n");
+      return code;
+    }
+  };
+
+  public static final MockJavaResource STATIC_INNER_SUBCLASS = new MockJavaResource(
+      "test.StaticInnerSubclass") {
+    @Override
+    protected CharSequence getContent() {
+      StringBuffer code = new StringBuffer();
+      code.append("package test;\n");
+      code.append("public class StaticInnerSubclass extends Outer.StaticInner {\n");
+      code.append("  public String value() { return \"StaticInnerSubclass\"; }\n");
+      code.append("}\n");
+      return code;
+    }
+  };
+
+  public static final MockJavaResource TOP = new MockJavaResource("test.Top") {
+    @Override
+    protected CharSequence getContent() {
+      StringBuffer code = new StringBuffer();
+      code.append("package test;\n");
+      code.append("public class Top {\n");
+      code.append("  public String value() { return \"Top\"; }\n");
+      code.append("}\n");
+      code.append("class Top2 extends Top {\n");
+      code.append("  public String value() { return \"Top2\"; }\n");
+      code.append("}\n");
+      return code;
+    }
+  };
+
+  public static final MockJavaResource TOP3 = new MockJavaResource("test.Top3") {
+    @Override
+    protected CharSequence getContent() {
+      StringBuffer code = new StringBuffer();
+      code.append("package test;\n");
+      code.append("public class Top3 extends Top2 {\n");
+      code.append("  public String value() { return \"Top3\"; }\n");
+      code.append("}\n");
+      return code;
+    }
+  };
+
+  /**
+   * This map contains the hand-computed set of references we expect each of the
+   * test compilation units to have. The actual set of references computed by
+   * {@link CompilationState} will be checked against this set.
+   */
+  private static final Map<String, Set<String>> EXPECTED_DEPENDENCIES = new HashMap<String, Set<String>>();
+
+  static {
+    // Setup EXPECTED_DEPENDENCIES with hand-computed data.
+    initializeExpectedDependency(JavaResourceBase.FOO, JavaResourceBase.STRING);
+    initializeExpectedDependency(JavaResourceBase.BAR, JavaResourceBase.STRING,
+        JavaResourceBase.FOO);
+
+    // TOP has a self-reference
+    initializeExpectedDependency(TOP, JavaResourceBase.STRING, TOP);
+    initializeExpectedDependency(TOP3, JavaResourceBase.STRING, TOP);
+
+    initializeExpectedDependency(OUTER, JavaResourceBase.STRING);
+    initializeExpectedDependency(MEMBER_INNER_SUBCLASS,
+        JavaResourceBase.STRING, OUTER);
+
+    initializeExpectedDependency(OUTER, JavaResourceBase.STRING);
+    initializeExpectedDependency(STATIC_INNER_SUBCLASS,
+        JavaResourceBase.STRING, OUTER);
+  }
+
+  /**
+   * Tweak this if you want to see the log output.
+   */
+  private static TreeLogger createTreeLogger() {
+    boolean reallyLog = false;
+    if (reallyLog) {
+      AbstractTreeLogger logger = new PrintWriterTreeLogger();
+      logger.setMaxDetail(TreeLogger.ALL);
+      return logger;
+    }
+    return TreeLogger.NULL;
+  }
+
+  private static void initializeExpectedDependency(Resource source,
+      Resource... targets) {
+    Set<String> targetSet = new HashSet<String>();
+    for (Resource target : targets) {
+      targetSet.add(target.getLocation());
+    }
+    EXPECTED_DEPENDENCIES.put(source.getLocation(), targetSet);
+  }
+
+  private MockResourceOracle oracle = new MockResourceOracle(
+      JavaResourceBase.getStandardResources());
+
+  private CompilationState state = new CompilationState(createTreeLogger(),
+      oracle);
+
+  public void testBinaryBindingsWithMemberInnerClass() {
+    testBinaryBindings(OUTER, MEMBER_INNER_SUBCLASS);
+  }
+
+  public void testBinaryBindingsWithMultipleTopLevelClasses() {
+    testBinaryBindings(TOP, TOP3);
+  }
+
+  public void testBinaryBindingsWithSimpleUnits() {
+    testBinaryBindings(JavaResourceBase.FOO, JavaResourceBase.BAR);
+  }
+
+  public void testBinaryBindingsWithStaticInnerClass() {
+    testBinaryBindings(OUTER, STATIC_INNER_SUBCLASS);
+  }
+
+  public void testSourceBindingsWithMemberInnerClass() {
+    testSourceBindings(OUTER, MEMBER_INNER_SUBCLASS);
+  }
+
+  public void testSourceBindingsWithMultipleTopLevelClasses() {
+    testSourceBindings(TOP, TOP3);
+  }
+
+  public void testSourceBindingsWithSimpleUnits() {
+    testSourceBindings(JavaResourceBase.FOO, JavaResourceBase.BAR);
+  }
+
+  public void testSourceBindingsWithStaticInnerClass() {
+    testSourceBindings(OUTER, STATIC_INNER_SUBCLASS);
+  }
+
+  public void testWithGeneratedUnits() {
+    state.addGeneratedCompilationUnits(createTreeLogger(),
+        copyAsGeneratedUnits(JavaResourceBase.BAR, JavaResourceBase.FOO));
+    assertRefsMatchExpectedRefs(JavaResourceBase.BAR, JavaResourceBase.FOO);
+  }
+
+  public void testWithMixedUnits() {
+    oracle.add(JavaResourceBase.FOO);
+    state.refresh(createTreeLogger());
+    state.addGeneratedCompilationUnits(createTreeLogger(),
+        copyAsGeneratedUnits(JavaResourceBase.BAR));
+    assertRefsMatchExpectedRefs(JavaResourceBase.BAR, JavaResourceBase.FOO);
+  }
+
+  private void assertRefsMatchExpectedRefs(Resource... files) {
+    for (Resource sourceFile : files) {
+      Set<String> sourceFileRefs = state.getCompilationUnitMap().get(
+          SourceFileCompilationUnit.getTypeName(sourceFile)).getFileNameRefs();
+      Set<String> expectedSourceFileRefs = EXPECTED_DEPENDENCIES.get(sourceFile.getLocation());
+      assertEquals(expectedSourceFileRefs, sourceFileRefs);
+    }
+  }
+
+  /**
+   * Returns copies of units as generated units for testing interactions with
+   * generated units.
+   */
+  private Set<CompilationUnit> copyAsGeneratedUnits(Resource... sourceFiles) {
+    Set<CompilationUnit> units = new HashSet<CompilationUnit>();
+    for (Resource sourceFile : sourceFiles) {
+      units.add(new SourceFileCompilationUnit(sourceFile) {
+        @Override
+        public boolean isGenerated() {
+          return true;
+        }
+      });
+    }
+    return units;
+  }
+
+  /**
+   * Independently compiles each file in order to force each subsequent unit to
+   * have only binary references to the previous unit(s). This tests the binary
+   * reference matching in {@link CompilationState}.
+   */
+  private void testBinaryBindings(Resource... files) {
+    for (Resource sourceFile : files) {
+      oracle.add(sourceFile);
+      state.refresh(createTreeLogger());
+    }
+    assertRefsMatchExpectedRefs(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(Resource... files) {
+    for (Resource sourceFile : files) {
+      oracle.add(sourceFile);
+    }
+    state.refresh(createTreeLogger());
+    assertRefsMatchExpectedRefs(files);
+  }
+}
diff --git a/dev/core/test/com/google/gwt/dev/js/JsStaticEvalTest.java b/dev/core/test/com/google/gwt/dev/js/JsStaticEvalTest.java
index 271f174..52e6bc9 100644
--- a/dev/core/test/com/google/gwt/dev/js/JsStaticEvalTest.java
+++ b/dev/core/test/com/google/gwt/dev/js/JsStaticEvalTest.java
@@ -1,77 +1,77 @@
-/*

- * Copyright 2009 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.js;

-

-/**

- * Tests the JsStaticEval optimizer.

- */

-public class JsStaticEvalTest extends OptimizerTestBase {

-

-  public void testIfWithEmptyThen() throws Exception {

-    assertEquals("a();", optimize("if (a()) { }"));

-  }

-

-  public void testIfWithEmptyThenAndElseExpression() throws Exception {

-    assertEquals("a()||b();", optimize("if (a()) { } else { b(); }"));

-  }

-

-  public void testIfWithEmptyThenAndElse() throws Exception {

-    assertEquals("if(!a()){throw 1}",

-        optimize("if (a()) { } else { throw 1; }"));

-  }

-

-  public void testIfWithEmptyThenAndEmptyElse() throws Exception {

-    assertEquals("a();", optimize("if (a()) { } else { }"));

-  }

-

-  public void testIfWithThenAndEmptyElse() throws Exception {

-    assertEquals("if(a()){throw 1}", optimize("if (a()) { throw 1; } else { }"));

-  }

-

-  public void testIfWithThenExpressionAndEmptyElse() throws Exception {

-    assertEquals("a()&&b();", optimize("if (a()) { b() } else { }"));

-  }

-

-  public void testIfWithThenExpressionAndElseExpression() throws Exception {

-    assertEquals("a()?b():c();", optimize("if (a()) { b() } else { c(); }"));

-  }

-

-  public void testIfWithThenExpressionAndElseStatement() throws Exception {

-    // This can't be optimized further

-    assertEquals("if(a()){b()}else{throw 1}",

-        optimize("if (a()) { b() } else { throw 1; }"));

-  }

-

-  public void testLiteralEqNull() throws Exception {

-    assertEquals("alert(false);", optimize("alert('test' == null)"));

-  }

-

-  public void testLiteralNeNull() throws Exception {

-    assertEquals("alert(true);", optimize("alert('test' != null)"));

-  }

-

-  public void testNullEqNull() throws Exception {

-    assertEquals("alert(true);", optimize("alert(null == null)"));

-  }

-

-  public void testNullNeNull() throws Exception {

-    assertEquals("alert(false);", optimize("alert(null != null)"));

-  }

-

-  private String optimize(String js) throws Exception {

-    return optimize(js, JsStaticEval.class);

-  }

-}

+/*
+ * Copyright 2009 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.js;
+
+/**
+ * Tests the JsStaticEval optimizer.
+ */
+public class JsStaticEvalTest extends OptimizerTestBase {
+
+  public void testIfWithEmptyThen() throws Exception {
+    assertEquals("a();", optimize("if (a()) { }"));
+  }
+
+  public void testIfWithEmptyThenAndElseExpression() throws Exception {
+    assertEquals("a()||b();", optimize("if (a()) { } else { b(); }"));
+  }
+
+  public void testIfWithEmptyThenAndElse() throws Exception {
+    assertEquals("if(!a()){throw 1}",
+        optimize("if (a()) { } else { throw 1; }"));
+  }
+
+  public void testIfWithEmptyThenAndEmptyElse() throws Exception {
+    assertEquals("a();", optimize("if (a()) { } else { }"));
+  }
+
+  public void testIfWithThenAndEmptyElse() throws Exception {
+    assertEquals("if(a()){throw 1}", optimize("if (a()) { throw 1; } else { }"));
+  }
+
+  public void testIfWithThenExpressionAndEmptyElse() throws Exception {
+    assertEquals("a()&&b();", optimize("if (a()) { b() } else { }"));
+  }
+
+  public void testIfWithThenExpressionAndElseExpression() throws Exception {
+    assertEquals("a()?b():c();", optimize("if (a()) { b() } else { c(); }"));
+  }
+
+  public void testIfWithThenExpressionAndElseStatement() throws Exception {
+    // This can't be optimized further
+    assertEquals("if(a()){b()}else{throw 1}",
+        optimize("if (a()) { b() } else { throw 1; }"));
+  }
+
+  public void testLiteralEqNull() throws Exception {
+    assertEquals("alert(false);", optimize("alert('test' == null)"));
+  }
+
+  public void testLiteralNeNull() throws Exception {
+    assertEquals("alert(true);", optimize("alert('test' != null)"));
+  }
+
+  public void testNullEqNull() throws Exception {
+    assertEquals("alert(true);", optimize("alert(null == null)"));
+  }
+
+  public void testNullNeNull() throws Exception {
+    assertEquals("alert(false);", optimize("alert(null != null)"));
+  }
+
+  private String optimize(String js) throws Exception {
+    return optimize(js, JsStaticEval.class);
+  }
+}
diff --git a/dev/core/test/com/google/gwt/dev/util/DiskCacheTest.java b/dev/core/test/com/google/gwt/dev/util/DiskCacheTest.java
index 36c0ec9..968ccc2 100644
--- a/dev/core/test/com/google/gwt/dev/util/DiskCacheTest.java
+++ b/dev/core/test/com/google/gwt/dev/util/DiskCacheTest.java
@@ -1,79 +1,79 @@
-/*

- * Copyright 2009 Google Inc.

- * 

- * Licensed under the Apache License, Version 2.0 (the "License"); you may not

- * use this file except in compliance with the License. You may obtain a copy of

- * the License at

- * 

- * http://www.apache.org/licenses/LICENSE-2.0

- * 

- * Unless required by applicable law or agreed to in writing, software

- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT

- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the

- * License for the specific language governing permissions and limitations under

- * the License.

- */

-package com.google.gwt.dev.util;

-

-import junit.framework.TestCase;

-

-import java.util.Arrays;

-

-/**

- * Tests {@link DiskCache}.

- */

-public class DiskCacheTest extends TestCase {

-  private final DiskCache diskCache = new DiskCache();

-

-  public void testBytes() {

-    byte[] a = new byte[0];

-    byte[] b = new byte[] {1, 5, 9, 7, 3, 4, 2};

-    byte[] c = new byte[3524];

-    for (int i = 1; i < c.length; ++i) {

-      c[i] = (byte) (i * 31 + c[i - 1]);

-    }

-    byte[][] insertOrder = new byte[][] {a, b, c, b, c, a, a, b, b, c, c, a};

-    long[] tokens = new long[insertOrder.length];

-    for (int i = 0; i < insertOrder.length; ++i) {

-      tokens[i] = diskCache.writeByteArray(insertOrder[i]);

-    }

-

-    int testIndex = 0;

-    for (int i = 0; i < 20; ++i) {

-      testIndex += tokens[i % tokens.length];

-      testIndex %= insertOrder.length;

-      byte[] expected = insertOrder[testIndex];

-      byte[] actual = diskCache.readByteArray(tokens[testIndex]);

-      assertTrue("Values were not equals at index '" + testIndex + "'",

-          Arrays.equals(expected, actual));

-    }

-  }

-

-  public void testStrings() {

-    String a = "";

-    String b = "abjdsfkl;jasdf";

-    char[] c = new char[2759];

-    for (int i = 1; i < c.length; ++i) {

-      c[i] = (char) (i * 31 + c[i - 1]);

-      // Avoid problematic characters.

-      c[i] &= 0x7FFF;

-      --c[i];

-    }

-    String s = String.valueOf(c);

-    String[] insertOrder = new String[] {s, a, b, s, b, s, a, a, s, b, b, a, s};

-    long[] tokens = new long[insertOrder.length];

-    for (int i = 0; i < insertOrder.length; ++i) {

-      tokens[i] = diskCache.writeString(insertOrder[i]);

-    }

-

-    int testIndex = 0;

-    for (int i = 0; i < 20; ++i) {

-      testIndex += tokens[i % tokens.length];

-      testIndex %= insertOrder.length;

-      String expected = insertOrder[testIndex];

-      String actual = diskCache.readString(tokens[testIndex]);

-      assertEquals("Values were not equals at index '" + testIndex + "'",

-          expected, actual);

-    }

-  }

-}

+/*
+ * Copyright 2009 Google Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.dev.util;
+
+import junit.framework.TestCase;
+
+import java.util.Arrays;
+
+/**
+ * Tests {@link DiskCache}.
+ */
+public class DiskCacheTest extends TestCase {
+  private final DiskCache diskCache = new DiskCache();
+
+  public void testBytes() {
+    byte[] a = new byte[0];
+    byte[] b = new byte[] {1, 5, 9, 7, 3, 4, 2};
+    byte[] c = new byte[3524];
+    for (int i = 1; i < c.length; ++i) {
+      c[i] = (byte) (i * 31 + c[i - 1]);
+    }
+    byte[][] insertOrder = new byte[][] {a, b, c, b, c, a, a, b, b, c, c, a};
+    long[] tokens = new long[insertOrder.length];
+    for (int i = 0; i < insertOrder.length; ++i) {
+      tokens[i] = diskCache.writeByteArray(insertOrder[i]);
+    }
+
+    int testIndex = 0;
+    for (int i = 0; i < 20; ++i) {
+      testIndex += tokens[i % tokens.length];
+      testIndex %= insertOrder.length;
+      byte[] expected = insertOrder[testIndex];
+      byte[] actual = diskCache.readByteArray(tokens[testIndex]);
+      assertTrue("Values were not equals at index '" + testIndex + "'",
+          Arrays.equals(expected, actual));
+    }
+  }
+
+  public void testStrings() {
+    String a = "";
+    String b = "abjdsfkl;jasdf";
+    char[] c = new char[2759];
+    for (int i = 1; i < c.length; ++i) {
+      c[i] = (char) (i * 31 + c[i - 1]);
+      // Avoid problematic characters.
+      c[i] &= 0x7FFF;
+      --c[i];
+    }
+    String s = String.valueOf(c);
+    String[] insertOrder = new String[] {s, a, b, s, b, s, a, a, s, b, b, a, s};
+    long[] tokens = new long[insertOrder.length];
+    for (int i = 0; i < insertOrder.length; ++i) {
+      tokens[i] = diskCache.writeString(insertOrder[i]);
+    }
+
+    int testIndex = 0;
+    for (int i = 0; i < 20; ++i) {
+      testIndex += tokens[i % tokens.length];
+      testIndex %= insertOrder.length;
+      String expected = insertOrder[testIndex];
+      String actual = diskCache.readString(tokens[testIndex]);
+      assertEquals("Values were not equals at index '" + testIndex + "'",
+          expected, actual);
+    }
+  }
+}
diff --git a/dev/core/test/com/google/gwt/dev/util/collect/HashMapTest.java b/dev/core/test/com/google/gwt/dev/util/collect/HashMapTest.java
index 6fad6c8..f36d5dd 100644
--- a/dev/core/test/com/google/gwt/dev/util/collect/HashMapTest.java
+++ b/dev/core/test/com/google/gwt/dev/util/collect/HashMapTest.java
@@ -1,55 +1,55 @@
-/*

- * Copyright 2009 Google Inc.

- * 

- * Licensed under the Apache License, Version 2.0 (the "License"); you may not

- * use this file except in compliance with the License. You may obtain a copy of

- * the License at

- * 

- * http://www.apache.org/licenses/LICENSE-2.0

- * 

- * Unless required by applicable law or agreed to in writing, software

- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT

- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the

- * License for the specific language governing permissions and limitations under

- * the License.

- */

-package com.google.gwt.dev.util.collect;

-

-import org.apache.commons.collections.map.AbstractTestIterableMap;

-

-import java.util.Map;

-

-/**

- * Test for {@link HashMap}.

- */

-public class HashMapTest extends AbstractTestIterableMap {

-  public HashMapTest(String testName) {

-    super(testName);

-  }

-

-  @SuppressWarnings("unchecked")

-  @Override

-  public Map makeEmptyMap() {

-    return new HashMap();

-  }

-

-  @Override

-  public void testFailFastEntrySet() {

-    // Does not throw ConcurrentModificationException.

-  }

-

-  @Override

-  public void testFailFastKeySet() {

-    // Does not throw ConcurrentModificationException.

-  }

-

-  @Override

-  public void testFailFastValues() {

-    // Does not throw ConcurrentModificationException.

-  }

-

-  @Override

-  protected boolean skipSerializedCanonicalTests() {

-    return true;

-  }

-}

+/*
+ * Copyright 2009 Google Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.dev.util.collect;
+
+import org.apache.commons.collections.map.AbstractTestIterableMap;
+
+import java.util.Map;
+
+/**
+ * Test for {@link HashMap}.
+ */
+public class HashMapTest extends AbstractTestIterableMap {
+  public HashMapTest(String testName) {
+    super(testName);
+  }
+
+  @SuppressWarnings("unchecked")
+  @Override
+  public Map makeEmptyMap() {
+    return new HashMap();
+  }
+
+  @Override
+  public void testFailFastEntrySet() {
+    // Does not throw ConcurrentModificationException.
+  }
+
+  @Override
+  public void testFailFastKeySet() {
+    // Does not throw ConcurrentModificationException.
+  }
+
+  @Override
+  public void testFailFastValues() {
+    // Does not throw ConcurrentModificationException.
+  }
+
+  @Override
+  protected boolean skipSerializedCanonicalTests() {
+    return true;
+  }
+}
diff --git a/dev/core/test/com/google/gwt/dev/util/collect/HashSetTest.java b/dev/core/test/com/google/gwt/dev/util/collect/HashSetTest.java
index 0d7309b..a7c325a 100644
--- a/dev/core/test/com/google/gwt/dev/util/collect/HashSetTest.java
+++ b/dev/core/test/com/google/gwt/dev/util/collect/HashSetTest.java
@@ -1,40 +1,40 @@
-/*

- * Copyright 2009 Google Inc.

- * 

- * Licensed under the Apache License, Version 2.0 (the "License"); you may not

- * use this file except in compliance with the License. You may obtain a copy of

- * the License at

- * 

- * http://www.apache.org/licenses/LICENSE-2.0

- * 

- * Unless required by applicable law or agreed to in writing, software

- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT

- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the

- * License for the specific language governing permissions and limitations under

- * the License.

- */

-package com.google.gwt.dev.util.collect;

-

-import org.apache.commons.collections.set.AbstractTestSet;

-

-import java.util.Set;

-

-/**

- * Test for {@link HashMap}.

- */

-public class HashSetTest extends AbstractTestSet {

-  public HashSetTest(String testName) {

-    super(testName);

-  }

-

-  @SuppressWarnings("unchecked")

-  @Override

-  public Set makeEmptySet() {

-    return new HashSet();

-  }

-

-  @Override

-  protected boolean skipSerializedCanonicalTests() {

-    return true;

-  }

-}

+/*
+ * Copyright 2009 Google Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.dev.util.collect;
+
+import org.apache.commons.collections.set.AbstractTestSet;
+
+import java.util.Set;
+
+/**
+ * Test for {@link HashMap}.
+ */
+public class HashSetTest extends AbstractTestSet {
+  public HashSetTest(String testName) {
+    super(testName);
+  }
+
+  @SuppressWarnings("unchecked")
+  @Override
+  public Set makeEmptySet() {
+    return new HashSet();
+  }
+
+  @Override
+  protected boolean skipSerializedCanonicalTests() {
+    return true;
+  }
+}
diff --git a/dev/core/test/com/google/gwt/dev/util/collect/IdentityHashMapTest.java b/dev/core/test/com/google/gwt/dev/util/collect/IdentityHashMapTest.java
index aa4398a..4e17349 100644
--- a/dev/core/test/com/google/gwt/dev/util/collect/IdentityHashMapTest.java
+++ b/dev/core/test/com/google/gwt/dev/util/collect/IdentityHashMapTest.java
@@ -1,80 +1,80 @@
-/*

- * Copyright 2009 Google Inc.

- * 

- * Licensed under the Apache License, Version 2.0 (the "License"); you may not

- * use this file except in compliance with the License. You may obtain a copy of

- * the License at

- * 

- * http://www.apache.org/licenses/LICENSE-2.0

- * 

- * Unless required by applicable law or agreed to in writing, software

- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT

- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the

- * License for the specific language governing permissions and limitations under

- * the License.

- */

-package com.google.gwt.dev.util.collect;

-

-import junit.framework.Test;

-import junit.framework.TestSuite;

-

-import org.apache.commons.collections.map.TestIdentityMap;

-

-import java.util.Map;

-

-/**

- * Test for {@link IdentityHashMap}.

- */

-public class IdentityHashMapTest {

-

-  public static class HashMapExtTest extends HashMapTest {

-    public HashMapExtTest(String testName) {

-      super(testName);

-    }

-

-    @SuppressWarnings("unchecked")

-    @Override

-    public Map makeConfirmedMap() {

-      return new java.util.IdentityHashMap();

-    }

-

-    @SuppressWarnings("unchecked")

-    @Override

-    public Map makeEmptyMap() {

-      return new IdentityHashMap();

-    }

-

-    @Override

-    protected boolean skipSerializedCanonicalTests() {

-      return true;

-    }

-  }

-

-  public static class IdentityMapExtTest extends TestIdentityMap {

-    public static Test suite() {

-      return new TestSuite(IdentityMapExtTest.class);

-    }

-

-    public IdentityMapExtTest(String testName) {

-      super(testName);

-    }

-

-    @SuppressWarnings("unchecked")

-    @Override

-    public Object makeObject() {

-      return new IdentityHashMap();

-    }

-

-    @Override

-    protected boolean skipSerializedCanonicalTests() {

-      return true;

-    }

-  }

-

-  public static Test suite() {

-    TestSuite suite = new TestSuite(IdentityHashMapTest.class.getName());

-    suite.addTestSuite(IdentityMapExtTest.class);

-    suite.addTestSuite(HashMapExtTest.class);

-    return suite;

-  }

-}

+/*
+ * Copyright 2009 Google Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.dev.util.collect;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.commons.collections.map.TestIdentityMap;
+
+import java.util.Map;
+
+/**
+ * Test for {@link IdentityHashMap}.
+ */
+public class IdentityHashMapTest {
+
+  public static class HashMapExtTest extends HashMapTest {
+    public HashMapExtTest(String testName) {
+      super(testName);
+    }
+
+    @SuppressWarnings("unchecked")
+    @Override
+    public Map makeConfirmedMap() {
+      return new java.util.IdentityHashMap();
+    }
+
+    @SuppressWarnings("unchecked")
+    @Override
+    public Map makeEmptyMap() {
+      return new IdentityHashMap();
+    }
+
+    @Override
+    protected boolean skipSerializedCanonicalTests() {
+      return true;
+    }
+  }
+
+  public static class IdentityMapExtTest extends TestIdentityMap {
+    public static Test suite() {
+      return new TestSuite(IdentityMapExtTest.class);
+    }
+
+    public IdentityMapExtTest(String testName) {
+      super(testName);
+    }
+
+    @SuppressWarnings("unchecked")
+    @Override
+    public Object makeObject() {
+      return new IdentityHashMap();
+    }
+
+    @Override
+    protected boolean skipSerializedCanonicalTests() {
+      return true;
+    }
+  }
+
+  public static Test suite() {
+    TestSuite suite = new TestSuite(IdentityHashMapTest.class.getName());
+    suite.addTestSuite(IdentityMapExtTest.class);
+    suite.addTestSuite(HashMapExtTest.class);
+    return suite;
+  }
+}
diff --git a/dev/core/test/com/google/gwt/dev/util/collect/IdentityHashSetTest.java b/dev/core/test/com/google/gwt/dev/util/collect/IdentityHashSetTest.java
index b9fb4ef..3435cdf 100644
--- a/dev/core/test/com/google/gwt/dev/util/collect/IdentityHashSetTest.java
+++ b/dev/core/test/com/google/gwt/dev/util/collect/IdentityHashSetTest.java
@@ -1,99 +1,99 @@
-/*

- * Copyright 2009 Google Inc.

- * 

- * Licensed under the Apache License, Version 2.0 (the "License"); you may not

- * use this file except in compliance with the License. You may obtain a copy of

- * the License at

- * 

- * http://www.apache.org/licenses/LICENSE-2.0

- * 

- * Unless required by applicable law or agreed to in writing, software

- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT

- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the

- * License for the specific language governing permissions and limitations under

- * the License.

- */

-package com.google.gwt.dev.util.collect;

-

-import org.apache.commons.collections.set.AbstractTestSet;

-

-import java.util.AbstractSet;

-import java.util.Collection;

-import java.util.Iterator;

-import java.util.Set;

-

-/**

- * Test for {@link HashMap}.

- */

-public class IdentityHashSetTest extends AbstractTestSet {

-  private static final Float FLOAT_6 = 6.0f;

-  private static final Double DOUBLE_5 = 5.0;

-

-  public IdentityHashSetTest(String testName) {

-    super(testName);

-  }

-

-  @Override

-  public boolean areEqualElementsDistinguishable() {

-    return true;

-  }

-

-  /**

-   * Must use stable identities.

-   */

-  @Override

-  public Object[] getFullNonNullElements() {

-    return new Object[] {

-        "", "One", 2, "Three", 4, "One", DOUBLE_5, FLOAT_6, "Seven", "Eight",

-        "Nine", 10, (short) 11, 12L, "Thirteen", "14", "15", (byte) 16};

-  }

-

-  /**

-   * Must use stable identities.

-   */

-  @Override

-  public Object[] getOtherNonNullElements() {

-    return new Object[] {

-        0, 0f, 0.0, "Zero", (short) 0, (byte) 0, 0L, '\u0000', "0"};

-  }

-

-  @SuppressWarnings("unchecked")

-  @Override

-  public Collection makeConfirmedCollection() {

-    final java.util.IdentityHashMap map = new java.util.IdentityHashMap();

-    return new AbstractSet() {

-      @Override

-      public boolean add(Object e) {

-        return map.put(e, e) == null;

-      }

-

-      @Override

-      public Iterator iterator() {

-        return map.keySet().iterator();

-      }

-

-      @Override

-      public int size() {

-        return map.size();

-      }

-    };

-  }

-

-  @SuppressWarnings("unchecked")

-  @Override

-  public Set makeEmptySet() {

-    return new IdentityHashSet();

-  }

-

-  @Override

-  protected boolean skipSerializedCanonicalTests() {

-    return true;

-  }

-

-  /**

-   * This can't possible work due to non-stable identities.

-   */

-  @Override

-  public void testSerializeDeserializeThenCompare() throws Exception {

-  }

-}

+/*
+ * Copyright 2009 Google Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.dev.util.collect;
+
+import org.apache.commons.collections.set.AbstractTestSet;
+
+import java.util.AbstractSet;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Set;
+
+/**
+ * Test for {@link HashMap}.
+ */
+public class IdentityHashSetTest extends AbstractTestSet {
+  private static final Float FLOAT_6 = 6.0f;
+  private static final Double DOUBLE_5 = 5.0;
+
+  public IdentityHashSetTest(String testName) {
+    super(testName);
+  }
+
+  @Override
+  public boolean areEqualElementsDistinguishable() {
+    return true;
+  }
+
+  /**
+   * Must use stable identities.
+   */
+  @Override
+  public Object[] getFullNonNullElements() {
+    return new Object[] {
+        "", "One", 2, "Three", 4, "One", DOUBLE_5, FLOAT_6, "Seven", "Eight",
+        "Nine", 10, (short) 11, 12L, "Thirteen", "14", "15", (byte) 16};
+  }
+
+  /**
+   * Must use stable identities.
+   */
+  @Override
+  public Object[] getOtherNonNullElements() {
+    return new Object[] {
+        0, 0f, 0.0, "Zero", (short) 0, (byte) 0, 0L, '\u0000', "0"};
+  }
+
+  @SuppressWarnings("unchecked")
+  @Override
+  public Collection makeConfirmedCollection() {
+    final java.util.IdentityHashMap map = new java.util.IdentityHashMap();
+    return new AbstractSet() {
+      @Override
+      public boolean add(Object e) {
+        return map.put(e, e) == null;
+      }
+
+      @Override
+      public Iterator iterator() {
+        return map.keySet().iterator();
+      }
+
+      @Override
+      public int size() {
+        return map.size();
+      }
+    };
+  }
+
+  @SuppressWarnings("unchecked")
+  @Override
+  public Set makeEmptySet() {
+    return new IdentityHashSet();
+  }
+
+  @Override
+  protected boolean skipSerializedCanonicalTests() {
+    return true;
+  }
+
+  /**
+   * This can't possible work due to non-stable identities.
+   */
+  @Override
+  public void testSerializeDeserializeThenCompare() throws Exception {
+  }
+}
diff --git a/dev/core/test/org/apache/commons/collections/AbstractTestObject.java b/dev/core/test/org/apache/commons/collections/AbstractTestObject.java
index f0bdc20..21aab95 100644
--- a/dev/core/test/org/apache/commons/collections/AbstractTestObject.java
+++ b/dev/core/test/org/apache/commons/collections/AbstractTestObject.java
@@ -1,328 +1,328 @@
-/*

- *  Licensed to the Apache Software Foundation (ASF) under one or more

- *  contributor license agreements.  See the NOTICE file distributed with

- *  this work for additional information regarding copyright ownership.

- *  The ASF licenses this file to You 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 org.apache.commons.collections;

-

-import java.io.ByteArrayInputStream;

-import java.io.ByteArrayOutputStream;

-import java.io.File;

-import java.io.FileInputStream;

-import java.io.FileOutputStream;

-import java.io.IOException;

-import java.io.InputStream;

-import java.io.ObjectInputStream;

-import java.io.ObjectOutputStream;

-import java.io.OutputStream;

-import java.io.Serializable;

-

-/**

- * Abstract test class for {@link java.lang.Object} methods and contracts.

- * <p>

- * To use, simply extend this class, and implement

- * the {@link #makeObject()} method.

- * <p>

- * If your {@link Object} fails one of these tests by design,

- * you may still use this base set of cases.  Simply override the

- * test case (method) your {@link Object} fails.

- *

- * @version $Revision: 646780 $ $Date: 2008-04-10 13:48:07 +0100 (Thu, 10 Apr 2008) $

- * 

- * @author Rodney Waldhoff

- * @author Stephen Colebourne

- * @author Anonymous

- */

-public abstract class AbstractTestObject extends BulkTest {

-

-    /** Current major release for Collections */

-    public static final int COLLECTIONS_MAJOR_VERSION = 3;

-    

-    /**

-     * JUnit constructor.

-     * 

-     * @param testName  the test class name

-     */

-    public AbstractTestObject(String testName) {

-        super(testName);

-    }

-

-    //-----------------------------------------------------------------------

-    /**

-     * Implement this method to return the object to test.

-     * 

-     * @return the object to test

-     */

-    public abstract Object makeObject();

-

-    /**

-     * Override this method if a subclass is testing an object

-     * that cannot serialize an "empty" Collection.

-     * (e.g. Comparators have no contents)

-     * 

-     * @return true

-     */

-    public boolean supportsEmptyCollections() {

-        return true;

-    }

-

-    /**

-     * Override this method if a subclass is testing an object

-     * that cannot serialize a "full" Collection.

-     * (e.g. Comparators have no contents)

-     * 

-     * @return true

-     */

-    public boolean supportsFullCollections() {

-        return true;

-    }

-

-    /**

-     * Is serialization testing supported.

-     * Default is true.

-     */

-    public boolean isTestSerialization() {

-        return true;

-    }

-

-    /**

-     * Returns true to indicate that the collection supports equals() comparisons.

-     * This implementation returns true;

-     */

-    public boolean isEqualsCheckable() {

-        return true;

-    }

-

-    //-----------------------------------------------------------------------

-    public void testObjectEqualsSelf() {

-        Object obj = makeObject();

-        assertEquals("A Object should equal itself", obj, obj);

-    }

-

-    public void testEqualsNull() {

-        Object obj = makeObject();

-        assertEquals(false, obj.equals(null)); // make sure this doesn't throw NPE either

-    }

-

-    public void testObjectHashCodeEqualsSelfHashCode() {

-        Object obj = makeObject();

-        assertEquals("hashCode should be repeatable", obj.hashCode(), obj.hashCode());

-    }

-

-    public void testObjectHashCodeEqualsContract() {

-        Object obj1 = makeObject();

-        if (obj1.equals(obj1)) {

-            assertEquals(

-                "[1] When two objects are equal, their hashCodes should be also.",

-                obj1.hashCode(), obj1.hashCode());

-        }

-        Object obj2 = makeObject();

-        if (obj1.equals(obj2)) {

-            assertEquals(

-                "[2] When two objects are equal, their hashCodes should be also.",

-                obj1.hashCode(), obj2.hashCode());

-            assertTrue(

-                "When obj1.equals(obj2) is true, then obj2.equals(obj1) should also be true",

-                obj2.equals(obj1));

-        }

-    }

-

-    public void testSerializeDeserializeThenCompare() throws Exception {

-        Object obj = makeObject();

-        if (obj instanceof Serializable && isTestSerialization()) {

-            ByteArrayOutputStream buffer = new ByteArrayOutputStream();

-            ObjectOutputStream out = new ObjectOutputStream(buffer);

-            out.writeObject(obj);

-            out.close();

-

-            ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray()));

-            Object dest = in.readObject();

-            in.close();

-            if (isEqualsCheckable()) {

-                assertEquals("obj != deserialize(serialize(obj))", obj, dest);

-            }

-        }

-    }

-

-    /**

-     * Sanity check method, makes sure that any Serializable

-     * class can be serialized and de-serialized in memory, 

-     * using the handy makeObject() method

-     * 

-     * @throws IOException

-     * @throws ClassNotFoundException

-     */

-    public void testSimpleSerialization() throws Exception {

-        Object o = makeObject();

-        if (o instanceof Serializable && isTestSerialization()) {

-            byte[] objekt = writeExternalFormToBytes((Serializable) o);

-            Object p = readExternalFormFromBytes(objekt);

-        }

-    }

-

-    /**

-     * Tests serialization by comparing against a previously stored version in CVS.

-     * If the test object is serializable, confirm that a canonical form exists.

-     */

-    public void testCanonicalEmptyCollectionExists() {

-        if (supportsEmptyCollections() && isTestSerialization() && !skipSerializedCanonicalTests()) {

-            Object object = makeObject();

-            if (object instanceof Serializable) {

-                String name = getCanonicalEmptyCollectionName(object);

-                assertTrue(

-                    "Canonical empty collection (" + name + ") is not in CVS",

-                    new File(name).exists());

-            }

-        }

-    }

-

-    /**

-     * Tests serialization by comparing against a previously stored version in CVS.

-     * If the test object is serializable, confirm that a canonical form exists.

-     */

-    public void testCanonicalFullCollectionExists() {

-        if (supportsFullCollections() && isTestSerialization() && !skipSerializedCanonicalTests()) {

-            Object object = makeObject();

-            if (object instanceof Serializable) {

-                String name = getCanonicalFullCollectionName(object);

-                assertTrue(

-                    "Canonical full collection (" + name + ") is not in CVS",

-                    new File(name).exists());

-            }

-        }

-    }

-

-    // protected implementation

-    //-----------------------------------------------------------------------

-    /**

-     * Get the version of Collections that this object tries to

-     * maintain serialization compatibility with. Defaults to 1, the

-     * earliest Collections version. (Note: some collections did not

-     * even exist in this version).

-     * 

-     * This constant makes it possible for TestMap (and other subclasses,

-     * if necessary) to automatically check CVS for a versionX copy of a

-     * Serialized object, so we can make sure that compatibility is maintained.

-     * See, for example, TestMap.getCanonicalFullMapName(Map map).

-     * Subclasses can override this variable, indicating compatibility

-     * with earlier Collections versions.

-     * 

-     * @return The version, or <code>null</code> if this object shouldn't be

-     * tested for compatibility with previous versions.

-     */

-    public String getCompatibilityVersion() {

-        return "1";

-    }

-

-    protected String getCanonicalEmptyCollectionName(Object object) {

-        StringBuffer retval = new StringBuffer();

-        retval.append("data/test/");

-        String colName = object.getClass().getName();

-        colName = colName.substring(colName.lastIndexOf(".") + 1, colName.length());

-        retval.append(colName);

-        retval.append(".emptyCollection.version");

-        retval.append(getCompatibilityVersion());

-        retval.append(".obj");

-        return retval.toString();

-    }

-

-    protected String getCanonicalFullCollectionName(Object object) {

-        StringBuffer retval = new StringBuffer();

-        retval.append("data/test/");

-        String colName = object.getClass().getName();

-        colName = colName.substring(colName.lastIndexOf(".") + 1, colName.length());

-        retval.append(colName);

-        retval.append(".fullCollection.version");

-        retval.append(getCompatibilityVersion());

-        retval.append(".obj");

-        return retval.toString();

-    }

-

-    /**

-     * Write a Serializable or Externalizable object as

-     * a file at the given path.  NOT USEFUL as part

-     * of a unit test; this is just a utility method

-     * for creating disk-based objects in CVS that can become

-     * the basis for compatibility tests using

-     * readExternalFormFromDisk(String path)

-     * 

-     * @param o Object to serialize

-     * @param path path to write the serialized Object

-     * @exception IOException

-     */

-    protected void writeExternalFormToDisk(Serializable o, String path) throws IOException {

-        FileOutputStream fileStream = new FileOutputStream(path);

-        writeExternalFormToStream(o, fileStream);

-    }

-

-    /**

-     * Converts a Serializable or Externalizable object to

-     * bytes.  Useful for in-memory tests of serialization

-     * 

-     * @param o Object to convert to bytes

-     * @return serialized form of the Object

-     * @exception IOException

-     */

-    protected byte[] writeExternalFormToBytes(Serializable o) throws IOException {

-        ByteArrayOutputStream byteStream = new ByteArrayOutputStream();

-        writeExternalFormToStream(o, byteStream);

-        return byteStream.toByteArray();

-    }

-

-    /**

-     * Reads a Serialized or Externalized Object from disk.

-     * Useful for creating compatibility tests between

-     * different CVS versions of the same class

-     * 

-     * @param path path to the serialized Object

-     * @return the Object at the given path

-     * @exception IOException

-     * @exception ClassNotFoundException

-     */

-    protected Object readExternalFormFromDisk(String path) throws IOException, ClassNotFoundException {

-        FileInputStream stream = new FileInputStream(path);

-        return readExternalFormFromStream(stream);

-    }

-

-    /**

-     * Read a Serialized or Externalized Object from bytes.

-     * Useful for verifying serialization in memory.

-     * 

-     * @param b byte array containing a serialized Object

-     * @return Object contained in the bytes

-     * @exception IOException

-     * @exception ClassNotFoundException

-     */

-    protected Object readExternalFormFromBytes(byte[] b) throws IOException, ClassNotFoundException {

-        ByteArrayInputStream stream = new ByteArrayInputStream(b);

-        return readExternalFormFromStream(stream);

-    }

-

-    protected boolean skipSerializedCanonicalTests() {

-        return Boolean.getBoolean("org.apache.commons.collections:with-clover");

-    }

-

-    // private implementation

-    //-----------------------------------------------------------------------

-    private Object readExternalFormFromStream(InputStream stream) throws IOException, ClassNotFoundException {

-        ObjectInputStream oStream = new ObjectInputStream(stream);

-        return oStream.readObject();

-    }

-

-    private void writeExternalFormToStream(Serializable o, OutputStream stream) throws IOException {

-        ObjectOutputStream oStream = new ObjectOutputStream(stream);

-        oStream.writeObject(o);

-    }

-

-}

+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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 org.apache.commons.collections;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.OutputStream;
+import java.io.Serializable;
+
+/**
+ * Abstract test class for {@link java.lang.Object} methods and contracts.
+ * <p>
+ * To use, simply extend this class, and implement
+ * the {@link #makeObject()} method.
+ * <p>
+ * If your {@link Object} fails one of these tests by design,
+ * you may still use this base set of cases.  Simply override the
+ * test case (method) your {@link Object} fails.
+ *
+ * @version $Revision: 646780 $ $Date: 2008-04-10 13:48:07 +0100 (Thu, 10 Apr 2008) $
+ * 
+ * @author Rodney Waldhoff
+ * @author Stephen Colebourne
+ * @author Anonymous
+ */
+public abstract class AbstractTestObject extends BulkTest {
+
+    /** Current major release for Collections */
+    public static final int COLLECTIONS_MAJOR_VERSION = 3;
+    
+    /**
+     * JUnit constructor.
+     * 
+     * @param testName  the test class name
+     */
+    public AbstractTestObject(String testName) {
+        super(testName);
+    }
+
+    //-----------------------------------------------------------------------
+    /**
+     * Implement this method to return the object to test.
+     * 
+     * @return the object to test
+     */
+    public abstract Object makeObject();
+
+    /**
+     * Override this method if a subclass is testing an object
+     * that cannot serialize an "empty" Collection.
+     * (e.g. Comparators have no contents)
+     * 
+     * @return true
+     */
+    public boolean supportsEmptyCollections() {
+        return true;
+    }
+
+    /**
+     * Override this method if a subclass is testing an object
+     * that cannot serialize a "full" Collection.
+     * (e.g. Comparators have no contents)
+     * 
+     * @return true
+     */
+    public boolean supportsFullCollections() {
+        return true;
+    }
+
+    /**
+     * Is serialization testing supported.
+     * Default is true.
+     */
+    public boolean isTestSerialization() {
+        return true;
+    }
+
+    /**
+     * Returns true to indicate that the collection supports equals() comparisons.
+     * This implementation returns true;
+     */
+    public boolean isEqualsCheckable() {
+        return true;
+    }
+
+    //-----------------------------------------------------------------------
+    public void testObjectEqualsSelf() {
+        Object obj = makeObject();
+        assertEquals("A Object should equal itself", obj, obj);
+    }
+
+    public void testEqualsNull() {
+        Object obj = makeObject();
+        assertEquals(false, obj.equals(null)); // make sure this doesn't throw NPE either
+    }
+
+    public void testObjectHashCodeEqualsSelfHashCode() {
+        Object obj = makeObject();
+        assertEquals("hashCode should be repeatable", obj.hashCode(), obj.hashCode());
+    }
+
+    public void testObjectHashCodeEqualsContract() {
+        Object obj1 = makeObject();
+        if (obj1.equals(obj1)) {
+            assertEquals(
+                "[1] When two objects are equal, their hashCodes should be also.",
+                obj1.hashCode(), obj1.hashCode());
+        }
+        Object obj2 = makeObject();
+        if (obj1.equals(obj2)) {
+            assertEquals(
+                "[2] When two objects are equal, their hashCodes should be also.",
+                obj1.hashCode(), obj2.hashCode());
+            assertTrue(
+                "When obj1.equals(obj2) is true, then obj2.equals(obj1) should also be true",
+                obj2.equals(obj1));
+        }
+    }
+
+    public void testSerializeDeserializeThenCompare() throws Exception {
+        Object obj = makeObject();
+        if (obj instanceof Serializable && isTestSerialization()) {
+            ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+            ObjectOutputStream out = new ObjectOutputStream(buffer);
+            out.writeObject(obj);
+            out.close();
+
+            ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray()));
+            Object dest = in.readObject();
+            in.close();
+            if (isEqualsCheckable()) {
+                assertEquals("obj != deserialize(serialize(obj))", obj, dest);
+            }
+        }
+    }
+
+    /**
+     * Sanity check method, makes sure that any Serializable
+     * class can be serialized and de-serialized in memory, 
+     * using the handy makeObject() method
+     * 
+     * @throws IOException
+     * @throws ClassNotFoundException
+     */
+    public void testSimpleSerialization() throws Exception {
+        Object o = makeObject();
+        if (o instanceof Serializable && isTestSerialization()) {
+            byte[] objekt = writeExternalFormToBytes((Serializable) o);
+            Object p = readExternalFormFromBytes(objekt);
+        }
+    }
+
+    /**
+     * Tests serialization by comparing against a previously stored version in CVS.
+     * If the test object is serializable, confirm that a canonical form exists.
+     */
+    public void testCanonicalEmptyCollectionExists() {
+        if (supportsEmptyCollections() && isTestSerialization() && !skipSerializedCanonicalTests()) {
+            Object object = makeObject();
+            if (object instanceof Serializable) {
+                String name = getCanonicalEmptyCollectionName(object);
+                assertTrue(
+                    "Canonical empty collection (" + name + ") is not in CVS",
+                    new File(name).exists());
+            }
+        }
+    }
+
+    /**
+     * Tests serialization by comparing against a previously stored version in CVS.
+     * If the test object is serializable, confirm that a canonical form exists.
+     */
+    public void testCanonicalFullCollectionExists() {
+        if (supportsFullCollections() && isTestSerialization() && !skipSerializedCanonicalTests()) {
+            Object object = makeObject();
+            if (object instanceof Serializable) {
+                String name = getCanonicalFullCollectionName(object);
+                assertTrue(
+                    "Canonical full collection (" + name + ") is not in CVS",
+                    new File(name).exists());
+            }
+        }
+    }
+
+    // protected implementation
+    //-----------------------------------------------------------------------
+    /**
+     * Get the version of Collections that this object tries to
+     * maintain serialization compatibility with. Defaults to 1, the
+     * earliest Collections version. (Note: some collections did not
+     * even exist in this version).
+     * 
+     * This constant makes it possible for TestMap (and other subclasses,
+     * if necessary) to automatically check CVS for a versionX copy of a
+     * Serialized object, so we can make sure that compatibility is maintained.
+     * See, for example, TestMap.getCanonicalFullMapName(Map map).
+     * Subclasses can override this variable, indicating compatibility
+     * with earlier Collections versions.
+     * 
+     * @return The version, or <code>null</code> if this object shouldn't be
+     * tested for compatibility with previous versions.
+     */
+    public String getCompatibilityVersion() {
+        return "1";
+    }
+
+    protected String getCanonicalEmptyCollectionName(Object object) {
+        StringBuffer retval = new StringBuffer();
+        retval.append("data/test/");
+        String colName = object.getClass().getName();
+        colName = colName.substring(colName.lastIndexOf(".") + 1, colName.length());
+        retval.append(colName);
+        retval.append(".emptyCollection.version");
+        retval.append(getCompatibilityVersion());
+        retval.append(".obj");
+        return retval.toString();
+    }
+
+    protected String getCanonicalFullCollectionName(Object object) {
+        StringBuffer retval = new StringBuffer();
+        retval.append("data/test/");
+        String colName = object.getClass().getName();
+        colName = colName.substring(colName.lastIndexOf(".") + 1, colName.length());
+        retval.append(colName);
+        retval.append(".fullCollection.version");
+        retval.append(getCompatibilityVersion());
+        retval.append(".obj");
+        return retval.toString();
+    }
+
+    /**
+     * Write a Serializable or Externalizable object as
+     * a file at the given path.  NOT USEFUL as part
+     * of a unit test; this is just a utility method
+     * for creating disk-based objects in CVS that can become
+     * the basis for compatibility tests using
+     * readExternalFormFromDisk(String path)
+     * 
+     * @param o Object to serialize
+     * @param path path to write the serialized Object
+     * @exception IOException
+     */
+    protected void writeExternalFormToDisk(Serializable o, String path) throws IOException {
+        FileOutputStream fileStream = new FileOutputStream(path);
+        writeExternalFormToStream(o, fileStream);
+    }
+
+    /**
+     * Converts a Serializable or Externalizable object to
+     * bytes.  Useful for in-memory tests of serialization
+     * 
+     * @param o Object to convert to bytes
+     * @return serialized form of the Object
+     * @exception IOException
+     */
+    protected byte[] writeExternalFormToBytes(Serializable o) throws IOException {
+        ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
+        writeExternalFormToStream(o, byteStream);
+        return byteStream.toByteArray();
+    }
+
+    /**
+     * Reads a Serialized or Externalized Object from disk.
+     * Useful for creating compatibility tests between
+     * different CVS versions of the same class
+     * 
+     * @param path path to the serialized Object
+     * @return the Object at the given path
+     * @exception IOException
+     * @exception ClassNotFoundException
+     */
+    protected Object readExternalFormFromDisk(String path) throws IOException, ClassNotFoundException {
+        FileInputStream stream = new FileInputStream(path);
+        return readExternalFormFromStream(stream);
+    }
+
+    /**
+     * Read a Serialized or Externalized Object from bytes.
+     * Useful for verifying serialization in memory.
+     * 
+     * @param b byte array containing a serialized Object
+     * @return Object contained in the bytes
+     * @exception IOException
+     * @exception ClassNotFoundException
+     */
+    protected Object readExternalFormFromBytes(byte[] b) throws IOException, ClassNotFoundException {
+        ByteArrayInputStream stream = new ByteArrayInputStream(b);
+        return readExternalFormFromStream(stream);
+    }
+
+    protected boolean skipSerializedCanonicalTests() {
+        return Boolean.getBoolean("org.apache.commons.collections:with-clover");
+    }
+
+    // private implementation
+    //-----------------------------------------------------------------------
+    private Object readExternalFormFromStream(InputStream stream) throws IOException, ClassNotFoundException {
+        ObjectInputStream oStream = new ObjectInputStream(stream);
+        return oStream.readObject();
+    }
+
+    private void writeExternalFormToStream(Serializable o, OutputStream stream) throws IOException {
+        ObjectOutputStream oStream = new ObjectOutputStream(stream);
+        oStream.writeObject(o);
+    }
+
+}
diff --git a/dev/core/test/org/apache/commons/collections/BulkTest.java b/dev/core/test/org/apache/commons/collections/BulkTest.java
index 0d9e1ba..6461e71 100644
--- a/dev/core/test/org/apache/commons/collections/BulkTest.java
+++ b/dev/core/test/org/apache/commons/collections/BulkTest.java
@@ -1,462 +1,462 @@
-/*

- *  Licensed to the Apache Software Foundation (ASF) under one or more

- *  contributor license agreements.  See the NOTICE file distributed with

- *  this work for additional information regarding copyright ownership.

- *  The ASF licenses this file to You 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 org.apache.commons.collections;

-

-import java.lang.reflect.Constructor;

-import java.lang.reflect.InvocationTargetException;

-import java.lang.reflect.Method;

-import java.lang.reflect.Modifier;

-import java.util.ArrayList;

-import java.util.Arrays;

-import java.util.List;

-

-import junit.framework.TestCase;

-import junit.framework.TestSuite;

-

-/**

- * A {@link TestCase} that can define both simple and bulk test methods.

- * <p>

- * A <I>simple test method</I> is the type of test traditionally 

- * supplied by by {@link TestCase}.  To define a simple test, create a public 

- * no-argument method whose name starts with "test".  You can specify the

- * the name of simple test in the constructor of <code>BulkTest</code>;

- * a subsequent call to {@link TestCase#run} will run that simple test.

- * <p>

- * A <I>bulk test method</I>, on the other hand, returns a new instance

- * of <code>BulkTest</code>, which can itself define new simple and bulk

- * test methods.  By using the {@link #makeSuite} method, you can 

- * automatically create a hierarchal suite of tests and child bulk tests.

- * <p>

- * For instance, consider the following two classes:

- *

- * <Pre>

- *  public class TestSet extends BulkTest {

- *

- *      private Set set;

- *

- *      public TestSet(Set set) {

- *          this.set = set;

- *      }

- *

- *      public void testContains() {

- *          boolean r = set.contains(set.iterator().next()));

- *          assertTrue("Set should contain first element, r);

- *      }

- *

- *      public void testClear() {

- *          set.clear();

- *          assertTrue("Set should be empty after clear", set.isEmpty());

- *      }

- *  }

- *

- *

- *  public class TestHashMap extends BulkTest {

- *

- *      private Map makeFullMap() {

- *          HashMap result = new HashMap();

- *          result.put("1", "One");

- *          result.put("2", "Two");

- *          return result;

- *      }

- *

- *      public void testClear() {

- *          Map map = makeFullMap();

- *          map.clear();

- *          assertTrue("Map empty after clear", map.isEmpty());

- *      }

- *

- *      public BulkTest bulkTestKeySet() {

- *          return new TestSet(makeFullMap().keySet());

- *      }

- *

- *      public BulkTest bulkTestEntrySet() {

- *          return new TestSet(makeFullMap().entrySet());

- *      }

- *  }

- *  </Pre>

- *

- *  In the above examples, <code>TestSet</code> defines two

- *  simple test methods and no bulk test methods; <code>TestHashMap</code>

- *  defines one simple test method and two bulk test methods.  When

- *  <code>makeSuite(TestHashMap.class).run</code> is executed, 

- *  <I>five</I> simple test methods will be run, in this order:<P>

- *

- *  <Ol>

- *  <Li>TestHashMap.testClear()

- *  <Li>TestHashMap.bulkTestKeySet().testContains();

- *  <Li>TestHashMap.bulkTestKeySet().testClear();

- *  <Li>TestHashMap.bulkTestEntrySet().testContains();

- *  <Li>TestHashMap.bulkTestEntrySet().testClear();

- *  </Ol>

- *

- *  In the graphical junit test runners, the tests would be displayed in

- *  the following tree:<P>

- *

- *  <UL>

- *  <LI>TestHashMap</LI>

- *      <UL>

- *      <LI>testClear

- *      <LI>bulkTestKeySet

- *          <UL>

- *          <LI>testContains

- *          <LI>testClear

- *          </UL>

- *      <LI>bulkTestEntrySet

- *          <UL>

- *          <LI>testContains

- *          <LI>testClear

- *          </UL>

- *      </UL>

- *  </UL>

- *

- *  A subclass can override a superclass's bulk test by

- *  returning <code>null</code> from the bulk test method.  If you only

- *  want to override specific simple tests within a bulk test, use the

- *  {@link #ignoredTests} method.<P>

- *

- *  Note that if you want to use the bulk test methods, you <I>must</I>

- *  define your <code>suite()</code> method to use {@link #makeSuite}.

- *  The ordinary {@link TestSuite} constructor doesn't know how to 

- *  interpret bulk test methods.

- *

- *  @author Paul Jack

- *  @version $Id: BulkTest.java 646780 2008-04-10 12:48:07Z niallp $

- */

-public class BulkTest extends TestCase implements Cloneable {

-

-

-    // Note:  BulkTest is Cloneable to make it easier to construct 

-    // BulkTest instances for simple test methods that are defined in 

-    // anonymous inner classes.  Basically we don't have to worry about

-    // finding weird constructors.  (And even if we found them, technically

-    // it'd be illegal for anyone but the outer class to invoke them).  

-    // Given one BulkTest instance, we can just clone it and reset the 

-    // method name for every simple test it defines.  

-

-

-    /**

-     *  The full name of this bulk test instance.  This is the full name

-     *  that is compared to {@link #ignoredTests} to see if this

-     *  test should be ignored.  It's also displayed in the text runner

-     *  to ease debugging.

-     */

-    String verboseName;

-

-

-    /**

-     *  Constructs a new <code>BulkTest</code> instance that will run the

-     *  specified simple test.

-     *

-     *  @param name  the name of the simple test method to run

-     */

-    public BulkTest(String name) {

-        super(name);

-        this.verboseName = getClass().getName();

-    }

-

-

-    /**

-     *  Creates a clone of this <code>BulkTest</code>.<P>

-     *

-     *  @return  a clone of this <code>BulkTest</code>

-     */

-    public Object clone() {

-        try {

-            return super.clone();

-        } catch (CloneNotSupportedException e) {

-            throw new Error(); // should never happen

-        }

-    }

-

-

-    /**

-     *  Returns an array of test names to ignore.<P>

-     *

-     *  If a test that's defined by this <code>BulkTest</code> or

-     *  by one of its bulk test methods has a name that's in the returned

-     *  array, then that simple test will not be executed.<P>

-     *

-     *  A test's name is formed by taking the class name of the

-     *  root <code>BulkTest</code>, eliminating the package name, then

-     *  appending the names of any bulk test methods that were invoked

-     *  to get to the simple test, and then appending the simple test

-     *  method name.  The method names are delimited by periods:

-     *

-     *  <pre>

-     *  TestHashMap.bulkTestEntrySet.testClear

-     *  </pre>

-     *

-     *  is the name of one of the simple tests defined in the sample classes

-     *  described above.  If the sample <code>TestHashMap</code> class

-     *  included this method:

-     *

-     *  <pre>

-     *  public String[] ignoredTests() {

-     *      return new String[] { "TestHashMap.bulkTestEntrySet.testClear" };

-     *  }

-     *  </pre>

-     *

-     *  then the entry set's clear method wouldn't be tested, but the key

-     *  set's clear method would.

-     *

-     *  @return an array of the names of tests to ignore, or null if

-     *   no tests should be ignored

-     */

-    public String[] ignoredTests() {

-        return null;

-    }

-

-

-    /**

-     *  Returns the display name of this <code>BulkTest</code>.

-     *

-     *  @return the display name of this <code>BulkTest</code>

-     */

-    public String toString() {

-        return getName() + "(" + verboseName + ") ";

-    }

-

-

-    /**

-     *  Returns a {@link TestSuite} for testing all of the simple tests

-     *  <I>and</I> all the bulk tests defined by the given class.<P>

-     *

-     *  The class is examined for simple and bulk test methods; any child

-     *  bulk tests are also examined recursively; and the results are stored

-     *  in a hierarchal {@link TestSuite}.<P>

-     *

-     *  The given class must be a subclass of <code>BulkTest</code> and must

-     *  not be abstract.<P>

-     *

-     *  @param c  the class to examine for simple and bulk tests

-     *  @return  a {@link TestSuite} containing all the simple and bulk tests

-     *    defined by that class

-     */

-    public static TestSuite makeSuite(Class c) {

-        if (Modifier.isAbstract(c.getModifiers())) {

-            throw new IllegalArgumentException("Class must not be abstract.");

-        }

-        if (!BulkTest.class.isAssignableFrom(c)) {

-            throw new IllegalArgumentException("Class must extend BulkTest.");

-        }

-        return new BulkTestSuiteMaker(c).make();

-    }

-

-}

-

-

-// It was easier to use a separate class to do all the reflection stuff

-// for making the TestSuite instances.  Having permanent state around makes

-// it easier to handle the recursion.

-class BulkTestSuiteMaker {

-

-    /** The class that defines simple and bulk tests methods. */

-    private Class startingClass;

-

-    /** List of ignored simple test names. */

-    private List ignored;

-   

-    /** The TestSuite we're currently populating.  Can change over time. */

-    private TestSuite result;

-

-    /** 

-     *  The prefix for simple test methods.  Used to check if a test is in 

-     *  the ignored list.

-     */ 

-    private String prefix;

-

-    /** 

-     *  Constructor.

-     *

-     *  @param startingClass  the starting class

-     */     

-    public BulkTestSuiteMaker(Class startingClass) {

-        this.startingClass = startingClass;

-    }

-

-    /**

-     *  Makes a hierarchal TestSuite based on the starting class.

-     *

-     *  @return  the hierarchal TestSuite for startingClass

-     */

-    public TestSuite make() {

-         this.result = new TestSuite();

-         this.prefix = getBaseName(startingClass);

-         result.setName(prefix);

-

-         BulkTest bulk = makeFirstTestCase(startingClass);

-         ignored = new ArrayList();

-         String[] s = bulk.ignoredTests();

-         if (s != null) {

-             ignored.addAll(Arrays.asList(s));

-         }

-         make(bulk);

-         return result;

-    }

-

-    /**

-     *  Appends all the simple tests and bulk tests defined by the given

-     *  instance's class to the current TestSuite.

-     *

-     *  @param bulk  An instance of the class that defines simple and bulk

-     *    tests for us to append

-     */

-    void make(BulkTest bulk) {

-        Class c = bulk.getClass();

-        Method[] all = c.getMethods();

-        for (int i = 0; i < all.length; i++) {

-            if (isTest(all[i])) addTest(bulk, all[i]);

-            if (isBulk(all[i])) addBulk(bulk, all[i]);

-        }

-    }

-

-    /**

-     *  Adds the simple test defined by the given method to the TestSuite.

-     *

-     *  @param bulk  The instance of the class that defined the method

-     *   (I know it's weird.  But the point is, we can clone the instance

-     *   and not have to worry about constructors.)

-     *  @param m  The simple test method

-     */

-    void addTest(BulkTest bulk, Method m) {

-        BulkTest bulk2 = (BulkTest)bulk.clone();

-        bulk2.setName(m.getName());

-        bulk2.verboseName = prefix + "." + m.getName();

-        if (ignored.contains(bulk2.verboseName)) return;

-        result.addTest(bulk2);

-    }

-

-    /**

-     *  Adds a whole new suite of tests that are defined by the result of

-     *  the given bulk test method.  In other words, the given bulk test

-     *  method is invoked, and the resulting BulkTest instance is examined

-     *  for yet more simple and bulk tests.

-     *

-     *  @param bulk  The instance of the class that defined the method

-     *  @param m  The bulk test method

-     */

-    void addBulk(BulkTest bulk, Method m) {

-        String verboseName = prefix + "." + m.getName();

-        if (ignored.contains(verboseName)) return;

-        

-        BulkTest bulk2;

-        try {

-            bulk2 = (BulkTest)m.invoke(bulk, (Object[]) null);

-            if (bulk2 == null) return;

-        } catch (InvocationTargetException ex) {

-            ex.getTargetException().printStackTrace();

-            throw new Error(); // FIXME;

-        } catch (IllegalAccessException ex) {

-            ex.printStackTrace();

-            throw new Error(); // FIXME;

-        }

-

-        // Save current state on the stack.

-        String oldPrefix = prefix;

-        TestSuite oldResult = result;

-

-        prefix = prefix + "." + m.getName();

-        result = new TestSuite();

-        result.setName(m.getName());

-

-        make(bulk2);

-

-        oldResult.addTest(result);

-

-        // Restore the old state

-        prefix = oldPrefix;

-        result = oldResult;

-    }

-

-    /**

-     *  Returns the base name of the given class.

-     *

-     *  @param c  the class

-     *  @return the name of that class, minus any package names

-     */

-    private static String getBaseName(Class c) {

-        String name = c.getName();

-        int p = name.lastIndexOf('.');

-        if (p > 0) {

-            name = name.substring(p + 1);

-        }

-        return name;

-    }

-

-

-    // These three methods are used to create a valid BulkTest instance

-    // from a class.

-

-    private static Constructor getTestCaseConstructor(Class c) {

-        try {

-            return c.getConstructor(new Class[] { String.class });

-        } catch (NoSuchMethodException e) {

-            throw new IllegalArgumentException(c + " must provide " +

-             "a (String) constructor");

-        }

-    }

-

-    private static BulkTest makeTestCase(Class c, Method m) {

-        Constructor con = getTestCaseConstructor(c);

-        try {

-            return (BulkTest)con.newInstance(new Object[] {m.getName()});

-        } catch (InvocationTargetException e) {

-            e.printStackTrace();

-            throw new RuntimeException(); // FIXME;

-        } catch (IllegalAccessException e) {

-            throw new Error(); // should never occur

-        } catch (InstantiationException e) {

-            throw new RuntimeException(); // FIXME;

-        }

-    }

-

-    private static BulkTest makeFirstTestCase(Class c) {

-        Method[] all = c.getMethods();

-        for (int i = 0; i < all.length; i++) {

-            if (isTest(all[i])) return makeTestCase(c, all[i]);

-        }

-        throw new IllegalArgumentException(c.getName() + " must provide " 

-          + " at least one test method.");

-    }

-

-    /**

-     *  Returns true if the given method is a simple test method.

-     */

-    private static boolean isTest(Method m) {

-        if (!m.getName().startsWith("test")) return false;

-        if (m.getReturnType() != Void.TYPE) return false;

-        if (m.getParameterTypes().length != 0) return false;

-        int mods = m.getModifiers();

-        if (Modifier.isStatic(mods)) return false;

-        if (Modifier.isAbstract(mods)) return false;

-        return true;

-    }

-

-    /**

-     *  Returns true if the given method is a bulk test method.

-     */

-    private static boolean isBulk(Method m) {

-        if (!m.getName().startsWith("bulkTest")) return false;

-        if (m.getReturnType() != BulkTest.class) return false;

-        if (m.getParameterTypes().length != 0) return false;

-        int mods = m.getModifiers();

-        if (Modifier.isStatic(mods)) return false;

-        if (Modifier.isAbstract(mods)) return false;

-        return true;

-    }

-

-}

+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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 org.apache.commons.collections;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+ * A {@link TestCase} that can define both simple and bulk test methods.
+ * <p>
+ * A <I>simple test method</I> is the type of test traditionally 
+ * supplied by by {@link TestCase}.  To define a simple test, create a public 
+ * no-argument method whose name starts with "test".  You can specify the
+ * the name of simple test in the constructor of <code>BulkTest</code>;
+ * a subsequent call to {@link TestCase#run} will run that simple test.
+ * <p>
+ * A <I>bulk test method</I>, on the other hand, returns a new instance
+ * of <code>BulkTest</code>, which can itself define new simple and bulk
+ * test methods.  By using the {@link #makeSuite} method, you can 
+ * automatically create a hierarchal suite of tests and child bulk tests.
+ * <p>
+ * For instance, consider the following two classes:
+ *
+ * <Pre>
+ *  public class TestSet extends BulkTest {
+ *
+ *      private Set set;
+ *
+ *      public TestSet(Set set) {
+ *          this.set = set;
+ *      }
+ *
+ *      public void testContains() {
+ *          boolean r = set.contains(set.iterator().next()));
+ *          assertTrue("Set should contain first element, r);
+ *      }
+ *
+ *      public void testClear() {
+ *          set.clear();
+ *          assertTrue("Set should be empty after clear", set.isEmpty());
+ *      }
+ *  }
+ *
+ *
+ *  public class TestHashMap extends BulkTest {
+ *
+ *      private Map makeFullMap() {
+ *          HashMap result = new HashMap();
+ *          result.put("1", "One");
+ *          result.put("2", "Two");
+ *          return result;
+ *      }
+ *
+ *      public void testClear() {
+ *          Map map = makeFullMap();
+ *          map.clear();
+ *          assertTrue("Map empty after clear", map.isEmpty());
+ *      }
+ *
+ *      public BulkTest bulkTestKeySet() {
+ *          return new TestSet(makeFullMap().keySet());
+ *      }
+ *
+ *      public BulkTest bulkTestEntrySet() {
+ *          return new TestSet(makeFullMap().entrySet());
+ *      }
+ *  }
+ *  </Pre>
+ *
+ *  In the above examples, <code>TestSet</code> defines two
+ *  simple test methods and no bulk test methods; <code>TestHashMap</code>
+ *  defines one simple test method and two bulk test methods.  When
+ *  <code>makeSuite(TestHashMap.class).run</code> is executed, 
+ *  <I>five</I> simple test methods will be run, in this order:<P>
+ *
+ *  <Ol>
+ *  <Li>TestHashMap.testClear()
+ *  <Li>TestHashMap.bulkTestKeySet().testContains();
+ *  <Li>TestHashMap.bulkTestKeySet().testClear();
+ *  <Li>TestHashMap.bulkTestEntrySet().testContains();
+ *  <Li>TestHashMap.bulkTestEntrySet().testClear();
+ *  </Ol>
+ *
+ *  In the graphical junit test runners, the tests would be displayed in
+ *  the following tree:<P>
+ *
+ *  <UL>
+ *  <LI>TestHashMap</LI>
+ *      <UL>
+ *      <LI>testClear
+ *      <LI>bulkTestKeySet
+ *          <UL>
+ *          <LI>testContains
+ *          <LI>testClear
+ *          </UL>
+ *      <LI>bulkTestEntrySet
+ *          <UL>
+ *          <LI>testContains
+ *          <LI>testClear
+ *          </UL>
+ *      </UL>
+ *  </UL>
+ *
+ *  A subclass can override a superclass's bulk test by
+ *  returning <code>null</code> from the bulk test method.  If you only
+ *  want to override specific simple tests within a bulk test, use the
+ *  {@link #ignoredTests} method.<P>
+ *
+ *  Note that if you want to use the bulk test methods, you <I>must</I>
+ *  define your <code>suite()</code> method to use {@link #makeSuite}.
+ *  The ordinary {@link TestSuite} constructor doesn't know how to 
+ *  interpret bulk test methods.
+ *
+ *  @author Paul Jack
+ *  @version $Id: BulkTest.java 646780 2008-04-10 12:48:07Z niallp $
+ */
+public class BulkTest extends TestCase implements Cloneable {
+
+
+    // Note:  BulkTest is Cloneable to make it easier to construct 
+    // BulkTest instances for simple test methods that are defined in 
+    // anonymous inner classes.  Basically we don't have to worry about
+    // finding weird constructors.  (And even if we found them, technically
+    // it'd be illegal for anyone but the outer class to invoke them).  
+    // Given one BulkTest instance, we can just clone it and reset the 
+    // method name for every simple test it defines.  
+
+
+    /**
+     *  The full name of this bulk test instance.  This is the full name
+     *  that is compared to {@link #ignoredTests} to see if this
+     *  test should be ignored.  It's also displayed in the text runner
+     *  to ease debugging.
+     */
+    String verboseName;
+
+
+    /**
+     *  Constructs a new <code>BulkTest</code> instance that will run the
+     *  specified simple test.
+     *
+     *  @param name  the name of the simple test method to run
+     */
+    public BulkTest(String name) {
+        super(name);
+        this.verboseName = getClass().getName();
+    }
+
+
+    /**
+     *  Creates a clone of this <code>BulkTest</code>.<P>
+     *
+     *  @return  a clone of this <code>BulkTest</code>
+     */
+    public Object clone() {
+        try {
+            return super.clone();
+        } catch (CloneNotSupportedException e) {
+            throw new Error(); // should never happen
+        }
+    }
+
+
+    /**
+     *  Returns an array of test names to ignore.<P>
+     *
+     *  If a test that's defined by this <code>BulkTest</code> or
+     *  by one of its bulk test methods has a name that's in the returned
+     *  array, then that simple test will not be executed.<P>
+     *
+     *  A test's name is formed by taking the class name of the
+     *  root <code>BulkTest</code>, eliminating the package name, then
+     *  appending the names of any bulk test methods that were invoked
+     *  to get to the simple test, and then appending the simple test
+     *  method name.  The method names are delimited by periods:
+     *
+     *  <pre>
+     *  TestHashMap.bulkTestEntrySet.testClear
+     *  </pre>
+     *
+     *  is the name of one of the simple tests defined in the sample classes
+     *  described above.  If the sample <code>TestHashMap</code> class
+     *  included this method:
+     *
+     *  <pre>
+     *  public String[] ignoredTests() {
+     *      return new String[] { "TestHashMap.bulkTestEntrySet.testClear" };
+     *  }
+     *  </pre>
+     *
+     *  then the entry set's clear method wouldn't be tested, but the key
+     *  set's clear method would.
+     *
+     *  @return an array of the names of tests to ignore, or null if
+     *   no tests should be ignored
+     */
+    public String[] ignoredTests() {
+        return null;
+    }
+
+
+    /**
+     *  Returns the display name of this <code>BulkTest</code>.
+     *
+     *  @return the display name of this <code>BulkTest</code>
+     */
+    public String toString() {
+        return getName() + "(" + verboseName + ") ";
+    }
+
+
+    /**
+     *  Returns a {@link TestSuite} for testing all of the simple tests
+     *  <I>and</I> all the bulk tests defined by the given class.<P>
+     *
+     *  The class is examined for simple and bulk test methods; any child
+     *  bulk tests are also examined recursively; and the results are stored
+     *  in a hierarchal {@link TestSuite}.<P>
+     *
+     *  The given class must be a subclass of <code>BulkTest</code> and must
+     *  not be abstract.<P>
+     *
+     *  @param c  the class to examine for simple and bulk tests
+     *  @return  a {@link TestSuite} containing all the simple and bulk tests
+     *    defined by that class
+     */
+    public static TestSuite makeSuite(Class c) {
+        if (Modifier.isAbstract(c.getModifiers())) {
+            throw new IllegalArgumentException("Class must not be abstract.");
+        }
+        if (!BulkTest.class.isAssignableFrom(c)) {
+            throw new IllegalArgumentException("Class must extend BulkTest.");
+        }
+        return new BulkTestSuiteMaker(c).make();
+    }
+
+}
+
+
+// It was easier to use a separate class to do all the reflection stuff
+// for making the TestSuite instances.  Having permanent state around makes
+// it easier to handle the recursion.
+class BulkTestSuiteMaker {
+
+    /** The class that defines simple and bulk tests methods. */
+    private Class startingClass;
+
+    /** List of ignored simple test names. */
+    private List ignored;
+   
+    /** The TestSuite we're currently populating.  Can change over time. */
+    private TestSuite result;
+
+    /** 
+     *  The prefix for simple test methods.  Used to check if a test is in 
+     *  the ignored list.
+     */ 
+    private String prefix;
+
+    /** 
+     *  Constructor.
+     *
+     *  @param startingClass  the starting class
+     */     
+    public BulkTestSuiteMaker(Class startingClass) {
+        this.startingClass = startingClass;
+    }
+
+    /**
+     *  Makes a hierarchal TestSuite based on the starting class.
+     *
+     *  @return  the hierarchal TestSuite for startingClass
+     */
+    public TestSuite make() {
+         this.result = new TestSuite();
+         this.prefix = getBaseName(startingClass);
+         result.setName(prefix);
+
+         BulkTest bulk = makeFirstTestCase(startingClass);
+         ignored = new ArrayList();
+         String[] s = bulk.ignoredTests();
+         if (s != null) {
+             ignored.addAll(Arrays.asList(s));
+         }
+         make(bulk);
+         return result;
+    }
+
+    /**
+     *  Appends all the simple tests and bulk tests defined by the given
+     *  instance's class to the current TestSuite.
+     *
+     *  @param bulk  An instance of the class that defines simple and bulk
+     *    tests for us to append
+     */
+    void make(BulkTest bulk) {
+        Class c = bulk.getClass();
+        Method[] all = c.getMethods();
+        for (int i = 0; i < all.length; i++) {
+            if (isTest(all[i])) addTest(bulk, all[i]);
+            if (isBulk(all[i])) addBulk(bulk, all[i]);
+        }
+    }
+
+    /**
+     *  Adds the simple test defined by the given method to the TestSuite.
+     *
+     *  @param bulk  The instance of the class that defined the method
+     *   (I know it's weird.  But the point is, we can clone the instance
+     *   and not have to worry about constructors.)
+     *  @param m  The simple test method
+     */
+    void addTest(BulkTest bulk, Method m) {
+        BulkTest bulk2 = (BulkTest)bulk.clone();
+        bulk2.setName(m.getName());
+        bulk2.verboseName = prefix + "." + m.getName();
+        if (ignored.contains(bulk2.verboseName)) return;
+        result.addTest(bulk2);
+    }
+
+    /**
+     *  Adds a whole new suite of tests that are defined by the result of
+     *  the given bulk test method.  In other words, the given bulk test
+     *  method is invoked, and the resulting BulkTest instance is examined
+     *  for yet more simple and bulk tests.
+     *
+     *  @param bulk  The instance of the class that defined the method
+     *  @param m  The bulk test method
+     */
+    void addBulk(BulkTest bulk, Method m) {
+        String verboseName = prefix + "." + m.getName();
+        if (ignored.contains(verboseName)) return;
+        
+        BulkTest bulk2;
+        try {
+            bulk2 = (BulkTest)m.invoke(bulk, (Object[]) null);
+            if (bulk2 == null) return;
+        } catch (InvocationTargetException ex) {
+            ex.getTargetException().printStackTrace();
+            throw new Error(); // FIXME;
+        } catch (IllegalAccessException ex) {
+            ex.printStackTrace();
+            throw new Error(); // FIXME;
+        }
+
+        // Save current state on the stack.
+        String oldPrefix = prefix;
+        TestSuite oldResult = result;
+
+        prefix = prefix + "." + m.getName();
+        result = new TestSuite();
+        result.setName(m.getName());
+
+        make(bulk2);
+
+        oldResult.addTest(result);
+
+        // Restore the old state
+        prefix = oldPrefix;
+        result = oldResult;
+    }
+
+    /**
+     *  Returns the base name of the given class.
+     *
+     *  @param c  the class
+     *  @return the name of that class, minus any package names
+     */
+    private static String getBaseName(Class c) {
+        String name = c.getName();
+        int p = name.lastIndexOf('.');
+        if (p > 0) {
+            name = name.substring(p + 1);
+        }
+        return name;
+    }
+
+
+    // These three methods are used to create a valid BulkTest instance
+    // from a class.
+
+    private static Constructor getTestCaseConstructor(Class c) {
+        try {
+            return c.getConstructor(new Class[] { String.class });
+        } catch (NoSuchMethodException e) {
+            throw new IllegalArgumentException(c + " must provide " +
+             "a (String) constructor");
+        }
+    }
+
+    private static BulkTest makeTestCase(Class c, Method m) {
+        Constructor con = getTestCaseConstructor(c);
+        try {
+            return (BulkTest)con.newInstance(new Object[] {m.getName()});
+        } catch (InvocationTargetException e) {
+            e.printStackTrace();
+            throw new RuntimeException(); // FIXME;
+        } catch (IllegalAccessException e) {
+            throw new Error(); // should never occur
+        } catch (InstantiationException e) {
+            throw new RuntimeException(); // FIXME;
+        }
+    }
+
+    private static BulkTest makeFirstTestCase(Class c) {
+        Method[] all = c.getMethods();
+        for (int i = 0; i < all.length; i++) {
+            if (isTest(all[i])) return makeTestCase(c, all[i]);
+        }
+        throw new IllegalArgumentException(c.getName() + " must provide " 
+          + " at least one test method.");
+    }
+
+    /**
+     *  Returns true if the given method is a simple test method.
+     */
+    private static boolean isTest(Method m) {
+        if (!m.getName().startsWith("test")) return false;
+        if (m.getReturnType() != Void.TYPE) return false;
+        if (m.getParameterTypes().length != 0) return false;
+        int mods = m.getModifiers();
+        if (Modifier.isStatic(mods)) return false;
+        if (Modifier.isAbstract(mods)) return false;
+        return true;
+    }
+
+    /**
+     *  Returns true if the given method is a bulk test method.
+     */
+    private static boolean isBulk(Method m) {
+        if (!m.getName().startsWith("bulkTest")) return false;
+        if (m.getReturnType() != BulkTest.class) return false;
+        if (m.getParameterTypes().length != 0) return false;
+        int mods = m.getModifiers();
+        if (Modifier.isStatic(mods)) return false;
+        if (Modifier.isAbstract(mods)) return false;
+        return true;
+    }
+
+}
diff --git a/dev/core/test/org/apache/commons/collections/collection/AbstractTestCollection.java b/dev/core/test/org/apache/commons/collections/collection/AbstractTestCollection.java
index 1496dda..2071e3d 100644
--- a/dev/core/test/org/apache/commons/collections/collection/AbstractTestCollection.java
+++ b/dev/core/test/org/apache/commons/collections/collection/AbstractTestCollection.java
@@ -1,1333 +1,1333 @@
-/*

- *  Licensed to the Apache Software Foundation (ASF) under one or more

- *  contributor license agreements.  See the NOTICE file distributed with

- *  this work for additional information regarding copyright ownership.

- *  The ASF licenses this file to You 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 org.apache.commons.collections.collection;

-

-import java.io.ByteArrayInputStream;

-import java.io.ByteArrayOutputStream;

-import java.io.ObjectInputStream;

-import java.io.ObjectOutputStream;

-import java.io.Serializable;

-import java.lang.reflect.Array;

-import java.util.ArrayList;

-import java.util.Arrays;

-import java.util.Collection;

-import java.util.Collections;

-import java.util.ConcurrentModificationException;

-import java.util.HashMap;

-import java.util.HashSet;

-import java.util.Iterator;

-import java.util.List;

-import java.util.Map;

-import java.util.NoSuchElementException;

-

-import org.apache.commons.collections.AbstractTestObject;

-

-/**

- * Abstract test class for {@link java.util.Collection} methods and contracts.

- * <p>

- * You should create a concrete subclass of this class to test any custom

- * {@link Collection} implementation.  At minimum, you'll have to 

- * implement the {@link #makeCollection()} method.  You might want to 

- * override some of the additional public methods as well:

- * <p>

- * <b>Element Population Methods</b>

- * <p>

- * Override these if your collection restricts what kind of elements are

- * allowed (for instance, if <code>null</code> is not permitted):

- * <ul>

- * <li>{@link #getFullElements()}

- * <li>{@link #getOtherElements()}

- * </ul>

- * <p>

- * <b>Supported Operation Methods</b>

- * <p>

- * Override these if your collection doesn't support certain operations:

- * <ul>

- * <li>{@link #isAddSupported()}

- * <li>{@link #isRemoveSupported()}

- * <li>{@link #areEqualElementsDistinguishable()}

- * <li>{@link #isNullSupported()}

- * <li>{@link #isFailFastSupported()}

- * </ul>

- * <p>

- * <b>Fixture Methods</b>

- * <p>

- * Fixtures are used to verify that the the operation results in correct state

- * for the collection.  Basically, the operation is performed against your

- * collection implementation, and an identical operation is performed against a

- * <i>confirmed</i> collection implementation.  A confirmed collection

- * implementation is something like <code>java.util.ArrayList</code>, which is

- * known to conform exactly to its collection interface's contract.  After the

- * operation takes place on both your collection implementation and the

- * confirmed collection implementation, the two collections are compared to see

- * if their state is identical.  The comparison is usually much more involved

- * than a simple <code>equals</code> test.  This verification is used to ensure

- * proper modifications are made along with ensuring that the collection does

- * not change when read-only modifications are made.

- * <p>

- * The {@link #collection} field holds an instance of your collection

- * implementation; the {@link #confirmed} field holds an instance of the

- * confirmed collection implementation.  The {@link #resetEmpty()} and 

- * {@link #resetFull()} methods set these fields to empty or full collections,

- * so that tests can proceed from a known state.

- * <p>

- * After a modification operation to both {@link #collection} and

- * {@link #confirmed}, the {@link #verify()} method is invoked to compare

- * the results.  You may want to override {@link #verify()} to perform

- * additional verifications.  For instance, when testing the collection

- * views of a map, {@link AbstractTestMap} would override {@link #verify()} to make

- * sure the map is changed after the collection view is changed.

- * <p>

- * If you're extending this class directly, you will have to provide 

- * implementations for the following:

- * <ul>

- * <li>{@link #makeConfirmedCollection()}

- * <li>{@link #makeConfirmedFullCollection()}

- * </ul>

- * <p>

- * Those methods should provide a confirmed collection implementation 

- * that's compatible with your collection implementation.

- * <p>

- * If you're extending {@link AbstractTestList}, {@link AbstractTestSet},

- * or {@link AbstractTestBag}, you probably don't have to worry about the

- * above methods, because those three classes already override the methods

- * to provide standard JDK confirmed collections.<P>

- * <p>

- * <b>Other notes</b>

- * <p>

- * If your {@link Collection} fails one of these tests by design,

- * you may still use this base set of cases.  Simply override the

- * test case (method) your {@link Collection} fails.

- *

- * @version $Revision: 646780 $ $Date: 2008-04-10 13:48:07 +0100 (Thu, 10 Apr 2008) $

- * 

- * @author Rodney Waldhoff

- * @author Paul Jack

- * @author Michael A. Smith

- * @author Neil O'Toole

- * @author Stephen Colebourne

- */

-public abstract class AbstractTestCollection extends AbstractTestObject {

-

-    //

-    // NOTE: 

-    //

-    // Collection doesn't define any semantics for equals, and recommends you

-    // use reference-based default behavior of Object.equals.  (And a test for

-    // that already exists in AbstractTestObject).  Tests for equality of lists, sets

-    // and bags will have to be written in test subclasses.  Thus, there is no

-    // tests on Collection.equals nor any for Collection.hashCode.

-    //

-

-

-    // These fields are used by reset() and verify(), and any test

-    // method that tests a modification.

-

-    /** 

-     *  A collection instance that will be used for testing.

-     */

-    public Collection collection;

-

-    /** 

-     *  Confirmed collection.  This is an instance of a collection that is

-     *  confirmed to conform exactly to the java.util.Collection contract.

-     *  Modification operations are tested by performing a mod on your 

-     *  collection, performing the exact same mod on an equivalent confirmed

-     *  collection, and then calling verify() to make sure your collection

-     *  still matches the confirmed collection.

-     */

-    public Collection confirmed;

-

-    /**

-     * JUnit constructor.

-     * 

-     * @param testName  the test class name

-     */

-    public AbstractTestCollection(String testName) {

-        super(testName);

-    }

-

-    //-----------------------------------------------------------------------

-    /**

-     *  Specifies whether equal elements in the collection are, in fact,

-     *  distinguishable with information not readily available.  That is, if a

-     *  particular value is to be removed from the collection, then there is

-     *  one and only one value that can be removed, even if there are other

-     *  elements which are equal to it.  

-     *

-     *  <P>In most collection cases, elements are not distinguishable (equal is

-     *  equal), thus this method defaults to return false.  In some cases,

-     *  however, they are.  For example, the collection returned from the map's

-     *  values() collection view are backed by the map, so while there may be

-     *  two values that are equal, their associated keys are not.  Since the

-     *  keys are distinguishable, the values are.

-     *

-     *  <P>This flag is used to skip some verifications for iterator.remove()

-     *  where it is impossible to perform an equivalent modification on the

-     *  confirmed collection because it is not possible to determine which

-     *  value in the confirmed collection to actually remove.  Tests that

-     *  override the default (i.e. where equal elements are distinguishable),

-     *  should provide additional tests on iterator.remove() to make sure the

-     *  proper elements are removed when remove() is called on the iterator.

-     **/

-    public boolean areEqualElementsDistinguishable() {

-        return false;

-    }

-

-    /**

-     *  Returns true if the collections produced by 

-     *  {@link #makeCollection()} and {@link #makeFullCollection()}

-     *  support the <code>add</code> and <code>addAll</code>

-     *  operations.<P>

-     *  Default implementation returns true.  Override if your collection

-     *  class does not support add or addAll.

-     */

-    public boolean isAddSupported() {

-        return true;

-    }

-

-    /**

-     *  Returns true if the collections produced by 

-     *  {@link #makeCollection()} and {@link #makeFullCollection()}

-     *  support the <code>remove</code>, <code>removeAll</code>,

-     *  <code>retainAll</code>, <code>clear</code> and

-     *  <code>iterator().remove()</code> methods.

-     *  Default implementation returns true.  Override if your collection

-     *  class does not support removal operations.

-     */

-    public boolean isRemoveSupported() {

-        return true;

-    }

-

-    /**

-     * Returns true to indicate that the collection supports holding null.

-     * The default implementation returns true;

-     */

-    public boolean isNullSupported() {

-        return true;

-    }

-

-    /**

-     * Returns true to indicate that the collection supports fail fast iterators.

-     * The default implementation returns true;

-     */

-    public boolean isFailFastSupported() {

-        return false;

-    }

-

-    /**

-     * Returns true to indicate that the collection supports equals() comparisons.

-     * This implementation returns false;

-     */

-    public boolean isEqualsCheckable() {

-        return false;

-    }

-

-    //-----------------------------------------------------------------------

-    /**

-     *  Verifies that {@link #collection} and {@link #confirmed} have 

-     *  identical state.

-     */

-    public void verify() {

-        int confirmedSize = confirmed.size();

-        assertEquals("Collection size should match confirmed collection's",

-                     confirmedSize, collection.size());

-        assertEquals("Collection isEmpty() result should match confirmed " +

-                     " collection's", 

-                     confirmed.isEmpty(), collection.isEmpty());

-

-        // verify the collections are the same by attempting to match each

-        // object in the collection and confirmed collection.  To account for

-        // duplicates and differing orders, each confirmed element is copied

-        // into an array and a flag is maintained for each element to determine

-        // whether it has been matched once and only once.  If all elements in

-        // the confirmed collection are matched once and only once and there

-        // aren't any elements left to be matched in the collection,

-        // verification is a success.

-

-        // copy each collection value into an array

-        Object[] confirmedValues = new Object[confirmedSize];

-

-        Iterator iter;

-

-        iter = confirmed.iterator(); 

-        int pos = 0;

-        while(iter.hasNext()) {

-            confirmedValues[pos++] = iter.next();

-        }

-

-        // allocate an array of boolean flags for tracking values that have

-        // been matched once and only once.

-        boolean[] matched = new boolean[confirmedSize];

-        

-        // now iterate through the values of the collection and try to match

-        // the value with one in the confirmed array.

-        iter = collection.iterator();

-        while(iter.hasNext()) {

-            Object o = iter.next();

-            boolean match = false;

-            for(int i = 0; i < confirmedSize; i++) {

-                if(matched[i]) {

-                    // skip values already matched

-                    continue;

-                }

-                if(o == confirmedValues[i] ||

-                   (o != null && o.equals(confirmedValues[i]))) {

-                    // values matched

-                    matched[i] = true;

-                    match = true;

-                    break;

-                }

-            }

-            // no match found!

-            if(!match) {

-                fail("Collection should not contain a value that the " +

-                     "confirmed collection does not have: " + o +

-                     "\nTest: " + collection + "\nReal: " + confirmed);

-            }

-        }

-        

-        // make sure there aren't any unmatched values

-        for(int i = 0; i < confirmedSize; i++) {

-            if(!matched[i]) {

-                // the collection didn't match all the confirmed values

-                fail("Collection should contain all values that are in the confirmed collection" +

-                     "\nTest: " + collection + "\nReal: " + confirmed);

-            }

-        }

-    }

-    

-    //-----------------------------------------------------------------------

-    /**

-     *  Resets the {@link #collection} and {@link #confirmed} fields to empty

-     *  collections.  Invoke this method before performing a modification

-     *  test.

-     */

-    public void resetEmpty() {

-        this.collection = makeCollection();

-        this.confirmed = makeConfirmedCollection();

-    }

-

-    /**

-     *  Resets the {@link #collection} and {@link #confirmed} fields to full

-     *  collections.  Invoke this method before performing a modification

-     *  test.

-     */

-    public void resetFull() {

-        this.collection = makeFullCollection();

-        this.confirmed = makeConfirmedFullCollection();

-    }

-

-    //-----------------------------------------------------------------------

-    /**

-     *  Returns a confirmed empty collection.

-     *  For instance, an {@link java.util.ArrayList} for lists or a

-     *  {@link java.util.HashSet} for sets.

-     *

-     *  @return a confirmed empty collection

-     */

-    public abstract Collection makeConfirmedCollection();

-

-    /**

-     *  Returns a confirmed full collection.

-     *  For instance, an {@link java.util.ArrayList} for lists or a

-     *  {@link java.util.HashSet} for sets.  The returned collection

-     *  should contain the elements returned by {@link #getFullElements()}.

-     *

-     *  @return a confirmed full collection

-     */

-    public abstract Collection makeConfirmedFullCollection();

-

-    /**

-     * Return a new, empty {@link Collection} to be used for testing.

-     */

-    public abstract Collection makeCollection();

-

-    /**

-     *  Returns a full collection to be used for testing.  The collection

-     *  returned by this method should contain every element returned by

-     *  {@link #getFullElements()}.  The default implementation, in fact,

-     *  simply invokes <code>addAll</code> on an empty collection with

-     *  the results of {@link #getFullElements()}.  Override this default

-     *  if your collection doesn't support addAll.

-     */

-    public Collection makeFullCollection() {

-        Collection c = makeCollection();

-        c.addAll(Arrays.asList(getFullElements()));

-        return c;

-    }

-

-    /**

-     *  Returns an empty collection for Object tests.

-     */

-    public Object makeObject() {

-        return makeCollection();

-    }

-

-    /**

-     * Creates a new Map Entry that is independent of the first and the map.

-     */

-    public Map.Entry cloneMapEntry(Map.Entry entry) {

-        HashMap map = new HashMap();

-        map.put(entry.getKey(), entry.getValue());

-        return (Map.Entry) map.entrySet().iterator().next();

-    }

-

-    //-----------------------------------------------------------------------

-    /**

-     *  Returns an array of objects that are contained in a collection

-     *  produced by {@link #makeFullCollection()}.  Every element in the

-     *  returned array <I>must</I> be an element in a full collection.<P>

-     *  The default implementation returns a heterogenous array of 

-     *  objects with some duplicates. null is added if allowed.

-     *  Override if you require specific testing elements.  Note that if you

-     *  override {@link #makeFullCollection()}, you <I>must</I> override

-     *  this method to reflect the contents of a full collection.

-     */

-    public Object[] getFullElements() {

-        if (isNullSupported()) {

-            ArrayList list = new ArrayList();

-            list.addAll(Arrays.asList(getFullNonNullElements()));

-            list.add(4, null);

-            return list.toArray();

-        } else {

-            return (Object[]) getFullNonNullElements().clone();

-        }

-    }

-

-    /**

-     *  Returns an array of elements that are <I>not</I> contained in a

-     *  full collection.  Every element in the returned array must 

-     *  not exist in a collection returned by {@link #makeFullCollection()}.

-     *  The default implementation returns a heterogenous array of elements

-     *  without null.  Note that some of the tests add these elements

-     *  to an empty or full collection, so if your collection restricts

-     *  certain kinds of elements, you should override this method.

-     */

-    public Object[] getOtherElements() {

-        return getOtherNonNullElements();

-    }

-    

-    //-----------------------------------------------------------------------

-    /**

-     *  Returns a list of elements suitable for return by

-     *  {@link #getFullElements()}.  The array returned by this method

-     *  does not include null, but does include a variety of objects 

-     *  of different types.  Override getFullElements to return

-     *  the results of this method if your collection does not support

-     *  the null element.

-     */

-    public Object[] getFullNonNullElements() {

-        return new Object[] {

-            new String(""),

-            new String("One"),

-            new Integer(2),

-            "Three",

-            new Integer(4),

-            "One",

-            new Double(5),

-            new Float(6),

-            "Seven",

-            "Eight",

-            new String("Nine"),

-            new Integer(10),

-            new Short((short)11),

-            new Long(12),

-            "Thirteen",

-            "14",

-            "15",

-            new Byte((byte)16)

-        };

-    }

-

-    /**

-     *  Returns the default list of objects returned by 

-     *  {@link #getOtherElements()}.  Includes many objects

-     *  of different types.

-     */

-    public Object[] getOtherNonNullElements() {

-        return new Object[] {

-            new Integer(0),

-            new Float(0),

-            new Double(0),

-            "Zero",

-            new Short((short)0),

-            new Byte((byte)0),

-            new Long(0),

-            new Character('\u0000'),

-            "0"

-        };

-    }

-

-    /**

-     *  Returns a list of string elements suitable for return by

-     *  {@link #getFullElements()}.  Override getFullElements to return

-     *  the results of this method if your collection does not support

-     *  heterogenous elements or the null element.

-     */

-    public Object[] getFullNonNullStringElements() {

-        return new Object[] {

-            "If","the","dull","substance","of","my","flesh","were","thought",

-            "Injurious","distance","could","not","stop","my","way",

-        };

-    }

-

-    /**

-     *  Returns a list of string elements suitable for return by

-     *  {@link #getOtherElements()}.  Override getOtherElements to return

-     *  the results of this method if your collection does not support

-     *  heterogenous elements or the null element.

-     */

-    public Object[] getOtherNonNullStringElements() {

-        return new Object[] {

-            "For","then","despite",/* of */"space","I","would","be","brought",

-            "From","limits","far","remote","where","thou","dost","stay"

-        };

-    }

-

-    // Tests    

-    //-----------------------------------------------------------------------

-    /**

-     *  Tests {@link Collection#add(Object)}.

-     */

-    public void testCollectionAdd() {

-        if (!isAddSupported()) return;

-        

-        Object[] elements = getFullElements();

-        for (int i = 0; i < elements.length; i++) {

-            resetEmpty();

-            boolean r = collection.add(elements[i]);

-            confirmed.add(elements[i]);

-            verify();

-            assertTrue("Empty collection changed after add", r);

-            assertEquals("Collection size is 1 after first add", 1, collection.size());

-        }

-        

-        resetEmpty();

-        int size = 0;

-        for (int i = 0; i < elements.length; i++) {

-            boolean r = collection.add(elements[i]);

-            confirmed.add(elements[i]);

-            verify();

-            if (r) size++;

-            assertEquals("Collection size should grow after add", 

-                         size, collection.size());

-            assertTrue("Collection should contain added element",

-                       collection.contains(elements[i]));

-        }

-    }

-    

-    

-    /**

-     *  Tests {@link Collection#addAll(Collection)}.

-     */

-    public void testCollectionAddAll() {

-        if (!isAddSupported()) return;

-

-        resetEmpty();

-        Object[] elements = getFullElements();

-        boolean r = collection.addAll(Arrays.asList(elements));

-        confirmed.addAll(Arrays.asList(elements));

-        verify();

-        assertTrue("Empty collection should change after addAll", r);

-        for (int i = 0; i < elements.length; i++) {

-            assertTrue("Collection should contain added element",

-                       collection.contains(elements[i]));

-        }

-

-        resetFull();

-        int size = collection.size();

-        elements = getOtherElements();

-        r = collection.addAll(Arrays.asList(elements));

-        confirmed.addAll(Arrays.asList(elements));

-        verify();

-        assertTrue("Full collection should change after addAll", r);

-        for (int i = 0; i < elements.length; i++) {

-            assertTrue("Full collection should contain added element",

-                       collection.contains(elements[i]));

-        }

-        assertEquals("Size should increase after addAll", 

-                     size + elements.length, collection.size());

-        

-        resetFull();

-        size = collection.size();

-        r = collection.addAll(Arrays.asList(getFullElements()));

-        confirmed.addAll(Arrays.asList(getFullElements()));

-        verify();

-        if (r) {

-            assertTrue("Size should increase if addAll returns true", 

-                       size < collection.size());

-        } else {

-            assertEquals("Size should not change if addAll returns false",

-                         size, collection.size());

-        } 

-    }

-

-

-    /**

-     *  If {@link #isAddSupported()} returns false, tests that add operations

-     *  raise <code>UnsupportedOperationException.

-     */

-    public void testUnsupportedAdd() {

-        if (isAddSupported()) return;

-        

-        resetEmpty();

-        try {

-            collection.add(new Object());

-            fail("Emtpy collection should not support add.");

-        } catch (UnsupportedOperationException e) {

-            // expected

-        }

-        // make sure things didn't change even if the expected exception was

-        // thrown.

-        verify();

-

-        try {

-            collection.addAll(Arrays.asList(getFullElements()));

-            fail("Emtpy collection should not support addAll.");

-        } catch (UnsupportedOperationException e) {

-            // expected

-        }

-        // make sure things didn't change even if the expected exception was

-        // thrown.

-        verify();

-

-        resetFull();

-        try {

-            collection.add(new Object());

-            fail("Full collection should not support add.");

-        } catch (UnsupportedOperationException e) {

-            // expected

-        }

-        // make sure things didn't change even if the expected exception was

-        // thrown.

-        verify();

-        

-        try {

-            collection.addAll(Arrays.asList(getOtherElements()));

-            fail("Full collection should not support addAll.");

-        } catch (UnsupportedOperationException e) {

-            // expected

-        }

-        // make sure things didn't change even if the expected exception was

-        // thrown.

-        verify();

-    }

-

-

-    /**

-     *  Test {@link Collection#clear()}.

-     */

-    public void testCollectionClear() {

-        if (!isRemoveSupported()) return;

-

-        resetEmpty();

-        collection.clear(); // just to make sure it doesn't raise anything

-        verify();

-

-        resetFull();

-        collection.clear();

-        confirmed.clear();

-        verify();

-    }    

-

-    

-    /**

-     *  Tests {@link Collection#contains(Object)}.

-     */

-    public void testCollectionContains() {

-        Object[] elements;

-

-        resetEmpty();

-        elements = getFullElements();

-        for(int i = 0; i < elements.length; i++) {

-            assertTrue("Empty collection shouldn't contain element[" + i + "]",

-                       !collection.contains(elements[i]));

-        }

-        // make sure calls to "contains" don't change anything

-        verify();

-

-        elements = getOtherElements();

-        for(int i = 0; i < elements.length; i++) {

-            assertTrue("Empty collection shouldn't contain element[" + i + "]",

-                       !collection.contains(elements[i]));

-        }

-        // make sure calls to "contains" don't change anything

-        verify();

-

-        resetFull();

-        elements = getFullElements();

-        for(int i = 0; i < elements.length; i++) {

-            assertTrue("Full collection should contain element[" + i + "]", 

-                       collection.contains(elements[i]));

-        }

-        // make sure calls to "contains" don't change anything

-        verify();

-

-        resetFull();

-        elements = getOtherElements();

-        for(int i = 0; i < elements.length; i++) {

-            assertTrue("Full collection shouldn't contain element", 

-                       !collection.contains(elements[i]));

-        }

-    }

-

-

-    /**

-     *  Tests {@link Collection#containsAll(Collection)}.

-     */

-    public void testCollectionContainsAll() {

-        resetEmpty();

-        Collection col = new HashSet();

-        assertTrue("Every Collection should contain all elements of an " +

-                   "empty Collection.", collection.containsAll(col));

-        col.addAll(Arrays.asList(getOtherElements()));

-        assertTrue("Empty Collection shouldn't contain all elements of " +

-                   "a non-empty Collection.", !collection.containsAll(col));

-        // make sure calls to "containsAll" don't change anything

-        verify();

-

-        resetFull();

-        assertTrue("Full collection shouldn't contain other elements", 

-                   !collection.containsAll(col));

-        

-        col.clear();

-        col.addAll(Arrays.asList(getFullElements()));

-        assertTrue("Full collection should containAll full elements",

-                   collection.containsAll(col));

-        // make sure calls to "containsAll" don't change anything

-        verify();

-

-        int min = (getFullElements().length < 2 ? 0 : 2);

-        int max = (getFullElements().length == 1 ? 1 : 

-                    (getFullElements().length <= 5 ? getFullElements().length - 1 : 5));

-        col = Arrays.asList(getFullElements()).subList(min, max);

-        assertTrue("Full collection should containAll partial full " +

-                   "elements", collection.containsAll(col));

-        assertTrue("Full collection should containAll itself", 

-                   collection.containsAll(collection));

-        // make sure calls to "containsAll" don't change anything

-        verify();

-        

-        col = new ArrayList();

-        col.addAll(Arrays.asList(getFullElements()));

-        col.addAll(Arrays.asList(getFullElements()));

-        assertTrue("Full collection should containAll duplicate full " +

-                   "elements", collection.containsAll(col));

-

-        // make sure calls to "containsAll" don't change anything

-        verify();

-    }

-

-    /**

-     *  Tests {@link Collection#isEmpty()}.

-     */

-    public void testCollectionIsEmpty() {

-        resetEmpty();

-        assertEquals("New Collection should be empty.", 

-                     true, collection.isEmpty());

-        // make sure calls to "isEmpty() don't change anything

-        verify();

-

-        resetFull();

-        assertEquals("Full collection shouldn't be empty", 

-                     false, collection.isEmpty());

-        // make sure calls to "isEmpty() don't change anything

-        verify();

-    }

-

-

-    /**

-     *  Tests the read-only functionality of {@link Collection#iterator()}.

-     */

-    public void testCollectionIterator() {

-        resetEmpty();

-        Iterator it1 = collection.iterator();

-        assertEquals("Iterator for empty Collection shouldn't have next.",

-                     false, it1.hasNext());

-        try {

-            it1.next();

-            fail("Iterator at end of Collection should throw " +

-                 "NoSuchElementException when next is called.");

-        } catch(NoSuchElementException e) {

-            // expected

-        } 

-        // make sure nothing has changed after non-modification

-        verify();

-

-        resetFull();

-        it1 = collection.iterator();

-        for (int i = 0; i < collection.size(); i++) {

-            assertTrue("Iterator for full collection should haveNext", 

-                       it1.hasNext());

-            it1.next();

-        }

-        assertTrue("Iterator should be finished", !it1.hasNext());

-        

-        ArrayList list = new ArrayList();

-        it1 = collection.iterator();

-        for (int i = 0; i < collection.size(); i++) {

-            Object next = it1.next();

-            assertTrue("Collection should contain element returned by " +

-                       "its iterator", collection.contains(next));

-            list.add(next);

-        }

-        try {

-            it1.next();

-            fail("iterator.next() should raise NoSuchElementException " +

-                 "after it finishes");

-        } catch (NoSuchElementException e) {

-            // expected

-        }

-        // make sure nothing has changed after non-modification

-        verify();

-    }

-

-

-    /**

-     *  Tests removals from {@link Collection#iterator()}.

-     */

-    public void testCollectionIteratorRemove() {

-        if (!isRemoveSupported()) return;

-

-        resetEmpty();

-        try {

-            collection.iterator().remove();

-            fail("New iterator.remove should raise IllegalState");

-        } catch (IllegalStateException e) {

-            // expected

-        }

-        verify();

-

-        try {

-            Iterator iter = collection.iterator();

-            iter.hasNext();

-            iter.remove();

-            fail("New iterator.remove should raise IllegalState " +

-                 "even after hasNext");

-        } catch (IllegalStateException e) {

-            // expected

-        }

-        verify();

-

-        resetFull();

-        int size = collection.size();

-        Iterator iter = collection.iterator();

-        while (iter.hasNext()) {

-            Object o = iter.next();

-            // TreeMap reuses the Map Entry, so the verify below fails

-            // Clone it here if necessary

-            if (o instanceof Map.Entry) {

-                o = cloneMapEntry((Map.Entry) o);

-            }

-            iter.remove();

-

-            // if the elements aren't distinguishable, we can just remove a

-            // matching element from the confirmed collection and verify

-            // contents are still the same.  Otherwise, we don't have the

-            // ability to distinguish the elements and determine which to

-            // remove from the confirmed collection (in which case, we don't

-            // verify because we don't know how). 

-            //

-            // see areEqualElementsDistinguishable()

-            if(!areEqualElementsDistinguishable()) {

-                confirmed.remove(o);

-                verify();

-            }

-

-            size--;

-            assertEquals("Collection should shrink by one after " +

-                         "iterator.remove", size, collection.size());

-        }

-        assertTrue("Collection should be empty after iterator purge",

-                   collection.isEmpty());

-        

-        resetFull();

-        iter = collection.iterator();

-        iter.next();

-        iter.remove();

-        try {

-            iter.remove();

-            fail("Second iter.remove should raise IllegalState");

-        } catch (IllegalStateException e) {

-            // expected

-        }

-    }

-

-

-    /**

-     *  Tests {@link Collection#remove(Object)}.

-     */

-    public void testCollectionRemove() {

-        if (!isRemoveSupported()) return;

-

-        resetEmpty();

-        Object[] elements = getFullElements();

-        for (int i = 0; i < elements.length; i++) {

-            assertTrue("Shouldn't remove nonexistent element", 

-                       !collection.remove(elements[i]));

-            verify();

-        }

-        

-        Object[] other = getOtherElements();

-        

-        resetFull();

-        for (int i = 0; i < other.length; i++) {

-            assertTrue("Shouldn't remove nonexistent other element", 

-                       !collection.remove(other[i]));

-            verify();

-        }

-        

-        int size = collection.size();

-        for (int i = 0; i < elements.length; i++) {

-            resetFull();

-            assertTrue("Collection should remove extant element: " + elements[i],

-                       collection.remove(elements[i]));

-

-            // if the elements aren't distinguishable, we can just remove a

-            // matching element from the confirmed collection and verify

-            // contents are still the same.  Otherwise, we don't have the

-            // ability to distinguish the elements and determine which to

-            // remove from the confirmed collection (in which case, we don't

-            // verify because we don't know how). 

-            //

-            // see areEqualElementsDistinguishable()

-            if(!areEqualElementsDistinguishable()) {

-                confirmed.remove(elements[i]);

-                verify();

-            }

-

-            assertEquals("Collection should shrink after remove", 

-                         size - 1, collection.size());

-        }

-    }

-    

-

-    /**

-     *  Tests {@link Collection#removeAll(Collection)}.

-     */

-    public void testCollectionRemoveAll() {

-        if (!isRemoveSupported()) return;

-

-        resetEmpty();

-        assertTrue("Emtpy collection removeAll should return false for " +

-                   "empty input", 

-                   !collection.removeAll(Collections.EMPTY_SET));

-        verify();

-        

-        assertTrue("Emtpy collection removeAll should return false for " +

-                   "nonempty input", 

-                   !collection.removeAll(new ArrayList(collection)));

-        verify();

-        

-        resetFull();

-        assertTrue("Full collection removeAll should return false for " + 

-                   "empty input", 

-                   !collection.removeAll(Collections.EMPTY_SET));

-        verify();

-        

-        assertTrue("Full collection removeAll should return false for other elements", 

-                   !collection.removeAll(Arrays.asList(getOtherElements())));

-        verify();

-        

-        assertTrue("Full collection removeAll should return true for full elements", 

-                    collection.removeAll(new HashSet(collection)));

-        confirmed.removeAll(new HashSet(confirmed));

-        verify();

-        

-        resetFull();

-        int size = collection.size();

-        int min = (getFullElements().length < 2 ? 0 : 2);

-        int max = (getFullElements().length == 1 ? 1 : 

-                    (getFullElements().length <= 5 ? getFullElements().length - 1 : 5));

-        Collection all = Arrays.asList(getFullElements()).subList(min, max);

-        assertTrue("Full collection removeAll should work", 

-                   collection.removeAll(all));

-        confirmed.removeAll(all);

-        verify();

-        

-        assertTrue("Collection should shrink after removeAll", 

-                   collection.size() < size);

-        Iterator iter = all.iterator();

-        while (iter.hasNext()) {

-            assertTrue("Collection shouldn't contain removed element",

-                       !collection.contains(iter.next()));

-        }

-    }

-

-

-    /**

-     *  Tests {@link Collection#retainAll(Collection)}.

-     */

-    public void testCollectionRetainAll() {

-        if (!isRemoveSupported()) return;

-

-        resetEmpty();

-        List elements = Arrays.asList(getFullElements());

-        List other = Arrays.asList(getOtherElements());

-

-        assertTrue("Empty retainAll() should return false", 

-                   !collection.retainAll(Collections.EMPTY_SET));

-        verify();

-        

-        assertTrue("Empty retainAll() should return false", 

-                   !collection.retainAll(elements));

-        verify();

-        

-        resetFull();

-        assertTrue("Collection should change from retainAll empty", 

-                   collection.retainAll(Collections.EMPTY_SET));

-        confirmed.retainAll(Collections.EMPTY_SET);

-        verify();

-        

-        resetFull();

-        assertTrue("Collection changed from retainAll other", 

-                   collection.retainAll(other));

-        confirmed.retainAll(other);

-        verify();

-        

-        resetFull();

-        int size = collection.size();

-        assertTrue("Collection shouldn't change from retainAll elements",

-                   !collection.retainAll(elements));

-        verify();

-        assertEquals("Collection size shouldn't change", size, 

-                     collection.size());

-        

-        if (getFullElements().length > 1) {

-            resetFull();

-            size = collection.size();

-            int min = (getFullElements().length < 2 ? 0 : 2);

-            int max = (getFullElements().length <= 5 ? getFullElements().length - 1 : 5);

-            assertTrue("Collection should changed by partial retainAll",

-                       collection.retainAll(elements.subList(min, max)));

-            confirmed.retainAll(elements.subList(min, max));

-            verify();

-        

-            Iterator iter = collection.iterator();

-            while (iter.hasNext()) {

-                assertTrue("Collection only contains retained element", 

-                           elements.subList(min, max).contains(iter.next()));

-            }

-        }

-        

-        resetFull();

-        HashSet set = new HashSet(elements);

-        size = collection.size();

-        assertTrue("Collection shouldn't change from retainAll without " +

-                   "duplicate elements", !collection.retainAll(set));

-        verify();

-        assertEquals("Collection size didn't change from nonduplicate " +

-                     "retainAll", size, collection.size());

-    }

-    

-    

-    /**

-     *  Tests {@link Collection#size()}.

-     */

-    public void testCollectionSize() {

-        resetEmpty();

-        assertEquals("Size of new Collection is 0.", 0, collection.size());

-

-        resetFull();

-        assertTrue("Size of full collection should be greater than zero", 

-                   collection.size() > 0);

-    }

-

-

-    /**

-     *  Tests {@link Collection#toArray()}.

-     */

-    public void testCollectionToArray() {

-        resetEmpty();

-        assertEquals("Empty Collection should return empty array for toArray",

-                     0, collection.toArray().length);

-

-        resetFull();

-        Object[] array = collection.toArray();

-        assertEquals("Full collection toArray should be same size as " +

-                     "collection", array.length, collection.size());

-        Object[] confirmedArray = confirmed.toArray();

-        assertEquals("length of array from confirmed collection should " +

-                     "match the length of the collection's array", 

-                     confirmedArray.length, array.length);

-        boolean[] matched = new boolean[array.length];

-

-        for (int i = 0; i < array.length; i++) {

-            assertTrue("Collection should contain element in toArray",

-                       collection.contains(array[i]));

-

-            boolean match = false;

-            // find a match in the confirmed array

-            for(int j = 0; j < array.length; j++) {

-                // skip already matched

-                if(matched[j]) continue;

-                if(array[i] == confirmedArray[j] ||

-                   (array[i] != null && array[i].equals(confirmedArray[j]))) {

-                    matched[j] = true;

-                    match = true;

-                    break;

-                }

-            }

-            if(!match) {

-                fail("element " + i + " in returned array should be found " +

-                     "in the confirmed collection's array");

-            }

-        }

-        for(int i = 0; i < matched.length; i++) {

-            assertEquals("Collection should return all its elements in " +

-                         "toArray", true, matched[i]);

-        }

-    }

-

-

-    /**

-     *  Tests {@link Collection#toArray(Object[])}.

-     */

-    public void testCollectionToArray2() {

-        resetEmpty();

-        Object[] a = new Object[] { new Object(), null, null };

-        Object[] array = collection.toArray(a);

-        assertEquals("Given array shouldn't shrink", array, a);

-        assertEquals("Last element should be set to null", a[0], null);

-        verify();

-

-        resetFull();

-        try {

-            array = collection.toArray(new Void[collection.size()]);

-            fail("toArray(new Void[0]) should raise ArrayStore");

-        } catch (ArrayStoreException e) {

-            // expected

-        }

-        verify();

-

-        try {

-            array = collection.toArray(null);

-            fail("toArray(null) should raise NPE");

-        } catch (NullPointerException e) {

-            // expected

-        }

-        verify();

-        

-        array = collection.toArray(new Object[collection.size()]);

-        a = collection.toArray();

-        assertEquals("toArrays should be equal", 

-                     Arrays.asList(array), Arrays.asList(a));

-

-        // Figure out if they're all the same class

-        // TODO: It'd be nicer to detect a common superclass

-        HashSet classes = new HashSet();

-        for (int i = 0; i < array.length; i++) {

-            classes.add((array[i] == null) ? null : array[i].getClass());

-        }

-        if (classes.size() > 1) return;

-        

-        Class cl = (Class)classes.iterator().next();

-        if (Map.Entry.class.isAssignableFrom(cl)) {  // check needed for protective cases like Predicated/Unmod map entrySet

-            cl = Map.Entry.class;

-        }

-        a = (Object[])Array.newInstance(cl, 0);

-        array = collection.toArray(a);

-        assertEquals("toArray(Object[]) should return correct array type",

-                     a.getClass(), array.getClass());

-        assertEquals("type-specific toArrays should be equal", 

-                     Arrays.asList(array), 

-                     Arrays.asList(collection.toArray()));

-        verify();

-    }

-

-

-    /**

-     *  Tests <code>toString</code> on a collection.

-     */

-    public void testCollectionToString() {

-        resetEmpty();

-        assertTrue("toString shouldn't return null", 

-                   collection.toString() != null);

-

-        resetFull();

-        assertTrue("toString shouldn't return null", 

-                   collection.toString() != null);

-    }

-

-

-    /**

-     *  If isRemoveSupported() returns false, tests to see that remove

-     *  operations raise an UnsupportedOperationException.

-     */

-    public void testUnsupportedRemove() {

-        if (isRemoveSupported()) return;

-

-        resetEmpty();

-        try {

-            collection.clear();

-            fail("clear should raise UnsupportedOperationException");

-        } catch (UnsupportedOperationException e) {

-            // expected

-        }

-        verify();

-

-        try {

-            collection.remove(null);

-            fail("remove should raise UnsupportedOperationException");

-        } catch (UnsupportedOperationException e) {

-            // expected

-        }

-        verify();

-

-        try {

-            collection.removeAll(null);

-            fail("removeAll should raise UnsupportedOperationException");

-        } catch (UnsupportedOperationException e) {

-            // expected

-        }

-        verify();

-

-        try {

-            collection.retainAll(null);

-            fail("removeAll should raise UnsupportedOperationException");

-        } catch (UnsupportedOperationException e) {

-            // expected

-        }

-        verify();

-

-        resetFull();

-        try {

-            Iterator iterator = collection.iterator();

-            iterator.next();

-            iterator.remove();

-            fail("iterator.remove should raise UnsupportedOperationException");

-        } catch (UnsupportedOperationException e) {

-            // expected

-        }

-        verify();

-

-    }

-

-

-    /**

-     *  Tests that the collection's iterator is fail-fast.  

-     */

-    public void testCollectionIteratorFailFast() {

-        if (!isFailFastSupported()) return;

-        

-        if (isAddSupported()) {

-            resetFull();

-            try {

-                Iterator iter = collection.iterator();

-                Object o = getOtherElements()[0];

-                collection.add(o);

-                confirmed.add(o);

-                iter.next();

-                fail("next after add should raise ConcurrentModification");

-            } catch (ConcurrentModificationException e) {

-                // expected

-            }

-            verify();

-            

-            resetFull();

-            try {

-                Iterator iter = collection.iterator();

-                collection.addAll(Arrays.asList(getOtherElements()));

-                confirmed.addAll(Arrays.asList(getOtherElements()));

-                iter.next();

-                fail("next after addAll should raise ConcurrentModification");

-            } catch (ConcurrentModificationException e) {

-                // expected

-            }

-            verify();

-        }

-

-        if (!isRemoveSupported()) return;

-

-        resetFull();

-        try {

-            Iterator iter = collection.iterator();

-            collection.clear();

-            iter.next();

-            fail("next after clear should raise ConcurrentModification");

-        } catch (ConcurrentModificationException e) {

-            // expected

-        } catch (NoSuchElementException e) {

-            // (also legal given spec)

-        }

-        

-        resetFull();

-        try {

-            Iterator iter = collection.iterator();

-            collection.remove(getFullElements()[0]);

-            iter.next();

-            fail("next after remove should raise ConcurrentModification");

-        } catch (ConcurrentModificationException e) {

-            // expected

-        }

-

-        resetFull();

-        try {

-            Iterator iter = collection.iterator();

-            List sublist = Arrays.asList(getFullElements()).subList(2,5);

-            collection.removeAll(sublist);

-            iter.next();

-            fail("next after removeAll should raise ConcurrentModification");

-        } catch (ConcurrentModificationException e) {

-            // expected

-        }

-

-        resetFull();

-        try {

-            Iterator iter = collection.iterator();

-            List sublist = Arrays.asList(getFullElements()).subList(2,5);

-            collection.retainAll(sublist);

-            iter.next();

-            fail("next after retainAll should raise ConcurrentModification");

-        } catch (ConcurrentModificationException e) {

-            // expected

-        }

-    }

-

-    public void testSerializeDeserializeThenCompare() throws Exception {

-        Object obj = makeCollection();

-        if (obj instanceof Serializable && isTestSerialization()) {

-            ByteArrayOutputStream buffer = new ByteArrayOutputStream();

-            ObjectOutputStream out = new ObjectOutputStream(buffer);

-            out.writeObject(obj);

-            out.close();

-

-            ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray()));

-            Object dest = in.readObject();

-            in.close();

-            if (isEqualsCheckable()) {

-                assertEquals("obj != deserialize(serialize(obj)) - EMPTY Collection", obj, dest);

-            }

-        }

-        obj = makeFullCollection();

-        if (obj instanceof Serializable && isTestSerialization()) {

-            ByteArrayOutputStream buffer = new ByteArrayOutputStream();

-            ObjectOutputStream out = new ObjectOutputStream(buffer);

-            out.writeObject(obj);

-            out.close();

-

-            ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray()));

-            Object dest = in.readObject();

-            in.close();

-            if (isEqualsCheckable()) {

-                assertEquals("obj != deserialize(serialize(obj)) - FULL Collection", obj, dest);

-            }

-        }

-    }

-    

-}

+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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 org.apache.commons.collections.collection;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.lang.reflect.Array;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.ConcurrentModificationException;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.NoSuchElementException;
+
+import org.apache.commons.collections.AbstractTestObject;
+
+/**
+ * Abstract test class for {@link java.util.Collection} methods and contracts.
+ * <p>
+ * You should create a concrete subclass of this class to test any custom
+ * {@link Collection} implementation.  At minimum, you'll have to 
+ * implement the {@link #makeCollection()} method.  You might want to 
+ * override some of the additional public methods as well:
+ * <p>
+ * <b>Element Population Methods</b>
+ * <p>
+ * Override these if your collection restricts what kind of elements are
+ * allowed (for instance, if <code>null</code> is not permitted):
+ * <ul>
+ * <li>{@link #getFullElements()}
+ * <li>{@link #getOtherElements()}
+ * </ul>
+ * <p>
+ * <b>Supported Operation Methods</b>
+ * <p>
+ * Override these if your collection doesn't support certain operations:
+ * <ul>
+ * <li>{@link #isAddSupported()}
+ * <li>{@link #isRemoveSupported()}
+ * <li>{@link #areEqualElementsDistinguishable()}
+ * <li>{@link #isNullSupported()}
+ * <li>{@link #isFailFastSupported()}
+ * </ul>
+ * <p>
+ * <b>Fixture Methods</b>
+ * <p>
+ * Fixtures are used to verify that the the operation results in correct state
+ * for the collection.  Basically, the operation is performed against your
+ * collection implementation, and an identical operation is performed against a
+ * <i>confirmed</i> collection implementation.  A confirmed collection
+ * implementation is something like <code>java.util.ArrayList</code>, which is
+ * known to conform exactly to its collection interface's contract.  After the
+ * operation takes place on both your collection implementation and the
+ * confirmed collection implementation, the two collections are compared to see
+ * if their state is identical.  The comparison is usually much more involved
+ * than a simple <code>equals</code> test.  This verification is used to ensure
+ * proper modifications are made along with ensuring that the collection does
+ * not change when read-only modifications are made.
+ * <p>
+ * The {@link #collection} field holds an instance of your collection
+ * implementation; the {@link #confirmed} field holds an instance of the
+ * confirmed collection implementation.  The {@link #resetEmpty()} and 
+ * {@link #resetFull()} methods set these fields to empty or full collections,
+ * so that tests can proceed from a known state.
+ * <p>
+ * After a modification operation to both {@link #collection} and
+ * {@link #confirmed}, the {@link #verify()} method is invoked to compare
+ * the results.  You may want to override {@link #verify()} to perform
+ * additional verifications.  For instance, when testing the collection
+ * views of a map, {@link AbstractTestMap} would override {@link #verify()} to make
+ * sure the map is changed after the collection view is changed.
+ * <p>
+ * If you're extending this class directly, you will have to provide 
+ * implementations for the following:
+ * <ul>
+ * <li>{@link #makeConfirmedCollection()}
+ * <li>{@link #makeConfirmedFullCollection()}
+ * </ul>
+ * <p>
+ * Those methods should provide a confirmed collection implementation 
+ * that's compatible with your collection implementation.
+ * <p>
+ * If you're extending {@link AbstractTestList}, {@link AbstractTestSet},
+ * or {@link AbstractTestBag}, you probably don't have to worry about the
+ * above methods, because those three classes already override the methods
+ * to provide standard JDK confirmed collections.<P>
+ * <p>
+ * <b>Other notes</b>
+ * <p>
+ * If your {@link Collection} fails one of these tests by design,
+ * you may still use this base set of cases.  Simply override the
+ * test case (method) your {@link Collection} fails.
+ *
+ * @version $Revision: 646780 $ $Date: 2008-04-10 13:48:07 +0100 (Thu, 10 Apr 2008) $
+ * 
+ * @author Rodney Waldhoff
+ * @author Paul Jack
+ * @author Michael A. Smith
+ * @author Neil O'Toole
+ * @author Stephen Colebourne
+ */
+public abstract class AbstractTestCollection extends AbstractTestObject {
+
+    //
+    // NOTE: 
+    //
+    // Collection doesn't define any semantics for equals, and recommends you
+    // use reference-based default behavior of Object.equals.  (And a test for
+    // that already exists in AbstractTestObject).  Tests for equality of lists, sets
+    // and bags will have to be written in test subclasses.  Thus, there is no
+    // tests on Collection.equals nor any for Collection.hashCode.
+    //
+
+
+    // These fields are used by reset() and verify(), and any test
+    // method that tests a modification.
+
+    /** 
+     *  A collection instance that will be used for testing.
+     */
+    public Collection collection;
+
+    /** 
+     *  Confirmed collection.  This is an instance of a collection that is
+     *  confirmed to conform exactly to the java.util.Collection contract.
+     *  Modification operations are tested by performing a mod on your 
+     *  collection, performing the exact same mod on an equivalent confirmed
+     *  collection, and then calling verify() to make sure your collection
+     *  still matches the confirmed collection.
+     */
+    public Collection confirmed;
+
+    /**
+     * JUnit constructor.
+     * 
+     * @param testName  the test class name
+     */
+    public AbstractTestCollection(String testName) {
+        super(testName);
+    }
+
+    //-----------------------------------------------------------------------
+    /**
+     *  Specifies whether equal elements in the collection are, in fact,
+     *  distinguishable with information not readily available.  That is, if a
+     *  particular value is to be removed from the collection, then there is
+     *  one and only one value that can be removed, even if there are other
+     *  elements which are equal to it.  
+     *
+     *  <P>In most collection cases, elements are not distinguishable (equal is
+     *  equal), thus this method defaults to return false.  In some cases,
+     *  however, they are.  For example, the collection returned from the map's
+     *  values() collection view are backed by the map, so while there may be
+     *  two values that are equal, their associated keys are not.  Since the
+     *  keys are distinguishable, the values are.
+     *
+     *  <P>This flag is used to skip some verifications for iterator.remove()
+     *  where it is impossible to perform an equivalent modification on the
+     *  confirmed collection because it is not possible to determine which
+     *  value in the confirmed collection to actually remove.  Tests that
+     *  override the default (i.e. where equal elements are distinguishable),
+     *  should provide additional tests on iterator.remove() to make sure the
+     *  proper elements are removed when remove() is called on the iterator.
+     **/
+    public boolean areEqualElementsDistinguishable() {
+        return false;
+    }
+
+    /**
+     *  Returns true if the collections produced by 
+     *  {@link #makeCollection()} and {@link #makeFullCollection()}
+     *  support the <code>add</code> and <code>addAll</code>
+     *  operations.<P>
+     *  Default implementation returns true.  Override if your collection
+     *  class does not support add or addAll.
+     */
+    public boolean isAddSupported() {
+        return true;
+    }
+
+    /**
+     *  Returns true if the collections produced by 
+     *  {@link #makeCollection()} and {@link #makeFullCollection()}
+     *  support the <code>remove</code>, <code>removeAll</code>,
+     *  <code>retainAll</code>, <code>clear</code> and
+     *  <code>iterator().remove()</code> methods.
+     *  Default implementation returns true.  Override if your collection
+     *  class does not support removal operations.
+     */
+    public boolean isRemoveSupported() {
+        return true;
+    }
+
+    /**
+     * Returns true to indicate that the collection supports holding null.
+     * The default implementation returns true;
+     */
+    public boolean isNullSupported() {
+        return true;
+    }
+
+    /**
+     * Returns true to indicate that the collection supports fail fast iterators.
+     * The default implementation returns true;
+     */
+    public boolean isFailFastSupported() {
+        return false;
+    }
+
+    /**
+     * Returns true to indicate that the collection supports equals() comparisons.
+     * This implementation returns false;
+     */
+    public boolean isEqualsCheckable() {
+        return false;
+    }
+
+    //-----------------------------------------------------------------------
+    /**
+     *  Verifies that {@link #collection} and {@link #confirmed} have 
+     *  identical state.
+     */
+    public void verify() {
+        int confirmedSize = confirmed.size();
+        assertEquals("Collection size should match confirmed collection's",
+                     confirmedSize, collection.size());
+        assertEquals("Collection isEmpty() result should match confirmed " +
+                     " collection's", 
+                     confirmed.isEmpty(), collection.isEmpty());
+
+        // verify the collections are the same by attempting to match each
+        // object in the collection and confirmed collection.  To account for
+        // duplicates and differing orders, each confirmed element is copied
+        // into an array and a flag is maintained for each element to determine
+        // whether it has been matched once and only once.  If all elements in
+        // the confirmed collection are matched once and only once and there
+        // aren't any elements left to be matched in the collection,
+        // verification is a success.
+
+        // copy each collection value into an array
+        Object[] confirmedValues = new Object[confirmedSize];
+
+        Iterator iter;
+
+        iter = confirmed.iterator(); 
+        int pos = 0;
+        while(iter.hasNext()) {
+            confirmedValues[pos++] = iter.next();
+        }
+
+        // allocate an array of boolean flags for tracking values that have
+        // been matched once and only once.
+        boolean[] matched = new boolean[confirmedSize];
+        
+        // now iterate through the values of the collection and try to match
+        // the value with one in the confirmed array.
+        iter = collection.iterator();
+        while(iter.hasNext()) {
+            Object o = iter.next();
+            boolean match = false;
+            for(int i = 0; i < confirmedSize; i++) {
+                if(matched[i]) {
+                    // skip values already matched
+                    continue;
+                }
+                if(o == confirmedValues[i] ||
+                   (o != null && o.equals(confirmedValues[i]))) {
+                    // values matched
+                    matched[i] = true;
+                    match = true;
+                    break;
+                }
+            }
+            // no match found!
+            if(!match) {
+                fail("Collection should not contain a value that the " +
+                     "confirmed collection does not have: " + o +
+                     "\nTest: " + collection + "\nReal: " + confirmed);
+            }
+        }
+        
+        // make sure there aren't any unmatched values
+        for(int i = 0; i < confirmedSize; i++) {
+            if(!matched[i]) {
+                // the collection didn't match all the confirmed values
+                fail("Collection should contain all values that are in the confirmed collection" +
+                     "\nTest: " + collection + "\nReal: " + confirmed);
+            }
+        }
+    }
+    
+    //-----------------------------------------------------------------------
+    /**
+     *  Resets the {@link #collection} and {@link #confirmed} fields to empty
+     *  collections.  Invoke this method before performing a modification
+     *  test.
+     */
+    public void resetEmpty() {
+        this.collection = makeCollection();
+        this.confirmed = makeConfirmedCollection();
+    }
+
+    /**
+     *  Resets the {@link #collection} and {@link #confirmed} fields to full
+     *  collections.  Invoke this method before performing a modification
+     *  test.
+     */
+    public void resetFull() {
+        this.collection = makeFullCollection();
+        this.confirmed = makeConfirmedFullCollection();
+    }
+
+    //-----------------------------------------------------------------------
+    /**
+     *  Returns a confirmed empty collection.
+     *  For instance, an {@link java.util.ArrayList} for lists or a
+     *  {@link java.util.HashSet} for sets.
+     *
+     *  @return a confirmed empty collection
+     */
+    public abstract Collection makeConfirmedCollection();
+
+    /**
+     *  Returns a confirmed full collection.
+     *  For instance, an {@link java.util.ArrayList} for lists or a
+     *  {@link java.util.HashSet} for sets.  The returned collection
+     *  should contain the elements returned by {@link #getFullElements()}.
+     *
+     *  @return a confirmed full collection
+     */
+    public abstract Collection makeConfirmedFullCollection();
+
+    /**
+     * Return a new, empty {@link Collection} to be used for testing.
+     */
+    public abstract Collection makeCollection();
+
+    /**
+     *  Returns a full collection to be used for testing.  The collection
+     *  returned by this method should contain every element returned by
+     *  {@link #getFullElements()}.  The default implementation, in fact,
+     *  simply invokes <code>addAll</code> on an empty collection with
+     *  the results of {@link #getFullElements()}.  Override this default
+     *  if your collection doesn't support addAll.
+     */
+    public Collection makeFullCollection() {
+        Collection c = makeCollection();
+        c.addAll(Arrays.asList(getFullElements()));
+        return c;
+    }
+
+    /**
+     *  Returns an empty collection for Object tests.
+     */
+    public Object makeObject() {
+        return makeCollection();
+    }
+
+    /**
+     * Creates a new Map Entry that is independent of the first and the map.
+     */
+    public Map.Entry cloneMapEntry(Map.Entry entry) {
+        HashMap map = new HashMap();
+        map.put(entry.getKey(), entry.getValue());
+        return (Map.Entry) map.entrySet().iterator().next();
+    }
+
+    //-----------------------------------------------------------------------
+    /**
+     *  Returns an array of objects that are contained in a collection
+     *  produced by {@link #makeFullCollection()}.  Every element in the
+     *  returned array <I>must</I> be an element in a full collection.<P>
+     *  The default implementation returns a heterogenous array of 
+     *  objects with some duplicates. null is added if allowed.
+     *  Override if you require specific testing elements.  Note that if you
+     *  override {@link #makeFullCollection()}, you <I>must</I> override
+     *  this method to reflect the contents of a full collection.
+     */
+    public Object[] getFullElements() {
+        if (isNullSupported()) {
+            ArrayList list = new ArrayList();
+            list.addAll(Arrays.asList(getFullNonNullElements()));
+            list.add(4, null);
+            return list.toArray();
+        } else {
+            return (Object[]) getFullNonNullElements().clone();
+        }
+    }
+
+    /**
+     *  Returns an array of elements that are <I>not</I> contained in a
+     *  full collection.  Every element in the returned array must 
+     *  not exist in a collection returned by {@link #makeFullCollection()}.
+     *  The default implementation returns a heterogenous array of elements
+     *  without null.  Note that some of the tests add these elements
+     *  to an empty or full collection, so if your collection restricts
+     *  certain kinds of elements, you should override this method.
+     */
+    public Object[] getOtherElements() {
+        return getOtherNonNullElements();
+    }
+    
+    //-----------------------------------------------------------------------
+    /**
+     *  Returns a list of elements suitable for return by
+     *  {@link #getFullElements()}.  The array returned by this method
+     *  does not include null, but does include a variety of objects 
+     *  of different types.  Override getFullElements to return
+     *  the results of this method if your collection does not support
+     *  the null element.
+     */
+    public Object[] getFullNonNullElements() {
+        return new Object[] {
+            new String(""),
+            new String("One"),
+            new Integer(2),
+            "Three",
+            new Integer(4),
+            "One",
+            new Double(5),
+            new Float(6),
+            "Seven",
+            "Eight",
+            new String("Nine"),
+            new Integer(10),
+            new Short((short)11),
+            new Long(12),
+            "Thirteen",
+            "14",
+            "15",
+            new Byte((byte)16)
+        };
+    }
+
+    /**
+     *  Returns the default list of objects returned by 
+     *  {@link #getOtherElements()}.  Includes many objects
+     *  of different types.
+     */
+    public Object[] getOtherNonNullElements() {
+        return new Object[] {
+            new Integer(0),
+            new Float(0),
+            new Double(0),
+            "Zero",
+            new Short((short)0),
+            new Byte((byte)0),
+            new Long(0),
+            new Character('\u0000'),
+            "0"
+        };
+    }
+
+    /**
+     *  Returns a list of string elements suitable for return by
+     *  {@link #getFullElements()}.  Override getFullElements to return
+     *  the results of this method if your collection does not support
+     *  heterogenous elements or the null element.
+     */
+    public Object[] getFullNonNullStringElements() {
+        return new Object[] {
+            "If","the","dull","substance","of","my","flesh","were","thought",
+            "Injurious","distance","could","not","stop","my","way",
+        };
+    }
+
+    /**
+     *  Returns a list of string elements suitable for return by
+     *  {@link #getOtherElements()}.  Override getOtherElements to return
+     *  the results of this method if your collection does not support
+     *  heterogenous elements or the null element.
+     */
+    public Object[] getOtherNonNullStringElements() {
+        return new Object[] {
+            "For","then","despite",/* of */"space","I","would","be","brought",
+            "From","limits","far","remote","where","thou","dost","stay"
+        };
+    }
+
+    // Tests    
+    //-----------------------------------------------------------------------
+    /**
+     *  Tests {@link Collection#add(Object)}.
+     */
+    public void testCollectionAdd() {
+        if (!isAddSupported()) return;
+        
+        Object[] elements = getFullElements();
+        for (int i = 0; i < elements.length; i++) {
+            resetEmpty();
+            boolean r = collection.add(elements[i]);
+            confirmed.add(elements[i]);
+            verify();
+            assertTrue("Empty collection changed after add", r);
+            assertEquals("Collection size is 1 after first add", 1, collection.size());
+        }
+        
+        resetEmpty();
+        int size = 0;
+        for (int i = 0; i < elements.length; i++) {
+            boolean r = collection.add(elements[i]);
+            confirmed.add(elements[i]);
+            verify();
+            if (r) size++;
+            assertEquals("Collection size should grow after add", 
+                         size, collection.size());
+            assertTrue("Collection should contain added element",
+                       collection.contains(elements[i]));
+        }
+    }
+    
+    
+    /**
+     *  Tests {@link Collection#addAll(Collection)}.
+     */
+    public void testCollectionAddAll() {
+        if (!isAddSupported()) return;
+
+        resetEmpty();
+        Object[] elements = getFullElements();
+        boolean r = collection.addAll(Arrays.asList(elements));
+        confirmed.addAll(Arrays.asList(elements));
+        verify();
+        assertTrue("Empty collection should change after addAll", r);
+        for (int i = 0; i < elements.length; i++) {
+            assertTrue("Collection should contain added element",
+                       collection.contains(elements[i]));
+        }
+
+        resetFull();
+        int size = collection.size();
+        elements = getOtherElements();
+        r = collection.addAll(Arrays.asList(elements));
+        confirmed.addAll(Arrays.asList(elements));
+        verify();
+        assertTrue("Full collection should change after addAll", r);
+        for (int i = 0; i < elements.length; i++) {
+            assertTrue("Full collection should contain added element",
+                       collection.contains(elements[i]));
+        }
+        assertEquals("Size should increase after addAll", 
+                     size + elements.length, collection.size());
+        
+        resetFull();
+        size = collection.size();
+        r = collection.addAll(Arrays.asList(getFullElements()));
+        confirmed.addAll(Arrays.asList(getFullElements()));
+        verify();
+        if (r) {
+            assertTrue("Size should increase if addAll returns true", 
+                       size < collection.size());
+        } else {
+            assertEquals("Size should not change if addAll returns false",
+                         size, collection.size());
+        } 
+    }
+
+
+    /**
+     *  If {@link #isAddSupported()} returns false, tests that add operations
+     *  raise <code>UnsupportedOperationException.
+     */
+    public void testUnsupportedAdd() {
+        if (isAddSupported()) return;
+        
+        resetEmpty();
+        try {
+            collection.add(new Object());
+            fail("Emtpy collection should not support add.");
+        } catch (UnsupportedOperationException e) {
+            // expected
+        }
+        // make sure things didn't change even if the expected exception was
+        // thrown.
+        verify();
+
+        try {
+            collection.addAll(Arrays.asList(getFullElements()));
+            fail("Emtpy collection should not support addAll.");
+        } catch (UnsupportedOperationException e) {
+            // expected
+        }
+        // make sure things didn't change even if the expected exception was
+        // thrown.
+        verify();
+
+        resetFull();
+        try {
+            collection.add(new Object());
+            fail("Full collection should not support add.");
+        } catch (UnsupportedOperationException e) {
+            // expected
+        }
+        // make sure things didn't change even if the expected exception was
+        // thrown.
+        verify();
+        
+        try {
+            collection.addAll(Arrays.asList(getOtherElements()));
+            fail("Full collection should not support addAll.");
+        } catch (UnsupportedOperationException e) {
+            // expected
+        }
+        // make sure things didn't change even if the expected exception was
+        // thrown.
+        verify();
+    }
+
+
+    /**
+     *  Test {@link Collection#clear()}.
+     */
+    public void testCollectionClear() {
+        if (!isRemoveSupported()) return;
+
+        resetEmpty();
+        collection.clear(); // just to make sure it doesn't raise anything
+        verify();
+
+        resetFull();
+        collection.clear();
+        confirmed.clear();
+        verify();
+    }    
+
+    
+    /**
+     *  Tests {@link Collection#contains(Object)}.
+     */
+    public void testCollectionContains() {
+        Object[] elements;
+
+        resetEmpty();
+        elements = getFullElements();
+        for(int i = 0; i < elements.length; i++) {
+            assertTrue("Empty collection shouldn't contain element[" + i + "]",
+                       !collection.contains(elements[i]));
+        }
+        // make sure calls to "contains" don't change anything
+        verify();
+
+        elements = getOtherElements();
+        for(int i = 0; i < elements.length; i++) {
+            assertTrue("Empty collection shouldn't contain element[" + i + "]",
+                       !collection.contains(elements[i]));
+        }
+        // make sure calls to "contains" don't change anything
+        verify();
+
+        resetFull();
+        elements = getFullElements();
+        for(int i = 0; i < elements.length; i++) {
+            assertTrue("Full collection should contain element[" + i + "]", 
+                       collection.contains(elements[i]));
+        }
+        // make sure calls to "contains" don't change anything
+        verify();
+
+        resetFull();
+        elements = getOtherElements();
+        for(int i = 0; i < elements.length; i++) {
+            assertTrue("Full collection shouldn't contain element", 
+                       !collection.contains(elements[i]));
+        }
+    }
+
+
+    /**
+     *  Tests {@link Collection#containsAll(Collection)}.
+     */
+    public void testCollectionContainsAll() {
+        resetEmpty();
+        Collection col = new HashSet();
+        assertTrue("Every Collection should contain all elements of an " +
+                   "empty Collection.", collection.containsAll(col));
+        col.addAll(Arrays.asList(getOtherElements()));
+        assertTrue("Empty Collection shouldn't contain all elements of " +
+                   "a non-empty Collection.", !collection.containsAll(col));
+        // make sure calls to "containsAll" don't change anything
+        verify();
+
+        resetFull();
+        assertTrue("Full collection shouldn't contain other elements", 
+                   !collection.containsAll(col));
+        
+        col.clear();
+        col.addAll(Arrays.asList(getFullElements()));
+        assertTrue("Full collection should containAll full elements",
+                   collection.containsAll(col));
+        // make sure calls to "containsAll" don't change anything
+        verify();
+
+        int min = (getFullElements().length < 2 ? 0 : 2);
+        int max = (getFullElements().length == 1 ? 1 : 
+                    (getFullElements().length <= 5 ? getFullElements().length - 1 : 5));
+        col = Arrays.asList(getFullElements()).subList(min, max);
+        assertTrue("Full collection should containAll partial full " +
+                   "elements", collection.containsAll(col));
+        assertTrue("Full collection should containAll itself", 
+                   collection.containsAll(collection));
+        // make sure calls to "containsAll" don't change anything
+        verify();
+        
+        col = new ArrayList();
+        col.addAll(Arrays.asList(getFullElements()));
+        col.addAll(Arrays.asList(getFullElements()));
+        assertTrue("Full collection should containAll duplicate full " +
+                   "elements", collection.containsAll(col));
+
+        // make sure calls to "containsAll" don't change anything
+        verify();
+    }
+
+    /**
+     *  Tests {@link Collection#isEmpty()}.
+     */
+    public void testCollectionIsEmpty() {
+        resetEmpty();
+        assertEquals("New Collection should be empty.", 
+                     true, collection.isEmpty());
+        // make sure calls to "isEmpty() don't change anything
+        verify();
+
+        resetFull();
+        assertEquals("Full collection shouldn't be empty", 
+                     false, collection.isEmpty());
+        // make sure calls to "isEmpty() don't change anything
+        verify();
+    }
+
+
+    /**
+     *  Tests the read-only functionality of {@link Collection#iterator()}.
+     */
+    public void testCollectionIterator() {
+        resetEmpty();
+        Iterator it1 = collection.iterator();
+        assertEquals("Iterator for empty Collection shouldn't have next.",
+                     false, it1.hasNext());
+        try {
+            it1.next();
+            fail("Iterator at end of Collection should throw " +
+                 "NoSuchElementException when next is called.");
+        } catch(NoSuchElementException e) {
+            // expected
+        } 
+        // make sure nothing has changed after non-modification
+        verify();
+
+        resetFull();
+        it1 = collection.iterator();
+        for (int i = 0; i < collection.size(); i++) {
+            assertTrue("Iterator for full collection should haveNext", 
+                       it1.hasNext());
+            it1.next();
+        }
+        assertTrue("Iterator should be finished", !it1.hasNext());
+        
+        ArrayList list = new ArrayList();
+        it1 = collection.iterator();
+        for (int i = 0; i < collection.size(); i++) {
+            Object next = it1.next();
+            assertTrue("Collection should contain element returned by " +
+                       "its iterator", collection.contains(next));
+            list.add(next);
+        }
+        try {
+            it1.next();
+            fail("iterator.next() should raise NoSuchElementException " +
+                 "after it finishes");
+        } catch (NoSuchElementException e) {
+            // expected
+        }
+        // make sure nothing has changed after non-modification
+        verify();
+    }
+
+
+    /**
+     *  Tests removals from {@link Collection#iterator()}.
+     */
+    public void testCollectionIteratorRemove() {
+        if (!isRemoveSupported()) return;
+
+        resetEmpty();
+        try {
+            collection.iterator().remove();
+            fail("New iterator.remove should raise IllegalState");
+        } catch (IllegalStateException e) {
+            // expected
+        }
+        verify();
+
+        try {
+            Iterator iter = collection.iterator();
+            iter.hasNext();
+            iter.remove();
+            fail("New iterator.remove should raise IllegalState " +
+                 "even after hasNext");
+        } catch (IllegalStateException e) {
+            // expected
+        }
+        verify();
+
+        resetFull();
+        int size = collection.size();
+        Iterator iter = collection.iterator();
+        while (iter.hasNext()) {
+            Object o = iter.next();
+            // TreeMap reuses the Map Entry, so the verify below fails
+            // Clone it here if necessary
+            if (o instanceof Map.Entry) {
+                o = cloneMapEntry((Map.Entry) o);
+            }
+            iter.remove();
+
+            // if the elements aren't distinguishable, we can just remove a
+            // matching element from the confirmed collection and verify
+            // contents are still the same.  Otherwise, we don't have the
+            // ability to distinguish the elements and determine which to
+            // remove from the confirmed collection (in which case, we don't
+            // verify because we don't know how). 
+            //
+            // see areEqualElementsDistinguishable()
+            if(!areEqualElementsDistinguishable()) {
+                confirmed.remove(o);
+                verify();
+            }
+
+            size--;
+            assertEquals("Collection should shrink by one after " +
+                         "iterator.remove", size, collection.size());
+        }
+        assertTrue("Collection should be empty after iterator purge",
+                   collection.isEmpty());
+        
+        resetFull();
+        iter = collection.iterator();
+        iter.next();
+        iter.remove();
+        try {
+            iter.remove();
+            fail("Second iter.remove should raise IllegalState");
+        } catch (IllegalStateException e) {
+            // expected
+        }
+    }
+
+
+    /**
+     *  Tests {@link Collection#remove(Object)}.
+     */
+    public void testCollectionRemove() {
+        if (!isRemoveSupported()) return;
+
+        resetEmpty();
+        Object[] elements = getFullElements();
+        for (int i = 0; i < elements.length; i++) {
+            assertTrue("Shouldn't remove nonexistent element", 
+                       !collection.remove(elements[i]));
+            verify();
+        }
+        
+        Object[] other = getOtherElements();
+        
+        resetFull();
+        for (int i = 0; i < other.length; i++) {
+            assertTrue("Shouldn't remove nonexistent other element", 
+                       !collection.remove(other[i]));
+            verify();
+        }
+        
+        int size = collection.size();
+        for (int i = 0; i < elements.length; i++) {
+            resetFull();
+            assertTrue("Collection should remove extant element: " + elements[i],
+                       collection.remove(elements[i]));
+
+            // if the elements aren't distinguishable, we can just remove a
+            // matching element from the confirmed collection and verify
+            // contents are still the same.  Otherwise, we don't have the
+            // ability to distinguish the elements and determine which to
+            // remove from the confirmed collection (in which case, we don't
+            // verify because we don't know how). 
+            //
+            // see areEqualElementsDistinguishable()
+            if(!areEqualElementsDistinguishable()) {
+                confirmed.remove(elements[i]);
+                verify();
+            }
+
+            assertEquals("Collection should shrink after remove", 
+                         size - 1, collection.size());
+        }
+    }
+    
+
+    /**
+     *  Tests {@link Collection#removeAll(Collection)}.
+     */
+    public void testCollectionRemoveAll() {
+        if (!isRemoveSupported()) return;
+
+        resetEmpty();
+        assertTrue("Emtpy collection removeAll should return false for " +
+                   "empty input", 
+                   !collection.removeAll(Collections.EMPTY_SET));
+        verify();
+        
+        assertTrue("Emtpy collection removeAll should return false for " +
+                   "nonempty input", 
+                   !collection.removeAll(new ArrayList(collection)));
+        verify();
+        
+        resetFull();
+        assertTrue("Full collection removeAll should return false for " + 
+                   "empty input", 
+                   !collection.removeAll(Collections.EMPTY_SET));
+        verify();
+        
+        assertTrue("Full collection removeAll should return false for other elements", 
+                   !collection.removeAll(Arrays.asList(getOtherElements())));
+        verify();
+        
+        assertTrue("Full collection removeAll should return true for full elements", 
+                    collection.removeAll(new HashSet(collection)));
+        confirmed.removeAll(new HashSet(confirmed));
+        verify();
+        
+        resetFull();
+        int size = collection.size();
+        int min = (getFullElements().length < 2 ? 0 : 2);
+        int max = (getFullElements().length == 1 ? 1 : 
+                    (getFullElements().length <= 5 ? getFullElements().length - 1 : 5));
+        Collection all = Arrays.asList(getFullElements()).subList(min, max);
+        assertTrue("Full collection removeAll should work", 
+                   collection.removeAll(all));
+        confirmed.removeAll(all);
+        verify();
+        
+        assertTrue("Collection should shrink after removeAll", 
+                   collection.size() < size);
+        Iterator iter = all.iterator();
+        while (iter.hasNext()) {
+            assertTrue("Collection shouldn't contain removed element",
+                       !collection.contains(iter.next()));
+        }
+    }
+
+
+    /**
+     *  Tests {@link Collection#retainAll(Collection)}.
+     */
+    public void testCollectionRetainAll() {
+        if (!isRemoveSupported()) return;
+
+        resetEmpty();
+        List elements = Arrays.asList(getFullElements());
+        List other = Arrays.asList(getOtherElements());
+
+        assertTrue("Empty retainAll() should return false", 
+                   !collection.retainAll(Collections.EMPTY_SET));
+        verify();
+        
+        assertTrue("Empty retainAll() should return false", 
+                   !collection.retainAll(elements));
+        verify();
+        
+        resetFull();
+        assertTrue("Collection should change from retainAll empty", 
+                   collection.retainAll(Collections.EMPTY_SET));
+        confirmed.retainAll(Collections.EMPTY_SET);
+        verify();
+        
+        resetFull();
+        assertTrue("Collection changed from retainAll other", 
+                   collection.retainAll(other));
+        confirmed.retainAll(other);
+        verify();
+        
+        resetFull();
+        int size = collection.size();
+        assertTrue("Collection shouldn't change from retainAll elements",
+                   !collection.retainAll(elements));
+        verify();
+        assertEquals("Collection size shouldn't change", size, 
+                     collection.size());
+        
+        if (getFullElements().length > 1) {
+            resetFull();
+            size = collection.size();
+            int min = (getFullElements().length < 2 ? 0 : 2);
+            int max = (getFullElements().length <= 5 ? getFullElements().length - 1 : 5);
+            assertTrue("Collection should changed by partial retainAll",
+                       collection.retainAll(elements.subList(min, max)));
+            confirmed.retainAll(elements.subList(min, max));
+            verify();
+        
+            Iterator iter = collection.iterator();
+            while (iter.hasNext()) {
+                assertTrue("Collection only contains retained element", 
+                           elements.subList(min, max).contains(iter.next()));
+            }
+        }
+        
+        resetFull();
+        HashSet set = new HashSet(elements);
+        size = collection.size();
+        assertTrue("Collection shouldn't change from retainAll without " +
+                   "duplicate elements", !collection.retainAll(set));
+        verify();
+        assertEquals("Collection size didn't change from nonduplicate " +
+                     "retainAll", size, collection.size());
+    }
+    
+    
+    /**
+     *  Tests {@link Collection#size()}.
+     */
+    public void testCollectionSize() {
+        resetEmpty();
+        assertEquals("Size of new Collection is 0.", 0, collection.size());
+
+        resetFull();
+        assertTrue("Size of full collection should be greater than zero", 
+                   collection.size() > 0);
+    }
+
+
+    /**
+     *  Tests {@link Collection#toArray()}.
+     */
+    public void testCollectionToArray() {
+        resetEmpty();
+        assertEquals("Empty Collection should return empty array for toArray",
+                     0, collection.toArray().length);
+
+        resetFull();
+        Object[] array = collection.toArray();
+        assertEquals("Full collection toArray should be same size as " +
+                     "collection", array.length, collection.size());
+        Object[] confirmedArray = confirmed.toArray();
+        assertEquals("length of array from confirmed collection should " +
+                     "match the length of the collection's array", 
+                     confirmedArray.length, array.length);
+        boolean[] matched = new boolean[array.length];
+
+        for (int i = 0; i < array.length; i++) {
+            assertTrue("Collection should contain element in toArray",
+                       collection.contains(array[i]));
+
+            boolean match = false;
+            // find a match in the confirmed array
+            for(int j = 0; j < array.length; j++) {
+                // skip already matched
+                if(matched[j]) continue;
+                if(array[i] == confirmedArray[j] ||
+                   (array[i] != null && array[i].equals(confirmedArray[j]))) {
+                    matched[j] = true;
+                    match = true;
+                    break;
+                }
+            }
+            if(!match) {
+                fail("element " + i + " in returned array should be found " +
+                     "in the confirmed collection's array");
+            }
+        }
+        for(int i = 0; i < matched.length; i++) {
+            assertEquals("Collection should return all its elements in " +
+                         "toArray", true, matched[i]);
+        }
+    }
+
+
+    /**
+     *  Tests {@link Collection#toArray(Object[])}.
+     */
+    public void testCollectionToArray2() {
+        resetEmpty();
+        Object[] a = new Object[] { new Object(), null, null };
+        Object[] array = collection.toArray(a);
+        assertEquals("Given array shouldn't shrink", array, a);
+        assertEquals("Last element should be set to null", a[0], null);
+        verify();
+
+        resetFull();
+        try {
+            array = collection.toArray(new Void[collection.size()]);
+            fail("toArray(new Void[0]) should raise ArrayStore");
+        } catch (ArrayStoreException e) {
+            // expected
+        }
+        verify();
+
+        try {
+            array = collection.toArray(null);
+            fail("toArray(null) should raise NPE");
+        } catch (NullPointerException e) {
+            // expected
+        }
+        verify();
+        
+        array = collection.toArray(new Object[collection.size()]);
+        a = collection.toArray();
+        assertEquals("toArrays should be equal", 
+                     Arrays.asList(array), Arrays.asList(a));
+
+        // Figure out if they're all the same class
+        // TODO: It'd be nicer to detect a common superclass
+        HashSet classes = new HashSet();
+        for (int i = 0; i < array.length; i++) {
+            classes.add((array[i] == null) ? null : array[i].getClass());
+        }
+        if (classes.size() > 1) return;
+        
+        Class cl = (Class)classes.iterator().next();
+        if (Map.Entry.class.isAssignableFrom(cl)) {  // check needed for protective cases like Predicated/Unmod map entrySet
+            cl = Map.Entry.class;
+        }
+        a = (Object[])Array.newInstance(cl, 0);
+        array = collection.toArray(a);
+        assertEquals("toArray(Object[]) should return correct array type",
+                     a.getClass(), array.getClass());
+        assertEquals("type-specific toArrays should be equal", 
+                     Arrays.asList(array), 
+                     Arrays.asList(collection.toArray()));
+        verify();
+    }
+
+
+    /**
+     *  Tests <code>toString</code> on a collection.
+     */
+    public void testCollectionToString() {
+        resetEmpty();
+        assertTrue("toString shouldn't return null", 
+                   collection.toString() != null);
+
+        resetFull();
+        assertTrue("toString shouldn't return null", 
+                   collection.toString() != null);
+    }
+
+
+    /**
+     *  If isRemoveSupported() returns false, tests to see that remove
+     *  operations raise an UnsupportedOperationException.
+     */
+    public void testUnsupportedRemove() {
+        if (isRemoveSupported()) return;
+
+        resetEmpty();
+        try {
+            collection.clear();
+            fail("clear should raise UnsupportedOperationException");
+        } catch (UnsupportedOperationException e) {
+            // expected
+        }
+        verify();
+
+        try {
+            collection.remove(null);
+            fail("remove should raise UnsupportedOperationException");
+        } catch (UnsupportedOperationException e) {
+            // expected
+        }
+        verify();
+
+        try {
+            collection.removeAll(null);
+            fail("removeAll should raise UnsupportedOperationException");
+        } catch (UnsupportedOperationException e) {
+            // expected
+        }
+        verify();
+
+        try {
+            collection.retainAll(null);
+            fail("removeAll should raise UnsupportedOperationException");
+        } catch (UnsupportedOperationException e) {
+            // expected
+        }
+        verify();
+
+        resetFull();
+        try {
+            Iterator iterator = collection.iterator();
+            iterator.next();
+            iterator.remove();
+            fail("iterator.remove should raise UnsupportedOperationException");
+        } catch (UnsupportedOperationException e) {
+            // expected
+        }
+        verify();
+
+    }
+
+
+    /**
+     *  Tests that the collection's iterator is fail-fast.  
+     */
+    public void testCollectionIteratorFailFast() {
+        if (!isFailFastSupported()) return;
+        
+        if (isAddSupported()) {
+            resetFull();
+            try {
+                Iterator iter = collection.iterator();
+                Object o = getOtherElements()[0];
+                collection.add(o);
+                confirmed.add(o);
+                iter.next();
+                fail("next after add should raise ConcurrentModification");
+            } catch (ConcurrentModificationException e) {
+                // expected
+            }
+            verify();
+            
+            resetFull();
+            try {
+                Iterator iter = collection.iterator();
+                collection.addAll(Arrays.asList(getOtherElements()));
+                confirmed.addAll(Arrays.asList(getOtherElements()));
+                iter.next();
+                fail("next after addAll should raise ConcurrentModification");
+            } catch (ConcurrentModificationException e) {
+                // expected
+            }
+            verify();
+        }
+
+        if (!isRemoveSupported()) return;
+
+        resetFull();
+        try {
+            Iterator iter = collection.iterator();
+            collection.clear();
+            iter.next();
+            fail("next after clear should raise ConcurrentModification");
+        } catch (ConcurrentModificationException e) {
+            // expected
+        } catch (NoSuchElementException e) {
+            // (also legal given spec)
+        }
+        
+        resetFull();
+        try {
+            Iterator iter = collection.iterator();
+            collection.remove(getFullElements()[0]);
+            iter.next();
+            fail("next after remove should raise ConcurrentModification");
+        } catch (ConcurrentModificationException e) {
+            // expected
+        }
+
+        resetFull();
+        try {
+            Iterator iter = collection.iterator();
+            List sublist = Arrays.asList(getFullElements()).subList(2,5);
+            collection.removeAll(sublist);
+            iter.next();
+            fail("next after removeAll should raise ConcurrentModification");
+        } catch (ConcurrentModificationException e) {
+            // expected
+        }
+
+        resetFull();
+        try {
+            Iterator iter = collection.iterator();
+            List sublist = Arrays.asList(getFullElements()).subList(2,5);
+            collection.retainAll(sublist);
+            iter.next();
+            fail("next after retainAll should raise ConcurrentModification");
+        } catch (ConcurrentModificationException e) {
+            // expected
+        }
+    }
+
+    public void testSerializeDeserializeThenCompare() throws Exception {
+        Object obj = makeCollection();
+        if (obj instanceof Serializable && isTestSerialization()) {
+            ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+            ObjectOutputStream out = new ObjectOutputStream(buffer);
+            out.writeObject(obj);
+            out.close();
+
+            ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray()));
+            Object dest = in.readObject();
+            in.close();
+            if (isEqualsCheckable()) {
+                assertEquals("obj != deserialize(serialize(obj)) - EMPTY Collection", obj, dest);
+            }
+        }
+        obj = makeFullCollection();
+        if (obj instanceof Serializable && isTestSerialization()) {
+            ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+            ObjectOutputStream out = new ObjectOutputStream(buffer);
+            out.writeObject(obj);
+            out.close();
+
+            ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray()));
+            Object dest = in.readObject();
+            in.close();
+            if (isEqualsCheckable()) {
+                assertEquals("obj != deserialize(serialize(obj)) - FULL Collection", obj, dest);
+            }
+        }
+    }
+    
+}
diff --git a/dev/core/test/org/apache/commons/collections/iterators/AbstractTestIterator.java b/dev/core/test/org/apache/commons/collections/iterators/AbstractTestIterator.java
index 9422ad5..d2e6870 100644
--- a/dev/core/test/org/apache/commons/collections/iterators/AbstractTestIterator.java
+++ b/dev/core/test/org/apache/commons/collections/iterators/AbstractTestIterator.java
@@ -1,203 +1,203 @@
-/*

- *  Licensed to the Apache Software Foundation (ASF) under one or more

- *  contributor license agreements.  See the NOTICE file distributed with

- *  this work for additional information regarding copyright ownership.

- *  The ASF licenses this file to You 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 org.apache.commons.collections.iterators;

-

-import java.util.Iterator;

-import java.util.NoSuchElementException;

-

-import org.apache.commons.collections.AbstractTestObject;

-

-/**

- * Abstract class for testing the Iterator interface.

- * <p>

- * This class provides a framework for testing an implementation of Iterator.

- * Concrete subclasses must provide the iterator to be tested.

- * They must also specify certain details of how the iterator operates by

- * overriding the supportsXxx() methods if necessary.

- * 

- * @since Commons Collections 3.0

- * @version $Revision: 646780 $ $Date: 2008-04-10 13:48:07 +0100 (Thu, 10 Apr 2008) $

- * 

- * @author Morgan Delagrange

- * @author Stephen Colebourne

- */

-public abstract class AbstractTestIterator extends AbstractTestObject {

-

-    /**

-     * JUnit constructor.

-     * 

-     * @param testName  the test class name

-     */

-    public AbstractTestIterator(String testName) {

-        super(testName);

-    }

-

-    //-----------------------------------------------------------------------

-    /**

-     * Implement this method to return an iterator over an empty collection.

-     * 

-     * @return an empty iterator

-     */

-    public abstract Iterator makeEmptyIterator();

-

-    /**

-     * Implement this method to return an iterator over a collection with elements.

-     * 

-     * @return a full iterator

-     */

-    public abstract Iterator makeFullIterator();

-

-    /**

-     * Implements the abstract superclass method to return the full iterator.

-     * 

-     * @return a full iterator

-     */

-    public Object makeObject() {

-        return makeFullIterator();

-    }

-

-    /**

-     * Whether or not we are testing an iterator that can be empty.

-     * Default is true.

-     * 

-     * @return true if Iterator can be empty

-     */

-    public boolean supportsEmptyIterator() {

-        return true;

-    }

-

-    /**

-     * Whether or not we are testing an iterator that can contain elements.

-     * Default is true.

-     * 

-     * @return true if Iterator can be full

-     */

-    public boolean supportsFullIterator() {

-        return true;

-    }

-

-    /**

-     * Whether or not we are testing an iterator that supports remove().

-     * Default is true.

-     * 

-     * @return true if Iterator supports remove

-     */

-    public boolean supportsRemove() {

-        return true;

-    }

-

-    /**

-     * Allows subclasses to add complex cross verification

-     */

-    public void verify() {

-        // do nothing

-    }

-

-    //-----------------------------------------------------------------------

-    /**

-     * Test the empty iterator.

-     */

-    public void testEmptyIterator() {

-        if (supportsEmptyIterator() == false) {

-            return;

-        }

-

-        Iterator it = makeEmptyIterator();

-        

-        // hasNext() should return false

-        assertEquals("hasNext() should return false for empty iterators", false, it.hasNext());

-        

-        // next() should throw a NoSuchElementException

-        try {

-            it.next();

-            fail("NoSuchElementException must be thrown when Iterator is exhausted");

-        } catch (NoSuchElementException e) {

-        }

-        verify();

-        

-        assertNotNull(it.toString());

-    }

-

-    /**

-     * Test normal iteration behaviour.

-     */

-    public void testFullIterator() {

-        if (supportsFullIterator() == false) {

-            return;

-        }

-

-        Iterator it = makeFullIterator();

-

-        // hasNext() must be true (ensure makeFullIterator is correct!)

-        assertEquals("hasNext() should return true for at least one element", true, it.hasNext());

-

-        // next() must not throw exception (ensure makeFullIterator is correct!)

-        try {

-            it.next();

-        } catch (NoSuchElementException e) {

-            fail("Full iterators must have at least one element");

-        }

-

-        // iterate through

-        while (it.hasNext()) {

-            it.next();

-            verify();

-        }

-

-        // next() must throw NoSuchElementException now

-        try {

-            it.next();

-            fail("NoSuchElementException must be thrown when Iterator is exhausted");

-        } catch (NoSuchElementException e) {

-        }

-        

-        assertNotNull(it.toString());

-    }

-

-    /**

-     * Test remove behaviour.

-     */

-    public void testRemove() {

-        Iterator it = makeFullIterator();

-        

-        if (supportsRemove() == false) {

-            // check for UnsupportedOperationException if not supported

-            try {

-                it.remove();

-            } catch (UnsupportedOperationException ex) {}

-            return;

-        }

-        

-        // should throw IllegalStateException before next() called

-        try {

-            it.remove();

-            fail();

-        } catch (IllegalStateException ex) {}

-        verify();

-        

-        // remove after next should be fine

-        it.next();

-        it.remove();

-        

-        // should throw IllegalStateException for second remove()

-        try {

-            it.remove();

-            fail();

-        } catch (IllegalStateException ex) {}

-    }

-    

-}

+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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 org.apache.commons.collections.iterators;
+
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
+import org.apache.commons.collections.AbstractTestObject;
+
+/**
+ * Abstract class for testing the Iterator interface.
+ * <p>
+ * This class provides a framework for testing an implementation of Iterator.
+ * Concrete subclasses must provide the iterator to be tested.
+ * They must also specify certain details of how the iterator operates by
+ * overriding the supportsXxx() methods if necessary.
+ * 
+ * @since Commons Collections 3.0
+ * @version $Revision: 646780 $ $Date: 2008-04-10 13:48:07 +0100 (Thu, 10 Apr 2008) $
+ * 
+ * @author Morgan Delagrange
+ * @author Stephen Colebourne
+ */
+public abstract class AbstractTestIterator extends AbstractTestObject {
+
+    /**
+     * JUnit constructor.
+     * 
+     * @param testName  the test class name
+     */
+    public AbstractTestIterator(String testName) {
+        super(testName);
+    }
+
+    //-----------------------------------------------------------------------
+    /**
+     * Implement this method to return an iterator over an empty collection.
+     * 
+     * @return an empty iterator
+     */
+    public abstract Iterator makeEmptyIterator();
+
+    /**
+     * Implement this method to return an iterator over a collection with elements.
+     * 
+     * @return a full iterator
+     */
+    public abstract Iterator makeFullIterator();
+
+    /**
+     * Implements the abstract superclass method to return the full iterator.
+     * 
+     * @return a full iterator
+     */
+    public Object makeObject() {
+        return makeFullIterator();
+    }
+
+    /**
+     * Whether or not we are testing an iterator that can be empty.
+     * Default is true.
+     * 
+     * @return true if Iterator can be empty
+     */
+    public boolean supportsEmptyIterator() {
+        return true;
+    }
+
+    /**
+     * Whether or not we are testing an iterator that can contain elements.
+     * Default is true.
+     * 
+     * @return true if Iterator can be full
+     */
+    public boolean supportsFullIterator() {
+        return true;
+    }
+
+    /**
+     * Whether or not we are testing an iterator that supports remove().
+     * Default is true.
+     * 
+     * @return true if Iterator supports remove
+     */
+    public boolean supportsRemove() {
+        return true;
+    }
+
+    /**
+     * Allows subclasses to add complex cross verification
+     */
+    public void verify() {
+        // do nothing
+    }
+
+    //-----------------------------------------------------------------------
+    /**
+     * Test the empty iterator.
+     */
+    public void testEmptyIterator() {
+        if (supportsEmptyIterator() == false) {
+            return;
+        }
+
+        Iterator it = makeEmptyIterator();
+        
+        // hasNext() should return false
+        assertEquals("hasNext() should return false for empty iterators", false, it.hasNext());
+        
+        // next() should throw a NoSuchElementException
+        try {
+            it.next();
+            fail("NoSuchElementException must be thrown when Iterator is exhausted");
+        } catch (NoSuchElementException e) {
+        }
+        verify();
+        
+        assertNotNull(it.toString());
+    }
+
+    /**
+     * Test normal iteration behaviour.
+     */
+    public void testFullIterator() {
+        if (supportsFullIterator() == false) {
+            return;
+        }
+
+        Iterator it = makeFullIterator();
+
+        // hasNext() must be true (ensure makeFullIterator is correct!)
+        assertEquals("hasNext() should return true for at least one element", true, it.hasNext());
+
+        // next() must not throw exception (ensure makeFullIterator is correct!)
+        try {
+            it.next();
+        } catch (NoSuchElementException e) {
+            fail("Full iterators must have at least one element");
+        }
+
+        // iterate through
+        while (it.hasNext()) {
+            it.next();
+            verify();
+        }
+
+        // next() must throw NoSuchElementException now
+        try {
+            it.next();
+            fail("NoSuchElementException must be thrown when Iterator is exhausted");
+        } catch (NoSuchElementException e) {
+        }
+        
+        assertNotNull(it.toString());
+    }
+
+    /**
+     * Test remove behaviour.
+     */
+    public void testRemove() {
+        Iterator it = makeFullIterator();
+        
+        if (supportsRemove() == false) {
+            // check for UnsupportedOperationException if not supported
+            try {
+                it.remove();
+            } catch (UnsupportedOperationException ex) {}
+            return;
+        }
+        
+        // should throw IllegalStateException before next() called
+        try {
+            it.remove();
+            fail();
+        } catch (IllegalStateException ex) {}
+        verify();
+        
+        // remove after next should be fine
+        it.next();
+        it.remove();
+        
+        // should throw IllegalStateException for second remove()
+        try {
+            it.remove();
+            fail();
+        } catch (IllegalStateException ex) {}
+    }
+    
+}
diff --git a/dev/core/test/org/apache/commons/collections/iterators/AbstractTestMapIterator.java b/dev/core/test/org/apache/commons/collections/iterators/AbstractTestMapIterator.java
index b2acfd1..5bd5191 100644
--- a/dev/core/test/org/apache/commons/collections/iterators/AbstractTestMapIterator.java
+++ b/dev/core/test/org/apache/commons/collections/iterators/AbstractTestMapIterator.java
@@ -1,355 +1,355 @@
-/*

- *  Licensed to the Apache Software Foundation (ASF) under one or more

- *  contributor license agreements.  See the NOTICE file distributed with

- *  this work for additional information regarding copyright ownership.

- *  The ASF licenses this file to You 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 org.apache.commons.collections.iterators;

-

-import java.util.HashSet;

-import java.util.Iterator;

-import java.util.Map;

-import java.util.NoSuchElementException;

-import java.util.Set;

-

-import org.apache.commons.collections.MapIterator;

-

-/**

- * Abstract class for testing the MapIterator interface.

- * <p>

- * This class provides a framework for testing an implementation of MapIterator.

- * Concrete subclasses must provide the list iterator to be tested.

- * They must also specify certain details of how the list iterator operates by

- * overriding the supportsXxx() methods if necessary.

- * 

- * @since Commons Collections 3.0

- * @version $Revision: 646780 $ $Date: 2008-04-10 13:48:07 +0100 (Thu, 10 Apr 2008) $

- * 

- * @author Stephen Colebourne

- */

-public abstract class AbstractTestMapIterator extends AbstractTestIterator {

-

-    /**

-     * JUnit constructor.

-     * 

-     * @param testName  the test class name

-     */

-    public AbstractTestMapIterator(String testName) {

-        super(testName);

-    }

-

-    //-----------------------------------------------------------------------

-    /**

-     * Implement this method to return a map iterator over an empty map.

-     * 

-     * @return an empty iterator

-     */

-    public abstract MapIterator makeEmptyMapIterator();

-

-    /**

-     * Implement this method to return a map iterator over a map with elements.

-     * 

-     * @return a full iterator

-     */

-    public abstract MapIterator makeFullMapIterator();

-

-    /**

-     * Implement this method to return the map which contains the same data as the

-     * iterator.

-     * 

-     * @return a full map which can be updated

-     */

-    public abstract Map getMap();

-    

-    /**

-     * Implement this method to return the confirmed map which contains the same

-     * data as the iterator.

-     * 

-     * @return a full map which can be updated

-     */

-    public abstract Map getConfirmedMap();

-    

-    /**

-     * Implements the abstract superclass method to return the list iterator.

-     * 

-     * @return an empty iterator

-     */

-    public final Iterator makeEmptyIterator() {

-        return makeEmptyMapIterator();

-    }

-

-    /**

-     * Implements the abstract superclass method to return the list iterator.

-     * 

-     * @return a full iterator

-     */

-    public final Iterator makeFullIterator() {

-        return makeFullMapIterator();

-    }

-

-    /**

-     * Whether or not we are testing an iterator that supports setValue().

-     * Default is true.

-     * 

-     * @return true if Iterator supports set

-     */

-    public boolean supportsSetValue() {

-        return true;

-    }

-

-    /**

-     * Whether the get operation on the map structurally modifies the map,

-     * such as with LRUMap. Default is false.

-     * 

-     * @return true if the get method structurally modifies the map

-     */

-    public boolean isGetStructuralModify() {

-        return false;

-    }

-    

-    /**

-     * The values to be used in the add and set tests.

-     * Default is two strings.

-     */

-    public Object[] addSetValues() {

-        return new Object[] {"A", "B"};

-    }

-

-    //-----------------------------------------------------------------------

-    /**

-     * Test that the empty list iterator contract is correct.

-     */

-    public void testEmptyMapIterator() {

-        if (supportsEmptyIterator() == false) {

-            return;

-        }

-

-        MapIterator it = makeEmptyMapIterator();

-        Map map = getMap();

-        assertEquals(false, it.hasNext());

-        

-        // next() should throw a NoSuchElementException

-        try {

-            it.next();

-            fail();

-        } catch (NoSuchElementException ex) {}

-        

-        // getKey() should throw an IllegalStateException

-        try {

-            it.getKey();

-            fail();

-        } catch (IllegalStateException ex) {}

-        

-        // getValue() should throw an IllegalStateException

-        try {

-            it.getValue();

-            fail();

-        } catch (IllegalStateException ex) {}

-        

-        if (supportsSetValue() == false) {

-            // setValue() should throw an UnsupportedOperationException/IllegalStateException

-            try {

-                it.setValue(addSetValues()[0]);

-                fail();

-            } catch (UnsupportedOperationException ex) {

-            } catch (IllegalStateException ex) {}

-        } else {

-            // setValue() should throw an IllegalStateException

-            try {

-                it.setValue(addSetValues()[0]);

-                fail();

-            } catch (IllegalStateException ex) {}

-        }

-    }

-

-    //-----------------------------------------------------------------------

-    /**

-     * Test that the full list iterator contract is correct.

-     */

-    public void testFullMapIterator() {

-        if (supportsFullIterator() == false) {

-            return;

-        }

-

-        MapIterator it = makeFullMapIterator();

-        Map map = getMap();

-        assertEquals(true, it.hasNext());

-        

-        assertEquals(true, it.hasNext());

-        Set set = new HashSet();

-        while (it.hasNext()) {

-            // getKey

-            Object key = it.next();

-            assertSame("it.next() should equals getKey()", key, it.getKey());

-            assertTrue("Key must be in map",  map.containsKey(key));

-            assertTrue("Key must be unique", set.add(key));

-            

-            // getValue

-            Object value = it.getValue();

-            if (isGetStructuralModify() == false) {

-                assertSame("Value must be mapped to key", map.get(key), value);

-            }

-            assertTrue("Value must be in map",  map.containsValue(value));

-

-            verify();

-        }

-    }

-    

-    //-----------------------------------------------------------------------

-    public void testMapIteratorSet() {

-        if (supportsFullIterator() == false) {

-            return;

-        }

-

-        Object newValue = addSetValues()[0];

-        Object newValue2 = (addSetValues().length == 1 ? addSetValues()[0] : addSetValues()[1]);

-        MapIterator it = makeFullMapIterator();

-        Map map = getMap();

-        Map confirmed = getConfirmedMap();

-        assertEquals(true, it.hasNext());

-        Object key = it.next();

-        Object value = it.getValue();

-        

-        if (supportsSetValue() == false) {

-            try {

-                it.setValue(newValue);

-                fail();

-            } catch (UnsupportedOperationException ex) {}

-            return;

-        }

-        Object old = it.setValue(newValue);

-        confirmed.put(key, newValue);

-        assertSame("Key must not change after setValue", key, it.getKey());

-        assertSame("Value must be changed after setValue", newValue, it.getValue());

-        assertSame("setValue must return old value", value, old);

-        assertEquals("Map must contain key", true, map.containsKey(key));

-        // test against confirmed, as map may contain value twice

-        assertEquals("Map must not contain old value", 

-            confirmed.containsValue(old), map.containsValue(old));

-        assertEquals("Map must contain new value", true, map.containsValue(newValue));

-        verify();

-        

-        it.setValue(newValue);  // same value - should be OK

-        confirmed.put(key, newValue);

-        assertSame("Key must not change after setValue", key, it.getKey());

-        assertSame("Value must be changed after setValue", newValue, it.getValue());

-        verify();

-        

-        it.setValue(newValue2);  // new value

-        confirmed.put(key, newValue2);

-        assertSame("Key must not change after setValue", key, it.getKey());

-        assertSame("Value must be changed after setValue", newValue2, it.getValue());

-        verify();

-    }

-

-    //-----------------------------------------------------------------------

-    public void testRemove() { // override

-        MapIterator it = makeFullMapIterator();

-        Map map = getMap();

-        Map confirmed = getConfirmedMap();

-        assertEquals(true, it.hasNext());

-        Object key = it.next();

-        

-        if (supportsRemove() == false) {

-            try {

-                it.remove();

-                fail();

-            } catch (UnsupportedOperationException ex) {

-            }

-            return;

-        }

-        

-        it.remove();

-        confirmed.remove(key);

-        assertEquals(false, map.containsKey(key));

-        verify();

-        

-        try {

-            it.remove();  // second remove fails

-        } catch (IllegalStateException ex) {

-        }

-        verify();

-    }

-

-    //-----------------------------------------------------------------------

-    public void testMapIteratorSetRemoveSet() {

-        if (supportsSetValue() == false || supportsRemove() == false) {

-            return;

-        }

-        Object newValue = addSetValues()[0];

-        MapIterator it = makeFullMapIterator();

-        Map map = getMap();

-        Map confirmed = getConfirmedMap();

-        

-        assertEquals(true, it.hasNext());

-        Object key = it.next();

-        

-        it.setValue(newValue);

-        it.remove();

-        confirmed.remove(key);

-        verify();

-        

-        try {

-            it.setValue(newValue);

-            fail();

-        } catch (IllegalStateException ex) {}

-        verify();

-    }

-

-    //-----------------------------------------------------------------------

-    public void testMapIteratorRemoveGetKey() {

-        if (supportsRemove() == false) {

-            return;

-        }

-        MapIterator it = makeFullMapIterator();

-        Map map = getMap();

-        Map confirmed = getConfirmedMap();

-        

-        assertEquals(true, it.hasNext());

-        Object key = it.next();

-        

-        it.remove();

-        confirmed.remove(key);

-        verify();

-        

-        try {

-            it.getKey();

-            fail();

-        } catch (IllegalStateException ex) {}

-        verify();

-    }

-

-    //-----------------------------------------------------------------------

-    public void testMapIteratorRemoveGetValue() {

-        if (supportsRemove() == false) {

-            return;

-        }

-        MapIterator it = makeFullMapIterator();

-        Map map = getMap();

-        Map confirmed = getConfirmedMap();

-        

-        assertEquals(true, it.hasNext());

-        Object key = it.next();

-        

-        it.remove();

-        confirmed.remove(key);

-        verify();

-        

-        try {

-            it.getValue();

-            fail();

-        } catch (IllegalStateException ex) {}

-        verify();

-    }

-

-}

+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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 org.apache.commons.collections.iterators;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
+
+import org.apache.commons.collections.MapIterator;
+
+/**
+ * Abstract class for testing the MapIterator interface.
+ * <p>
+ * This class provides a framework for testing an implementation of MapIterator.
+ * Concrete subclasses must provide the list iterator to be tested.
+ * They must also specify certain details of how the list iterator operates by
+ * overriding the supportsXxx() methods if necessary.
+ * 
+ * @since Commons Collections 3.0
+ * @version $Revision: 646780 $ $Date: 2008-04-10 13:48:07 +0100 (Thu, 10 Apr 2008) $
+ * 
+ * @author Stephen Colebourne
+ */
+public abstract class AbstractTestMapIterator extends AbstractTestIterator {
+
+    /**
+     * JUnit constructor.
+     * 
+     * @param testName  the test class name
+     */
+    public AbstractTestMapIterator(String testName) {
+        super(testName);
+    }
+
+    //-----------------------------------------------------------------------
+    /**
+     * Implement this method to return a map iterator over an empty map.
+     * 
+     * @return an empty iterator
+     */
+    public abstract MapIterator makeEmptyMapIterator();
+
+    /**
+     * Implement this method to return a map iterator over a map with elements.
+     * 
+     * @return a full iterator
+     */
+    public abstract MapIterator makeFullMapIterator();
+
+    /**
+     * Implement this method to return the map which contains the same data as the
+     * iterator.
+     * 
+     * @return a full map which can be updated
+     */
+    public abstract Map getMap();
+    
+    /**
+     * Implement this method to return the confirmed map which contains the same
+     * data as the iterator.
+     * 
+     * @return a full map which can be updated
+     */
+    public abstract Map getConfirmedMap();
+    
+    /**
+     * Implements the abstract superclass method to return the list iterator.
+     * 
+     * @return an empty iterator
+     */
+    public final Iterator makeEmptyIterator() {
+        return makeEmptyMapIterator();
+    }
+
+    /**
+     * Implements the abstract superclass method to return the list iterator.
+     * 
+     * @return a full iterator
+     */
+    public final Iterator makeFullIterator() {
+        return makeFullMapIterator();
+    }
+
+    /**
+     * Whether or not we are testing an iterator that supports setValue().
+     * Default is true.
+     * 
+     * @return true if Iterator supports set
+     */
+    public boolean supportsSetValue() {
+        return true;
+    }
+
+    /**
+     * Whether the get operation on the map structurally modifies the map,
+     * such as with LRUMap. Default is false.
+     * 
+     * @return true if the get method structurally modifies the map
+     */
+    public boolean isGetStructuralModify() {
+        return false;
+    }
+    
+    /**
+     * The values to be used in the add and set tests.
+     * Default is two strings.
+     */
+    public Object[] addSetValues() {
+        return new Object[] {"A", "B"};
+    }
+
+    //-----------------------------------------------------------------------
+    /**
+     * Test that the empty list iterator contract is correct.
+     */
+    public void testEmptyMapIterator() {
+        if (supportsEmptyIterator() == false) {
+            return;
+        }
+
+        MapIterator it = makeEmptyMapIterator();
+        Map map = getMap();
+        assertEquals(false, it.hasNext());
+        
+        // next() should throw a NoSuchElementException
+        try {
+            it.next();
+            fail();
+        } catch (NoSuchElementException ex) {}
+        
+        // getKey() should throw an IllegalStateException
+        try {
+            it.getKey();
+            fail();
+        } catch (IllegalStateException ex) {}
+        
+        // getValue() should throw an IllegalStateException
+        try {
+            it.getValue();
+            fail();
+        } catch (IllegalStateException ex) {}
+        
+        if (supportsSetValue() == false) {
+            // setValue() should throw an UnsupportedOperationException/IllegalStateException
+            try {
+                it.setValue(addSetValues()[0]);
+                fail();
+            } catch (UnsupportedOperationException ex) {
+            } catch (IllegalStateException ex) {}
+        } else {
+            // setValue() should throw an IllegalStateException
+            try {
+                it.setValue(addSetValues()[0]);
+                fail();
+            } catch (IllegalStateException ex) {}
+        }
+    }
+
+    //-----------------------------------------------------------------------
+    /**
+     * Test that the full list iterator contract is correct.
+     */
+    public void testFullMapIterator() {
+        if (supportsFullIterator() == false) {
+            return;
+        }
+
+        MapIterator it = makeFullMapIterator();
+        Map map = getMap();
+        assertEquals(true, it.hasNext());
+        
+        assertEquals(true, it.hasNext());
+        Set set = new HashSet();
+        while (it.hasNext()) {
+            // getKey
+            Object key = it.next();
+            assertSame("it.next() should equals getKey()", key, it.getKey());
+            assertTrue("Key must be in map",  map.containsKey(key));
+            assertTrue("Key must be unique", set.add(key));
+            
+            // getValue
+            Object value = it.getValue();
+            if (isGetStructuralModify() == false) {
+                assertSame("Value must be mapped to key", map.get(key), value);
+            }
+            assertTrue("Value must be in map",  map.containsValue(value));
+
+            verify();
+        }
+    }
+    
+    //-----------------------------------------------------------------------
+    public void testMapIteratorSet() {
+        if (supportsFullIterator() == false) {
+            return;
+        }
+
+        Object newValue = addSetValues()[0];
+        Object newValue2 = (addSetValues().length == 1 ? addSetValues()[0] : addSetValues()[1]);
+        MapIterator it = makeFullMapIterator();
+        Map map = getMap();
+        Map confirmed = getConfirmedMap();
+        assertEquals(true, it.hasNext());
+        Object key = it.next();
+        Object value = it.getValue();
+        
+        if (supportsSetValue() == false) {
+            try {
+                it.setValue(newValue);
+                fail();
+            } catch (UnsupportedOperationException ex) {}
+            return;
+        }
+        Object old = it.setValue(newValue);
+        confirmed.put(key, newValue);
+        assertSame("Key must not change after setValue", key, it.getKey());
+        assertSame("Value must be changed after setValue", newValue, it.getValue());
+        assertSame("setValue must return old value", value, old);
+        assertEquals("Map must contain key", true, map.containsKey(key));
+        // test against confirmed, as map may contain value twice
+        assertEquals("Map must not contain old value", 
+            confirmed.containsValue(old), map.containsValue(old));
+        assertEquals("Map must contain new value", true, map.containsValue(newValue));
+        verify();
+        
+        it.setValue(newValue);  // same value - should be OK
+        confirmed.put(key, newValue);
+        assertSame("Key must not change after setValue", key, it.getKey());
+        assertSame("Value must be changed after setValue", newValue, it.getValue());
+        verify();
+        
+        it.setValue(newValue2);  // new value
+        confirmed.put(key, newValue2);
+        assertSame("Key must not change after setValue", key, it.getKey());
+        assertSame("Value must be changed after setValue", newValue2, it.getValue());
+        verify();
+    }
+
+    //-----------------------------------------------------------------------
+    public void testRemove() { // override
+        MapIterator it = makeFullMapIterator();
+        Map map = getMap();
+        Map confirmed = getConfirmedMap();
+        assertEquals(true, it.hasNext());
+        Object key = it.next();
+        
+        if (supportsRemove() == false) {
+            try {
+                it.remove();
+                fail();
+            } catch (UnsupportedOperationException ex) {
+            }
+            return;
+        }
+        
+        it.remove();
+        confirmed.remove(key);
+        assertEquals(false, map.containsKey(key));
+        verify();
+        
+        try {
+            it.remove();  // second remove fails
+        } catch (IllegalStateException ex) {
+        }
+        verify();
+    }
+
+    //-----------------------------------------------------------------------
+    public void testMapIteratorSetRemoveSet() {
+        if (supportsSetValue() == false || supportsRemove() == false) {
+            return;
+        }
+        Object newValue = addSetValues()[0];
+        MapIterator it = makeFullMapIterator();
+        Map map = getMap();
+        Map confirmed = getConfirmedMap();
+        
+        assertEquals(true, it.hasNext());
+        Object key = it.next();
+        
+        it.setValue(newValue);
+        it.remove();
+        confirmed.remove(key);
+        verify();
+        
+        try {
+            it.setValue(newValue);
+            fail();
+        } catch (IllegalStateException ex) {}
+        verify();
+    }
+
+    //-----------------------------------------------------------------------
+    public void testMapIteratorRemoveGetKey() {
+        if (supportsRemove() == false) {
+            return;
+        }
+        MapIterator it = makeFullMapIterator();
+        Map map = getMap();
+        Map confirmed = getConfirmedMap();
+        
+        assertEquals(true, it.hasNext());
+        Object key = it.next();
+        
+        it.remove();
+        confirmed.remove(key);
+        verify();
+        
+        try {
+            it.getKey();
+            fail();
+        } catch (IllegalStateException ex) {}
+        verify();
+    }
+
+    //-----------------------------------------------------------------------
+    public void testMapIteratorRemoveGetValue() {
+        if (supportsRemove() == false) {
+            return;
+        }
+        MapIterator it = makeFullMapIterator();
+        Map map = getMap();
+        Map confirmed = getConfirmedMap();
+        
+        assertEquals(true, it.hasNext());
+        Object key = it.next();
+        
+        it.remove();
+        confirmed.remove(key);
+        verify();
+        
+        try {
+            it.getValue();
+            fail();
+        } catch (IllegalStateException ex) {}
+        verify();
+    }
+
+}
diff --git a/dev/core/test/org/apache/commons/collections/map/AbstractTestIterableMap.java b/dev/core/test/org/apache/commons/collections/map/AbstractTestIterableMap.java
index bd57fcc..46b0436 100644
--- a/dev/core/test/org/apache/commons/collections/map/AbstractTestIterableMap.java
+++ b/dev/core/test/org/apache/commons/collections/map/AbstractTestIterableMap.java
@@ -1,168 +1,168 @@
-/*

- *  Licensed to the Apache Software Foundation (ASF) under one or more

- *  contributor license agreements.  See the NOTICE file distributed with

- *  this work for additional information regarding copyright ownership.

- *  The ASF licenses this file to You 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 org.apache.commons.collections.map;

-

-import java.util.ConcurrentModificationException;

-import java.util.Iterator;

-import java.util.Map;

-

-import org.apache.commons.collections.IterableMap;

-import org.apache.commons.collections.BulkTest;

-import org.apache.commons.collections.MapIterator;

-import org.apache.commons.collections.iterators.AbstractTestMapIterator;

-

-/**

- * Abstract test class for {@link IterableMap} methods and contracts.

- *

- * @version $Revision: 646780 $ $Date: 2008-04-10 13:48:07 +0100 (Thu, 10 Apr 2008) $

- * 

- * @author Stephen Colebourne

- */

-public abstract class AbstractTestIterableMap extends AbstractTestMap {

-

-    /**

-     * JUnit constructor.

-     * 

-     * @param testName  the test name

-     */

-    public AbstractTestIterableMap(String testName) {

-        super(testName);

-    }

-    

-    //-----------------------------------------------------------------------

-    public void testFailFastEntrySet() {

-        if (isRemoveSupported() == false) return;

-        resetFull();

-        Iterator it = map.entrySet().iterator();

-        Map.Entry val = (Map.Entry) it.next();

-        map.remove(val.getKey());

-        try {

-            it.next();

-            fail();

-        } catch (ConcurrentModificationException ex) {}

-        

-        resetFull();

-        it = map.entrySet().iterator();

-        it.next();

-        map.clear();

-        try {

-            it.next();

-            fail();

-        } catch (ConcurrentModificationException ex) {}

-    }

-    

-    public void testFailFastKeySet() {

-        if (isRemoveSupported() == false) return;

-        resetFull();

-        Iterator it = map.keySet().iterator();

-        Object val = it.next();

-        map.remove(val);

-        try {

-            it.next();

-            fail();

-        } catch (ConcurrentModificationException ex) {}

-        

-        resetFull();

-        it = map.keySet().iterator();

-        it.next();

-        map.clear();

-        try {

-            it.next();

-            fail();

-        } catch (ConcurrentModificationException ex) {}

-    }

-    

-    public void testFailFastValues() {

-        if (isRemoveSupported() == false) return;

-        resetFull();

-        Iterator it = map.values().iterator();

-        it.next();

-        map.remove(map.keySet().iterator().next());

-        try {

-            it.next();

-            fail();

-        } catch (ConcurrentModificationException ex) {}

-        

-        resetFull();

-        it = map.values().iterator();

-        it.next();

-        map.clear();

-        try {

-            it.next();

-            fail();

-        } catch (ConcurrentModificationException ex) {}

-    }

-    

-    //-----------------------------------------------------------------------

-    public BulkTest bulkTestMapIterator() {

-        return new InnerTestMapIterator();

-    }

-    

-    public class InnerTestMapIterator extends AbstractTestMapIterator {

-        public InnerTestMapIterator() {

-            super("InnerTestMapIterator");

-        }

-        

-        public Object[] addSetValues() {

-            return AbstractTestIterableMap.this.getNewSampleValues();

-        }

-        

-        public boolean supportsRemove() {

-            return AbstractTestIterableMap.this.isRemoveSupported();

-        }

-        

-        public boolean isGetStructuralModify() {

-            return AbstractTestIterableMap.this.isGetStructuralModify();

-        }

-

-        public boolean supportsSetValue() {

-            return AbstractTestIterableMap.this.isSetValueSupported();

-        }

-

-        public MapIterator makeEmptyMapIterator() {

-            resetEmpty();

-            return ((IterableMap) AbstractTestIterableMap.this.map).mapIterator();

-        }

-

-        public MapIterator makeFullMapIterator() {

-            resetFull();

-            return ((IterableMap) AbstractTestIterableMap.this.map).mapIterator();

-        }

-        

-        public Map getMap() {

-            // assumes makeFullMapIterator() called first

-            return AbstractTestIterableMap.this.map;

-        }

-        

-        public Map getConfirmedMap() {

-            // assumes makeFullMapIterator() called first

-            return AbstractTestIterableMap.this.confirmed;

-        }

-        

-        public void verify() {

-            super.verify();

-            AbstractTestIterableMap.this.verify();

-        }

-    }

-    

-//  public void testCreate() throws Exception {

-//      resetEmpty();

-//      writeExternalFormToDisk((Serializable) map, "D:/dev/collections/data/test/HashedMap.emptyCollection.version3.obj");

-//      resetFull();

-//      writeExternalFormToDisk((Serializable) map, "D:/dev/collections/data/test/HashedMap.fullCollection.version3.obj");

-//  }

-}

+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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 org.apache.commons.collections.map;
+
+import java.util.ConcurrentModificationException;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.apache.commons.collections.IterableMap;
+import org.apache.commons.collections.BulkTest;
+import org.apache.commons.collections.MapIterator;
+import org.apache.commons.collections.iterators.AbstractTestMapIterator;
+
+/**
+ * Abstract test class for {@link IterableMap} methods and contracts.
+ *
+ * @version $Revision: 646780 $ $Date: 2008-04-10 13:48:07 +0100 (Thu, 10 Apr 2008) $
+ * 
+ * @author Stephen Colebourne
+ */
+public abstract class AbstractTestIterableMap extends AbstractTestMap {
+
+    /**
+     * JUnit constructor.
+     * 
+     * @param testName  the test name
+     */
+    public AbstractTestIterableMap(String testName) {
+        super(testName);
+    }
+    
+    //-----------------------------------------------------------------------
+    public void testFailFastEntrySet() {
+        if (isRemoveSupported() == false) return;
+        resetFull();
+        Iterator it = map.entrySet().iterator();
+        Map.Entry val = (Map.Entry) it.next();
+        map.remove(val.getKey());
+        try {
+            it.next();
+            fail();
+        } catch (ConcurrentModificationException ex) {}
+        
+        resetFull();
+        it = map.entrySet().iterator();
+        it.next();
+        map.clear();
+        try {
+            it.next();
+            fail();
+        } catch (ConcurrentModificationException ex) {}
+    }
+    
+    public void testFailFastKeySet() {
+        if (isRemoveSupported() == false) return;
+        resetFull();
+        Iterator it = map.keySet().iterator();
+        Object val = it.next();
+        map.remove(val);
+        try {
+            it.next();
+            fail();
+        } catch (ConcurrentModificationException ex) {}
+        
+        resetFull();
+        it = map.keySet().iterator();
+        it.next();
+        map.clear();
+        try {
+            it.next();
+            fail();
+        } catch (ConcurrentModificationException ex) {}
+    }
+    
+    public void testFailFastValues() {
+        if (isRemoveSupported() == false) return;
+        resetFull();
+        Iterator it = map.values().iterator();
+        it.next();
+        map.remove(map.keySet().iterator().next());
+        try {
+            it.next();
+            fail();
+        } catch (ConcurrentModificationException ex) {}
+        
+        resetFull();
+        it = map.values().iterator();
+        it.next();
+        map.clear();
+        try {
+            it.next();
+            fail();
+        } catch (ConcurrentModificationException ex) {}
+    }
+    
+    //-----------------------------------------------------------------------
+    public BulkTest bulkTestMapIterator() {
+        return new InnerTestMapIterator();
+    }
+    
+    public class InnerTestMapIterator extends AbstractTestMapIterator {
+        public InnerTestMapIterator() {
+            super("InnerTestMapIterator");
+        }
+        
+        public Object[] addSetValues() {
+            return AbstractTestIterableMap.this.getNewSampleValues();
+        }
+        
+        public boolean supportsRemove() {
+            return AbstractTestIterableMap.this.isRemoveSupported();
+        }
+        
+        public boolean isGetStructuralModify() {
+            return AbstractTestIterableMap.this.isGetStructuralModify();
+        }
+
+        public boolean supportsSetValue() {
+            return AbstractTestIterableMap.this.isSetValueSupported();
+        }
+
+        public MapIterator makeEmptyMapIterator() {
+            resetEmpty();
+            return ((IterableMap) AbstractTestIterableMap.this.map).mapIterator();
+        }
+
+        public MapIterator makeFullMapIterator() {
+            resetFull();
+            return ((IterableMap) AbstractTestIterableMap.this.map).mapIterator();
+        }
+        
+        public Map getMap() {
+            // assumes makeFullMapIterator() called first
+            return AbstractTestIterableMap.this.map;
+        }
+        
+        public Map getConfirmedMap() {
+            // assumes makeFullMapIterator() called first
+            return AbstractTestIterableMap.this.confirmed;
+        }
+        
+        public void verify() {
+            super.verify();
+            AbstractTestIterableMap.this.verify();
+        }
+    }
+    
+//  public void testCreate() throws Exception {
+//      resetEmpty();
+//      writeExternalFormToDisk((Serializable) map, "D:/dev/collections/data/test/HashedMap.emptyCollection.version3.obj");
+//      resetFull();
+//      writeExternalFormToDisk((Serializable) map, "D:/dev/collections/data/test/HashedMap.fullCollection.version3.obj");
+//  }
+}
diff --git a/dev/core/test/org/apache/commons/collections/map/AbstractTestMap.java b/dev/core/test/org/apache/commons/collections/map/AbstractTestMap.java
index 8176900..433a665 100644
--- a/dev/core/test/org/apache/commons/collections/map/AbstractTestMap.java
+++ b/dev/core/test/org/apache/commons/collections/map/AbstractTestMap.java
@@ -1,1700 +1,1700 @@
-/*

- *  Licensed to the Apache Software Foundation (ASF) under one or more

- *  contributor license agreements.  See the NOTICE file distributed with

- *  this work for additional information regarding copyright ownership.

- *  The ASF licenses this file to You 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 org.apache.commons.collections.map;

-

-import java.io.Serializable;

-import java.util.ArrayList;

-import java.util.Collection;

-import java.util.HashMap;

-import java.util.Iterator;

-import java.util.List;

-import java.util.Map;

-import java.util.Set;

-

-import org.apache.commons.collections.AbstractTestObject;

-import org.apache.commons.collections.BulkTest;

-import org.apache.commons.collections.collection.AbstractTestCollection;

-import org.apache.commons.collections.set.AbstractTestSet;

-

-/**

- * Abstract test class for {@link java.util.Map} methods and contracts.

- * <p>

- * The forces at work here are similar to those in {@link AbstractTestCollection}.

- * If your class implements the full Map interface, including optional

- * operations, simply extend this class, and implement the

- * {@link #makeEmptyMap()} method.

- * <p>

- * On the other hand, if your map implementation is weird, you may have to

- * override one or more of the other protected methods.  They're described

- * below.

- * <p>

- * <b>Entry Population Methods</b>

- * <p>

- * Override these methods if your map requires special entries:

- * 

- * <ul>

- * <li>{@link #getSampleKeys()}

- * <li>{@link #getSampleValues()}

- * <li>{@link #getNewSampleValues()}

- * <li>{@link #getOtherKeys()}

- * <li>{@link #getOtherValues()}

- * </ul>

- *

- * <b>Supported Operation Methods</b>

- * <p>

- * Override these methods if your map doesn't support certain operations:

- *

- * <ul>

- * <li> {@link #isPutAddSupported()}

- * <li> {@link #isPutChangeSupported()}

- * <li> {@link #isSetValueSupported()}

- * <li> {@link #isRemoveSupported()}

- * <li> {@link #isGetStructuralModify()}

- * <li> {@link #isAllowDuplicateValues()}

- * <li> {@link #isAllowNullKey()}

- * <li> {@link #isAllowNullValue()}

- * </ul>

- *

- * <b>Fixture Methods</b>

- * <p>

- * For tests on modification operations (puts and removes), fixtures are used

- * to verify that that operation results in correct state for the map and its

- * collection views.  Basically, the modification is performed against your

- * map implementation, and an identical modification is performed against

- * a <I>confirmed</I> map implementation.  A confirmed map implementation is

- * something like <Code>java.util.HashMap</Code>, which is known to conform

- * exactly to the {@link Map} contract.  After the modification takes place

- * on both your map implementation and the confirmed map implementation, the

- * two maps are compared to see if their state is identical.  The comparison

- * also compares the collection views to make sure they're still the same.<P>

- *

- * The upshot of all that is that <I>any</I> test that modifies the map in

- * <I>any</I> way will verify that <I>all</I> of the map's state is still

- * correct, including the state of its collection views.  So for instance

- * if a key is removed by the map's key set's iterator, then the entry set 

- * is checked to make sure the key/value pair no longer appears.<P>

- *

- * The {@link #map} field holds an instance of your collection implementation.

- * The {@link #entrySet}, {@link #keySet} and {@link #values} fields hold

- * that map's collection views.  And the {@link #confirmed} field holds

- * an instance of the confirmed collection implementation.  The 

- * {@link #resetEmpty()} and {@link #resetFull()} methods set these fields to 

- * empty or full maps, so that tests can proceed from a known state.<P>

- *

- * After a modification operation to both {@link #map} and {@link #confirmed},

- * the {@link #verify()} method is invoked to compare the results.  The

- * {@link #verify} method calls separate methods to verify the map and its three

- * collection views ({@link #verifyMap}, {@link #verifyEntrySet},

- * {@link #verifyKeySet}, and {@link #verifyValues}).  You may want to override

- * one of the verification methodsto perform additional verifications.  For

- * instance, TestDoubleOrderedMap would want override its

- * {@link #verifyValues()} method to verify that the values are unique and in

- * ascending order.<P>

- *  

- * <b>Other Notes</b>

- * <p>

- * If your {@link Map} fails one of these tests by design, you may still use

- * this base set of cases.  Simply override the test case (method) your map

- * fails and/or the methods that define the assumptions used by the test

- * cases.  For example, if your map does not allow duplicate values, override

- * {@link #isAllowDuplicateValues()} and have it return <code>false</code>

- *

- * @author Michael Smith

- * @author Rodney Waldhoff

- * @author Paul Jack

- * @author Stephen Colebourne

- * @version $Revision: 646780 $ $Date: 2008-04-10 13:48:07 +0100 (Thu, 10 Apr 2008) $

- */

-public abstract class AbstractTestMap extends AbstractTestObject {

-

-    /**

-     * JDK1.2 has bugs in null handling of Maps, especially HashMap.Entry.toString

-     * This avoids nulls for JDK1.2

-     */

-    private static final boolean JDK12;

-    static {

-        String str = System.getProperty("java.version");

-        JDK12 = str.startsWith("1.2");

-    }

-

-    // These instance variables are initialized with the reset method.

-    // Tests for map methods that alter the map (put, putAll, remove) 

-    // first call reset() to create the map and its views; then perform

-    // the modification on the map; perform the same modification on the

-    // confirmed; and then call verify() to ensure that the map is equal

-    // to the confirmed, that the already-constructed collection views

-    // are still equal to the confirmed's collection views.

-

-

-    /** Map created by reset(). */

-    protected Map map;

-

-    /** Entry set of map created by reset(). */

-    protected Set entrySet;

-

-    /** Key set of map created by reset(). */

-    protected Set keySet;

-

-    /** Values collection of map created by reset(). */

-    protected Collection values;

-

-    /** HashMap created by reset(). */

-    protected Map confirmed;

-

-    /**

-     * JUnit constructor.

-     * 

-     * @param testName  the test name

-     */

-    public AbstractTestMap(String testName) {

-        super(testName);

-    }

-

-    /**

-     * Returns true if the maps produced by 

-     * {@link #makeEmptyMap()} and {@link #makeFullMap()}

-     * support the <code>put</code> and <code>putAll</code> operations

-     * adding new mappings.

-     * <p>

-     * Default implementation returns true.

-     * Override if your collection class does not support put adding.

-     */

-    public boolean isPutAddSupported() {

-        return true;

-    }

-

-    /**

-     * Returns true if the maps produced by 

-     * {@link #makeEmptyMap()} and {@link #makeFullMap()}

-     * support the <code>put</code> and <code>putAll</code> operations

-     * changing existing mappings.

-     * <p>

-     * Default implementation returns true.

-     * Override if your collection class does not support put changing.

-     */

-    public boolean isPutChangeSupported() {

-        return true;

-    }

-

-    /**

-     * Returns true if the maps produced by 

-     * {@link #makeEmptyMap()} and {@link #makeFullMap()}

-     * support the <code>setValue</code> operation on entrySet entries.

-     * <p>

-     * Default implementation returns isPutChangeSupported().

-     * Override if your collection class does not support setValue but does

-     * support put changing.

-     */

-    public boolean isSetValueSupported() {

-        return isPutChangeSupported();

-    }

-

-    /**

-     * Returns true if the maps produced by 

-     * {@link #makeEmptyMap()} and {@link #makeFullMap()}

-     * support the <code>remove</code> and <code>clear</code> operations.

-     * <p>

-     * Default implementation returns true.

-     * Override if your collection class does not support removal operations.

-     */

-    public boolean isRemoveSupported() {

-        return true;

-    }

-

-    /**

-     * Returns true if the maps produced by 

-     * {@link #makeEmptyMap()} and {@link #makeFullMap()}

-     * can cause structural modification on a get(). The example is LRUMap.

-     * <p>

-     * Default implementation returns false.

-     * Override if your map class structurally modifies on get.

-     */

-    public boolean isGetStructuralModify() {

-        return false;

-    }

-

-    /**

-     * Returns whether the sub map views of SortedMap are serializable.

-     * If the class being tested is based around a TreeMap then you should

-     * override and return false as TreeMap has a bug in deserialization.

-     * 

-     * @return false

-     */

-    public boolean isSubMapViewsSerializable() {

-        return true;

-    }

-

-    /**

-     * Returns true if the maps produced by 

-     * {@link #makeEmptyMap()} and {@link #makeFullMap()}

-     * supports null keys.

-     * <p>

-     * Default implementation returns true.

-     * Override if your collection class does not support null keys.

-     */

-    public boolean isAllowNullKey() {

-        return true;

-    }

-

-    /**

-     * Returns true if the maps produced by 

-     * {@link #makeEmptyMap()} and {@link #makeFullMap()}

-     * supports null values.

-     * <p>

-     * Default implementation returns true.

-     * Override if your collection class does not support null values.

-     */

-    public boolean isAllowNullValue() {

-        return true;

-    }

-

-    /**

-     * Returns true if the maps produced by 

-     * {@link #makeEmptyMap()} and {@link #makeFullMap()}

-     * supports duplicate values.

-     * <p>

-     * Default implementation returns true.

-     * Override if your collection class does not support duplicate values.

-     */

-    public boolean isAllowDuplicateValues() {

-        return true;

-    }

-

-    /**

-     *  Returns the set of keys in the mappings used to test the map.  This

-     *  method must return an array with the same length as {@link

-     *  #getSampleValues()} and all array elements must be different. The

-     *  default implementation constructs a set of String keys, and includes a

-     *  single null key if {@link #isAllowNullKey()} returns <code>true</code>.

-     */

-    public Object[] getSampleKeys() {

-        Object[] result = new Object[] {

-            "blah", "foo", "bar", "baz", "tmp", "gosh", "golly", "gee", 

-            "hello", "goodbye", "we'll", "see", "you", "all", "again",

-            "key",

-            "key2",

-            (isAllowNullKey() && !JDK12) ? null : "nonnullkey"

-        };

-        return result;

-    }

-

-

-    public Object[] getOtherKeys() {

-        return getOtherNonNullStringElements();

-    }

-

-    public Object[] getOtherValues() {

-        return getOtherNonNullStringElements();

-    }

-

-    /**

-     * Returns a list of string elements suitable for return by

-     * {@link #getOtherKeys()} or {@link #getOtherValues}.

-     *

-     * <p>Override getOtherElements to returnthe results of this method if your

-     * collection does not support heterogenous elements or the null element.

-     * </p>

-     */

-    public Object[] getOtherNonNullStringElements() {

-        return new Object[] {

-            "For","then","despite",/* of */"space","I","would","be","brought",

-            "From","limits","far","remote","where","thou","dost","stay"

-        };

-    }

-

-    /**

-     * Returns the set of values in the mappings used to test the map.  This

-     * method must return an array with the same length as

-     * {@link #getSampleKeys()}.  The default implementation constructs a set of

-     * String values and includes a single null value if 

-     * {@link #isAllowNullValue()} returns <code>true</code>, and includes

-     * two values that are the same if {@link #isAllowDuplicateValues()} returns

-     * <code>true</code>.

-     */

-    public Object[] getSampleValues() {

-        Object[] result = new Object[] {

-            "blahv", "foov", "barv", "bazv", "tmpv", "goshv", "gollyv", "geev",

-            "hellov", "goodbyev", "we'llv", "seev", "youv", "allv", "againv",

-            (isAllowNullValue() && !JDK12) ? null : "nonnullvalue",

-            "value",

-            (isAllowDuplicateValues()) ? "value" : "value2",

-        };

-        return result;

-    }

-

-    /**

-     * Returns a the set of values that can be used to replace the values

-     * returned from {@link #getSampleValues()}.  This method must return an

-     * array with the same length as {@link #getSampleValues()}.  The values

-     * returned from this method should not be the same as those returned from

-     * {@link #getSampleValues()}.  The default implementation constructs a

-     * set of String values and includes a single null value if

-     * {@link #isAllowNullValue()} returns <code>true</code>, and includes two values

-     * that are the same if {@link #isAllowDuplicateValues()} returns

-     * <code>true</code>.  

-     */

-    public Object[] getNewSampleValues() {

-        Object[] result = new Object[] {

-            (isAllowNullValue() && !JDK12 && isAllowDuplicateValues()) ? null : "newnonnullvalue",

-            "newvalue",

-            (isAllowDuplicateValues()) ? "newvalue" : "newvalue2",

-            "newblahv", "newfoov", "newbarv", "newbazv", "newtmpv", "newgoshv", 

-            "newgollyv", "newgeev", "newhellov", "newgoodbyev", "newwe'llv", 

-            "newseev", "newyouv", "newallv", "newagainv",

-        };

-        return result;

-    }

-

-    /**

-     *  Helper method to add all the mappings described by

-     * {@link #getSampleKeys()} and {@link #getSampleValues()}.

-     */

-    public void addSampleMappings(Map m) {

-

-        Object[] keys = getSampleKeys();

-        Object[] values = getSampleValues();

-        

-        for(int i = 0; i < keys.length; i++) {

-            try {

-                m.put(keys[i], values[i]);

-            } catch (NullPointerException exception) {

-                assertTrue("NullPointerException only allowed to be thrown " +

-                           "if either the key or value is null.", 

-                           keys[i] == null || values[i] == null);

-                

-                assertTrue("NullPointerException on null key, but " +

-                           "isAllowNullKey is not overridden to return false.", 

-                           keys[i] == null || !isAllowNullKey());

-                

-                assertTrue("NullPointerException on null value, but " +

-                           "isAllowNullValue is not overridden to return false.",

-                           values[i] == null || !isAllowNullValue());

-                

-                assertTrue("Unknown reason for NullPointer.", false);

-            }

-        }

-        assertEquals("size must reflect number of mappings added.",

-                     keys.length, m.size());

-    }

-

-    //-----------------------------------------------------------------------

-    /**

-     * Return a new, empty {@link Map} to be used for testing. 

-     * 

-     * @return the map to be tested

-     */

-    public abstract Map makeEmptyMap();

-

-    /**

-     * Return a new, populated map.  The mappings in the map should match the

-     * keys and values returned from {@link #getSampleKeys()} and

-     * {@link #getSampleValues()}.  The default implementation uses makeEmptyMap()

-     * and calls {@link #addSampleMappings} to add all the mappings to the

-     * map.

-     * 

-     * @return the map to be tested

-     */

-    public Map makeFullMap() {

-        Map m = makeEmptyMap();

-        addSampleMappings(m);

-        return m;

-    }

-

-    /**

-     * Implements the superclass method to return the map to be tested.

-     * 

-     * @return the map to be tested

-     */

-    public Object makeObject() {

-        return makeEmptyMap();

-    }

-

-    /**

-     * Override to return a map other than HashMap as the confirmed map.

-     * 

-     * @return a map that is known to be valid

-     */

-    public Map makeConfirmedMap() {

-        return new HashMap();

-    }

-

-    /**

-     * Creates a new Map Entry that is independent of the first and the map.

-     */

-    public Map.Entry cloneMapEntry(Map.Entry entry) {

-        HashMap map = new HashMap();

-        map.put(entry.getKey(), entry.getValue());

-        return (Map.Entry) map.entrySet().iterator().next();

-    }

-

-    /**

-     * Gets the compatability version, needed for package access.

-     */

-    public String getCompatibilityVersion() {

-        return super.getCompatibilityVersion();

-    }

-    //-----------------------------------------------------------------------

-    /**

-     * Test to ensure the test setup is working properly.  This method checks

-     * to ensure that the getSampleKeys and getSampleValues methods are

-     * returning results that look appropriate.  That is, they both return a

-     * non-null array of equal length.  The keys array must not have any

-     * duplicate values, and may only contain a (single) null key if

-     * isNullKeySupported() returns true.  The values array must only have a null

-     * value if useNullValue() is true and may only have duplicate values if

-     * isAllowDuplicateValues() returns true.  

-     */

-    public void testSampleMappings() {

-      Object[] keys = getSampleKeys();

-      Object[] values = getSampleValues();

-      Object[] newValues = getNewSampleValues();

-

-      assertTrue("failure in test: Must have keys returned from " +

-                 "getSampleKeys.", keys != null);

-

-      assertTrue("failure in test: Must have values returned from " +

-                 "getSampleValues.", values != null);

-

-      // verify keys and values have equivalent lengths (in case getSampleX are

-      // overridden)

-      assertEquals("failure in test: not the same number of sample " +

-                   "keys and values.",  keys.length, values.length);

-      

-      assertEquals("failure in test: not the same number of values and new values.",

-                   values.length, newValues.length);

-

-      // verify there aren't duplicate keys, and check values

-      for(int i = 0; i < keys.length - 1; i++) {

-          for(int j = i + 1; j < keys.length; j++) {

-              assertTrue("failure in test: duplicate null keys.",

-                         (keys[i] != null || keys[j] != null));

-              assertTrue("failure in test: duplicate non-null key.",

-                         (keys[i] == null || keys[j] == null || 

-                          (!keys[i].equals(keys[j]) && 

-                           !keys[j].equals(keys[i]))));

-          }

-          assertTrue("failure in test: found null key, but isNullKeySupported " +

-                     "is false.", keys[i] != null || isAllowNullKey());

-          assertTrue("failure in test: found null value, but isNullValueSupported " +

-                     "is false.", values[i] != null || isAllowNullValue());

-          assertTrue("failure in test: found null new value, but isNullValueSupported " +

-                     "is false.", newValues[i] != null || isAllowNullValue());

-          assertTrue("failure in test: values should not be the same as new value",

-                     values[i] != newValues[i] && 

-                     (values[i] == null || !values[i].equals(newValues[i])));

-      }

-    }

-    

-    // tests begin here.  Each test adds a little bit of tested functionality.

-    // Many methods assume previous methods passed.  That is, they do not

-    // exhaustively recheck things that have already been checked in a previous

-    // test methods.  

-

-    /**

-     * Test to ensure that makeEmptyMap and makeFull returns a new non-null

-     * map with each invocation.  

-     */

-    public void testMakeMap() {

-        Map em = makeEmptyMap();

-        assertTrue("failure in test: makeEmptyMap must return a non-null map.",

-                   em != null);

-        

-        Map em2 = makeEmptyMap();

-        assertTrue("failure in test: makeEmptyMap must return a non-null map.",

-                   em != null);

-

-        assertTrue("failure in test: makeEmptyMap must return a new map " +

-                   "with each invocation.", em != em2);

-

-        Map fm = makeFullMap();

-        assertTrue("failure in test: makeFullMap must return a non-null map.",

-                   fm != null);

-        

-        Map fm2 = makeFullMap();

-        assertTrue("failure in test: makeFullMap must return a non-null map.",

-                   fm != null);

-

-        assertTrue("failure in test: makeFullMap must return a new map " +

-                   "with each invocation.", fm != fm2);

-    }

-

-    /**

-     * Tests Map.isEmpty()

-     */

-    public void testMapIsEmpty() {

-        resetEmpty();

-        assertEquals("Map.isEmpty() should return true with an empty map", 

-                     true, map.isEmpty());

-        verify();

-

-        resetFull();

-        assertEquals("Map.isEmpty() should return false with a non-empty map",

-                     false, map.isEmpty());

-        verify();

-    }

-

-    /**

-     * Tests Map.size()

-     */

-    public void testMapSize() {

-        resetEmpty();

-        assertEquals("Map.size() should be 0 with an empty map",

-                     0, map.size());

-        verify();

-

-        resetFull();

-        assertEquals("Map.size() should equal the number of entries " +

-                     "in the map", getSampleKeys().length, map.size());

-        verify();

-    }

-

-    /**

-     * Tests {@link Map#clear()}.  If the map {@link #isRemoveSupported()}

-     * can add and remove elements}, then {@link Map#size()} and

-     * {@link Map#isEmpty()} are used to ensure that map has no elements after

-     * a call to clear.  If the map does not support adding and removing

-     * elements, this method checks to ensure clear throws an

-     * UnsupportedOperationException.

-     */

-    public void testMapClear() {

-        if (!isRemoveSupported()) {

-            try {

-                resetFull();

-                map.clear();

-                fail("Expected UnsupportedOperationException on clear");

-            } catch (UnsupportedOperationException ex) {}

-            return;

-        }

-

-        resetEmpty();

-        map.clear();

-        confirmed.clear();

-        verify();

-        

-        resetFull();

-        map.clear();

-        confirmed.clear();

-        verify();

-    }

-

-

-    /**

-     * Tests Map.containsKey(Object) by verifying it returns false for all

-     * sample keys on a map created using an empty map and returns true for

-     * all sample keys returned on a full map. 

-     */

-    public void testMapContainsKey() {

-        Object[] keys = getSampleKeys();

-

-        resetEmpty();

-        for(int i = 0; i < keys.length; i++) {

-            assertTrue("Map must not contain key when map is empty", 

-                       !map.containsKey(keys[i]));

-        }

-        verify();

-

-        resetFull();

-        for(int i = 0; i < keys.length; i++) {

-            assertTrue("Map must contain key for a mapping in the map. " +

-                       "Missing: " + keys[i], map.containsKey(keys[i]));

-        }

-        verify();

-    }

-

-    /**

-     * Tests Map.containsValue(Object) by verifying it returns false for all

-     * sample values on an empty map and returns true for all sample values on

-     * a full map.

-     */

-    public void testMapContainsValue() {

-        Object[] values = getSampleValues();

-

-        resetEmpty();

-        for(int i = 0; i < values.length; i++) {

-            assertTrue("Empty map must not contain value", 

-                       !map.containsValue(values[i]));

-        }

-        verify();

-        

-        resetFull();

-        for(int i = 0; i < values.length; i++) {

-            assertTrue("Map must contain value for a mapping in the map.", 

-                       map.containsValue(values[i]));

-        }

-        verify();

-    }

-

-

-    /**

-     * Tests Map.equals(Object)

-     */

-    public void testMapEquals() {

-        resetEmpty();

-        assertTrue("Empty maps unequal.", map.equals(confirmed));

-        verify();

-

-        resetFull();

-        assertTrue("Full maps unequal.", map.equals(confirmed));

-        verify();

-

-        resetFull();

-        // modify the HashMap created from the full map and make sure this

-        // change results in map.equals() to return false.

-        Iterator iter = confirmed.keySet().iterator();

-        iter.next();

-        iter.remove();

-        assertTrue("Different maps equal.", !map.equals(confirmed));

-        

-        resetFull();

-        assertTrue("equals(null) returned true.", !map.equals(null));

-        assertTrue("equals(new Object()) returned true.", 

-                   !map.equals(new Object()));

-        verify();

-    }

-

-

-    /**

-     * Tests Map.get(Object)

-     */

-    public void testMapGet() {

-        resetEmpty();

-

-        Object[] keys = getSampleKeys();

-        Object[] values = getSampleValues();

-

-        for (int i = 0; i < keys.length; i++) {

-            assertTrue("Empty map.get() should return null.", 

-                       map.get(keys[i]) == null);

-        }

-        verify();

-

-        resetFull();

-        for (int i = 0; i < keys.length; i++) {

-            assertEquals("Full map.get() should return value from mapping.", 

-                         values[i], map.get(keys[i]));

-        }

-    }

-

-    /**

-     * Tests Map.hashCode()

-     */

-    public void testMapHashCode() {

-        resetEmpty();

-        assertTrue("Empty maps have different hashCodes.", 

-                   map.hashCode() == confirmed.hashCode());

-

-        resetFull();

-        assertTrue("Equal maps have different hashCodes.", 

-                   map.hashCode() == confirmed.hashCode());

-    }

-

-    /**

-     * Tests Map.toString().  Since the format of the string returned by the

-     * toString() method is not defined in the Map interface, there is no

-     * common way to test the results of the toString() method.  Thereforce,

-     * it is encouraged that Map implementations override this test with one

-     * that checks the format matches any format defined in its API.  This

-     * default implementation just verifies that the toString() method does

-     * not return null.

-     */

-    public void testMapToString() {

-        resetEmpty();

-        assertTrue("Empty map toString() should not return null", 

-                   map.toString() != null);

-        verify();

-

-        resetFull();

-        assertTrue("Empty map toString() should not return null", 

-                   map.toString() != null);

-        verify();

-    }

-

-

-    /**

-     * Compare the current serialized form of the Map

-     * against the canonical version in CVS.

-     */

-    public void testEmptyMapCompatibility() throws Exception {

-        /**

-         * Create canonical objects with this code

-        Map map = makeEmptyMap();

-        if (!(map instanceof Serializable)) return;

-        

-        writeExternalFormToDisk((Serializable) map, getCanonicalEmptyCollectionName(map));

-        */

-

-        // test to make sure the canonical form has been preserved

-        Map map = makeEmptyMap();

-        if (map instanceof Serializable && !skipSerializedCanonicalTests() && isTestSerialization()) {

-            Map map2 = (Map) readExternalFormFromDisk(getCanonicalEmptyCollectionName(map));

-            assertEquals("Map is empty", 0, map2.size());

-        }

-    }

-

-    /**

-     * Compare the current serialized form of the Map

-     * against the canonical version in CVS.

-     */

-    public void testFullMapCompatibility() throws Exception {

-        /**

-         * Create canonical objects with this code

-        Map map = makeFullMap();

-        if (!(map instanceof Serializable)) return;

-        

-        writeExternalFormToDisk((Serializable) map, getCanonicalFullCollectionName(map));

-        */

-

-        // test to make sure the canonical form has been preserved

-        Map map = makeFullMap();

-        if (map instanceof Serializable && !skipSerializedCanonicalTests() && isTestSerialization()) {

-            Map map2 = (Map) readExternalFormFromDisk(getCanonicalFullCollectionName(map));

-            assertEquals("Map is the right size", getSampleKeys().length, map2.size());

-        }

-    }

-

-    /**

-     * Tests Map.put(Object, Object)

-     */

-    public void testMapPut() {

-        resetEmpty();

-        Object[] keys = getSampleKeys();

-        Object[] values = getSampleValues();

-        Object[] newValues = getNewSampleValues();

-

-        if (isPutAddSupported()) {

-            for (int i = 0; i < keys.length; i++) {

-                Object o = map.put(keys[i], values[i]);

-                confirmed.put(keys[i], values[i]);

-                verify();

-                assertTrue("First map.put should return null", o == null);

-                assertTrue("Map should contain key after put", 

-                           map.containsKey(keys[i]));

-                assertTrue("Map should contain value after put", 

-                           map.containsValue(values[i]));

-            }

-            if (isPutChangeSupported()) {

-                for (int i = 0; i < keys.length; i++) {

-                    Object o = map.put(keys[i], newValues[i]);

-                    confirmed.put(keys[i], newValues[i]);

-                    verify();

-                    assertEquals("Map.put should return previous value when changed",

-                                 values[i], o);

-                    assertTrue("Map should still contain key after put when changed",

-                               map.containsKey(keys[i]));

-                    assertTrue("Map should contain new value after put when changed",

-                               map.containsValue(newValues[i]));

-        

-                    // if duplicates are allowed, we're not guaranteed that the value

-                    // no longer exists, so don't try checking that.

-                    if (!isAllowDuplicateValues()) {

-                        assertTrue("Map should not contain old value after put when changed",

-                                   !map.containsValue(values[i]));

-                    }

-                }

-            } else {

-                try {

-                    // two possible exception here, either valid

-                    map.put(keys[0], newValues[0]);

-                    fail("Expected IllegalArgumentException or UnsupportedOperationException on put (change)");

-                } catch (IllegalArgumentException ex) {

-                } catch (UnsupportedOperationException ex) {}

-            }

-            

-        } else if (isPutChangeSupported()) {

-            resetEmpty();

-            try {

-                map.put(keys[0], values[0]);

-                fail("Expected UnsupportedOperationException or IllegalArgumentException on put (add) when fixed size");

-            } catch (IllegalArgumentException ex) {

-            } catch (UnsupportedOperationException ex) {

-            }

-            

-            resetFull();

-            int i = 0;

-            for (Iterator it = map.keySet().iterator(); it.hasNext() && i < newValues.length; i++) {

-                Object key = it.next();

-                Object o = map.put(key, newValues[i]);

-                Object value = confirmed.put(key, newValues[i]);

-                verify();

-                assertEquals("Map.put should return previous value when changed",

-                    value, o);

-                assertTrue("Map should still contain key after put when changed",

-                    map.containsKey(key));

-                assertTrue("Map should contain new value after put when changed",

-                    map.containsValue(newValues[i]));

-        

-                // if duplicates are allowed, we're not guaranteed that the value

-                // no longer exists, so don't try checking that.

-                if (!isAllowDuplicateValues()) {

-                    assertTrue("Map should not contain old value after put when changed",

-                        !map.containsValue(values[i]));

-                }

-            }

-        } else {

-            try {

-                map.put(keys[0], values[0]);

-                fail("Expected UnsupportedOperationException on put (add)");

-            } catch (UnsupportedOperationException ex) {}

-        }

-    }

-

-    /**

-     * Tests Map.put(null, value)

-     */

-    public void testMapPutNullKey() {

-        resetFull();

-        Object[] values = getSampleValues();

-    

-        if (isPutAddSupported()) {

-            if (isAllowNullKey()) {

-                map.put(null, values[0]);

-            } else {

-                try {

-                    map.put(null, values[0]);

-                    fail("put(null, value) should throw NPE/IAE");

-                } catch (NullPointerException ex) {

-                } catch (IllegalArgumentException ex) {}

-            }

-        }

-    }

-    

-    /**

-     * Tests Map.put(null, value)

-     */

-    public void testMapPutNullValue() {

-        resetFull();

-        Object[] keys = getSampleKeys();

-        

-        if (isPutAddSupported()) {

-            if (isAllowNullValue()) {

-                map.put(keys[0], null);

-            } else {

-                try {

-                    map.put(keys[0], null);

-                    fail("put(key, null) should throw NPE/IAE");

-                } catch (NullPointerException ex) {

-                } catch (IllegalArgumentException ex) {}

-            }

-        }

-    }

-    

-    /**

-     * Tests Map.putAll(map)

-     */

-    public void testMapPutAll() {

-        if (!isPutAddSupported()) {

-            if (!isPutChangeSupported()) {

-                Map temp = makeFullMap();

-                resetEmpty();

-                try {

-                    map.putAll(temp);

-                    fail("Expected UnsupportedOperationException on putAll");

-                } catch (UnsupportedOperationException ex) {}

-            }

-            return;

-        }

-

-        // check putAll OK adding empty map to empty map

-        resetEmpty();

-        assertEquals(0, map.size());

-        map.putAll(new HashMap());

-        assertEquals(0, map.size());

-

-        // check putAll OK adding empty map to non-empty map

-        resetFull();

-        int size = map.size();

-        map.putAll(new HashMap());

-        assertEquals(size, map.size());

-

-        // check putAll OK adding non-empty map to empty map

-        resetEmpty();

-        Map m2 = makeFullMap();

-        map.putAll(m2);

-        confirmed.putAll(m2);

-        verify();

-

-        // check putAll OK adding non-empty JDK map to empty map

-        resetEmpty();

-        m2 = makeConfirmedMap();

-        Object[] keys = getSampleKeys();

-        Object[] values = getSampleValues();

-        for(int i = 0; i < keys.length; i++) {

-            m2.put(keys[i], values[i]);

-        }

-        map.putAll(m2);

-        confirmed.putAll(m2);

-        verify();

-

-        // check putAll OK adding non-empty JDK map to non-empty map

-        resetEmpty();

-        m2 = makeConfirmedMap();

-        map.put(keys[0], values[0]);

-        confirmed.put(keys[0], values[0]);

-        verify();

-        for(int i = 1; i < keys.length; i++) {

-            m2.put(keys[i], values[i]);

-        }

-        map.putAll(m2);

-        confirmed.putAll(m2);

-        verify();

-    }

-

-    /**

-     * Tests Map.remove(Object)

-     */

-    public void testMapRemove() {

-        if (!isRemoveSupported()) {

-            try {

-                resetFull();

-                map.remove(map.keySet().iterator().next());

-                fail("Expected UnsupportedOperationException on remove");

-            } catch (UnsupportedOperationException ex) {}

-            return;

-        }

-

-        resetEmpty();

-

-        Object[] keys = getSampleKeys();

-        Object[] values = getSampleValues();

-        for(int i = 0; i < keys.length; i++) {

-            Object o = map.remove(keys[i]);

-            assertTrue("First map.remove should return null", o == null);

-        }

-        verify();

-

-        resetFull();

-

-        for(int i = 0; i < keys.length; i++) {

-            Object o = map.remove(keys[i]);

-            confirmed.remove(keys[i]);

-            verify();

-

-            assertEquals("map.remove with valid key should return value",

-                         values[i], o);

-        }

-

-        Object[] other = getOtherKeys();

-

-        resetFull();

-        int size = map.size();

-        for (int i = 0; i < other.length; i++) {

-            Object o = map.remove(other[i]);

-            assertEquals("map.remove for nonexistent key should return null",

-                         o, null);

-            assertEquals("map.remove for nonexistent key should not " +

-                         "shrink map", size, map.size());

-        }

-        verify();

-    }

-

-    //-----------------------------------------------------------------------

-    /**

-     * Tests that the {@link Map#values} collection is backed by

-     * the underlying map for clear().

-     */

-    public void testValuesClearChangesMap() {

-        if (!isRemoveSupported()) return;

-        

-        // clear values, reflected in map

-        resetFull();

-        Collection values = map.values();

-        assertTrue(map.size() > 0);

-        assertTrue(values.size() > 0);

-        values.clear();

-        assertTrue(map.size() == 0);

-        assertTrue(values.size() == 0);

-        

-        // clear map, reflected in values

-        resetFull();

-        values = map.values();

-        assertTrue(map.size() > 0);

-        assertTrue(values.size() > 0);

-        map.clear();

-        assertTrue(map.size() == 0);

-        assertTrue(values.size() == 0);

-    }

-    

-    /**

-     * Tests that the {@link Map#keySet} collection is backed by

-     * the underlying map for clear().

-     */

-    public void testKeySetClearChangesMap() {

-        if (!isRemoveSupported()) return;

-        

-        // clear values, reflected in map

-        resetFull();

-        Set keySet = map.keySet();

-        assertTrue(map.size() > 0);

-        assertTrue(keySet.size() > 0);

-        keySet.clear();

-        assertTrue(map.size() == 0);

-        assertTrue(keySet.size() == 0);

-        

-        // clear map, reflected in values

-        resetFull();

-        keySet = map.keySet();

-        assertTrue(map.size() > 0);

-        assertTrue(keySet.size() > 0);

-        map.clear();

-        assertTrue(map.size() == 0);

-        assertTrue(keySet.size() == 0);

-    }

-    

-    /**

-     * Tests that the {@link Map#entrySet()} collection is backed by

-     * the underlying map for clear().

-     */

-    public void testEntrySetClearChangesMap() {

-        if (!isRemoveSupported()) return;

-        

-        // clear values, reflected in map

-        resetFull();

-        Set entrySet = map.entrySet();

-        assertTrue(map.size() > 0);

-        assertTrue(entrySet.size() > 0);

-        entrySet.clear();

-        assertTrue(map.size() == 0);

-        assertTrue(entrySet.size() == 0);

-        

-        // clear map, reflected in values

-        resetFull();

-        entrySet = map.entrySet();

-        assertTrue(map.size() > 0);

-        assertTrue(entrySet.size() > 0);

-        map.clear();

-        assertTrue(map.size() == 0);

-        assertTrue(entrySet.size() == 0);

-    }

-

-    //-----------------------------------------------------------------------    

-    public void testEntrySetContains1() {

-        resetFull();

-        Set entrySet = map.entrySet();

-        Map.Entry entry = (Map.Entry) entrySet.iterator().next();

-        assertEquals(true, entrySet.contains(entry));

-    }

-    public void testEntrySetContains2() {

-        resetFull();

-        Set entrySet = map.entrySet();

-        Map.Entry entry = (Map.Entry) entrySet.iterator().next();

-        Map.Entry test = cloneMapEntry(entry);

-        assertEquals(true, entrySet.contains(test));

-    }

-    public void testEntrySetContains3() {

-        resetFull();

-        Set entrySet = map.entrySet();

-        Map.Entry entry = (Map.Entry) entrySet.iterator().next();

-        HashMap temp = new HashMap();

-        temp.put(entry.getKey(), "A VERY DIFFERENT VALUE");

-        Map.Entry test = (Map.Entry) temp.entrySet().iterator().next();

-        assertEquals(false, entrySet.contains(test));

-    }

-    

-    public void testEntrySetRemove1() {

-        if (!isRemoveSupported()) return;

-        resetFull();

-        int size = map.size();

-        Set entrySet = map.entrySet();

-        Map.Entry entry = (Map.Entry) entrySet.iterator().next();

-        Object key = entry.getKey();

-        

-        assertEquals(true, entrySet.remove(entry));

-        assertEquals(false, map.containsKey(key));

-        assertEquals(size - 1, map.size());

-    }            

-    public void testEntrySetRemove2() {

-        if (!isRemoveSupported()) return;

-        resetFull();

-        int size = map.size();

-        Set entrySet = map.entrySet();

-        Map.Entry entry = (Map.Entry) entrySet.iterator().next();

-        Object key = entry.getKey();

-        Map.Entry test = cloneMapEntry(entry);

-        

-        assertEquals(true, entrySet.remove(test));

-        assertEquals(false, map.containsKey(key));

-        assertEquals(size - 1, map.size());

-    }

-    public void testEntrySetRemove3() {

-        if (!isRemoveSupported()) return;

-        resetFull();

-        int size = map.size();

-        Set entrySet = map.entrySet();

-        Map.Entry entry = (Map.Entry) entrySet.iterator().next();

-        Object key = entry.getKey();

-        HashMap temp = new HashMap();

-        temp.put(entry.getKey(), "A VERY DIFFERENT VALUE");

-        Map.Entry test = (Map.Entry) temp.entrySet().iterator().next();

-        

-        assertEquals(false, entrySet.remove(test));

-        assertEquals(true, map.containsKey(key));

-        assertEquals(size, map.size());

-    }

-    

-    //-----------------------------------------------------------------------

-    /**

-     * Tests that the {@link Map#values} collection is backed by

-     * the underlying map by removing from the values collection

-     * and testing if the value was removed from the map.

-     * <p>

-     * We should really test the "vice versa" case--that values removed

-     * from the map are removed from the values collection--also,

-     * but that's a more difficult test to construct (lacking a

-     * "removeValue" method.)

-     * </p>

-     * <p>

-     * See bug <a href="http://issues.apache.org/bugzilla/show_bug.cgi?id=9573">

-     * 9573</a>.

-     * </p>

-     */

-    public void testValuesRemoveChangesMap() {

-        resetFull();

-        Object[] sampleValues = getSampleValues();

-        Collection values = map.values();

-        for (int i = 0; i < sampleValues.length; i++) {

-            if (map.containsValue(sampleValues[i])) {

-                int j = 0;  // loop counter prevents infinite loops when remove is broken

-                while (values.contains(sampleValues[i]) && j < 10000) {

-                    try {

-                        values.remove(sampleValues[i]);

-                    } catch (UnsupportedOperationException e) {

-                        // if values.remove is unsupported, just skip this test

-                        return;

-                    }

-                    j++;

-                }

-                assertTrue("values().remove(obj) is broken", j < 10000);

-                assertTrue(

-                    "Value should have been removed from the underlying map.",

-                    !map.containsValue(sampleValues[i]));

-            }

-        }

-    }

-

-    /**

-     * Tests that the {@link Map#keySet} set is backed by

-     * the underlying map by removing from the keySet set

-     * and testing if the key was removed from the map.

-     */

-    public void testKeySetRemoveChangesMap() {

-        resetFull();

-        Object[] sampleKeys = getSampleKeys();

-        Set keys = map.keySet();

-        for (int i = 0; i < sampleKeys.length; i++) {

-            try {

-                keys.remove(sampleKeys[i]);

-            } catch (UnsupportedOperationException e) {

-                // if key.remove is unsupported, just skip this test

-                return;

-            }

-            assertTrue(

-                "Key should have been removed from the underlying map.",

-                !map.containsKey(sampleKeys[i]));

-        }

-    }

-

-    // TODO: Need:

-    //    testValuesRemovedFromEntrySetAreRemovedFromMap

-    //    same for EntrySet/KeySet/values's

-    //      Iterator.remove, removeAll, retainAll

-

-

-    /**

-     * Utility methods to create an array of Map.Entry objects

-     * out of the given key and value arrays.<P>

-     *

-     * @param keys    the array of keys

-     * @param values  the array of values

-     * @return an array of Map.Entry of those keys to those values

-     */

-    private Map.Entry[] makeEntryArray(Object[] keys, Object[] values) {

-        Map.Entry[] result = new Map.Entry[keys.length];

-        for (int i = 0; i < keys.length; i++) {

-            Map map = makeConfirmedMap();

-            map.put(keys[i], values[i]);

-            result[i] = (Map.Entry) map.entrySet().iterator().next();

-        }

-        return result;

-    }

-

-

-    /**

-     * Bulk test {@link Map#entrySet()}.  This method runs through all of

-     * the tests in {@link AbstractTestSet}.

-     * After modification operations, {@link #verify()} is invoked to ensure

-     * that the map and the other collection views are still valid.

-     *

-     * @return a {@link AbstractTestSet} instance for testing the map's entry set

-     */

-    public BulkTest bulkTestMapEntrySet() {

-        return new TestMapEntrySet();

-    }

-

-    public class TestMapEntrySet extends AbstractTestSet {

-        public TestMapEntrySet() {

-            super("MapEntrySet");

-        }

-

-        // Have to implement manually; entrySet doesn't support addAll

-        public Object[] getFullElements() {

-            Object[] k = getSampleKeys();

-            Object[] v = getSampleValues();

-            return makeEntryArray(k, v);

-        }

-        

-        // Have to implement manually; entrySet doesn't support addAll

-        public Object[] getOtherElements() {

-            Object[] k = getOtherKeys();

-            Object[] v = getOtherValues();

-            return makeEntryArray(k, v);

-        }

-        

-        public Set makeEmptySet() {

-            return makeEmptyMap().entrySet();

-        }

-        

-        public Set makeFullSet() {

-            return makeFullMap().entrySet();

-        }

-        

-        public boolean isAddSupported() {

-            // Collection views don't support add operations.

-            return false;

-        }

-        public boolean isRemoveSupported() {

-            // Entry set should only support remove if map does

-            return AbstractTestMap.this.isRemoveSupported();

-        }

-        public boolean isGetStructuralModify() {

-            return AbstractTestMap.this.isGetStructuralModify();

-        }

-        public boolean isTestSerialization() {

-            return false;

-        }

-

-        public void resetFull() {

-            AbstractTestMap.this.resetFull();

-            collection = map.entrySet();

-            TestMapEntrySet.this.confirmed = AbstractTestMap.this.confirmed.entrySet();

-        }

-        

-        public void resetEmpty() {

-            AbstractTestMap.this.resetEmpty();

-            collection = map.entrySet();

-            TestMapEntrySet.this.confirmed = AbstractTestMap.this.confirmed.entrySet();

-        }

-        

-        public void testMapEntrySetIteratorEntry() {

-            resetFull();

-            Iterator it = collection.iterator();

-            int count = 0;

-            while (it.hasNext()) {

-                Map.Entry entry = (Map.Entry) it.next();

-                assertEquals(true, AbstractTestMap.this.map.containsKey(entry.getKey()));

-                assertEquals(true, AbstractTestMap.this.map.containsValue(entry.getValue()));

-                if (isGetStructuralModify() == false) {

-                    assertEquals(AbstractTestMap.this.map.get(entry.getKey()), entry.getValue());

-                }

-                count++;

-            }

-            assertEquals(collection.size(), count);

-        }

-

-        public void testMapEntrySetIteratorEntrySetValue() {

-            Object key1 = getSampleKeys()[0];

-            Object key2 = (getSampleKeys().length ==1 ? getSampleKeys()[0] : getSampleKeys()[1]);

-            Object newValue1 = getNewSampleValues()[0];

-            Object newValue2 = (getNewSampleValues().length ==1 ? getNewSampleValues()[0] : getNewSampleValues()[1]);

-            

-            resetFull();

-            // explicitly get entries as sample values/keys are connected for some maps

-            // such as BeanMap

-            Iterator it = TestMapEntrySet.this.collection.iterator();

-            Map.Entry entry1 = getEntry(it, key1);

-            it = TestMapEntrySet.this.collection.iterator();

-            Map.Entry entry2 = getEntry(it, key2);

-            Iterator itConfirmed = TestMapEntrySet.this.confirmed.iterator();

-            Map.Entry entryConfirmed1 = getEntry(itConfirmed, key1);

-            itConfirmed = TestMapEntrySet.this.confirmed.iterator();

-            Map.Entry entryConfirmed2 = getEntry(itConfirmed, key2);

-            verify();

-            

-            if (isSetValueSupported() == false) {

-                try {

-                    entry1.setValue(newValue1);

-                } catch (UnsupportedOperationException ex) {

-                }

-                return;

-            }

-            

-            entry1.setValue(newValue1);

-            entryConfirmed1.setValue(newValue1);

-            assertEquals(newValue1, entry1.getValue());

-            assertEquals(true, AbstractTestMap.this.map.containsKey(entry1.getKey()));

-            assertEquals(true, AbstractTestMap.this.map.containsValue(newValue1));

-            assertEquals(newValue1, AbstractTestMap.this.map.get(entry1.getKey()));

-            verify();

-            

-            entry1.setValue(newValue1);

-            entryConfirmed1.setValue(newValue1);

-            assertEquals(newValue1, entry1.getValue());

-            assertEquals(true, AbstractTestMap.this.map.containsKey(entry1.getKey()));

-            assertEquals(true, AbstractTestMap.this.map.containsValue(newValue1));

-            assertEquals(newValue1, AbstractTestMap.this.map.get(entry1.getKey()));

-            verify();

-            

-            entry2.setValue(newValue2);

-            entryConfirmed2.setValue(newValue2);

-            assertEquals(newValue2, entry2.getValue());

-            assertEquals(true, AbstractTestMap.this.map.containsKey(entry2.getKey()));

-            assertEquals(true, AbstractTestMap.this.map.containsValue(newValue2));

-            assertEquals(newValue2, AbstractTestMap.this.map.get(entry2.getKey()));

-            verify();

-        }

-        

-        public Map.Entry getEntry(Iterator itConfirmed, Object key) {

-            Map.Entry entry = null;

-            while (itConfirmed.hasNext()) {

-                Map.Entry temp = (Map.Entry) itConfirmed.next();

-                if (temp.getKey() == null) {

-                    if (key == null) {

-                        entry = temp;

-                        break;

-                    }

-                } else if (temp.getKey().equals(key)) {

-                    entry = temp;

-                    break;

-                }

-            }

-            assertNotNull("No matching entry in map for key '" + key + "'", entry);

-            return entry;

-        }

-

-        public void testMapEntrySetRemoveNonMapEntry() {

-            if (isRemoveSupported() == false) return;

-            resetFull();

-            assertEquals(false, getSet().remove(null));

-            assertEquals(false, getSet().remove(new Object()));

-        }

-        

-        public void verify() {

-            super.verify();

-            AbstractTestMap.this.verify();

-        }

-    }

-

-

-    /**

-     * Bulk test {@link Map#keySet()}.  This method runs through all of

-     * the tests in {@link AbstractTestSet}.

-     * After modification operations, {@link #verify()} is invoked to ensure

-     * that the map and the other collection views are still valid.

-     *

-     * @return a {@link AbstractTestSet} instance for testing the map's key set

-     */

-    public BulkTest bulkTestMapKeySet() {

-        return new TestMapKeySet();

-    }

-

-    public class TestMapKeySet extends AbstractTestSet {

-        public TestMapKeySet() {

-            super("");

-        }

-        public Object[] getFullElements() {

-            return getSampleKeys();

-        }

-        

-        public Object[] getOtherElements() {

-            return getOtherKeys();

-        }

-        

-        public Set makeEmptySet() {

-            return makeEmptyMap().keySet();

-        }

-        

-        public Set makeFullSet() {

-            return makeFullMap().keySet();

-        }

-        

-        public boolean isNullSupported() {

-            return AbstractTestMap.this.isAllowNullKey();

-        }

-        public boolean isAddSupported() {

-            return false;

-        }

-        public boolean isRemoveSupported() {

-            return AbstractTestMap.this.isRemoveSupported();

-        }

-        public boolean isTestSerialization() {

-            return false;

-        }

-        

-        public void resetEmpty() {

-            AbstractTestMap.this.resetEmpty();

-            collection = map.keySet();

-            TestMapKeySet.this.confirmed = AbstractTestMap.this.confirmed.keySet();

-        }

-        

-        public void resetFull() {

-            AbstractTestMap.this.resetFull();

-            collection = map.keySet();

-            TestMapKeySet.this.confirmed = AbstractTestMap.this.confirmed.keySet();

-        }

-        

-        public void verify() {

-            super.verify();

-            AbstractTestMap.this.verify();

-        }

-    }

-

-

-    /**

-     * Bulk test {@link Map#values()}.  This method runs through all of

-     * the tests in {@link AbstractTestCollection}.

-     * After modification operations, {@link #verify()} is invoked to ensure

-     * that the map and the other collection views are still valid.

-     *

-     * @return a {@link AbstractTestCollection} instance for testing the map's

-     *    values collection

-     */

-    public BulkTest bulkTestMapValues() {

-        return new TestMapValues();

-    }

-

-    public class TestMapValues extends AbstractTestCollection {

-        public TestMapValues() {

-            super("");

-        }

-

-        public Object[] getFullElements() {

-            return getSampleValues();

-        }

-        

-        public Object[] getOtherElements() {

-            return getOtherValues();

-        }

-        

-        public Collection makeCollection() {

-            return makeEmptyMap().values();

-        }

-        

-        public Collection makeFullCollection() {

-            return makeFullMap().values();

-        }

-        

-        public boolean isNullSupported() {

-            return AbstractTestMap.this.isAllowNullKey();

-        }

-        public boolean isAddSupported() {

-            return false;

-        }

-        public boolean isRemoveSupported() {

-            return AbstractTestMap.this.isRemoveSupported();

-        }

-        public boolean isTestSerialization() {

-            return false;

-        }

-        

-        public boolean areEqualElementsDistinguishable() {

-            // equal values are associated with different keys, so they are

-            // distinguishable.  

-            return true;

-        }

-

-        public Collection makeConfirmedCollection() {

-            // never gets called, reset methods are overridden

-            return null;

-        }

-        

-        public Collection makeConfirmedFullCollection() {

-            // never gets called, reset methods are overridden

-            return null;

-        }

-        

-        public void resetFull() {

-            AbstractTestMap.this.resetFull();

-            collection = map.values();

-            TestMapValues.this.confirmed = AbstractTestMap.this.confirmed.values();

-        }

-        

-        public void resetEmpty() {

-            AbstractTestMap.this.resetEmpty();

-            collection = map.values();

-            TestMapValues.this.confirmed = AbstractTestMap.this.confirmed.values();

-        }

-

-        public void verify() {

-            super.verify();

-            AbstractTestMap.this.verify();

-        }

-

-        // TODO: should test that a remove on the values collection view

-        // removes the proper mapping and not just any mapping that may have

-        // the value equal to the value returned from the values iterator.

-    }

-

-

-    /**

-     * Resets the {@link #map}, {@link #entrySet}, {@link #keySet},

-     * {@link #values} and {@link #confirmed} fields to empty.

-     */

-    public void resetEmpty() {

-        this.map = makeEmptyMap();

-        views();

-        this.confirmed = makeConfirmedMap();

-    }

-

-    /**

-     * Resets the {@link #map}, {@link #entrySet}, {@link #keySet},

-     * {@link #values} and {@link #confirmed} fields to full.

-     */

-    public void resetFull() {

-        this.map = makeFullMap();

-        views();

-        this.confirmed = makeConfirmedMap();

-        Object[] k = getSampleKeys();

-        Object[] v = getSampleValues();

-        for (int i = 0; i < k.length; i++) {

-            confirmed.put(k[i], v[i]);

-        }

-    }

-

-

-    /**

-     * Resets the collection view fields.

-     */

-    private void views() {

-        this.keySet = map.keySet();

-        this.values = map.values();

-        this.entrySet = map.entrySet();

-    }

-

-

-    /**

-     * Verifies that {@link #map} is still equal to {@link #confirmed}.

-     * This method checks that the map is equal to the HashMap, 

-     * <I>and</I> that the map's collection views are still equal to

-     * the HashMap's collection views.  An <Code>equals</Code> test

-     * is done on the maps and their collection views; their size and

-     * <Code>isEmpty</Code> results are compared; their hashCodes are

-     * compared; and <Code>containsAll</Code> tests are run on the 

-     * collection views.

-     */

-    public void verify() {

-        verifyMap();

-        verifyEntrySet();

-        verifyKeySet();

-        verifyValues();

-    }

-

-    public void verifyMap() {

-        int size = confirmed.size();

-        boolean empty = confirmed.isEmpty();

-        assertEquals("Map should be same size as HashMap", 

-                     size, map.size());

-        assertEquals("Map should be empty if HashMap is", 

-                     empty, map.isEmpty());

-        assertEquals("hashCodes should be the same",

-                     confirmed.hashCode(), map.hashCode());

-        // this fails for LRUMap because confirmed.equals() somehow modifies

-        // map, causing concurrent modification exceptions.

-        //assertEquals("Map should still equal HashMap", confirmed, map);

-        // this works though and performs the same verification:

-        assertTrue("Map should still equal HashMap", map.equals(confirmed));

-        // TODO: this should really be reexamined to figure out why LRU map

-        // behaves like it does (the equals shouldn't modify since all accesses

-        // by the confirmed collection should be through an iterator, thus not

-        // causing LRUMap to change).

-    }

-

-    public void verifyEntrySet() {

-        int size = confirmed.size();

-        boolean empty = confirmed.isEmpty();

-        assertEquals("entrySet should be same size as HashMap's" +

-                     "\nTest: " + entrySet + "\nReal: " + confirmed.entrySet(),

-                     size, entrySet.size());

-        assertEquals("entrySet should be empty if HashMap is" +

-                     "\nTest: " + entrySet + "\nReal: " + confirmed.entrySet(),

-                     empty, entrySet.isEmpty());

-        assertTrue("entrySet should contain all HashMap's elements" +

-                   "\nTest: " + entrySet + "\nReal: " + confirmed.entrySet(),

-                   entrySet.containsAll(confirmed.entrySet()));

-        assertEquals("entrySet hashCodes should be the same" +

-                     "\nTest: " + entrySet + "\nReal: " + confirmed.entrySet(),

-                     confirmed.entrySet().hashCode(), entrySet.hashCode());

-        assertEquals("Map's entry set should still equal HashMap's",

-                     confirmed.entrySet(), entrySet);

-    }

-

-    public void verifyKeySet() { 

-        int size = confirmed.size();

-        boolean empty = confirmed.isEmpty();

-        assertEquals("keySet should be same size as HashMap's" +

-                     "\nTest: " + keySet + "\nReal: " + confirmed.keySet(),

-                     size, keySet.size());

-        assertEquals("keySet should be empty if HashMap is" +

-                     "\nTest: " + keySet + "\nReal: " + confirmed.keySet(),

-                     empty, keySet.isEmpty());

-        assertTrue("keySet should contain all HashMap's elements" +

-                   "\nTest: " + keySet + "\nReal: " + confirmed.keySet(),

-                   keySet.containsAll(confirmed.keySet()));

-        assertEquals("keySet hashCodes should be the same" +

-                     "\nTest: " + keySet + "\nReal: " + confirmed.keySet(),

-                     confirmed.keySet().hashCode(), keySet.hashCode());

-        assertEquals("Map's key set should still equal HashMap's",

-                     confirmed.keySet(), keySet);

-    }

-

-    public void verifyValues() {

-        List known = new ArrayList(confirmed.values());

-        List test = new ArrayList(values);

-

-        int size = confirmed.size();

-        boolean empty = confirmed.isEmpty();

-        assertEquals("values should be same size as HashMap's" +

-                     "\nTest: " + test + "\nReal: " + known,

-                     size, values.size());

-        assertEquals("values should be empty if HashMap is" +

-                     "\nTest: " + test + "\nReal: " + known,

-                     empty, values.isEmpty());

-        assertTrue("values should contain all HashMap's elements" +

-                   "\nTest: " + test + "\nReal: " + known,

-                    test.containsAll(known));

-        assertTrue("values should contain all HashMap's elements" +

-                   "\nTest: " + test + "\nReal: " + known,

-                   known.containsAll(test));

-        // originally coded to use a HashBag, but now separate jar so...

-        for (Iterator it = known.iterator(); it.hasNext();) {

-            boolean removed = test.remove(it.next());

-            assertTrue("Map's values should still equal HashMap's", removed);

-        }

-        assertTrue("Map's values should still equal HashMap's", test.isEmpty());

-    }

-

-

-    /**

-     * Erases any leftover instance variables by setting them to null.

-     */

-    public void tearDown() throws Exception {

-        map = null;

-        keySet = null;

-        entrySet = null;

-        values = null;

-        confirmed = null;

-    }

-

-}

+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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 org.apache.commons.collections.map;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.commons.collections.AbstractTestObject;
+import org.apache.commons.collections.BulkTest;
+import org.apache.commons.collections.collection.AbstractTestCollection;
+import org.apache.commons.collections.set.AbstractTestSet;
+
+/**
+ * Abstract test class for {@link java.util.Map} methods and contracts.
+ * <p>
+ * The forces at work here are similar to those in {@link AbstractTestCollection}.
+ * If your class implements the full Map interface, including optional
+ * operations, simply extend this class, and implement the
+ * {@link #makeEmptyMap()} method.
+ * <p>
+ * On the other hand, if your map implementation is weird, you may have to
+ * override one or more of the other protected methods.  They're described
+ * below.
+ * <p>
+ * <b>Entry Population Methods</b>
+ * <p>
+ * Override these methods if your map requires special entries:
+ * 
+ * <ul>
+ * <li>{@link #getSampleKeys()}
+ * <li>{@link #getSampleValues()}
+ * <li>{@link #getNewSampleValues()}
+ * <li>{@link #getOtherKeys()}
+ * <li>{@link #getOtherValues()}
+ * </ul>
+ *
+ * <b>Supported Operation Methods</b>
+ * <p>
+ * Override these methods if your map doesn't support certain operations:
+ *
+ * <ul>
+ * <li> {@link #isPutAddSupported()}
+ * <li> {@link #isPutChangeSupported()}
+ * <li> {@link #isSetValueSupported()}
+ * <li> {@link #isRemoveSupported()}
+ * <li> {@link #isGetStructuralModify()}
+ * <li> {@link #isAllowDuplicateValues()}
+ * <li> {@link #isAllowNullKey()}
+ * <li> {@link #isAllowNullValue()}
+ * </ul>
+ *
+ * <b>Fixture Methods</b>
+ * <p>
+ * For tests on modification operations (puts and removes), fixtures are used
+ * to verify that that operation results in correct state for the map and its
+ * collection views.  Basically, the modification is performed against your
+ * map implementation, and an identical modification is performed against
+ * a <I>confirmed</I> map implementation.  A confirmed map implementation is
+ * something like <Code>java.util.HashMap</Code>, which is known to conform
+ * exactly to the {@link Map} contract.  After the modification takes place
+ * on both your map implementation and the confirmed map implementation, the
+ * two maps are compared to see if their state is identical.  The comparison
+ * also compares the collection views to make sure they're still the same.<P>
+ *
+ * The upshot of all that is that <I>any</I> test that modifies the map in
+ * <I>any</I> way will verify that <I>all</I> of the map's state is still
+ * correct, including the state of its collection views.  So for instance
+ * if a key is removed by the map's key set's iterator, then the entry set 
+ * is checked to make sure the key/value pair no longer appears.<P>
+ *
+ * The {@link #map} field holds an instance of your collection implementation.
+ * The {@link #entrySet}, {@link #keySet} and {@link #values} fields hold
+ * that map's collection views.  And the {@link #confirmed} field holds
+ * an instance of the confirmed collection implementation.  The 
+ * {@link #resetEmpty()} and {@link #resetFull()} methods set these fields to 
+ * empty or full maps, so that tests can proceed from a known state.<P>
+ *
+ * After a modification operation to both {@link #map} and {@link #confirmed},
+ * the {@link #verify()} method is invoked to compare the results.  The
+ * {@link #verify} method calls separate methods to verify the map and its three
+ * collection views ({@link #verifyMap}, {@link #verifyEntrySet},
+ * {@link #verifyKeySet}, and {@link #verifyValues}).  You may want to override
+ * one of the verification methodsto perform additional verifications.  For
+ * instance, TestDoubleOrderedMap would want override its
+ * {@link #verifyValues()} method to verify that the values are unique and in
+ * ascending order.<P>
+ *  
+ * <b>Other Notes</b>
+ * <p>
+ * If your {@link Map} fails one of these tests by design, you may still use
+ * this base set of cases.  Simply override the test case (method) your map
+ * fails and/or the methods that define the assumptions used by the test
+ * cases.  For example, if your map does not allow duplicate values, override
+ * {@link #isAllowDuplicateValues()} and have it return <code>false</code>
+ *
+ * @author Michael Smith
+ * @author Rodney Waldhoff
+ * @author Paul Jack
+ * @author Stephen Colebourne
+ * @version $Revision: 646780 $ $Date: 2008-04-10 13:48:07 +0100 (Thu, 10 Apr 2008) $
+ */
+public abstract class AbstractTestMap extends AbstractTestObject {
+
+    /**
+     * JDK1.2 has bugs in null handling of Maps, especially HashMap.Entry.toString
+     * This avoids nulls for JDK1.2
+     */
+    private static final boolean JDK12;
+    static {
+        String str = System.getProperty("java.version");
+        JDK12 = str.startsWith("1.2");
+    }
+
+    // These instance variables are initialized with the reset method.
+    // Tests for map methods that alter the map (put, putAll, remove) 
+    // first call reset() to create the map and its views; then perform
+    // the modification on the map; perform the same modification on the
+    // confirmed; and then call verify() to ensure that the map is equal
+    // to the confirmed, that the already-constructed collection views
+    // are still equal to the confirmed's collection views.
+
+
+    /** Map created by reset(). */
+    protected Map map;
+
+    /** Entry set of map created by reset(). */
+    protected Set entrySet;
+
+    /** Key set of map created by reset(). */
+    protected Set keySet;
+
+    /** Values collection of map created by reset(). */
+    protected Collection values;
+
+    /** HashMap created by reset(). */
+    protected Map confirmed;
+
+    /**
+     * JUnit constructor.
+     * 
+     * @param testName  the test name
+     */
+    public AbstractTestMap(String testName) {
+        super(testName);
+    }
+
+    /**
+     * Returns true if the maps produced by 
+     * {@link #makeEmptyMap()} and {@link #makeFullMap()}
+     * support the <code>put</code> and <code>putAll</code> operations
+     * adding new mappings.
+     * <p>
+     * Default implementation returns true.
+     * Override if your collection class does not support put adding.
+     */
+    public boolean isPutAddSupported() {
+        return true;
+    }
+
+    /**
+     * Returns true if the maps produced by 
+     * {@link #makeEmptyMap()} and {@link #makeFullMap()}
+     * support the <code>put</code> and <code>putAll</code> operations
+     * changing existing mappings.
+     * <p>
+     * Default implementation returns true.
+     * Override if your collection class does not support put changing.
+     */
+    public boolean isPutChangeSupported() {
+        return true;
+    }
+
+    /**
+     * Returns true if the maps produced by 
+     * {@link #makeEmptyMap()} and {@link #makeFullMap()}
+     * support the <code>setValue</code> operation on entrySet entries.
+     * <p>
+     * Default implementation returns isPutChangeSupported().
+     * Override if your collection class does not support setValue but does
+     * support put changing.
+     */
+    public boolean isSetValueSupported() {
+        return isPutChangeSupported();
+    }
+
+    /**
+     * Returns true if the maps produced by 
+     * {@link #makeEmptyMap()} and {@link #makeFullMap()}
+     * support the <code>remove</code> and <code>clear</code> operations.
+     * <p>
+     * Default implementation returns true.
+     * Override if your collection class does not support removal operations.
+     */
+    public boolean isRemoveSupported() {
+        return true;
+    }
+
+    /**
+     * Returns true if the maps produced by 
+     * {@link #makeEmptyMap()} and {@link #makeFullMap()}
+     * can cause structural modification on a get(). The example is LRUMap.
+     * <p>
+     * Default implementation returns false.
+     * Override if your map class structurally modifies on get.
+     */
+    public boolean isGetStructuralModify() {
+        return false;
+    }
+
+    /**
+     * Returns whether the sub map views of SortedMap are serializable.
+     * If the class being tested is based around a TreeMap then you should
+     * override and return false as TreeMap has a bug in deserialization.
+     * 
+     * @return false
+     */
+    public boolean isSubMapViewsSerializable() {
+        return true;
+    }
+
+    /**
+     * Returns true if the maps produced by 
+     * {@link #makeEmptyMap()} and {@link #makeFullMap()}
+     * supports null keys.
+     * <p>
+     * Default implementation returns true.
+     * Override if your collection class does not support null keys.
+     */
+    public boolean isAllowNullKey() {
+        return true;
+    }
+
+    /**
+     * Returns true if the maps produced by 
+     * {@link #makeEmptyMap()} and {@link #makeFullMap()}
+     * supports null values.
+     * <p>
+     * Default implementation returns true.
+     * Override if your collection class does not support null values.
+     */
+    public boolean isAllowNullValue() {
+        return true;
+    }
+
+    /**
+     * Returns true if the maps produced by 
+     * {@link #makeEmptyMap()} and {@link #makeFullMap()}
+     * supports duplicate values.
+     * <p>
+     * Default implementation returns true.
+     * Override if your collection class does not support duplicate values.
+     */
+    public boolean isAllowDuplicateValues() {
+        return true;
+    }
+
+    /**
+     *  Returns the set of keys in the mappings used to test the map.  This
+     *  method must return an array with the same length as {@link
+     *  #getSampleValues()} and all array elements must be different. The
+     *  default implementation constructs a set of String keys, and includes a
+     *  single null key if {@link #isAllowNullKey()} returns <code>true</code>.
+     */
+    public Object[] getSampleKeys() {
+        Object[] result = new Object[] {
+            "blah", "foo", "bar", "baz", "tmp", "gosh", "golly", "gee", 
+            "hello", "goodbye", "we'll", "see", "you", "all", "again",
+            "key",
+            "key2",
+            (isAllowNullKey() && !JDK12) ? null : "nonnullkey"
+        };
+        return result;
+    }
+
+
+    public Object[] getOtherKeys() {
+        return getOtherNonNullStringElements();
+    }
+
+    public Object[] getOtherValues() {
+        return getOtherNonNullStringElements();
+    }
+
+    /**
+     * Returns a list of string elements suitable for return by
+     * {@link #getOtherKeys()} or {@link #getOtherValues}.
+     *
+     * <p>Override getOtherElements to returnthe results of this method if your
+     * collection does not support heterogenous elements or the null element.
+     * </p>
+     */
+    public Object[] getOtherNonNullStringElements() {
+        return new Object[] {
+            "For","then","despite",/* of */"space","I","would","be","brought",
+            "From","limits","far","remote","where","thou","dost","stay"
+        };
+    }
+
+    /**
+     * Returns the set of values in the mappings used to test the map.  This
+     * method must return an array with the same length as
+     * {@link #getSampleKeys()}.  The default implementation constructs a set of
+     * String values and includes a single null value if 
+     * {@link #isAllowNullValue()} returns <code>true</code>, and includes
+     * two values that are the same if {@link #isAllowDuplicateValues()} returns
+     * <code>true</code>.
+     */
+    public Object[] getSampleValues() {
+        Object[] result = new Object[] {
+            "blahv", "foov", "barv", "bazv", "tmpv", "goshv", "gollyv", "geev",
+            "hellov", "goodbyev", "we'llv", "seev", "youv", "allv", "againv",
+            (isAllowNullValue() && !JDK12) ? null : "nonnullvalue",
+            "value",
+            (isAllowDuplicateValues()) ? "value" : "value2",
+        };
+        return result;
+    }
+
+    /**
+     * Returns a the set of values that can be used to replace the values
+     * returned from {@link #getSampleValues()}.  This method must return an
+     * array with the same length as {@link #getSampleValues()}.  The values
+     * returned from this method should not be the same as those returned from
+     * {@link #getSampleValues()}.  The default implementation constructs a
+     * set of String values and includes a single null value if
+     * {@link #isAllowNullValue()} returns <code>true</code>, and includes two values
+     * that are the same if {@link #isAllowDuplicateValues()} returns
+     * <code>true</code>.  
+     */
+    public Object[] getNewSampleValues() {
+        Object[] result = new Object[] {
+            (isAllowNullValue() && !JDK12 && isAllowDuplicateValues()) ? null : "newnonnullvalue",
+            "newvalue",
+            (isAllowDuplicateValues()) ? "newvalue" : "newvalue2",
+            "newblahv", "newfoov", "newbarv", "newbazv", "newtmpv", "newgoshv", 
+            "newgollyv", "newgeev", "newhellov", "newgoodbyev", "newwe'llv", 
+            "newseev", "newyouv", "newallv", "newagainv",
+        };
+        return result;
+    }
+
+    /**
+     *  Helper method to add all the mappings described by
+     * {@link #getSampleKeys()} and {@link #getSampleValues()}.
+     */
+    public void addSampleMappings(Map m) {
+
+        Object[] keys = getSampleKeys();
+        Object[] values = getSampleValues();
+        
+        for(int i = 0; i < keys.length; i++) {
+            try {
+                m.put(keys[i], values[i]);
+            } catch (NullPointerException exception) {
+                assertTrue("NullPointerException only allowed to be thrown " +
+                           "if either the key or value is null.", 
+                           keys[i] == null || values[i] == null);
+                
+                assertTrue("NullPointerException on null key, but " +
+                           "isAllowNullKey is not overridden to return false.", 
+                           keys[i] == null || !isAllowNullKey());
+                
+                assertTrue("NullPointerException on null value, but " +
+                           "isAllowNullValue is not overridden to return false.",
+                           values[i] == null || !isAllowNullValue());
+                
+                assertTrue("Unknown reason for NullPointer.", false);
+            }
+        }
+        assertEquals("size must reflect number of mappings added.",
+                     keys.length, m.size());
+    }
+
+    //-----------------------------------------------------------------------
+    /**
+     * Return a new, empty {@link Map} to be used for testing. 
+     * 
+     * @return the map to be tested
+     */
+    public abstract Map makeEmptyMap();
+
+    /**
+     * Return a new, populated map.  The mappings in the map should match the
+     * keys and values returned from {@link #getSampleKeys()} and
+     * {@link #getSampleValues()}.  The default implementation uses makeEmptyMap()
+     * and calls {@link #addSampleMappings} to add all the mappings to the
+     * map.
+     * 
+     * @return the map to be tested
+     */
+    public Map makeFullMap() {
+        Map m = makeEmptyMap();
+        addSampleMappings(m);
+        return m;
+    }
+
+    /**
+     * Implements the superclass method to return the map to be tested.
+     * 
+     * @return the map to be tested
+     */
+    public Object makeObject() {
+        return makeEmptyMap();
+    }
+
+    /**
+     * Override to return a map other than HashMap as the confirmed map.
+     * 
+     * @return a map that is known to be valid
+     */
+    public Map makeConfirmedMap() {
+        return new HashMap();
+    }
+
+    /**
+     * Creates a new Map Entry that is independent of the first and the map.
+     */
+    public Map.Entry cloneMapEntry(Map.Entry entry) {
+        HashMap map = new HashMap();
+        map.put(entry.getKey(), entry.getValue());
+        return (Map.Entry) map.entrySet().iterator().next();
+    }
+
+    /**
+     * Gets the compatability version, needed for package access.
+     */
+    public String getCompatibilityVersion() {
+        return super.getCompatibilityVersion();
+    }
+    //-----------------------------------------------------------------------
+    /**
+     * Test to ensure the test setup is working properly.  This method checks
+     * to ensure that the getSampleKeys and getSampleValues methods are
+     * returning results that look appropriate.  That is, they both return a
+     * non-null array of equal length.  The keys array must not have any
+     * duplicate values, and may only contain a (single) null key if
+     * isNullKeySupported() returns true.  The values array must only have a null
+     * value if useNullValue() is true and may only have duplicate values if
+     * isAllowDuplicateValues() returns true.  
+     */
+    public void testSampleMappings() {
+      Object[] keys = getSampleKeys();
+      Object[] values = getSampleValues();
+      Object[] newValues = getNewSampleValues();
+
+      assertTrue("failure in test: Must have keys returned from " +
+                 "getSampleKeys.", keys != null);
+
+      assertTrue("failure in test: Must have values returned from " +
+                 "getSampleValues.", values != null);
+
+      // verify keys and values have equivalent lengths (in case getSampleX are
+      // overridden)
+      assertEquals("failure in test: not the same number of sample " +
+                   "keys and values.",  keys.length, values.length);
+      
+      assertEquals("failure in test: not the same number of values and new values.",
+                   values.length, newValues.length);
+
+      // verify there aren't duplicate keys, and check values
+      for(int i = 0; i < keys.length - 1; i++) {
+          for(int j = i + 1; j < keys.length; j++) {
+              assertTrue("failure in test: duplicate null keys.",
+                         (keys[i] != null || keys[j] != null));
+              assertTrue("failure in test: duplicate non-null key.",
+                         (keys[i] == null || keys[j] == null || 
+                          (!keys[i].equals(keys[j]) && 
+                           !keys[j].equals(keys[i]))));
+          }
+          assertTrue("failure in test: found null key, but isNullKeySupported " +
+                     "is false.", keys[i] != null || isAllowNullKey());
+          assertTrue("failure in test: found null value, but isNullValueSupported " +
+                     "is false.", values[i] != null || isAllowNullValue());
+          assertTrue("failure in test: found null new value, but isNullValueSupported " +
+                     "is false.", newValues[i] != null || isAllowNullValue());
+          assertTrue("failure in test: values should not be the same as new value",
+                     values[i] != newValues[i] && 
+                     (values[i] == null || !values[i].equals(newValues[i])));
+      }
+    }
+    
+    // tests begin here.  Each test adds a little bit of tested functionality.
+    // Many methods assume previous methods passed.  That is, they do not
+    // exhaustively recheck things that have already been checked in a previous
+    // test methods.  
+
+    /**
+     * Test to ensure that makeEmptyMap and makeFull returns a new non-null
+     * map with each invocation.  
+     */
+    public void testMakeMap() {
+        Map em = makeEmptyMap();
+        assertTrue("failure in test: makeEmptyMap must return a non-null map.",
+                   em != null);
+        
+        Map em2 = makeEmptyMap();
+        assertTrue("failure in test: makeEmptyMap must return a non-null map.",
+                   em != null);
+
+        assertTrue("failure in test: makeEmptyMap must return a new map " +
+                   "with each invocation.", em != em2);
+
+        Map fm = makeFullMap();
+        assertTrue("failure in test: makeFullMap must return a non-null map.",
+                   fm != null);
+        
+        Map fm2 = makeFullMap();
+        assertTrue("failure in test: makeFullMap must return a non-null map.",
+                   fm != null);
+
+        assertTrue("failure in test: makeFullMap must return a new map " +
+                   "with each invocation.", fm != fm2);
+    }
+
+    /**
+     * Tests Map.isEmpty()
+     */
+    public void testMapIsEmpty() {
+        resetEmpty();
+        assertEquals("Map.isEmpty() should return true with an empty map", 
+                     true, map.isEmpty());
+        verify();
+
+        resetFull();
+        assertEquals("Map.isEmpty() should return false with a non-empty map",
+                     false, map.isEmpty());
+        verify();
+    }
+
+    /**
+     * Tests Map.size()
+     */
+    public void testMapSize() {
+        resetEmpty();
+        assertEquals("Map.size() should be 0 with an empty map",
+                     0, map.size());
+        verify();
+
+        resetFull();
+        assertEquals("Map.size() should equal the number of entries " +
+                     "in the map", getSampleKeys().length, map.size());
+        verify();
+    }
+
+    /**
+     * Tests {@link Map#clear()}.  If the map {@link #isRemoveSupported()}
+     * can add and remove elements}, then {@link Map#size()} and
+     * {@link Map#isEmpty()} are used to ensure that map has no elements after
+     * a call to clear.  If the map does not support adding and removing
+     * elements, this method checks to ensure clear throws an
+     * UnsupportedOperationException.
+     */
+    public void testMapClear() {
+        if (!isRemoveSupported()) {
+            try {
+                resetFull();
+                map.clear();
+                fail("Expected UnsupportedOperationException on clear");
+            } catch (UnsupportedOperationException ex) {}
+            return;
+        }
+
+        resetEmpty();
+        map.clear();
+        confirmed.clear();
+        verify();
+        
+        resetFull();
+        map.clear();
+        confirmed.clear();
+        verify();
+    }
+
+
+    /**
+     * Tests Map.containsKey(Object) by verifying it returns false for all
+     * sample keys on a map created using an empty map and returns true for
+     * all sample keys returned on a full map. 
+     */
+    public void testMapContainsKey() {
+        Object[] keys = getSampleKeys();
+
+        resetEmpty();
+        for(int i = 0; i < keys.length; i++) {
+            assertTrue("Map must not contain key when map is empty", 
+                       !map.containsKey(keys[i]));
+        }
+        verify();
+
+        resetFull();
+        for(int i = 0; i < keys.length; i++) {
+            assertTrue("Map must contain key for a mapping in the map. " +
+                       "Missing: " + keys[i], map.containsKey(keys[i]));
+        }
+        verify();
+    }
+
+    /**
+     * Tests Map.containsValue(Object) by verifying it returns false for all
+     * sample values on an empty map and returns true for all sample values on
+     * a full map.
+     */
+    public void testMapContainsValue() {
+        Object[] values = getSampleValues();
+
+        resetEmpty();
+        for(int i = 0; i < values.length; i++) {
+            assertTrue("Empty map must not contain value", 
+                       !map.containsValue(values[i]));
+        }
+        verify();
+        
+        resetFull();
+        for(int i = 0; i < values.length; i++) {
+            assertTrue("Map must contain value for a mapping in the map.", 
+                       map.containsValue(values[i]));
+        }
+        verify();
+    }
+
+
+    /**
+     * Tests Map.equals(Object)
+     */
+    public void testMapEquals() {
+        resetEmpty();
+        assertTrue("Empty maps unequal.", map.equals(confirmed));
+        verify();
+
+        resetFull();
+        assertTrue("Full maps unequal.", map.equals(confirmed));
+        verify();
+
+        resetFull();
+        // modify the HashMap created from the full map and make sure this
+        // change results in map.equals() to return false.
+        Iterator iter = confirmed.keySet().iterator();
+        iter.next();
+        iter.remove();
+        assertTrue("Different maps equal.", !map.equals(confirmed));
+        
+        resetFull();
+        assertTrue("equals(null) returned true.", !map.equals(null));
+        assertTrue("equals(new Object()) returned true.", 
+                   !map.equals(new Object()));
+        verify();
+    }
+
+
+    /**
+     * Tests Map.get(Object)
+     */
+    public void testMapGet() {
+        resetEmpty();
+
+        Object[] keys = getSampleKeys();
+        Object[] values = getSampleValues();
+
+        for (int i = 0; i < keys.length; i++) {
+            assertTrue("Empty map.get() should return null.", 
+                       map.get(keys[i]) == null);
+        }
+        verify();
+
+        resetFull();
+        for (int i = 0; i < keys.length; i++) {
+            assertEquals("Full map.get() should return value from mapping.", 
+                         values[i], map.get(keys[i]));
+        }
+    }
+
+    /**
+     * Tests Map.hashCode()
+     */
+    public void testMapHashCode() {
+        resetEmpty();
+        assertTrue("Empty maps have different hashCodes.", 
+                   map.hashCode() == confirmed.hashCode());
+
+        resetFull();
+        assertTrue("Equal maps have different hashCodes.", 
+                   map.hashCode() == confirmed.hashCode());
+    }
+
+    /**
+     * Tests Map.toString().  Since the format of the string returned by the
+     * toString() method is not defined in the Map interface, there is no
+     * common way to test the results of the toString() method.  Thereforce,
+     * it is encouraged that Map implementations override this test with one
+     * that checks the format matches any format defined in its API.  This
+     * default implementation just verifies that the toString() method does
+     * not return null.
+     */
+    public void testMapToString() {
+        resetEmpty();
+        assertTrue("Empty map toString() should not return null", 
+                   map.toString() != null);
+        verify();
+
+        resetFull();
+        assertTrue("Empty map toString() should not return null", 
+                   map.toString() != null);
+        verify();
+    }
+
+
+    /**
+     * Compare the current serialized form of the Map
+     * against the canonical version in CVS.
+     */
+    public void testEmptyMapCompatibility() throws Exception {
+        /**
+         * Create canonical objects with this code
+        Map map = makeEmptyMap();
+        if (!(map instanceof Serializable)) return;
+        
+        writeExternalFormToDisk((Serializable) map, getCanonicalEmptyCollectionName(map));
+        */
+
+        // test to make sure the canonical form has been preserved
+        Map map = makeEmptyMap();
+        if (map instanceof Serializable && !skipSerializedCanonicalTests() && isTestSerialization()) {
+            Map map2 = (Map) readExternalFormFromDisk(getCanonicalEmptyCollectionName(map));
+            assertEquals("Map is empty", 0, map2.size());
+        }
+    }
+
+    /**
+     * Compare the current serialized form of the Map
+     * against the canonical version in CVS.
+     */
+    public void testFullMapCompatibility() throws Exception {
+        /**
+         * Create canonical objects with this code
+        Map map = makeFullMap();
+        if (!(map instanceof Serializable)) return;
+        
+        writeExternalFormToDisk((Serializable) map, getCanonicalFullCollectionName(map));
+        */
+
+        // test to make sure the canonical form has been preserved
+        Map map = makeFullMap();
+        if (map instanceof Serializable && !skipSerializedCanonicalTests() && isTestSerialization()) {
+            Map map2 = (Map) readExternalFormFromDisk(getCanonicalFullCollectionName(map));
+            assertEquals("Map is the right size", getSampleKeys().length, map2.size());
+        }
+    }
+
+    /**
+     * Tests Map.put(Object, Object)
+     */
+    public void testMapPut() {
+        resetEmpty();
+        Object[] keys = getSampleKeys();
+        Object[] values = getSampleValues();
+        Object[] newValues = getNewSampleValues();
+
+        if (isPutAddSupported()) {
+            for (int i = 0; i < keys.length; i++) {
+                Object o = map.put(keys[i], values[i]);
+                confirmed.put(keys[i], values[i]);
+                verify();
+                assertTrue("First map.put should return null", o == null);
+                assertTrue("Map should contain key after put", 
+                           map.containsKey(keys[i]));
+                assertTrue("Map should contain value after put", 
+                           map.containsValue(values[i]));
+            }
+            if (isPutChangeSupported()) {
+                for (int i = 0; i < keys.length; i++) {
+                    Object o = map.put(keys[i], newValues[i]);
+                    confirmed.put(keys[i], newValues[i]);
+                    verify();
+                    assertEquals("Map.put should return previous value when changed",
+                                 values[i], o);
+                    assertTrue("Map should still contain key after put when changed",
+                               map.containsKey(keys[i]));
+                    assertTrue("Map should contain new value after put when changed",
+                               map.containsValue(newValues[i]));
+        
+                    // if duplicates are allowed, we're not guaranteed that the value
+                    // no longer exists, so don't try checking that.
+                    if (!isAllowDuplicateValues()) {
+                        assertTrue("Map should not contain old value after put when changed",
+                                   !map.containsValue(values[i]));
+                    }
+                }
+            } else {
+                try {
+                    // two possible exception here, either valid
+                    map.put(keys[0], newValues[0]);
+                    fail("Expected IllegalArgumentException or UnsupportedOperationException on put (change)");
+                } catch (IllegalArgumentException ex) {
+                } catch (UnsupportedOperationException ex) {}
+            }
+            
+        } else if (isPutChangeSupported()) {
+            resetEmpty();
+            try {
+                map.put(keys[0], values[0]);
+                fail("Expected UnsupportedOperationException or IllegalArgumentException on put (add) when fixed size");
+            } catch (IllegalArgumentException ex) {
+            } catch (UnsupportedOperationException ex) {
+            }
+            
+            resetFull();
+            int i = 0;
+            for (Iterator it = map.keySet().iterator(); it.hasNext() && i < newValues.length; i++) {
+                Object key = it.next();
+                Object o = map.put(key, newValues[i]);
+                Object value = confirmed.put(key, newValues[i]);
+                verify();
+                assertEquals("Map.put should return previous value when changed",
+                    value, o);
+                assertTrue("Map should still contain key after put when changed",
+                    map.containsKey(key));
+                assertTrue("Map should contain new value after put when changed",
+                    map.containsValue(newValues[i]));
+        
+                // if duplicates are allowed, we're not guaranteed that the value
+                // no longer exists, so don't try checking that.
+                if (!isAllowDuplicateValues()) {
+                    assertTrue("Map should not contain old value after put when changed",
+                        !map.containsValue(values[i]));
+                }
+            }
+        } else {
+            try {
+                map.put(keys[0], values[0]);
+                fail("Expected UnsupportedOperationException on put (add)");
+            } catch (UnsupportedOperationException ex) {}
+        }
+    }
+
+    /**
+     * Tests Map.put(null, value)
+     */
+    public void testMapPutNullKey() {
+        resetFull();
+        Object[] values = getSampleValues();
+    
+        if (isPutAddSupported()) {
+            if (isAllowNullKey()) {
+                map.put(null, values[0]);
+            } else {
+                try {
+                    map.put(null, values[0]);
+                    fail("put(null, value) should throw NPE/IAE");
+                } catch (NullPointerException ex) {
+                } catch (IllegalArgumentException ex) {}
+            }
+        }
+    }
+    
+    /**
+     * Tests Map.put(null, value)
+     */
+    public void testMapPutNullValue() {
+        resetFull();
+        Object[] keys = getSampleKeys();
+        
+        if (isPutAddSupported()) {
+            if (isAllowNullValue()) {
+                map.put(keys[0], null);
+            } else {
+                try {
+                    map.put(keys[0], null);
+                    fail("put(key, null) should throw NPE/IAE");
+                } catch (NullPointerException ex) {
+                } catch (IllegalArgumentException ex) {}
+            }
+        }
+    }
+    
+    /**
+     * Tests Map.putAll(map)
+     */
+    public void testMapPutAll() {
+        if (!isPutAddSupported()) {
+            if (!isPutChangeSupported()) {
+                Map temp = makeFullMap();
+                resetEmpty();
+                try {
+                    map.putAll(temp);
+                    fail("Expected UnsupportedOperationException on putAll");
+                } catch (UnsupportedOperationException ex) {}
+            }
+            return;
+        }
+
+        // check putAll OK adding empty map to empty map
+        resetEmpty();
+        assertEquals(0, map.size());
+        map.putAll(new HashMap());
+        assertEquals(0, map.size());
+
+        // check putAll OK adding empty map to non-empty map
+        resetFull();
+        int size = map.size();
+        map.putAll(new HashMap());
+        assertEquals(size, map.size());
+
+        // check putAll OK adding non-empty map to empty map
+        resetEmpty();
+        Map m2 = makeFullMap();
+        map.putAll(m2);
+        confirmed.putAll(m2);
+        verify();
+
+        // check putAll OK adding non-empty JDK map to empty map
+        resetEmpty();
+        m2 = makeConfirmedMap();
+        Object[] keys = getSampleKeys();
+        Object[] values = getSampleValues();
+        for(int i = 0; i < keys.length; i++) {
+            m2.put(keys[i], values[i]);
+        }
+        map.putAll(m2);
+        confirmed.putAll(m2);
+        verify();
+
+        // check putAll OK adding non-empty JDK map to non-empty map
+        resetEmpty();
+        m2 = makeConfirmedMap();
+        map.put(keys[0], values[0]);
+        confirmed.put(keys[0], values[0]);
+        verify();
+        for(int i = 1; i < keys.length; i++) {
+            m2.put(keys[i], values[i]);
+        }
+        map.putAll(m2);
+        confirmed.putAll(m2);
+        verify();
+    }
+
+    /**
+     * Tests Map.remove(Object)
+     */
+    public void testMapRemove() {
+        if (!isRemoveSupported()) {
+            try {
+                resetFull();
+                map.remove(map.keySet().iterator().next());
+                fail("Expected UnsupportedOperationException on remove");
+            } catch (UnsupportedOperationException ex) {}
+            return;
+        }
+
+        resetEmpty();
+
+        Object[] keys = getSampleKeys();
+        Object[] values = getSampleValues();
+        for(int i = 0; i < keys.length; i++) {
+            Object o = map.remove(keys[i]);
+            assertTrue("First map.remove should return null", o == null);
+        }
+        verify();
+
+        resetFull();
+
+        for(int i = 0; i < keys.length; i++) {
+            Object o = map.remove(keys[i]);
+            confirmed.remove(keys[i]);
+            verify();
+
+            assertEquals("map.remove with valid key should return value",
+                         values[i], o);
+        }
+
+        Object[] other = getOtherKeys();
+
+        resetFull();
+        int size = map.size();
+        for (int i = 0; i < other.length; i++) {
+            Object o = map.remove(other[i]);
+            assertEquals("map.remove for nonexistent key should return null",
+                         o, null);
+            assertEquals("map.remove for nonexistent key should not " +
+                         "shrink map", size, map.size());
+        }
+        verify();
+    }
+
+    //-----------------------------------------------------------------------
+    /**
+     * Tests that the {@link Map#values} collection is backed by
+     * the underlying map for clear().
+     */
+    public void testValuesClearChangesMap() {
+        if (!isRemoveSupported()) return;
+        
+        // clear values, reflected in map
+        resetFull();
+        Collection values = map.values();
+        assertTrue(map.size() > 0);
+        assertTrue(values.size() > 0);
+        values.clear();
+        assertTrue(map.size() == 0);
+        assertTrue(values.size() == 0);
+        
+        // clear map, reflected in values
+        resetFull();
+        values = map.values();
+        assertTrue(map.size() > 0);
+        assertTrue(values.size() > 0);
+        map.clear();
+        assertTrue(map.size() == 0);
+        assertTrue(values.size() == 0);
+    }
+    
+    /**
+     * Tests that the {@link Map#keySet} collection is backed by
+     * the underlying map for clear().
+     */
+    public void testKeySetClearChangesMap() {
+        if (!isRemoveSupported()) return;
+        
+        // clear values, reflected in map
+        resetFull();
+        Set keySet = map.keySet();
+        assertTrue(map.size() > 0);
+        assertTrue(keySet.size() > 0);
+        keySet.clear();
+        assertTrue(map.size() == 0);
+        assertTrue(keySet.size() == 0);
+        
+        // clear map, reflected in values
+        resetFull();
+        keySet = map.keySet();
+        assertTrue(map.size() > 0);
+        assertTrue(keySet.size() > 0);
+        map.clear();
+        assertTrue(map.size() == 0);
+        assertTrue(keySet.size() == 0);
+    }
+    
+    /**
+     * Tests that the {@link Map#entrySet()} collection is backed by
+     * the underlying map for clear().
+     */
+    public void testEntrySetClearChangesMap() {
+        if (!isRemoveSupported()) return;
+        
+        // clear values, reflected in map
+        resetFull();
+        Set entrySet = map.entrySet();
+        assertTrue(map.size() > 0);
+        assertTrue(entrySet.size() > 0);
+        entrySet.clear();
+        assertTrue(map.size() == 0);
+        assertTrue(entrySet.size() == 0);
+        
+        // clear map, reflected in values
+        resetFull();
+        entrySet = map.entrySet();
+        assertTrue(map.size() > 0);
+        assertTrue(entrySet.size() > 0);
+        map.clear();
+        assertTrue(map.size() == 0);
+        assertTrue(entrySet.size() == 0);
+    }
+
+    //-----------------------------------------------------------------------    
+    public void testEntrySetContains1() {
+        resetFull();
+        Set entrySet = map.entrySet();
+        Map.Entry entry = (Map.Entry) entrySet.iterator().next();
+        assertEquals(true, entrySet.contains(entry));
+    }
+    public void testEntrySetContains2() {
+        resetFull();
+        Set entrySet = map.entrySet();
+        Map.Entry entry = (Map.Entry) entrySet.iterator().next();
+        Map.Entry test = cloneMapEntry(entry);
+        assertEquals(true, entrySet.contains(test));
+    }
+    public void testEntrySetContains3() {
+        resetFull();
+        Set entrySet = map.entrySet();
+        Map.Entry entry = (Map.Entry) entrySet.iterator().next();
+        HashMap temp = new HashMap();
+        temp.put(entry.getKey(), "A VERY DIFFERENT VALUE");
+        Map.Entry test = (Map.Entry) temp.entrySet().iterator().next();
+        assertEquals(false, entrySet.contains(test));
+    }
+    
+    public void testEntrySetRemove1() {
+        if (!isRemoveSupported()) return;
+        resetFull();
+        int size = map.size();
+        Set entrySet = map.entrySet();
+        Map.Entry entry = (Map.Entry) entrySet.iterator().next();
+        Object key = entry.getKey();
+        
+        assertEquals(true, entrySet.remove(entry));
+        assertEquals(false, map.containsKey(key));
+        assertEquals(size - 1, map.size());
+    }            
+    public void testEntrySetRemove2() {
+        if (!isRemoveSupported()) return;
+        resetFull();
+        int size = map.size();
+        Set entrySet = map.entrySet();
+        Map.Entry entry = (Map.Entry) entrySet.iterator().next();
+        Object key = entry.getKey();
+        Map.Entry test = cloneMapEntry(entry);
+        
+        assertEquals(true, entrySet.remove(test));
+        assertEquals(false, map.containsKey(key));
+        assertEquals(size - 1, map.size());
+    }
+    public void testEntrySetRemove3() {
+        if (!isRemoveSupported()) return;
+        resetFull();
+        int size = map.size();
+        Set entrySet = map.entrySet();
+        Map.Entry entry = (Map.Entry) entrySet.iterator().next();
+        Object key = entry.getKey();
+        HashMap temp = new HashMap();
+        temp.put(entry.getKey(), "A VERY DIFFERENT VALUE");
+        Map.Entry test = (Map.Entry) temp.entrySet().iterator().next();
+        
+        assertEquals(false, entrySet.remove(test));
+        assertEquals(true, map.containsKey(key));
+        assertEquals(size, map.size());
+    }
+    
+    //-----------------------------------------------------------------------
+    /**
+     * Tests that the {@link Map#values} collection is backed by
+     * the underlying map by removing from the values collection
+     * and testing if the value was removed from the map.
+     * <p>
+     * We should really test the "vice versa" case--that values removed
+     * from the map are removed from the values collection--also,
+     * but that's a more difficult test to construct (lacking a
+     * "removeValue" method.)
+     * </p>
+     * <p>
+     * See bug <a href="http://issues.apache.org/bugzilla/show_bug.cgi?id=9573">
+     * 9573</a>.
+     * </p>
+     */
+    public void testValuesRemoveChangesMap() {
+        resetFull();
+        Object[] sampleValues = getSampleValues();
+        Collection values = map.values();
+        for (int i = 0; i < sampleValues.length; i++) {
+            if (map.containsValue(sampleValues[i])) {
+                int j = 0;  // loop counter prevents infinite loops when remove is broken
+                while (values.contains(sampleValues[i]) && j < 10000) {
+                    try {
+                        values.remove(sampleValues[i]);
+                    } catch (UnsupportedOperationException e) {
+                        // if values.remove is unsupported, just skip this test
+                        return;
+                    }
+                    j++;
+                }
+                assertTrue("values().remove(obj) is broken", j < 10000);
+                assertTrue(
+                    "Value should have been removed from the underlying map.",
+                    !map.containsValue(sampleValues[i]));
+            }
+        }
+    }
+
+    /**
+     * Tests that the {@link Map#keySet} set is backed by
+     * the underlying map by removing from the keySet set
+     * and testing if the key was removed from the map.
+     */
+    public void testKeySetRemoveChangesMap() {
+        resetFull();
+        Object[] sampleKeys = getSampleKeys();
+        Set keys = map.keySet();
+        for (int i = 0; i < sampleKeys.length; i++) {
+            try {
+                keys.remove(sampleKeys[i]);
+            } catch (UnsupportedOperationException e) {
+                // if key.remove is unsupported, just skip this test
+                return;
+            }
+            assertTrue(
+                "Key should have been removed from the underlying map.",
+                !map.containsKey(sampleKeys[i]));
+        }
+    }
+
+    // TODO: Need:
+    //    testValuesRemovedFromEntrySetAreRemovedFromMap
+    //    same for EntrySet/KeySet/values's
+    //      Iterator.remove, removeAll, retainAll
+
+
+    /**
+     * Utility methods to create an array of Map.Entry objects
+     * out of the given key and value arrays.<P>
+     *
+     * @param keys    the array of keys
+     * @param values  the array of values
+     * @return an array of Map.Entry of those keys to those values
+     */
+    private Map.Entry[] makeEntryArray(Object[] keys, Object[] values) {
+        Map.Entry[] result = new Map.Entry[keys.length];
+        for (int i = 0; i < keys.length; i++) {
+            Map map = makeConfirmedMap();
+            map.put(keys[i], values[i]);
+            result[i] = (Map.Entry) map.entrySet().iterator().next();
+        }
+        return result;
+    }
+
+
+    /**
+     * Bulk test {@link Map#entrySet()}.  This method runs through all of
+     * the tests in {@link AbstractTestSet}.
+     * After modification operations, {@link #verify()} is invoked to ensure
+     * that the map and the other collection views are still valid.
+     *
+     * @return a {@link AbstractTestSet} instance for testing the map's entry set
+     */
+    public BulkTest bulkTestMapEntrySet() {
+        return new TestMapEntrySet();
+    }
+
+    public class TestMapEntrySet extends AbstractTestSet {
+        public TestMapEntrySet() {
+            super("MapEntrySet");
+        }
+
+        // Have to implement manually; entrySet doesn't support addAll
+        public Object[] getFullElements() {
+            Object[] k = getSampleKeys();
+            Object[] v = getSampleValues();
+            return makeEntryArray(k, v);
+        }
+        
+        // Have to implement manually; entrySet doesn't support addAll
+        public Object[] getOtherElements() {
+            Object[] k = getOtherKeys();
+            Object[] v = getOtherValues();
+            return makeEntryArray(k, v);
+        }
+        
+        public Set makeEmptySet() {
+            return makeEmptyMap().entrySet();
+        }
+        
+        public Set makeFullSet() {
+            return makeFullMap().entrySet();
+        }
+        
+        public boolean isAddSupported() {
+            // Collection views don't support add operations.
+            return false;
+        }
+        public boolean isRemoveSupported() {
+            // Entry set should only support remove if map does
+            return AbstractTestMap.this.isRemoveSupported();
+        }
+        public boolean isGetStructuralModify() {
+            return AbstractTestMap.this.isGetStructuralModify();
+        }
+        public boolean isTestSerialization() {
+            return false;
+        }
+
+        public void resetFull() {
+            AbstractTestMap.this.resetFull();
+            collection = map.entrySet();
+            TestMapEntrySet.this.confirmed = AbstractTestMap.this.confirmed.entrySet();
+        }
+        
+        public void resetEmpty() {
+            AbstractTestMap.this.resetEmpty();
+            collection = map.entrySet();
+            TestMapEntrySet.this.confirmed = AbstractTestMap.this.confirmed.entrySet();
+        }
+        
+        public void testMapEntrySetIteratorEntry() {
+            resetFull();
+            Iterator it = collection.iterator();
+            int count = 0;
+            while (it.hasNext()) {
+                Map.Entry entry = (Map.Entry) it.next();
+                assertEquals(true, AbstractTestMap.this.map.containsKey(entry.getKey()));
+                assertEquals(true, AbstractTestMap.this.map.containsValue(entry.getValue()));
+                if (isGetStructuralModify() == false) {
+                    assertEquals(AbstractTestMap.this.map.get(entry.getKey()), entry.getValue());
+                }
+                count++;
+            }
+            assertEquals(collection.size(), count);
+        }
+
+        public void testMapEntrySetIteratorEntrySetValue() {
+            Object key1 = getSampleKeys()[0];
+            Object key2 = (getSampleKeys().length ==1 ? getSampleKeys()[0] : getSampleKeys()[1]);
+            Object newValue1 = getNewSampleValues()[0];
+            Object newValue2 = (getNewSampleValues().length ==1 ? getNewSampleValues()[0] : getNewSampleValues()[1]);
+            
+            resetFull();
+            // explicitly get entries as sample values/keys are connected for some maps
+            // such as BeanMap
+            Iterator it = TestMapEntrySet.this.collection.iterator();
+            Map.Entry entry1 = getEntry(it, key1);
+            it = TestMapEntrySet.this.collection.iterator();
+            Map.Entry entry2 = getEntry(it, key2);
+            Iterator itConfirmed = TestMapEntrySet.this.confirmed.iterator();
+            Map.Entry entryConfirmed1 = getEntry(itConfirmed, key1);
+            itConfirmed = TestMapEntrySet.this.confirmed.iterator();
+            Map.Entry entryConfirmed2 = getEntry(itConfirmed, key2);
+            verify();
+            
+            if (isSetValueSupported() == false) {
+                try {
+                    entry1.setValue(newValue1);
+                } catch (UnsupportedOperationException ex) {
+                }
+                return;
+            }
+            
+            entry1.setValue(newValue1);
+            entryConfirmed1.setValue(newValue1);
+            assertEquals(newValue1, entry1.getValue());
+            assertEquals(true, AbstractTestMap.this.map.containsKey(entry1.getKey()));
+            assertEquals(true, AbstractTestMap.this.map.containsValue(newValue1));
+            assertEquals(newValue1, AbstractTestMap.this.map.get(entry1.getKey()));
+            verify();
+            
+            entry1.setValue(newValue1);
+            entryConfirmed1.setValue(newValue1);
+            assertEquals(newValue1, entry1.getValue());
+            assertEquals(true, AbstractTestMap.this.map.containsKey(entry1.getKey()));
+            assertEquals(true, AbstractTestMap.this.map.containsValue(newValue1));
+            assertEquals(newValue1, AbstractTestMap.this.map.get(entry1.getKey()));
+            verify();
+            
+            entry2.setValue(newValue2);
+            entryConfirmed2.setValue(newValue2);
+            assertEquals(newValue2, entry2.getValue());
+            assertEquals(true, AbstractTestMap.this.map.containsKey(entry2.getKey()));
+            assertEquals(true, AbstractTestMap.this.map.containsValue(newValue2));
+            assertEquals(newValue2, AbstractTestMap.this.map.get(entry2.getKey()));
+            verify();
+        }
+        
+        public Map.Entry getEntry(Iterator itConfirmed, Object key) {
+            Map.Entry entry = null;
+            while (itConfirmed.hasNext()) {
+                Map.Entry temp = (Map.Entry) itConfirmed.next();
+                if (temp.getKey() == null) {
+                    if (key == null) {
+                        entry = temp;
+                        break;
+                    }
+                } else if (temp.getKey().equals(key)) {
+                    entry = temp;
+                    break;
+                }
+            }
+            assertNotNull("No matching entry in map for key '" + key + "'", entry);
+            return entry;
+        }
+
+        public void testMapEntrySetRemoveNonMapEntry() {
+            if (isRemoveSupported() == false) return;
+            resetFull();
+            assertEquals(false, getSet().remove(null));
+            assertEquals(false, getSet().remove(new Object()));
+        }
+        
+        public void verify() {
+            super.verify();
+            AbstractTestMap.this.verify();
+        }
+    }
+
+
+    /**
+     * Bulk test {@link Map#keySet()}.  This method runs through all of
+     * the tests in {@link AbstractTestSet}.
+     * After modification operations, {@link #verify()} is invoked to ensure
+     * that the map and the other collection views are still valid.
+     *
+     * @return a {@link AbstractTestSet} instance for testing the map's key set
+     */
+    public BulkTest bulkTestMapKeySet() {
+        return new TestMapKeySet();
+    }
+
+    public class TestMapKeySet extends AbstractTestSet {
+        public TestMapKeySet() {
+            super("");
+        }
+        public Object[] getFullElements() {
+            return getSampleKeys();
+        }
+        
+        public Object[] getOtherElements() {
+            return getOtherKeys();
+        }
+        
+        public Set makeEmptySet() {
+            return makeEmptyMap().keySet();
+        }
+        
+        public Set makeFullSet() {
+            return makeFullMap().keySet();
+        }
+        
+        public boolean isNullSupported() {
+            return AbstractTestMap.this.isAllowNullKey();
+        }
+        public boolean isAddSupported() {
+            return false;
+        }
+        public boolean isRemoveSupported() {
+            return AbstractTestMap.this.isRemoveSupported();
+        }
+        public boolean isTestSerialization() {
+            return false;
+        }
+        
+        public void resetEmpty() {
+            AbstractTestMap.this.resetEmpty();
+            collection = map.keySet();
+            TestMapKeySet.this.confirmed = AbstractTestMap.this.confirmed.keySet();
+        }
+        
+        public void resetFull() {
+            AbstractTestMap.this.resetFull();
+            collection = map.keySet();
+            TestMapKeySet.this.confirmed = AbstractTestMap.this.confirmed.keySet();
+        }
+        
+        public void verify() {
+            super.verify();
+            AbstractTestMap.this.verify();
+        }
+    }
+
+
+    /**
+     * Bulk test {@link Map#values()}.  This method runs through all of
+     * the tests in {@link AbstractTestCollection}.
+     * After modification operations, {@link #verify()} is invoked to ensure
+     * that the map and the other collection views are still valid.
+     *
+     * @return a {@link AbstractTestCollection} instance for testing the map's
+     *    values collection
+     */
+    public BulkTest bulkTestMapValues() {
+        return new TestMapValues();
+    }
+
+    public class TestMapValues extends AbstractTestCollection {
+        public TestMapValues() {
+            super("");
+        }
+
+        public Object[] getFullElements() {
+            return getSampleValues();
+        }
+        
+        public Object[] getOtherElements() {
+            return getOtherValues();
+        }
+        
+        public Collection makeCollection() {
+            return makeEmptyMap().values();
+        }
+        
+        public Collection makeFullCollection() {
+            return makeFullMap().values();
+        }
+        
+        public boolean isNullSupported() {
+            return AbstractTestMap.this.isAllowNullKey();
+        }
+        public boolean isAddSupported() {
+            return false;
+        }
+        public boolean isRemoveSupported() {
+            return AbstractTestMap.this.isRemoveSupported();
+        }
+        public boolean isTestSerialization() {
+            return false;
+        }
+        
+        public boolean areEqualElementsDistinguishable() {
+            // equal values are associated with different keys, so they are
+            // distinguishable.  
+            return true;
+        }
+
+        public Collection makeConfirmedCollection() {
+            // never gets called, reset methods are overridden
+            return null;
+        }
+        
+        public Collection makeConfirmedFullCollection() {
+            // never gets called, reset methods are overridden
+            return null;
+        }
+        
+        public void resetFull() {
+            AbstractTestMap.this.resetFull();
+            collection = map.values();
+            TestMapValues.this.confirmed = AbstractTestMap.this.confirmed.values();
+        }
+        
+        public void resetEmpty() {
+            AbstractTestMap.this.resetEmpty();
+            collection = map.values();
+            TestMapValues.this.confirmed = AbstractTestMap.this.confirmed.values();
+        }
+
+        public void verify() {
+            super.verify();
+            AbstractTestMap.this.verify();
+        }
+
+        // TODO: should test that a remove on the values collection view
+        // removes the proper mapping and not just any mapping that may have
+        // the value equal to the value returned from the values iterator.
+    }
+
+
+    /**
+     * Resets the {@link #map}, {@link #entrySet}, {@link #keySet},
+     * {@link #values} and {@link #confirmed} fields to empty.
+     */
+    public void resetEmpty() {
+        this.map = makeEmptyMap();
+        views();
+        this.confirmed = makeConfirmedMap();
+    }
+
+    /**
+     * Resets the {@link #map}, {@link #entrySet}, {@link #keySet},
+     * {@link #values} and {@link #confirmed} fields to full.
+     */
+    public void resetFull() {
+        this.map = makeFullMap();
+        views();
+        this.confirmed = makeConfirmedMap();
+        Object[] k = getSampleKeys();
+        Object[] v = getSampleValues();
+        for (int i = 0; i < k.length; i++) {
+            confirmed.put(k[i], v[i]);
+        }
+    }
+
+
+    /**
+     * Resets the collection view fields.
+     */
+    private void views() {
+        this.keySet = map.keySet();
+        this.values = map.values();
+        this.entrySet = map.entrySet();
+    }
+
+
+    /**
+     * Verifies that {@link #map} is still equal to {@link #confirmed}.
+     * This method checks that the map is equal to the HashMap, 
+     * <I>and</I> that the map's collection views are still equal to
+     * the HashMap's collection views.  An <Code>equals</Code> test
+     * is done on the maps and their collection views; their size and
+     * <Code>isEmpty</Code> results are compared; their hashCodes are
+     * compared; and <Code>containsAll</Code> tests are run on the 
+     * collection views.
+     */
+    public void verify() {
+        verifyMap();
+        verifyEntrySet();
+        verifyKeySet();
+        verifyValues();
+    }
+
+    public void verifyMap() {
+        int size = confirmed.size();
+        boolean empty = confirmed.isEmpty();
+        assertEquals("Map should be same size as HashMap", 
+                     size, map.size());
+        assertEquals("Map should be empty if HashMap is", 
+                     empty, map.isEmpty());
+        assertEquals("hashCodes should be the same",
+                     confirmed.hashCode(), map.hashCode());
+        // this fails for LRUMap because confirmed.equals() somehow modifies
+        // map, causing concurrent modification exceptions.
+        //assertEquals("Map should still equal HashMap", confirmed, map);
+        // this works though and performs the same verification:
+        assertTrue("Map should still equal HashMap", map.equals(confirmed));
+        // TODO: this should really be reexamined to figure out why LRU map
+        // behaves like it does (the equals shouldn't modify since all accesses
+        // by the confirmed collection should be through an iterator, thus not
+        // causing LRUMap to change).
+    }
+
+    public void verifyEntrySet() {
+        int size = confirmed.size();
+        boolean empty = confirmed.isEmpty();
+        assertEquals("entrySet should be same size as HashMap's" +
+                     "\nTest: " + entrySet + "\nReal: " + confirmed.entrySet(),
+                     size, entrySet.size());
+        assertEquals("entrySet should be empty if HashMap is" +
+                     "\nTest: " + entrySet + "\nReal: " + confirmed.entrySet(),
+                     empty, entrySet.isEmpty());
+        assertTrue("entrySet should contain all HashMap's elements" +
+                   "\nTest: " + entrySet + "\nReal: " + confirmed.entrySet(),
+                   entrySet.containsAll(confirmed.entrySet()));
+        assertEquals("entrySet hashCodes should be the same" +
+                     "\nTest: " + entrySet + "\nReal: " + confirmed.entrySet(),
+                     confirmed.entrySet().hashCode(), entrySet.hashCode());
+        assertEquals("Map's entry set should still equal HashMap's",
+                     confirmed.entrySet(), entrySet);
+    }
+
+    public void verifyKeySet() { 
+        int size = confirmed.size();
+        boolean empty = confirmed.isEmpty();
+        assertEquals("keySet should be same size as HashMap's" +
+                     "\nTest: " + keySet + "\nReal: " + confirmed.keySet(),
+                     size, keySet.size());
+        assertEquals("keySet should be empty if HashMap is" +
+                     "\nTest: " + keySet + "\nReal: " + confirmed.keySet(),
+                     empty, keySet.isEmpty());
+        assertTrue("keySet should contain all HashMap's elements" +
+                   "\nTest: " + keySet + "\nReal: " + confirmed.keySet(),
+                   keySet.containsAll(confirmed.keySet()));
+        assertEquals("keySet hashCodes should be the same" +
+                     "\nTest: " + keySet + "\nReal: " + confirmed.keySet(),
+                     confirmed.keySet().hashCode(), keySet.hashCode());
+        assertEquals("Map's key set should still equal HashMap's",
+                     confirmed.keySet(), keySet);
+    }
+
+    public void verifyValues() {
+        List known = new ArrayList(confirmed.values());
+        List test = new ArrayList(values);
+
+        int size = confirmed.size();
+        boolean empty = confirmed.isEmpty();
+        assertEquals("values should be same size as HashMap's" +
+                     "\nTest: " + test + "\nReal: " + known,
+                     size, values.size());
+        assertEquals("values should be empty if HashMap is" +
+                     "\nTest: " + test + "\nReal: " + known,
+                     empty, values.isEmpty());
+        assertTrue("values should contain all HashMap's elements" +
+                   "\nTest: " + test + "\nReal: " + known,
+                    test.containsAll(known));
+        assertTrue("values should contain all HashMap's elements" +
+                   "\nTest: " + test + "\nReal: " + known,
+                   known.containsAll(test));
+        // originally coded to use a HashBag, but now separate jar so...
+        for (Iterator it = known.iterator(); it.hasNext();) {
+            boolean removed = test.remove(it.next());
+            assertTrue("Map's values should still equal HashMap's", removed);
+        }
+        assertTrue("Map's values should still equal HashMap's", test.isEmpty());
+    }
+
+
+    /**
+     * Erases any leftover instance variables by setting them to null.
+     */
+    public void tearDown() throws Exception {
+        map = null;
+        keySet = null;
+        entrySet = null;
+        values = null;
+        confirmed = null;
+    }
+
+}
diff --git a/dev/core/test/org/apache/commons/collections/map/TestIdentityMap.java b/dev/core/test/org/apache/commons/collections/map/TestIdentityMap.java
index ed4b725..13e042a 100644
--- a/dev/core/test/org/apache/commons/collections/map/TestIdentityMap.java
+++ b/dev/core/test/org/apache/commons/collections/map/TestIdentityMap.java
@@ -1,146 +1,146 @@
-/*

- *  Licensed to the Apache Software Foundation (ASF) under one or more

- *  contributor license agreements.  See the NOTICE file distributed with

- *  this work for additional information regarding copyright ownership.

- *  The ASF licenses this file to You 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 org.apache.commons.collections.map;

-

-import java.io.IOException;

-import java.io.Serializable;

-import java.util.Iterator;

-import java.util.Map;

-

-import junit.framework.Test;

-import junit.framework.TestSuite;

-import junit.textui.TestRunner;

-

-import org.apache.commons.collections.AbstractTestObject;

-import org.apache.commons.collections.IterableMap;

-

-/**

- * JUnit tests.

- * 

- * @version $Revision: 646780 $ $Date: 2008-04-10 13:48:07 +0100 (Thu, 10 Apr 2008) $

- * 

- * @author Stephen Colebourne

- */

-public class TestIdentityMap extends AbstractTestObject {

-    

-    private static final Integer I1A = new Integer(1);

-    private static final Integer I1B = new Integer(1);

-    private static final Integer I2A = new Integer(2);

-    private static final Integer I2B = new Integer(2);

-

-    public TestIdentityMap(String testName) {

-        super(testName);

-    }

-

-    public static void main(String[] args) {

-        TestRunner.run(suite());

-    }

-    

-    public static Test suite() {

-        return new TestSuite(TestIdentityMap.class);

-//        return BulkTest.makeSuite(TestIdentityMap.class);  // causes race condition!

-    }

-    

-    public Object makeObject() {

-        return new IdentityMap();

-    }

-    

-    public String getCompatibilityVersion() {

-        return "3";

-    }

-    

-    //-----------------------------------------------------------------------

-    public void testBasics() {

-        IterableMap map = new IdentityMap();

-        assertEquals(0, map.size());

-        

-        map.put(I1A, I2A);

-        assertEquals(1, map.size());

-        assertSame(I2A, map.get(I1A));

-        assertSame(null, map.get(I1B));

-        assertEquals(true, map.containsKey(I1A));

-        assertEquals(false, map.containsKey(I1B));

-        assertEquals(true, map.containsValue(I2A));

-        assertEquals(false, map.containsValue(I2B));

-        

-        map.put(I1A, I2B);

-        assertEquals(1, map.size());

-        assertSame(I2B, map.get(I1A));

-        assertSame(null, map.get(I1B));

-        assertEquals(true, map.containsKey(I1A));

-        assertEquals(false, map.containsKey(I1B));

-        assertEquals(false, map.containsValue(I2A));

-        assertEquals(true, map.containsValue(I2B));

-        

-        map.put(I1B, I2B);

-        assertEquals(2, map.size());

-        assertSame(I2B, map.get(I1A));

-        assertSame(I2B, map.get(I1B));

-        assertEquals(true, map.containsKey(I1A));

-        assertEquals(true, map.containsKey(I1B));

-        assertEquals(false, map.containsValue(I2A));

-        assertEquals(true, map.containsValue(I2B));

-    }

-    

-    //-----------------------------------------------------------------------

-    public void testHashEntry() {

-        IterableMap map = new IdentityMap();

-        

-        map.put(I1A, I2A);

-        map.put(I1B, I2A);

-        

-        Map.Entry entry1 = (Map.Entry) map.entrySet().iterator().next();

-        Iterator it = map.entrySet().iterator();

-        Map.Entry entry2 = (Map.Entry) it.next();

-        Map.Entry entry3 = (Map.Entry) it.next();

-        

-        assertEquals(true, entry1.equals(entry2));

-        assertEquals(true, entry2.equals(entry1));

-        assertEquals(false, entry1.equals(entry3));

-    }

-    

-    /**

-     * Compare the current serialized form of the Map

-     * against the canonical version in CVS.

-     */

-    public void testEmptyMapCompatibility() throws IOException, ClassNotFoundException {

-        // test to make sure the canonical form has been preserved

-        Map map = (Map) makeObject();

-        if (map instanceof Serializable && !skipSerializedCanonicalTests()) {

-            Map map2 = (Map) readExternalFormFromDisk(getCanonicalEmptyCollectionName(map));

-            assertEquals("Map is empty", 0, map2.size());

-        }

-    }

-

-    public void testClone() {

-        IdentityMap map = new IdentityMap(10);

-        map.put("1", "1");

-        Map cloned = (Map) map.clone();

-        assertEquals(map.size(), cloned.size());

-        assertSame(map.get("1"), cloned.get("1"));

-    }

-    

-//    public void testCreate() throws Exception {

-//        Map map = new IdentityMap();

-//        writeExternalFormToDisk((java.io.Serializable) map, "D:/dev/collections/data/test/IdentityMap.emptyCollection.version3.obj");

-//        map = new IdentityMap();

-//        map.put(I1A, I2A);

-//        map.put(I1B, I2A);

-//        map.put(I2A, I2B);

-//        writeExternalFormToDisk((java.io.Serializable) map, "D:/dev/collections/data/test/IdentityMap.fullCollection.version3.obj");

-//    }

-}

+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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 org.apache.commons.collections.map;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.Iterator;
+import java.util.Map;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+import org.apache.commons.collections.AbstractTestObject;
+import org.apache.commons.collections.IterableMap;
+
+/**
+ * JUnit tests.
+ * 
+ * @version $Revision: 646780 $ $Date: 2008-04-10 13:48:07 +0100 (Thu, 10 Apr 2008) $
+ * 
+ * @author Stephen Colebourne
+ */
+public class TestIdentityMap extends AbstractTestObject {
+    
+    private static final Integer I1A = new Integer(1);
+    private static final Integer I1B = new Integer(1);
+    private static final Integer I2A = new Integer(2);
+    private static final Integer I2B = new Integer(2);
+
+    public TestIdentityMap(String testName) {
+        super(testName);
+    }
+
+    public static void main(String[] args) {
+        TestRunner.run(suite());
+    }
+    
+    public static Test suite() {
+        return new TestSuite(TestIdentityMap.class);
+//        return BulkTest.makeSuite(TestIdentityMap.class);  // causes race condition!
+    }
+    
+    public Object makeObject() {
+        return new IdentityMap();
+    }
+    
+    public String getCompatibilityVersion() {
+        return "3";
+    }
+    
+    //-----------------------------------------------------------------------
+    public void testBasics() {
+        IterableMap map = new IdentityMap();
+        assertEquals(0, map.size());
+        
+        map.put(I1A, I2A);
+        assertEquals(1, map.size());
+        assertSame(I2A, map.get(I1A));
+        assertSame(null, map.get(I1B));
+        assertEquals(true, map.containsKey(I1A));
+        assertEquals(false, map.containsKey(I1B));
+        assertEquals(true, map.containsValue(I2A));
+        assertEquals(false, map.containsValue(I2B));
+        
+        map.put(I1A, I2B);
+        assertEquals(1, map.size());
+        assertSame(I2B, map.get(I1A));
+        assertSame(null, map.get(I1B));
+        assertEquals(true, map.containsKey(I1A));
+        assertEquals(false, map.containsKey(I1B));
+        assertEquals(false, map.containsValue(I2A));
+        assertEquals(true, map.containsValue(I2B));
+        
+        map.put(I1B, I2B);
+        assertEquals(2, map.size());
+        assertSame(I2B, map.get(I1A));
+        assertSame(I2B, map.get(I1B));
+        assertEquals(true, map.containsKey(I1A));
+        assertEquals(true, map.containsKey(I1B));
+        assertEquals(false, map.containsValue(I2A));
+        assertEquals(true, map.containsValue(I2B));
+    }
+    
+    //-----------------------------------------------------------------------
+    public void testHashEntry() {
+        IterableMap map = new IdentityMap();
+        
+        map.put(I1A, I2A);
+        map.put(I1B, I2A);
+        
+        Map.Entry entry1 = (Map.Entry) map.entrySet().iterator().next();
+        Iterator it = map.entrySet().iterator();
+        Map.Entry entry2 = (Map.Entry) it.next();
+        Map.Entry entry3 = (Map.Entry) it.next();
+        
+        assertEquals(true, entry1.equals(entry2));
+        assertEquals(true, entry2.equals(entry1));
+        assertEquals(false, entry1.equals(entry3));
+    }
+    
+    /**
+     * Compare the current serialized form of the Map
+     * against the canonical version in CVS.
+     */
+    public void testEmptyMapCompatibility() throws IOException, ClassNotFoundException {
+        // test to make sure the canonical form has been preserved
+        Map map = (Map) makeObject();
+        if (map instanceof Serializable && !skipSerializedCanonicalTests()) {
+            Map map2 = (Map) readExternalFormFromDisk(getCanonicalEmptyCollectionName(map));
+            assertEquals("Map is empty", 0, map2.size());
+        }
+    }
+
+    public void testClone() {
+        IdentityMap map = new IdentityMap(10);
+        map.put("1", "1");
+        Map cloned = (Map) map.clone();
+        assertEquals(map.size(), cloned.size());
+        assertSame(map.get("1"), cloned.get("1"));
+    }
+    
+//    public void testCreate() throws Exception {
+//        Map map = new IdentityMap();
+//        writeExternalFormToDisk((java.io.Serializable) map, "D:/dev/collections/data/test/IdentityMap.emptyCollection.version3.obj");
+//        map = new IdentityMap();
+//        map.put(I1A, I2A);
+//        map.put(I1B, I2A);
+//        map.put(I2A, I2B);
+//        writeExternalFormToDisk((java.io.Serializable) map, "D:/dev/collections/data/test/IdentityMap.fullCollection.version3.obj");
+//    }
+}
diff --git a/dev/core/test/org/apache/commons/collections/set/AbstractTestSet.java b/dev/core/test/org/apache/commons/collections/set/AbstractTestSet.java
index 34d7330..398fa78 100644
--- a/dev/core/test/org/apache/commons/collections/set/AbstractTestSet.java
+++ b/dev/core/test/org/apache/commons/collections/set/AbstractTestSet.java
@@ -1,195 +1,195 @@
-/*

- *  Licensed to the Apache Software Foundation (ASF) under one or more

- *  contributor license agreements.  See the NOTICE file distributed with

- *  this work for additional information regarding copyright ownership.

- *  The ASF licenses this file to You 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 org.apache.commons.collections.set;

-

-import java.util.Arrays;

-import java.util.Collection;

-import java.util.HashSet;

-import java.util.Iterator;

-import java.util.Set;

-

-import org.apache.commons.collections.collection.AbstractTestCollection;

-

-/**

- * Abstract test class for {@link Set} methods and contracts.

- * <p>

- * Since {@link Set} doesn't stipulate much new behavior that isn't already

- * found in {@link Collection}, this class basically just adds tests for

- * {@link Set#equals} and {@link Set#hashCode()} along with an updated

- * {@link #verify()} that ensures elements do not appear more than once in the

- * set.

- * <p>

- * To use, subclass and override the {@link #makeEmptySet()}

- * method.  You may have to override other protected methods if your

- * set is not modifiable, or if your set restricts what kinds of

- * elements may be added; see {@link AbstractTestCollection} for more details.

- *

- * @since Commons Collections 3.0

- * @version $Revision: 646780 $ $Date: 2008-04-10 13:48:07 +0100 (Thu, 10 Apr 2008) $

- * 

- * @author Paul Jack

- */

-public abstract class AbstractTestSet extends AbstractTestCollection {

-

-    /**

-     * JUnit constructor.

-     *

-     * @param name  name for test

-     */

-    public AbstractTestSet(String name) {

-        super(name);

-    }

-

-    //-----------------------------------------------------------------------

-    /**

-     * Provides additional verifications for sets.

-     */

-    public void verify() {

-        super.verify();

-        

-        assertEquals("Sets should be equal", confirmed, collection);

-        assertEquals("Sets should have equal hashCodes", 

-                     confirmed.hashCode(), collection.hashCode());

-        Collection set = makeConfirmedCollection();

-        Iterator iterator = collection.iterator();

-        while (iterator.hasNext()) {

-            assertTrue("Set.iterator should only return unique elements", 

-                       set.add(iterator.next()));

-        }

-    }

-

-    //-----------------------------------------------------------------------

-    /**

-     * Set equals method is defined.

-     */

-    public boolean isEqualsCheckable() {

-        return true;

-    }

-

-    /**

-     * Returns an empty Set for use in modification testing.

-     *

-     * @return a confirmed empty collection

-     */

-    public Collection makeConfirmedCollection() {

-        return new HashSet();

-    }

-

-    /**

-     * Returns a full Set for use in modification testing.

-     *

-     * @return a confirmed full collection

-     */

-    public Collection makeConfirmedFullCollection() {

-        Collection set = makeConfirmedCollection();

-        set.addAll(Arrays.asList(getFullElements()));

-        return set;

-    }

-

-    /**

-     * Makes an empty set.  The returned set should have no elements.

-     *

-     * @return an empty set

-     */

-    public abstract Set makeEmptySet();

-

-    /**

-     * Makes a full set by first creating an empty set and then adding

-     * all the elements returned by {@link #getFullElements()}.

-     *

-     * Override if your set does not support the add operation.

-     *

-     * @return a full set

-     */

-    public Set makeFullSet() {

-        Set set = makeEmptySet();

-        set.addAll(Arrays.asList(getFullElements()));

-        return set;

-    }

-

-    /**

-     * Makes an empty collection by invoking {@link #makeEmptySet()}.  

-     *

-     * @return an empty collection

-     */

-    public final Collection makeCollection() {

-        return makeEmptySet();

-    }

-

-    /**

-     * Makes a full collection by invoking {@link #makeFullSet()}.

-     *

-     * @return a full collection

-     */

-    public final Collection makeFullCollection() {

-        return makeFullSet();

-    }

-

-    //-----------------------------------------------------------------------

-    /**

-     * Return the {@link AbstractTestCollection#collection} fixture, but cast as a Set.  

-     */

-    public Set getSet() {

-        return (Set)collection;

-    }

-

-    /**

-     * Return the {@link AbstractTestCollection#confirmed} fixture, but cast as a Set.

-     */

-    public Set getConfirmedSet() {

-        return (Set)confirmed;

-    }

-

-    //-----------------------------------------------------------------------

-    /**

-     * Tests {@link Set#equals(Object)}.

-     */

-    public void testSetEquals() {

-        resetEmpty();

-        assertEquals("Empty sets should be equal", 

-                     getSet(), getConfirmedSet());

-        verify();

-

-        Collection set2 = makeConfirmedCollection();

-        set2.add("foo");

-        assertTrue("Empty set shouldn't equal nonempty set", 

-                   !getSet().equals(set2));

-

-        resetFull();

-        assertEquals("Full sets should be equal", getSet(), getConfirmedSet());

-        verify();

-

-        set2.clear();

-        set2.addAll(Arrays.asList(getOtherElements()));

-        assertTrue("Sets with different contents shouldn't be equal", 

-                   !getSet().equals(set2));

-    }

-

-    /**

-     * Tests {@link Set#hashCode()}.

-     */

-    public void testSetHashCode() {

-        resetEmpty();

-        assertEquals("Empty sets have equal hashCodes", 

-                     getSet().hashCode(), getConfirmedSet().hashCode());

-

-        resetFull();

-        assertEquals("Equal sets have equal hashCodes", 

-                     getSet().hashCode(), getConfirmedSet().hashCode());

-    }

-

-}

+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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 org.apache.commons.collections.set;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import org.apache.commons.collections.collection.AbstractTestCollection;
+
+/**
+ * Abstract test class for {@link Set} methods and contracts.
+ * <p>
+ * Since {@link Set} doesn't stipulate much new behavior that isn't already
+ * found in {@link Collection}, this class basically just adds tests for
+ * {@link Set#equals} and {@link Set#hashCode()} along with an updated
+ * {@link #verify()} that ensures elements do not appear more than once in the
+ * set.
+ * <p>
+ * To use, subclass and override the {@link #makeEmptySet()}
+ * method.  You may have to override other protected methods if your
+ * set is not modifiable, or if your set restricts what kinds of
+ * elements may be added; see {@link AbstractTestCollection} for more details.
+ *
+ * @since Commons Collections 3.0
+ * @version $Revision: 646780 $ $Date: 2008-04-10 13:48:07 +0100 (Thu, 10 Apr 2008) $
+ * 
+ * @author Paul Jack
+ */
+public abstract class AbstractTestSet extends AbstractTestCollection {
+
+    /**
+     * JUnit constructor.
+     *
+     * @param name  name for test
+     */
+    public AbstractTestSet(String name) {
+        super(name);
+    }
+
+    //-----------------------------------------------------------------------
+    /**
+     * Provides additional verifications for sets.
+     */
+    public void verify() {
+        super.verify();
+        
+        assertEquals("Sets should be equal", confirmed, collection);
+        assertEquals("Sets should have equal hashCodes", 
+                     confirmed.hashCode(), collection.hashCode());
+        Collection set = makeConfirmedCollection();
+        Iterator iterator = collection.iterator();
+        while (iterator.hasNext()) {
+            assertTrue("Set.iterator should only return unique elements", 
+                       set.add(iterator.next()));
+        }
+    }
+
+    //-----------------------------------------------------------------------
+    /**
+     * Set equals method is defined.
+     */
+    public boolean isEqualsCheckable() {
+        return true;
+    }
+
+    /**
+     * Returns an empty Set for use in modification testing.
+     *
+     * @return a confirmed empty collection
+     */
+    public Collection makeConfirmedCollection() {
+        return new HashSet();
+    }
+
+    /**
+     * Returns a full Set for use in modification testing.
+     *
+     * @return a confirmed full collection
+     */
+    public Collection makeConfirmedFullCollection() {
+        Collection set = makeConfirmedCollection();
+        set.addAll(Arrays.asList(getFullElements()));
+        return set;
+    }
+
+    /**
+     * Makes an empty set.  The returned set should have no elements.
+     *
+     * @return an empty set
+     */
+    public abstract Set makeEmptySet();
+
+    /**
+     * Makes a full set by first creating an empty set and then adding
+     * all the elements returned by {@link #getFullElements()}.
+     *
+     * Override if your set does not support the add operation.
+     *
+     * @return a full set
+     */
+    public Set makeFullSet() {
+        Set set = makeEmptySet();
+        set.addAll(Arrays.asList(getFullElements()));
+        return set;
+    }
+
+    /**
+     * Makes an empty collection by invoking {@link #makeEmptySet()}.  
+     *
+     * @return an empty collection
+     */
+    public final Collection makeCollection() {
+        return makeEmptySet();
+    }
+
+    /**
+     * Makes a full collection by invoking {@link #makeFullSet()}.
+     *
+     * @return a full collection
+     */
+    public final Collection makeFullCollection() {
+        return makeFullSet();
+    }
+
+    //-----------------------------------------------------------------------
+    /**
+     * Return the {@link AbstractTestCollection#collection} fixture, but cast as a Set.  
+     */
+    public Set getSet() {
+        return (Set)collection;
+    }
+
+    /**
+     * Return the {@link AbstractTestCollection#confirmed} fixture, but cast as a Set.
+     */
+    public Set getConfirmedSet() {
+        return (Set)confirmed;
+    }
+
+    //-----------------------------------------------------------------------
+    /**
+     * Tests {@link Set#equals(Object)}.
+     */
+    public void testSetEquals() {
+        resetEmpty();
+        assertEquals("Empty sets should be equal", 
+                     getSet(), getConfirmedSet());
+        verify();
+
+        Collection set2 = makeConfirmedCollection();
+        set2.add("foo");
+        assertTrue("Empty set shouldn't equal nonempty set", 
+                   !getSet().equals(set2));
+
+        resetFull();
+        assertEquals("Full sets should be equal", getSet(), getConfirmedSet());
+        verify();
+
+        set2.clear();
+        set2.addAll(Arrays.asList(getOtherElements()));
+        assertTrue("Sets with different contents shouldn't be equal", 
+                   !getSet().equals(set2));
+    }
+
+    /**
+     * Tests {@link Set#hashCode()}.
+     */
+    public void testSetHashCode() {
+        resetEmpty();
+        assertEquals("Empty sets have equal hashCodes", 
+                     getSet().hashCode(), getConfirmedSet().hashCode());
+
+        resetFull();
+        assertEquals("Equal sets have equal hashCodes", 
+                     getSet().hashCode(), getConfirmedSet().hashCode());
+    }
+
+}
diff --git a/reference/code-museum/src/com/google/gwt/museum/client/common/ControlInputPanel.java b/reference/code-museum/src/com/google/gwt/museum/client/common/ControlInputPanel.java
index c6f7516..371da89 100644
--- a/reference/code-museum/src/com/google/gwt/museum/client/common/ControlInputPanel.java
+++ b/reference/code-museum/src/com/google/gwt/museum/client/common/ControlInputPanel.java
@@ -1,107 +1,107 @@
-/*

- * Copyright 2009 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.museum.client.common;

-

-import com.google.gwt.core.client.GWT;

-import com.google.gwt.user.client.ui.Composite;

-import com.google.gwt.user.client.ui.FlexTable;

-import com.google.gwt.user.client.ui.HasText;

-import com.google.gwt.user.client.ui.TextBox;

-import com.google.gwt.user.client.ui.Widget;

-

-/**

- * Helper class to get/set default values for visual tests.

- */

-public class ControlInputPanel extends Composite {

-  /**

-   * Input

-   * 

-   * @param <V>

-   * @param <W>

-   */

-  public abstract static class Input<V, W extends Widget> {

-    protected String name;

-    protected V value;

-    protected W widget;

-

-    protected Input(String name) {

-      this.name = name;

-      this.widget = createInputWidget();

-    }

-

-    /**

-     * Gets the name of the input

-     * 

-     * @return the name of the input

-     */

-    public String getName() {

-      return name;

-    }

-

-    /**

-     * Gets the value of this input.

-     */

-    public abstract V getValue();

-

-    @SuppressWarnings("unchecked")

-    protected W createInputWidget() {

-      return (W) new TextBox();

-    }

-

-    protected void setValue(V value) {

-      ((HasText) widget).setText(value.toString());

-    }

-  }

-

-  /**

-   * Set/get integer value.

-   */

-

-  public static class IntegerInput extends Input<Integer, TextBox> {

-    public IntegerInput(String name, int defaultValue, ControlInputPanel p) {

-      this(name, defaultValue, defaultValue, p);

-    }

-

-    public IntegerInput(String name, int defaultHostedValue,

-        int defaultWebValue, ControlInputPanel p) {

-      super(name);

-

-      this.value = GWT.isScript() ? defaultWebValue : defaultHostedValue;

-      p.add(this);

-      widget.setText(value.toString());

-    }

-

-    @Override

-    public Integer getValue() {

-      return Integer.valueOf(widget.getText());

-    }

-  }

-

-  final FlexTable layout = new FlexTable();

-

-  private int numInputs;

-

-  public ControlInputPanel() {

-    layout.setWidth("100%");

-    initWidget(layout);

-  }

-

-  private void add(Input<?, ?> input) {

-    layout.setText(0, numInputs, input.getName());

-    layout.setWidget(1, numInputs, input.widget);

-  }

-}

+/*
+ * Copyright 2009 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.museum.client.common;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.FlexTable;
+import com.google.gwt.user.client.ui.HasText;
+import com.google.gwt.user.client.ui.TextBox;
+import com.google.gwt.user.client.ui.Widget;
+
+/**
+ * Helper class to get/set default values for visual tests.
+ */
+public class ControlInputPanel extends Composite {
+  /**
+   * Input
+   * 
+   * @param <V>
+   * @param <W>
+   */
+  public abstract static class Input<V, W extends Widget> {
+    protected String name;
+    protected V value;
+    protected W widget;
+
+    protected Input(String name) {
+      this.name = name;
+      this.widget = createInputWidget();
+    }
+
+    /**
+     * Gets the name of the input
+     * 
+     * @return the name of the input
+     */
+    public String getName() {
+      return name;
+    }
+
+    /**
+     * Gets the value of this input.
+     */
+    public abstract V getValue();
+
+    @SuppressWarnings("unchecked")
+    protected W createInputWidget() {
+      return (W) new TextBox();
+    }
+
+    protected void setValue(V value) {
+      ((HasText) widget).setText(value.toString());
+    }
+  }
+
+  /**
+   * Set/get integer value.
+   */
+
+  public static class IntegerInput extends Input<Integer, TextBox> {
+    public IntegerInput(String name, int defaultValue, ControlInputPanel p) {
+      this(name, defaultValue, defaultValue, p);
+    }
+
+    public IntegerInput(String name, int defaultHostedValue,
+        int defaultWebValue, ControlInputPanel p) {
+      super(name);
+
+      this.value = GWT.isScript() ? defaultWebValue : defaultHostedValue;
+      p.add(this);
+      widget.setText(value.toString());
+    }
+
+    @Override
+    public Integer getValue() {
+      return Integer.valueOf(widget.getText());
+    }
+  }
+
+  final FlexTable layout = new FlexTable();
+
+  private int numInputs;
+
+  public ControlInputPanel() {
+    layout.setWidth("100%");
+    initWidget(layout);
+  }
+
+  private void add(Input<?, ?> input) {
+    layout.setText(0, numInputs, input.getName());
+    layout.setWidget(1, numInputs, input.widget);
+  }
+}
diff --git a/reference/code-museum/src/com/google/gwt/museum/client/common/SimpleLayout.java b/reference/code-museum/src/com/google/gwt/museum/client/common/SimpleLayout.java
index 2a82ea1..1e713e7 100644
--- a/reference/code-museum/src/com/google/gwt/museum/client/common/SimpleLayout.java
+++ b/reference/code-museum/src/com/google/gwt/museum/client/common/SimpleLayout.java
@@ -1,108 +1,108 @@
-/*

- * Copyright 2009 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.museum.client.common;

-

-import com.google.gwt.user.client.ui.CaptionPanel;

-import com.google.gwt.user.client.ui.Composite;

-import com.google.gwt.user.client.ui.HasWidgets;

-import com.google.gwt.user.client.ui.HorizontalPanel;

-import com.google.gwt.user.client.ui.VerticalPanel;

-import com.google.gwt.user.client.ui.Widget;

-

-import java.util.Iterator;

-

-/**

- * Helper class to avoid manually assembling vertical and horizontal panels for

- * these tests. It acts like a "typewriter" layout.

- * 

- * So, for instance

- * <pre>

- *   // assume the existence of widgets a-z

- *   SimpleLayout layout = new SimpleLayout();

- *   layout.add(a);

- *   layout.add(b);

- *   layout.nextRow();

- *   layout.add(c);

- *   layout.nextRow();

- *   layout.add(d);

- *   layout.add(e);

- *</pre>

- * 

- * would be rendered as:

- * <pre>

- *  a b 

- *  c 

- *  d e

- *  </pre>

- * */

-public class SimpleLayout extends Composite implements HasWidgets {

-

-  private final VerticalPanel master = new VerticalPanel();

-  private VerticalPanel allRows = new VerticalPanel();

-  private HorizontalPanel currentRow;

-

-  public SimpleLayout() {

-    initWidget(master);

-    master.add(allRows);

-    nextRow();

-  }

-

-  /**

-   * Adds a widget to the current row with the given caption.

-   */

-  public void add(String caption, Widget w) {

-    CaptionPanel c = new CaptionPanel(caption);

-    c.add(w);

-    add(c);

-  }

-

-  /**

-   * Adds a widget to the current row.

-   */

-  public void add(Widget w) {

-    currentRow.add(w);

-  }

-

-  /**

-   * Adds a footer to this layout table, the footer is guaranteed to be beneath

-   * all the rows.

-   */

-  public void addFooter(Widget w) {

-    master.add(w);

-  }

-

-  public void clear() {

-    master.clear();

-  }

-

-  public Iterator<Widget> iterator() {

-    return master.iterator();

-  }

-

-  /**

-   * Creates another row. After creating this row, all widgets added using

-   * {@link #add(Widget)} and {@link #add(String, Widget)} will be added to the

-   * new row.

-   */

-  public void nextRow() {

-    currentRow = new HorizontalPanel();

-    allRows.add(currentRow);

-  }

-

-  public boolean remove(Widget w) {

-    return master.remove(w);

-  }

-}

+/*
+ * Copyright 2009 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.museum.client.common;
+
+import com.google.gwt.user.client.ui.CaptionPanel;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.HasWidgets;
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.VerticalPanel;
+import com.google.gwt.user.client.ui.Widget;
+
+import java.util.Iterator;
+
+/**
+ * Helper class to avoid manually assembling vertical and horizontal panels for
+ * these tests. It acts like a "typewriter" layout.
+ * 
+ * So, for instance
+ * <pre>
+ *   // assume the existence of widgets a-z
+ *   SimpleLayout layout = new SimpleLayout();
+ *   layout.add(a);
+ *   layout.add(b);
+ *   layout.nextRow();
+ *   layout.add(c);
+ *   layout.nextRow();
+ *   layout.add(d);
+ *   layout.add(e);
+ *</pre>
+ * 
+ * would be rendered as:
+ * <pre>
+ *  a b 
+ *  c 
+ *  d e
+ *  </pre>
+ * */
+public class SimpleLayout extends Composite implements HasWidgets {
+
+  private final VerticalPanel master = new VerticalPanel();
+  private VerticalPanel allRows = new VerticalPanel();
+  private HorizontalPanel currentRow;
+
+  public SimpleLayout() {
+    initWidget(master);
+    master.add(allRows);
+    nextRow();
+  }
+
+  /**
+   * Adds a widget to the current row with the given caption.
+   */
+  public void add(String caption, Widget w) {
+    CaptionPanel c = new CaptionPanel(caption);
+    c.add(w);
+    add(c);
+  }
+
+  /**
+   * Adds a widget to the current row.
+   */
+  public void add(Widget w) {
+    currentRow.add(w);
+  }
+
+  /**
+   * Adds a footer to this layout table, the footer is guaranteed to be beneath
+   * all the rows.
+   */
+  public void addFooter(Widget w) {
+    master.add(w);
+  }
+
+  public void clear() {
+    master.clear();
+  }
+
+  public Iterator<Widget> iterator() {
+    return master.iterator();
+  }
+
+  /**
+   * Creates another row. After creating this row, all widgets added using
+   * {@link #add(Widget)} and {@link #add(String, Widget)} will be added to the
+   * new row.
+   */
+  public void nextRow() {
+    currentRow = new HorizontalPanel();
+    allRows.add(currentRow);
+  }
+
+  public boolean remove(Widget w) {
+    return master.remove(w);
+  }
+}
diff --git a/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/Issue2553.java b/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/Issue2553.java
index 6595534..cd70ae6 100644
--- a/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/Issue2553.java
+++ b/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/Issue2553.java
@@ -1,52 +1,52 @@
-/*

- * 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.museum.client.defaultmuseum;

-

-import com.google.gwt.museum.client.common.AbstractIssue;

-import com.google.gwt.user.client.ui.Tree;

-import com.google.gwt.user.client.ui.Widget;

-

-/**

- * Test for http://code.google.com/p/google-web-toolkit/issues/detail?id=2553

- */

-public class Issue2553 extends AbstractIssue {

-

-  @Override

-  public Widget createIssue() {

-    Tree tree = new Tree();

-    tree.addItem("This is a long text displayed in a tree item");

-    tree.addItem("This is a long text displayed in a tree item and it's longer than the others");

-    tree.addItem("This is a long text displayed in a tree item");

-    return tree;

-  }

-

-  @Override

-  public String getInstructions() {

-    return "resize the browser to a smaller width than the tree's width";

-  }

-

-  @Override

-  public String getSummary() {

-    return "Word wrap of treeitem's text when browser width is too small";

-  }

-

-  @Override

-  public boolean hasCSS() {

-    return false;

-  }

-

-}

+/*
+ * 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.museum.client.defaultmuseum;
+
+import com.google.gwt.museum.client.common.AbstractIssue;
+import com.google.gwt.user.client.ui.Tree;
+import com.google.gwt.user.client.ui.Widget;
+
+/**
+ * Test for http://code.google.com/p/google-web-toolkit/issues/detail?id=2553
+ */
+public class Issue2553 extends AbstractIssue {
+
+  @Override
+  public Widget createIssue() {
+    Tree tree = new Tree();
+    tree.addItem("This is a long text displayed in a tree item");
+    tree.addItem("This is a long text displayed in a tree item and it's longer than the others");
+    tree.addItem("This is a long text displayed in a tree item");
+    return tree;
+  }
+
+  @Override
+  public String getInstructions() {
+    return "resize the browser to a smaller width than the tree's width";
+  }
+
+  @Override
+  public String getSummary() {
+    return "Word wrap of treeitem's text when browser width is too small";
+  }
+
+  @Override
+  public boolean hasCSS() {
+    return false;
+  }
+
+}
diff --git a/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/Issue3186.java b/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/Issue3186.java
index a8360ca..666450b 100644
--- a/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/Issue3186.java
+++ b/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/Issue3186.java
@@ -1,211 +1,211 @@
-/*

- * 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.museum.client.defaultmuseum;

-

-import com.google.gwt.dom.client.Element;

-import com.google.gwt.museum.client.common.AbstractIssue;

-import com.google.gwt.user.client.Event;

-import com.google.gwt.user.client.ui.AbsolutePanel;

-import com.google.gwt.user.client.ui.FlexTable;

-import com.google.gwt.user.client.ui.FocusPanel;

-import com.google.gwt.user.client.ui.MouseListener;

-import com.google.gwt.user.client.ui.MouseListenerCollection;

-import com.google.gwt.user.client.ui.Widget;

-

-import java.util.HashMap;

-import java.util.Map;

-

-/**

- * Ensure the ListenerWrapper for mouse still works like the old listeners did.

- */

-@SuppressWarnings("deprecation")

-public class Issue3186 extends AbstractIssue {

-

-  enum VisibleEvents {

-    mouseDown, mouseEnter, mouseLeave, mouseMove, mouseUp

-  }

-

-  private final class TestWidget extends FocusPanel {

-    private class Control implements MouseListener {

-      int controlX;

-      int controlY;

-      int controlMouseEnter;

-      int controlMouseLeave;

-

-      public void onMouseDown(Widget sender, int x, int y) {

-        this.controlX = x;

-        this.controlY = y;

-      }

-

-      public void onMouseEnter(Widget sender) {

-        ++controlMouseEnter;

-      }

-

-      public void onMouseLeave(Widget sender) {

-        ++controlMouseLeave;

-      }

-

-      public void onMouseMove(Widget sender, int x, int y) {

-        this.controlX = x;

-        this.controlY = y;

-      }

-

-      public void onMouseUp(Widget sender, int x, int y) {

-        this.controlX = x;

-        this.controlY = y;

-      }

-    }

-

-    private class Current implements MouseListener {

-      private int mouseEnterCount;

-      private int mouseLeaveCount;

-

-      public void onMouseDown(Widget sender, int x, int y) {

-        check(x, y, VisibleEvents.mouseDown);

-      }

-

-      public void onMouseEnter(Widget sender) {

-        ++mouseEnterCount;

-        if (mouseEnterCount != control.controlMouseEnter) {

-          fail("recieved:" + mouseEnterCount + " events, expected:"

-              + control.controlMouseEnter, VisibleEvents.mouseEnter);

-        } else {

-          pass(VisibleEvents.mouseEnter);

-        }

-        sender.getElement().getStyle().setProperty("background", "yellow");

-      }

-

-      public void onMouseLeave(Widget sender) {

-        ++mouseLeaveCount;

-        if (mouseLeaveCount != control.controlMouseLeave) {

-          fail("recieved:" + mouseLeaveCount + " events, expected:"

-              + control.controlMouseLeave, VisibleEvents.mouseLeave);

-        } else {

-          pass(VisibleEvents.mouseLeave);

-        }

-

-        sender.getElement().getStyle().setProperty("background", "");

-      }

-

-      public void onMouseMove(Widget sender, int x, int y) {

-        check(x, y, VisibleEvents.mouseMove);

-      }

-

-      public void onMouseUp(Widget sender, int x, int y) {

-        check(x, y, VisibleEvents.mouseUp);

-      }

-

-      private void check(int x, int y, VisibleEvents event) {

-        String errorReport = getErrorReport(x, y);

-        if (errorReport == null) {

-          eventToElement.get(event).setInnerHTML(

-              "<span style='color:green'>pass</span>");

-        } else {

-          fail(errorReport, event);

-        }

-      }

-

-      private String getErrorReport(int x, int y) {

-        String errorReport = null;

-        if (x != control.controlX) {

-          errorReport = "wanted x: " + control.controlX + " actual x" + x;

-        } else if (y != control.controlY) {

-          errorReport += "wanted y: " + control.controlY + " actual y" + y;

-        }

-        return errorReport;

-      }

-    }

-

-    private FlexTable layout = null;

-    private MouseListenerCollection collection = new MouseListenerCollection();

-

-    private Control control = new Control();

-    private Current current = new Current();

-    private final Map<VisibleEvents, Element> eventToElement = new HashMap<VisibleEvents, Element>();

-

-    public TestWidget() {

-      layout = new FlexTable();

-      layout.setCellPadding(3);

-      layout.setBorderWidth(2);

-

-      layout.setHTML(0, 0, "<b>MouseEvents</b>");

-      layout.setHTML(0, 1, "<b>Status</b>");

-

-      for (VisibleEvents e : VisibleEvents.values()) {

-        eventToElement.put(e, addResultRow(e.name()));

-      }

-      add(layout);

-      this.addMouseListener(current);

-      collection.add(control);

-    }

-

-    public void fail(String errorReport, VisibleEvents event) {

-      eventToElement.get(event).setInnerHTML(

-          "<span style='color:red'>" + errorReport + "</span>");

-    }

-

-    @Override

-    public void onBrowserEvent(Event event) {

-      collection.fireMouseEvent(this, event);

-      super.onBrowserEvent(event);

-    }

-

-    public void pass(VisibleEvents event) {

-      eventToElement.get(event).setInnerHTML(

-          "<span style='color:green'>pass</span>");

-    }

-

-    private Element addResultRow(String eventName) {

-      int row = layout.getRowCount();

-      layout.setHTML(row, 0, eventName);

-      layout.setHTML(row, 1, "<span style='color:red'>?</span>");

-      Element cell = layout.getCellFormatter().getElement(row, 1);

-      return cell;

-    }

-  }

-

-  @Override

-  public Widget createIssue() {

-    AbsolutePanel p = new AbsolutePanel();

-    p.setHeight("500px");

-    p.setWidth("500px");

-    final TestWidget dialog = showTestWidget();

-    p.add(dialog, 100, 100);

-    return p;

-  }

-

-  @Override

-  public String getInstructions() {

-    return "move your mouse around ";

-  }

-

-  @Override

-  public String getSummary() {

-    return "mouse listeners work the same";

-  }

-

-  @Override

-  public boolean hasCSS() {

-    return false;

-  }

-

-  private TestWidget showTestWidget() {

-    final TestWidget dialog = new TestWidget();

-    return dialog;

-  }

-

-}

+/*
+ * 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.museum.client.defaultmuseum;
+
+import com.google.gwt.dom.client.Element;
+import com.google.gwt.museum.client.common.AbstractIssue;
+import com.google.gwt.user.client.Event;
+import com.google.gwt.user.client.ui.AbsolutePanel;
+import com.google.gwt.user.client.ui.FlexTable;
+import com.google.gwt.user.client.ui.FocusPanel;
+import com.google.gwt.user.client.ui.MouseListener;
+import com.google.gwt.user.client.ui.MouseListenerCollection;
+import com.google.gwt.user.client.ui.Widget;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Ensure the ListenerWrapper for mouse still works like the old listeners did.
+ */
+@SuppressWarnings("deprecation")
+public class Issue3186 extends AbstractIssue {
+
+  enum VisibleEvents {
+    mouseDown, mouseEnter, mouseLeave, mouseMove, mouseUp
+  }
+
+  private final class TestWidget extends FocusPanel {
+    private class Control implements MouseListener {
+      int controlX;
+      int controlY;
+      int controlMouseEnter;
+      int controlMouseLeave;
+
+      public void onMouseDown(Widget sender, int x, int y) {
+        this.controlX = x;
+        this.controlY = y;
+      }
+
+      public void onMouseEnter(Widget sender) {
+        ++controlMouseEnter;
+      }
+
+      public void onMouseLeave(Widget sender) {
+        ++controlMouseLeave;
+      }
+
+      public void onMouseMove(Widget sender, int x, int y) {
+        this.controlX = x;
+        this.controlY = y;
+      }
+
+      public void onMouseUp(Widget sender, int x, int y) {
+        this.controlX = x;
+        this.controlY = y;
+      }
+    }
+
+    private class Current implements MouseListener {
+      private int mouseEnterCount;
+      private int mouseLeaveCount;
+
+      public void onMouseDown(Widget sender, int x, int y) {
+        check(x, y, VisibleEvents.mouseDown);
+      }
+
+      public void onMouseEnter(Widget sender) {
+        ++mouseEnterCount;
+        if (mouseEnterCount != control.controlMouseEnter) {
+          fail("recieved:" + mouseEnterCount + " events, expected:"
+              + control.controlMouseEnter, VisibleEvents.mouseEnter);
+        } else {
+          pass(VisibleEvents.mouseEnter);
+        }
+        sender.getElement().getStyle().setProperty("background", "yellow");
+      }
+
+      public void onMouseLeave(Widget sender) {
+        ++mouseLeaveCount;
+        if (mouseLeaveCount != control.controlMouseLeave) {
+          fail("recieved:" + mouseLeaveCount + " events, expected:"
+              + control.controlMouseLeave, VisibleEvents.mouseLeave);
+        } else {
+          pass(VisibleEvents.mouseLeave);
+        }
+
+        sender.getElement().getStyle().setProperty("background", "");
+      }
+
+      public void onMouseMove(Widget sender, int x, int y) {
+        check(x, y, VisibleEvents.mouseMove);
+      }
+
+      public void onMouseUp(Widget sender, int x, int y) {
+        check(x, y, VisibleEvents.mouseUp);
+      }
+
+      private void check(int x, int y, VisibleEvents event) {
+        String errorReport = getErrorReport(x, y);
+        if (errorReport == null) {
+          eventToElement.get(event).setInnerHTML(
+              "<span style='color:green'>pass</span>");
+        } else {
+          fail(errorReport, event);
+        }
+      }
+
+      private String getErrorReport(int x, int y) {
+        String errorReport = null;
+        if (x != control.controlX) {
+          errorReport = "wanted x: " + control.controlX + " actual x" + x;
+        } else if (y != control.controlY) {
+          errorReport += "wanted y: " + control.controlY + " actual y" + y;
+        }
+        return errorReport;
+      }
+    }
+
+    private FlexTable layout = null;
+    private MouseListenerCollection collection = new MouseListenerCollection();
+
+    private Control control = new Control();
+    private Current current = new Current();
+    private final Map<VisibleEvents, Element> eventToElement = new HashMap<VisibleEvents, Element>();
+
+    public TestWidget() {
+      layout = new FlexTable();
+      layout.setCellPadding(3);
+      layout.setBorderWidth(2);
+
+      layout.setHTML(0, 0, "<b>MouseEvents</b>");
+      layout.setHTML(0, 1, "<b>Status</b>");
+
+      for (VisibleEvents e : VisibleEvents.values()) {
+        eventToElement.put(e, addResultRow(e.name()));
+      }
+      add(layout);
+      this.addMouseListener(current);
+      collection.add(control);
+    }
+
+    public void fail(String errorReport, VisibleEvents event) {
+      eventToElement.get(event).setInnerHTML(
+          "<span style='color:red'>" + errorReport + "</span>");
+    }
+
+    @Override
+    public void onBrowserEvent(Event event) {
+      collection.fireMouseEvent(this, event);
+      super.onBrowserEvent(event);
+    }
+
+    public void pass(VisibleEvents event) {
+      eventToElement.get(event).setInnerHTML(
+          "<span style='color:green'>pass</span>");
+    }
+
+    private Element addResultRow(String eventName) {
+      int row = layout.getRowCount();
+      layout.setHTML(row, 0, eventName);
+      layout.setHTML(row, 1, "<span style='color:red'>?</span>");
+      Element cell = layout.getCellFormatter().getElement(row, 1);
+      return cell;
+    }
+  }
+
+  @Override
+  public Widget createIssue() {
+    AbsolutePanel p = new AbsolutePanel();
+    p.setHeight("500px");
+    p.setWidth("500px");
+    final TestWidget dialog = showTestWidget();
+    p.add(dialog, 100, 100);
+    return p;
+  }
+
+  @Override
+  public String getInstructions() {
+    return "move your mouse around ";
+  }
+
+  @Override
+  public String getSummary() {
+    return "mouse listeners work the same";
+  }
+
+  @Override
+  public boolean hasCSS() {
+    return false;
+  }
+
+  private TestWidget showTestWidget() {
+    final TestWidget dialog = new TestWidget();
+    return dialog;
+  }
+
+}
diff --git a/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/SpeedForClear.java b/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/SpeedForClear.java
index 558aeed..5e1f4cf 100644
--- a/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/SpeedForClear.java
+++ b/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/SpeedForClear.java
@@ -1,129 +1,129 @@
-/*

- * Copyright 2009 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.museum.client.defaultmuseum;

-

-import com.google.gwt.core.client.Duration;

-import com.google.gwt.event.dom.client.ClickEvent;

-import com.google.gwt.event.dom.client.ClickHandler;

-import com.google.gwt.museum.client.common.AbstractIssue;

-import com.google.gwt.museum.client.common.ControlInputPanel;

-import com.google.gwt.museum.client.common.SimpleLogger;

-import com.google.gwt.museum.client.common.ControlInputPanel.IntegerInput;

-import com.google.gwt.user.client.ui.Button;

-import com.google.gwt.user.client.ui.FlowPanel;

-import com.google.gwt.user.client.ui.Label;

-import com.google.gwt.user.client.ui.Panel;

-import com.google.gwt.user.client.ui.RootPanel;

-import com.google.gwt.user.client.ui.VerticalPanel;

-import com.google.gwt.user.client.ui.Widget;

-

-import java.util.ArrayList;

-import java.util.List;

-

-/*

- * Originally, on IE, about three seconds to distroy

- */

-/**

- * Tests bad behavior for clear.

- * 

- * <pre>

- * ff -- 1000 flow panels, aprox 500  millis

- * ie -- 1000 flow panels, aprox 3000 millis

- * 

- * in new version

- * ie -- 1000 flow panels, aprox 30-80 millis

- * ff -- 1000 flow panels, aprox 13-50 millis

- * </pre>

- * <p>

- * <img class='gallery' src='FlowPanel.png'/>

- * </p>

- */

-public class SpeedForClear extends AbstractIssue {

-  private Panel target;

-  private List<Widget> children = new ArrayList<Widget>();

-  private SimpleLogger log = new SimpleLogger();

-

-  @Override

-  public Widget createIssue() {

-    VerticalPanel v = new VerticalPanel();

-    ControlInputPanel p = new ControlInputPanel();

-    v.add(p);

-    v.add(log);

-    final IntegerInput size = new IntegerInput("flowpanel", 10, p);

-    Button create = new Button("create widget", new ClickHandler() {

-

-      public void onClick(ClickEvent event) {

-        createLargeFlowPanel(size.getValue());

-      }

-    });

-

-    Button distroy = new Button("time the removal", new ClickHandler() {

-      public void onClick(ClickEvent event) {

-        Duration d = new Duration();

-        target.clear();

-

-        log.report("Took " + d.elapsedMillis() + " milliseconds to clear "

-            + size.getValue() + " widgets from a flow panel");

-        for (Widget child : children) {

-          if (child.getElement().getPropertyString("__listener") != null) {

-            throw new IllegalStateException(

-                "each child should no longer have a listener");

-          }

-        }

-      }

-    });

-    v.add(create);

-    v.add(distroy);

-    return v;

-  }

-

-  @Override

-  public String getInstructions() {

-    return "check the speed of clear methods";

-  }

-

-  @Override

-  public String getSummary() {

-    return "clear() speed check";

-  }

-

-  @Override

-  public boolean hasCSS() {

-    return false;

-  }

-

-  private void createLargeFlowPanel(int size) {

-

-    if (target != null) {

-      target.removeFromParent();

-    }

-    target = new FlowPanel();

-

-    for (int i = 0; i < size; i++) {

-      Widget w = new Label("widget-" + i);

-      target.add(w);

-      children.add(w);

-    }

-

-    RootPanel.get().add(target);

-    for (Widget child : target) {

-      if (child.getElement().getPropertyString("__listener") == null) {

-        throw new IllegalStateException("each child should now have a listener");

-      }

-    }

-  }

-

-}

+/*
+ * Copyright 2009 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.museum.client.defaultmuseum;
+
+import com.google.gwt.core.client.Duration;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.museum.client.common.AbstractIssue;
+import com.google.gwt.museum.client.common.ControlInputPanel;
+import com.google.gwt.museum.client.common.SimpleLogger;
+import com.google.gwt.museum.client.common.ControlInputPanel.IntegerInput;
+import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.FlowPanel;
+import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.Panel;
+import com.google.gwt.user.client.ui.RootPanel;
+import com.google.gwt.user.client.ui.VerticalPanel;
+import com.google.gwt.user.client.ui.Widget;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/*
+ * Originally, on IE, about three seconds to distroy
+ */
+/**
+ * Tests bad behavior for clear.
+ * 
+ * <pre>
+ * ff -- 1000 flow panels, aprox 500  millis
+ * ie -- 1000 flow panels, aprox 3000 millis
+ * 
+ * in new version
+ * ie -- 1000 flow panels, aprox 30-80 millis
+ * ff -- 1000 flow panels, aprox 13-50 millis
+ * </pre>
+ * <p>
+ * <img class='gallery' src='FlowPanel.png'/>
+ * </p>
+ */
+public class SpeedForClear extends AbstractIssue {
+  private Panel target;
+  private List<Widget> children = new ArrayList<Widget>();
+  private SimpleLogger log = new SimpleLogger();
+
+  @Override
+  public Widget createIssue() {
+    VerticalPanel v = new VerticalPanel();
+    ControlInputPanel p = new ControlInputPanel();
+    v.add(p);
+    v.add(log);
+    final IntegerInput size = new IntegerInput("flowpanel", 10, p);
+    Button create = new Button("create widget", new ClickHandler() {
+
+      public void onClick(ClickEvent event) {
+        createLargeFlowPanel(size.getValue());
+      }
+    });
+
+    Button distroy = new Button("time the removal", new ClickHandler() {
+      public void onClick(ClickEvent event) {
+        Duration d = new Duration();
+        target.clear();
+
+        log.report("Took " + d.elapsedMillis() + " milliseconds to clear "
+            + size.getValue() + " widgets from a flow panel");
+        for (Widget child : children) {
+          if (child.getElement().getPropertyString("__listener") != null) {
+            throw new IllegalStateException(
+                "each child should no longer have a listener");
+          }
+        }
+      }
+    });
+    v.add(create);
+    v.add(distroy);
+    return v;
+  }
+
+  @Override
+  public String getInstructions() {
+    return "check the speed of clear methods";
+  }
+
+  @Override
+  public String getSummary() {
+    return "clear() speed check";
+  }
+
+  @Override
+  public boolean hasCSS() {
+    return false;
+  }
+
+  private void createLargeFlowPanel(int size) {
+
+    if (target != null) {
+      target.removeFromParent();
+    }
+    target = new FlowPanel();
+
+    for (int i = 0; i < size; i++) {
+      Widget w = new Label("widget-" + i);
+      target.add(w);
+      children.add(w);
+    }
+
+    RootPanel.get().add(target);
+    for (Widget child : target) {
+      if (child.getElement().getPropertyString("__listener") == null) {
+        throw new IllegalStateException("each child should now have a listener");
+      }
+    }
+  }
+
+}
diff --git a/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/SpeedForClippedImageLoading.java b/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/SpeedForClippedImageLoading.java
index f4dea21..04d216e 100644
--- a/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/SpeedForClippedImageLoading.java
+++ b/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/SpeedForClippedImageLoading.java
@@ -1,104 +1,104 @@
-/*

- * Copyright 2009 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.museum.client.defaultmuseum;

-

-import com.google.gwt.core.client.Duration;

-import com.google.gwt.core.client.GWT;

-import com.google.gwt.event.dom.client.ClickEvent;

-import com.google.gwt.event.dom.client.ClickHandler;

-import com.google.gwt.event.dom.client.LoadEvent;

-import com.google.gwt.event.dom.client.LoadHandler;

-import com.google.gwt.museum.client.common.AbstractIssue;

-import com.google.gwt.museum.client.common.ControlInputPanel;

-import com.google.gwt.museum.client.common.SimpleLogger;

-import com.google.gwt.museum.client.common.ControlInputPanel.IntegerInput;

-import com.google.gwt.user.client.ui.Button;

-import com.google.gwt.user.client.ui.Image;

-import com.google.gwt.user.client.ui.RootPanel;

-import com.google.gwt.user.client.ui.TreeImages;

-import com.google.gwt.user.client.ui.VerticalPanel;

-import com.google.gwt.user.client.ui.Widget;

-

-import java.util.ArrayList;

-import java.util.List;

-

-/**

- * Tests the speed of clipped images.

- * 

- */

-public class SpeedForClippedImageLoading extends AbstractIssue {

-  private SimpleLogger log = new SimpleLogger();

-  List<Image> images = new ArrayList<Image>();

-

-  @Override

-  public Widget createIssue() {

-    VerticalPanel v = new VerticalPanel();

-    ControlInputPanel p = new ControlInputPanel();

-    v.add(p);

-    v.add(log);

-    final IntegerInput size = new IntegerInput("how many clipped images", 10,

-        30, p);

-

-    Button createClippedImages = new Button("time the creation",

-        new ClickHandler() {

-          boolean firstTime = true;

-

-          public void onClick(ClickEvent event) {

-            final Duration d = new Duration();

-

-            final int numImages = size.getValue();

-            final TreeImages test = GWT.<TreeImages> create(TreeImages.class);

-

-            for (int i = 0; i < numImages; i++) {

-              Image current = test.treeClosed().createImage();

-

-              if (i == numImages - 1) {

-                current.addLoadHandler(new LoadHandler() {

-                  public void onLoad(LoadEvent event) {

-                    if (firstTime) {

-                      log.report("Took " + d.elapsedMillis()

-                          + " milliseconds to create the images");

-                    }

-                    firstTime = false;

-                  }

-                });

-              }

-              images.add(current);

-              RootPanel.get().add(current);

-            }

-          }

-        });

-

-    v.add(createClippedImages);

-    return v;

-  }

-

-  @Override

-  public String getInstructions() {

-    return "IE has traditionally been very slow compared to the other browsers,  this speed test in intended to allow us to capture and document improvements in the speed of clipped images";

-  }

-

-  @Override

-  public String getSummary() {

-    return "clear() speed check";

-  }

-

-  @Override

-  public boolean hasCSS() {

-    return false;

-  }

-

-}

+/*
+ * Copyright 2009 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.museum.client.defaultmuseum;
+
+import com.google.gwt.core.client.Duration;
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.event.dom.client.LoadEvent;
+import com.google.gwt.event.dom.client.LoadHandler;
+import com.google.gwt.museum.client.common.AbstractIssue;
+import com.google.gwt.museum.client.common.ControlInputPanel;
+import com.google.gwt.museum.client.common.SimpleLogger;
+import com.google.gwt.museum.client.common.ControlInputPanel.IntegerInput;
+import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.Image;
+import com.google.gwt.user.client.ui.RootPanel;
+import com.google.gwt.user.client.ui.TreeImages;
+import com.google.gwt.user.client.ui.VerticalPanel;
+import com.google.gwt.user.client.ui.Widget;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Tests the speed of clipped images.
+ * 
+ */
+public class SpeedForClippedImageLoading extends AbstractIssue {
+  private SimpleLogger log = new SimpleLogger();
+  List<Image> images = new ArrayList<Image>();
+
+  @Override
+  public Widget createIssue() {
+    VerticalPanel v = new VerticalPanel();
+    ControlInputPanel p = new ControlInputPanel();
+    v.add(p);
+    v.add(log);
+    final IntegerInput size = new IntegerInput("how many clipped images", 10,
+        30, p);
+
+    Button createClippedImages = new Button("time the creation",
+        new ClickHandler() {
+          boolean firstTime = true;
+
+          public void onClick(ClickEvent event) {
+            final Duration d = new Duration();
+
+            final int numImages = size.getValue();
+            final TreeImages test = GWT.<TreeImages> create(TreeImages.class);
+
+            for (int i = 0; i < numImages; i++) {
+              Image current = test.treeClosed().createImage();
+
+              if (i == numImages - 1) {
+                current.addLoadHandler(new LoadHandler() {
+                  public void onLoad(LoadEvent event) {
+                    if (firstTime) {
+                      log.report("Took " + d.elapsedMillis()
+                          + " milliseconds to create the images");
+                    }
+                    firstTime = false;
+                  }
+                });
+              }
+              images.add(current);
+              RootPanel.get().add(current);
+            }
+          }
+        });
+
+    v.add(createClippedImages);
+    return v;
+  }
+
+  @Override
+  public String getInstructions() {
+    return "IE has traditionally been very slow compared to the other browsers,  this speed test in intended to allow us to capture and document improvements in the speed of clipped images";
+  }
+
+  @Override
+  public String getSummary() {
+    return "clear() speed check";
+  }
+
+  @Override
+  public boolean hasCSS() {
+    return false;
+  }
+
+}
diff --git a/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/VisualsForCustomButtons.java b/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/VisualsForCustomButtons.java
index 7cf7229..26d58c3 100644
--- a/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/VisualsForCustomButtons.java
+++ b/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/VisualsForCustomButtons.java
@@ -1,73 +1,73 @@
-/*

- * Copyright 2009 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.museum.client.defaultmuseum;

-

-import com.google.gwt.museum.client.common.AbstractIssue;

-import com.google.gwt.museum.client.common.EventReporter;

-import com.google.gwt.museum.client.common.SimpleLayout;

-import com.google.gwt.user.client.ui.PushButton;

-import com.google.gwt.user.client.ui.ToggleButton;

-import com.google.gwt.user.client.ui.Tree;

-import com.google.gwt.user.client.ui.Widget;

-

-/**

- * Visual test for custom buttons.

- */

-public class VisualsForCustomButtons extends AbstractIssue {

-

-  @Override

-  public Widget createIssue() {

-    SimpleLayout l = new SimpleLayout();

-    Tree t = new Tree();

-    PushButton a = new PushButton("Simple-dum");

-    t.add(a);

-    PushButton a2 = new PushButton("Simple-dee");

-    t.add(a2);

-    PushButton aUp = new PushButton("A-up");

-    aUp.getDownFace().setHTML("A-down");

-    t.add(aUp);

-

-    ToggleButton b = new ToggleButton("B");

-    t.add(b);

-    l.add(t);

-    l.nextRow();

-    EventReporter<Object, Object> handler = new EventReporter<Object, Object>();

-    l.addFooter(handler);

-    handler.addClickHandler(a, l);

-    handler.addClickHandler(a2, l);

-    handler.addClickHandler(aUp, l);

-    handler.addClickHandler(b, l);

-

-    return l;

-  }

-

-  @Override

-  public String getInstructions() {

-    return "Check for custom buttons";

-  }

-

-  @Override

-  public String getSummary() {

-    return "CustomButton visual test";

-  }

-

-  @Override

-  public boolean hasCSS() {

-

-    return false;

-  }

-

-}

+/*
+ * Copyright 2009 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.museum.client.defaultmuseum;
+
+import com.google.gwt.museum.client.common.AbstractIssue;
+import com.google.gwt.museum.client.common.EventReporter;
+import com.google.gwt.museum.client.common.SimpleLayout;
+import com.google.gwt.user.client.ui.PushButton;
+import com.google.gwt.user.client.ui.ToggleButton;
+import com.google.gwt.user.client.ui.Tree;
+import com.google.gwt.user.client.ui.Widget;
+
+/**
+ * Visual test for custom buttons.
+ */
+public class VisualsForCustomButtons extends AbstractIssue {
+
+  @Override
+  public Widget createIssue() {
+    SimpleLayout l = new SimpleLayout();
+    Tree t = new Tree();
+    PushButton a = new PushButton("Simple-dum");
+    t.add(a);
+    PushButton a2 = new PushButton("Simple-dee");
+    t.add(a2);
+    PushButton aUp = new PushButton("A-up");
+    aUp.getDownFace().setHTML("A-down");
+    t.add(aUp);
+
+    ToggleButton b = new ToggleButton("B");
+    t.add(b);
+    l.add(t);
+    l.nextRow();
+    EventReporter<Object, Object> handler = new EventReporter<Object, Object>();
+    l.addFooter(handler);
+    handler.addClickHandler(a, l);
+    handler.addClickHandler(a2, l);
+    handler.addClickHandler(aUp, l);
+    handler.addClickHandler(b, l);
+
+    return l;
+  }
+
+  @Override
+  public String getInstructions() {
+    return "Check for custom buttons";
+  }
+
+  @Override
+  public String getSummary() {
+    return "CustomButton visual test";
+  }
+
+  @Override
+  public boolean hasCSS() {
+
+    return false;
+  }
+
+}
diff --git a/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/VisualsForDateBox.java b/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/VisualsForDateBox.java
index e9cab6e..273c8e8 100644
--- a/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/VisualsForDateBox.java
+++ b/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/VisualsForDateBox.java
@@ -1,194 +1,194 @@
-/*

- * 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.museum.client.defaultmuseum;

-

-import com.google.gwt.event.dom.client.ClickEvent;

-import com.google.gwt.event.dom.client.ClickHandler;

-import com.google.gwt.event.dom.client.KeyDownEvent;

-import com.google.gwt.event.dom.client.KeyDownHandler;

-import com.google.gwt.event.logical.shared.ValueChangeEvent;

-import com.google.gwt.event.logical.shared.ValueChangeHandler;

-import com.google.gwt.i18n.client.DateTimeFormat;

-import com.google.gwt.museum.client.common.AbstractIssue;

-import com.google.gwt.museum.client.common.EventReporter;

-import com.google.gwt.user.client.ui.Button;

-import com.google.gwt.user.client.ui.HTML;

-import com.google.gwt.user.client.ui.HorizontalPanel;

-import com.google.gwt.user.client.ui.Label;

-import com.google.gwt.user.client.ui.TextBox;

-import com.google.gwt.user.client.ui.VerticalPanel;

-import com.google.gwt.user.client.ui.Widget;

-import com.google.gwt.user.datepicker.client.DateBox;

-import com.google.gwt.user.datepicker.client.DatePicker;

-import com.google.gwt.user.datepicker.client.DateBox.DefaultFormat;

-

-import java.util.Date;

-

-/**

- * Visuals for date box.

- */

-public class VisualsForDateBox extends AbstractIssue {

-  class FormatWithNewYearsEve extends DefaultFormat {

-    public FormatWithNewYearsEve() {

-    }

-

-    public FormatWithNewYearsEve(DateTimeFormat format) {

-      super(format);

-    }

-

-    @Override

-    public String format(DateBox box, Date d) {

-      if (d == null) {

-        return "Please Change me";

-      } else {

-        return super.format(box, d);

-      }

-    }

-

-    @SuppressWarnings("deprecation")

-    @Override

-    public Date parse(DateBox box, String input, boolean reportError) {

-      if (input.equalsIgnoreCase("new year's eve")) {

-        Date d = new Date();

-        d.setDate(31);

-        d.setMonth(12);

-        return d;

-      } else {

-        return super.parse(box, input, reportError);

-      }

-    }

-  }

-

-  @Override

-  public Widget createIssue() {

-    VerticalPanel v = new VerticalPanel();

-    v.add(new HTML("<div style='height:25px'></div>"));

-    v.add(dateRange());

-    v.add(new HTML("<div style='height:25px'></div>"));

-    return v;

-  }

-

-  @Override

-  public String getInstructions() {

-    return "Instructions <ul><li>Click on first date box, see that date picker is displayed</li> "

-        + "<li>use arrow keys to navigate to second date box, select a date.</li> "

-        + "<li>type in a bad date then click back to the first date box. Your bad date should now be in red</li>"

-        + "<li>get back to the second box, now type in a valid date and tab away, its text should now be black again. </li>"

-        + "<li>Try typing 'New Year's Eve' in on the start datebox)</li>"

-        + "<li> Hit 'Show values' and confirm that you see the correct values</li></ul>";

-  }

-

-  @Override

-  public String getSummary() {

-    return "date box visual test";

-  }

-

-  @Override

-  public boolean hasCSS() {

-    return false;

-  }

-

-  private Widget dateRange() {

-    VerticalPanel v = new VerticalPanel();

-    HorizontalPanel p = new HorizontalPanel();

-    v.add(p);

-    final DateBox start = new DateBox(new DatePicker(), null,

-        new FormatWithNewYearsEve());

-

-    start.setWidth("13em");

-    final DateBox end = new DateBox();

-    end.setWidth("13em");

-

-    end.getDatePicker().addValueChangeHandler(new ValueChangeHandler<Date>() {

-      public void onValueChange(ValueChangeEvent<Date> event) {

-        start.removeStyleName("user-modified");

-      }

-    });

-

-    final TextBox startText = start.getTextBox();

-    startText.addKeyDownHandler(new KeyDownHandler() {

-      public void onKeyDown(KeyDownEvent e) {

-        if (e.isRightArrow()

-            && start.getCursorPos() == startText.getText().length()) {

-          start.hideDatePicker();

-          end.setFocus(true);

-        }

-      }

-    });

-

-    end.getTextBox().addKeyDownHandler(new KeyDownHandler() {

-      public void onKeyDown(KeyDownEvent e) {

-        if ((e.isLeftArrow()) && end.getCursorPos() == 0) {

-          end.hideDatePicker();

-          start.setFocus(true);

-        }

-      }

-    });

-

-    end.setValue(new Date());

-    p.add(start);

-    Label l = new Label(" - ");

-    l.setStyleName("filler");

-    p.add(l);

-    p.add(end);

-    final Label value = new Label();

-    p.add(value);

-    HorizontalPanel h2 = new HorizontalPanel();

-    v.add(h2);

-    h2.add(new Button("Short format", new ClickHandler() {

-      public void onClick(ClickEvent event) {

-        updateFormat(start, end, DateTimeFormat.getShortDateFormat());

-      }

-    }));

-    h2.add(new Button("Long format", new ClickHandler() {

-

-      public void onClick(ClickEvent event) {

-        updateFormat(start, end, DateTimeFormat.getMediumDateFormat());

-      }

-    }));

-

-    h2.add(new Button("Clear", new ClickHandler() {

-      public void onClick(ClickEvent sender) {

-        start.setValue(null);

-        end.setValue(null);

-      }

-    }));

-

-    h2.add(new Button("Show Values", new ClickHandler() {

-      public void onClick(ClickEvent event) {

-        DateTimeFormat f = DateTimeFormat.getShortDateFormat();

-        Date d1 = start.getValue();

-        Date d2 = end.getValue();

-        value.setText("Start: \"" + (d1 == null ? "null" : f.format(d1))

-            + "\" End: \"" + (d2 == null ? "null" : f.format(d2)) + "\"");

-      }

-    }));

-

-    EventReporter<Date, DateBox> reporter = new EventReporter<Date, DateBox>();

-    start.addValueChangeHandler(reporter);

-    end.addValueChangeHandler(reporter);

-    reporter.report("Events are logged here");

-    v.add(reporter);

-    return v;

-  }

-

-  private void updateFormat(DateBox start, DateBox end, DateTimeFormat format) {

-    // You can replace the format itself.

-    start.setFormat(new FormatWithNewYearsEve(format));

-    end.setFormat(new DefaultFormat(format));

-  }

+/*
+ * 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.museum.client.defaultmuseum;
+
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.event.dom.client.KeyDownEvent;
+import com.google.gwt.event.dom.client.KeyDownHandler;
+import com.google.gwt.event.logical.shared.ValueChangeEvent;
+import com.google.gwt.event.logical.shared.ValueChangeHandler;
+import com.google.gwt.i18n.client.DateTimeFormat;
+import com.google.gwt.museum.client.common.AbstractIssue;
+import com.google.gwt.museum.client.common.EventReporter;
+import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.HTML;
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.TextBox;
+import com.google.gwt.user.client.ui.VerticalPanel;
+import com.google.gwt.user.client.ui.Widget;
+import com.google.gwt.user.datepicker.client.DateBox;
+import com.google.gwt.user.datepicker.client.DatePicker;
+import com.google.gwt.user.datepicker.client.DateBox.DefaultFormat;
+
+import java.util.Date;
+
+/**
+ * Visuals for date box.
+ */
+public class VisualsForDateBox extends AbstractIssue {
+  class FormatWithNewYearsEve extends DefaultFormat {
+    public FormatWithNewYearsEve() {
+    }
+
+    public FormatWithNewYearsEve(DateTimeFormat format) {
+      super(format);
+    }
+
+    @Override
+    public String format(DateBox box, Date d) {
+      if (d == null) {
+        return "Please Change me";
+      } else {
+        return super.format(box, d);
+      }
+    }
+
+    @SuppressWarnings("deprecation")
+    @Override
+    public Date parse(DateBox box, String input, boolean reportError) {
+      if (input.equalsIgnoreCase("new year's eve")) {
+        Date d = new Date();
+        d.setDate(31);
+        d.setMonth(12);
+        return d;
+      } else {
+        return super.parse(box, input, reportError);
+      }
+    }
+  }
+
+  @Override
+  public Widget createIssue() {
+    VerticalPanel v = new VerticalPanel();
+    v.add(new HTML("<div style='height:25px'></div>"));
+    v.add(dateRange());
+    v.add(new HTML("<div style='height:25px'></div>"));
+    return v;
+  }
+
+  @Override
+  public String getInstructions() {
+    return "Instructions <ul><li>Click on first date box, see that date picker is displayed</li> "
+        + "<li>use arrow keys to navigate to second date box, select a date.</li> "
+        + "<li>type in a bad date then click back to the first date box. Your bad date should now be in red</li>"
+        + "<li>get back to the second box, now type in a valid date and tab away, its text should now be black again. </li>"
+        + "<li>Try typing 'New Year's Eve' in on the start datebox)</li>"
+        + "<li> Hit 'Show values' and confirm that you see the correct values</li></ul>";
+  }
+
+  @Override
+  public String getSummary() {
+    return "date box visual test";
+  }
+
+  @Override
+  public boolean hasCSS() {
+    return false;
+  }
+
+  private Widget dateRange() {
+    VerticalPanel v = new VerticalPanel();
+    HorizontalPanel p = new HorizontalPanel();
+    v.add(p);
+    final DateBox start = new DateBox(new DatePicker(), null,
+        new FormatWithNewYearsEve());
+
+    start.setWidth("13em");
+    final DateBox end = new DateBox();
+    end.setWidth("13em");
+
+    end.getDatePicker().addValueChangeHandler(new ValueChangeHandler<Date>() {
+      public void onValueChange(ValueChangeEvent<Date> event) {
+        start.removeStyleName("user-modified");
+      }
+    });
+
+    final TextBox startText = start.getTextBox();
+    startText.addKeyDownHandler(new KeyDownHandler() {
+      public void onKeyDown(KeyDownEvent e) {
+        if (e.isRightArrow()
+            && start.getCursorPos() == startText.getText().length()) {
+          start.hideDatePicker();
+          end.setFocus(true);
+        }
+      }
+    });
+
+    end.getTextBox().addKeyDownHandler(new KeyDownHandler() {
+      public void onKeyDown(KeyDownEvent e) {
+        if ((e.isLeftArrow()) && end.getCursorPos() == 0) {
+          end.hideDatePicker();
+          start.setFocus(true);
+        }
+      }
+    });
+
+    end.setValue(new Date());
+    p.add(start);
+    Label l = new Label(" - ");
+    l.setStyleName("filler");
+    p.add(l);
+    p.add(end);
+    final Label value = new Label();
+    p.add(value);
+    HorizontalPanel h2 = new HorizontalPanel();
+    v.add(h2);
+    h2.add(new Button("Short format", new ClickHandler() {
+      public void onClick(ClickEvent event) {
+        updateFormat(start, end, DateTimeFormat.getShortDateFormat());
+      }
+    }));
+    h2.add(new Button("Long format", new ClickHandler() {
+
+      public void onClick(ClickEvent event) {
+        updateFormat(start, end, DateTimeFormat.getMediumDateFormat());
+      }
+    }));
+
+    h2.add(new Button("Clear", new ClickHandler() {
+      public void onClick(ClickEvent sender) {
+        start.setValue(null);
+        end.setValue(null);
+      }
+    }));
+
+    h2.add(new Button("Show Values", new ClickHandler() {
+      public void onClick(ClickEvent event) {
+        DateTimeFormat f = DateTimeFormat.getShortDateFormat();
+        Date d1 = start.getValue();
+        Date d2 = end.getValue();
+        value.setText("Start: \"" + (d1 == null ? "null" : f.format(d1))
+            + "\" End: \"" + (d2 == null ? "null" : f.format(d2)) + "\"");
+      }
+    }));
+
+    EventReporter<Date, DateBox> reporter = new EventReporter<Date, DateBox>();
+    start.addValueChangeHandler(reporter);
+    end.addValueChangeHandler(reporter);
+    reporter.report("Events are logged here");
+    v.add(reporter);
+    return v;
+  }
+
+  private void updateFormat(DateBox start, DateBox end, DateTimeFormat format) {
+    // You can replace the format itself.
+    start.setFormat(new FormatWithNewYearsEve(format));
+    end.setFormat(new DefaultFormat(format));
+  }
 }
\ No newline at end of file
diff --git a/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/VisualsForSuggestBox.java b/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/VisualsForSuggestBox.java
index 2c7c111..a495c3a 100644
--- a/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/VisualsForSuggestBox.java
+++ b/reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/VisualsForSuggestBox.java
@@ -1,141 +1,141 @@
-/*

- * Copyright 2009 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.museum.client.defaultmuseum;

-

-import com.google.gwt.dom.client.Document;

-import com.google.gwt.dom.client.Element;

-import com.google.gwt.event.dom.client.ClickEvent;

-import com.google.gwt.event.dom.client.ClickHandler;

-import com.google.gwt.event.dom.client.MouseDownEvent;

-import com.google.gwt.event.dom.client.MouseDownHandler;

-import com.google.gwt.museum.client.common.AbstractIssue;

-import com.google.gwt.user.client.Timer;

-import com.google.gwt.user.client.ui.Button;

-import com.google.gwt.user.client.ui.FlexTable;

-import com.google.gwt.user.client.ui.HTML;

-import com.google.gwt.user.client.ui.Label;

-import com.google.gwt.user.client.ui.MultiWordSuggestOracle;

-import com.google.gwt.user.client.ui.SuggestBox;

-import com.google.gwt.user.client.ui.VerticalPanel;

-import com.google.gwt.user.client.ui.Widget;

-

-import java.util.Arrays;

-import java.util.List;

-

-/**

- * Visual test for suggest box.

- */

-public class VisualsForSuggestBox extends AbstractIssue {

-  MultiWordSuggestOracle girlsNames = new MultiWordSuggestOracle();

-  MultiWordSuggestOracle girlsNamesWithDefault = new MultiWordSuggestOracle();

-

-  Element textBoxToWrap;

-

-  VisualsForSuggestBox() {

-    List<String> femaleNames = Arrays.asList("Jamie", "Jill", "Jackie",

-        "Susan", "Helen", "Emily", "Karen", "Emily", "Isabella", "Emma", "Ava",

-        "Madison", "Sophia", "Olivia", "Abigail", "Hannah", "Elizabeth",

-        "Addison", "Samantha", "Ashley", "Alyssa", "Mia", "Chloe", "Natalie",

-        "Sarah", "Alexis", "Grace", "Ella", "Brianna", "Hailey", "Taylor",

-        "Anna", "Kayla", "Lily", "Lauren", "Victoria", "Savannah", "Nevaeh",

-        "Jasmine", "Lillian", "Julia", "Sofia", "Kaylee", "Sydney",

-        "Gabriella", "Katherine", "Alexa", "Destiny", "Jessica", "Morgan",

-        "Kaitlyn", "Brooke", "Allison", "Makayla", "Avery", "Alexandra",

-        "Jocelyn");

-    girlsNames.addAll(femaleNames);

-    girlsNamesWithDefault.addAll(femaleNames);

-    girlsNamesWithDefault.setDefaultSuggestionsFromText(femaleNames);

-  }

-

-  /**

-   * This is the entry point method.

-   */

-  @Override

-  public Widget createIssue() {

-    VerticalPanel panel = new VerticalPanel();

-    HTML wrapperText = new HTML(

-        "Make sure this wrapped suggest box works as normal.");

-    panel.add(wrapperText);

-    textBoxToWrap = Document.get().createTextInputElement();

-    wrapperText.getElement().appendChild(textBoxToWrap);

-

-    panel.add(new HTML(

-        "Select the show button, nothing should open <br/> Type 'e' and select the button again, now a suggestion list should open and close."));

-    panel.add(manuallyShowAndHide());

-    panel.add(new Label(

-        "Click on suggest box, it should open automatically. Check that First item is not selected"));

-    panel.add(suggestBoxWithDefault());

-    return panel;

-  }

-

-  @Override

-  public String getInstructions() {

-    return "Follow the directions above each suggest box";

-  }

-

-  @Override

-  public String getSummary() {

-    return "suggest box visuals";

-  }

-

-  @Override

-  public boolean hasCSS() {

-    return false;

-  }

-

-  private Widget manuallyShowAndHide() {

-    FlexTable t = new FlexTable();

-    t.getFlexCellFormatter().setColSpan(0, 0, 20);

-    final SuggestBox box = simpleSuggestBox();

-    box.setAnimationEnabled(true);

-    t.setWidget(0, 0, box);

-

-    Button showSuggestions = new Button(

-        "show suggestions, then hide after 2  seconds", new ClickHandler() {

-          public void onClick(ClickEvent event) {

-            box.showSuggestionList();

-            new Timer() {

-

-              @Override

-              public void run() {

-                box.hideSuggestionList();

-              }

-

-            }.schedule(2000);

-          }

-        });

-    t.setWidget(1, 0, showSuggestions);

-    return t;

-  }

-

-  private SuggestBox simpleSuggestBox() {

-    SuggestBox b = new SuggestBox(girlsNames);

-    return b;

-  }

-

-  private SuggestBox suggestBoxWithDefault() {

-    final SuggestBox b = new SuggestBox(girlsNamesWithDefault);

-    b.setAutoSelectEnabled(false);

-    b.getTextBox().addMouseDownHandler(new MouseDownHandler() {

-

-      public void onMouseDown(MouseDownEvent event) {

-        b.showSuggestionList();

-      }

-

-    });

-    return b;

-  }

+/*
+ * Copyright 2009 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.museum.client.defaultmuseum;
+
+import com.google.gwt.dom.client.Document;
+import com.google.gwt.dom.client.Element;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.event.dom.client.MouseDownEvent;
+import com.google.gwt.event.dom.client.MouseDownHandler;
+import com.google.gwt.museum.client.common.AbstractIssue;
+import com.google.gwt.user.client.Timer;
+import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.FlexTable;
+import com.google.gwt.user.client.ui.HTML;
+import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.MultiWordSuggestOracle;
+import com.google.gwt.user.client.ui.SuggestBox;
+import com.google.gwt.user.client.ui.VerticalPanel;
+import com.google.gwt.user.client.ui.Widget;
+
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * Visual test for suggest box.
+ */
+public class VisualsForSuggestBox extends AbstractIssue {
+  MultiWordSuggestOracle girlsNames = new MultiWordSuggestOracle();
+  MultiWordSuggestOracle girlsNamesWithDefault = new MultiWordSuggestOracle();
+
+  Element textBoxToWrap;
+
+  VisualsForSuggestBox() {
+    List<String> femaleNames = Arrays.asList("Jamie", "Jill", "Jackie",
+        "Susan", "Helen", "Emily", "Karen", "Emily", "Isabella", "Emma", "Ava",
+        "Madison", "Sophia", "Olivia", "Abigail", "Hannah", "Elizabeth",
+        "Addison", "Samantha", "Ashley", "Alyssa", "Mia", "Chloe", "Natalie",
+        "Sarah", "Alexis", "Grace", "Ella", "Brianna", "Hailey", "Taylor",
+        "Anna", "Kayla", "Lily", "Lauren", "Victoria", "Savannah", "Nevaeh",
+        "Jasmine", "Lillian", "Julia", "Sofia", "Kaylee", "Sydney",
+        "Gabriella", "Katherine", "Alexa", "Destiny", "Jessica", "Morgan",
+        "Kaitlyn", "Brooke", "Allison", "Makayla", "Avery", "Alexandra",
+        "Jocelyn");
+    girlsNames.addAll(femaleNames);
+    girlsNamesWithDefault.addAll(femaleNames);
+    girlsNamesWithDefault.setDefaultSuggestionsFromText(femaleNames);
+  }
+
+  /**
+   * This is the entry point method.
+   */
+  @Override
+  public Widget createIssue() {
+    VerticalPanel panel = new VerticalPanel();
+    HTML wrapperText = new HTML(
+        "Make sure this wrapped suggest box works as normal.");
+    panel.add(wrapperText);
+    textBoxToWrap = Document.get().createTextInputElement();
+    wrapperText.getElement().appendChild(textBoxToWrap);
+
+    panel.add(new HTML(
+        "Select the show button, nothing should open <br/> Type 'e' and select the button again, now a suggestion list should open and close."));
+    panel.add(manuallyShowAndHide());
+    panel.add(new Label(
+        "Click on suggest box, it should open automatically. Check that First item is not selected"));
+    panel.add(suggestBoxWithDefault());
+    return panel;
+  }
+
+  @Override
+  public String getInstructions() {
+    return "Follow the directions above each suggest box";
+  }
+
+  @Override
+  public String getSummary() {
+    return "suggest box visuals";
+  }
+
+  @Override
+  public boolean hasCSS() {
+    return false;
+  }
+
+  private Widget manuallyShowAndHide() {
+    FlexTable t = new FlexTable();
+    t.getFlexCellFormatter().setColSpan(0, 0, 20);
+    final SuggestBox box = simpleSuggestBox();
+    box.setAnimationEnabled(true);
+    t.setWidget(0, 0, box);
+
+    Button showSuggestions = new Button(
+        "show suggestions, then hide after 2  seconds", new ClickHandler() {
+          public void onClick(ClickEvent event) {
+            box.showSuggestionList();
+            new Timer() {
+
+              @Override
+              public void run() {
+                box.hideSuggestionList();
+              }
+
+            }.schedule(2000);
+          }
+        });
+    t.setWidget(1, 0, showSuggestions);
+    return t;
+  }
+
+  private SuggestBox simpleSuggestBox() {
+    SuggestBox b = new SuggestBox(girlsNames);
+    return b;
+  }
+
+  private SuggestBox suggestBoxWithDefault() {
+    final SuggestBox b = new SuggestBox(girlsNamesWithDefault);
+    b.setAutoSelectEnabled(false);
+    b.getTextBox().addMouseDownHandler(new MouseDownHandler() {
+
+      public void onMouseDown(MouseDownEvent event) {
+        b.showSuggestionList();
+      }
+
+    });
+    return b;
+  }
 }
\ No newline at end of file
diff --git a/user/src/com/google/gwt/dom/client/NativeEvent.java b/user/src/com/google/gwt/dom/client/NativeEvent.java
index 622286b..60e2c77 100644
--- a/user/src/com/google/gwt/dom/client/NativeEvent.java
+++ b/user/src/com/google/gwt/dom/client/NativeEvent.java
@@ -1,225 +1,225 @@
-/*

- * Copyright 2009 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.dom.client;

-

-import com.google.gwt.core.client.JavaScriptObject;

-

-/**

- * The native dom event.

- */

-public class NativeEvent extends JavaScriptObject {

-

-  /**

-   * The left mouse button.

-   */

-  public static final int BUTTON_LEFT = 1;

-

-  /**

-   * The middle mouse button.

-   */

-  public static final int BUTTON_MIDDLE = 4;

-

-  /**

-   * The right mouse button.

-   */

-  public static final int BUTTON_RIGHT = 2;

-

-  /**

-   * Required constructor for GWT compiler to function.

-   */

-  protected NativeEvent() {

-  }

-

-  /**

-   * Gets whether the ALT key was depressed when the given event occurred.

-   * 

-   * @return <code>true</code> if ALT was depressed when the event occurred

-   */

-  public final boolean getAltKey() {

-    return DOMImpl.impl.eventGetAltKey(this);

-  }

-

-  /**

-   * Gets the mouse buttons that were depressed when the given event occurred.

-   * 

-   * @return a bit-field, defined by {@link NativeEvent#BUTTON_LEFT},

-   *         {@link NativeEvent#BUTTON_MIDDLE}, and

-   *         {@link NativeEvent#BUTTON_RIGHT}

-   */

-  public final int getButton() {

-    return DOMImpl.impl.eventGetButton(this);

-  }

-

-  /**

-   * Gets the mouse x-position within the browser window's client area.

-   * 

-   * @return the mouse x-position

-   */

-  public final int getClientX() {

-    return DOMImpl.impl.eventGetClientX(this);

-  }

-

-  /**

-   * Gets the mouse y-position within the browser window's client area.

-   * 

-   * @return the mouse y-position

-   */

-  public final int getClientY() {

-    return DOMImpl.impl.eventGetClientY(this);

-  }

-

-  /**

-   * Gets whether the CTRL key was depressed when the given event occurred.

-   * 

-   * @return <code>true</code> if CTRL was depressed when the event occurred

-   */

-  public final boolean getCtrlKey() {

-    return DOMImpl.impl.eventGetCtrlKey(this);

-  }

-

-  /**

-   * Gets the current target element of this event. This is the element whose

-   * listener fired last, not the element which fired the event initially.

-   * 

-   * @return the event's current target element

-   */

-  public final EventTarget getCurrentEventTarget() {

-    return DOMImpl.impl.eventGetCurrentTarget(this);

-  }

-

-  /**

-   * Returns the element that was the actual target of the given event.

-   * 

-   * @return the target element

-   */

-  public final EventTarget getEventTarget() {

-    return DOMImpl.impl.eventGetTarget(this);

-  }

-

-  /**

-   * Gets the key code associated with this event.

-   * 

-   * <p>

-   * For key press events, this method returns the Unicode value of the

-   * character generated. For key down and key up events, it returns the code

-   * associated with the physical key.

-   * </p>

-   * 

-   * @return the Unicode character or key code.

-   * @see com.google.gwt.event.dom.client.KeyCodes

-   */

-  public final int getKeyCode() {

-    return DOMImpl.impl.eventGetKeyCode(this);

-  }

-

-  /**

-   * Gets whether the META key was depressed when the given event occurred.

-   * 

-   * @return <code>true</code> if META was depressed when the event occurred

-   */

-  public final boolean getMetaKey() {

-    return DOMImpl.impl.eventGetMetaKey(this);

-  }

-

-  /**

-   * Gets the velocity of the mouse wheel associated with the event along the Y

-   * axis.

-   * <p>

-   * The velocity of the event is an artifical measurement for relative

-   * comparisons of wheel activity. It is affected by some non-browser factors,

-   * including choice of input hardware and mouse acceleration settings. The

-   * sign of the velocity measurement agrees with the screen coordinate system;

-   * negative values are towards the origin and positive values are away from

-   * the origin. Standard scrolling speed is approximately ten units per event.

-   * </p>

-   * 

-   * @return The velocity of the mouse wheel.

-   */

-  public final int getMouseWheelVelocityY() {

-    return DOMImpl.impl.eventGetMouseWheelVelocityY(this);

-  }

-

-  /**

-   * Gets the related target for this event.

-   * 

-   * @return the related target

-   */

-  public final EventTarget getRelatedEventTarget() {

-    return DOMImpl.impl.eventGetRelatedTarget(this);

-  }

-

-  /**

-   * Gets the mouse x-position on the user's display.

-   * 

-   * @return the mouse x-position

-   */

-  public final int getScreenX() {

-    return DOMImpl.impl.eventGetScreenX(this);

-  }

-

-  /**

-   * Gets the mouse y-position on the user's display.

-   * 

-   * @return the mouse y-position

-   */

-  public final int getScreenY() {

-    return DOMImpl.impl.eventGetScreenY(this);

-  }

-

-  /**

-   * Gets whether the shift key was depressed when the given event occurred.

-   * 

-   * @return <code>true</code> if shift was depressed when the event occurred

-   */

-  public final boolean getShiftKey() {

-    return DOMImpl.impl.eventGetShiftKey(this);

-  }

-

-  /**

-   * Gets a string representation of this event.

-   * 

-   * We do not override {@link #toString()} because it is final in

-   * {@link com.google.gwt.core.client.JavaScriptObject }.

-   * 

-   * @return the string representation of this event

-   */

-  public final String getString() {

-    return DOMImpl.impl.eventToString(this);

-  }

-

-  /**

-   * Gets the enumerated type of this event.

-   * 

-   * @return the event's enumerated type

-   */

-  public final String getType() {

-    return DOMImpl.impl.eventGetType(this);

-  }

-

-  /**

-   * Prevents the browser from taking its default action for the given event.

-   */

-  public final void preventDefault() {

-    DOMImpl.impl.eventPreventDefault(this);

-  }

-

-  /**

-   * Stops the event from being propagated to parent elements.

-   */

-  public final void stopPropagation() {

-    DOMImpl.impl.eventStopPropagation(this);

-  }

-}

+/*
+ * Copyright 2009 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.dom.client;
+
+import com.google.gwt.core.client.JavaScriptObject;
+
+/**
+ * The native dom event.
+ */
+public class NativeEvent extends JavaScriptObject {
+
+  /**
+   * The left mouse button.
+   */
+  public static final int BUTTON_LEFT = 1;
+
+  /**
+   * The middle mouse button.
+   */
+  public static final int BUTTON_MIDDLE = 4;
+
+  /**
+   * The right mouse button.
+   */
+  public static final int BUTTON_RIGHT = 2;
+
+  /**
+   * Required constructor for GWT compiler to function.
+   */
+  protected NativeEvent() {
+  }
+
+  /**
+   * Gets whether the ALT key was depressed when the given event occurred.
+   * 
+   * @return <code>true</code> if ALT was depressed when the event occurred
+   */
+  public final boolean getAltKey() {
+    return DOMImpl.impl.eventGetAltKey(this);
+  }
+
+  /**
+   * Gets the mouse buttons that were depressed when the given event occurred.
+   * 
+   * @return a bit-field, defined by {@link NativeEvent#BUTTON_LEFT},
+   *         {@link NativeEvent#BUTTON_MIDDLE}, and
+   *         {@link NativeEvent#BUTTON_RIGHT}
+   */
+  public final int getButton() {
+    return DOMImpl.impl.eventGetButton(this);
+  }
+
+  /**
+   * Gets the mouse x-position within the browser window's client area.
+   * 
+   * @return the mouse x-position
+   */
+  public final int getClientX() {
+    return DOMImpl.impl.eventGetClientX(this);
+  }
+
+  /**
+   * Gets the mouse y-position within the browser window's client area.
+   * 
+   * @return the mouse y-position
+   */
+  public final int getClientY() {
+    return DOMImpl.impl.eventGetClientY(this);
+  }
+
+  /**
+   * Gets whether the CTRL key was depressed when the given event occurred.
+   * 
+   * @return <code>true</code> if CTRL was depressed when the event occurred
+   */
+  public final boolean getCtrlKey() {
+    return DOMImpl.impl.eventGetCtrlKey(this);
+  }
+
+  /**
+   * Gets the current target element of this event. This is the element whose
+   * listener fired last, not the element which fired the event initially.
+   * 
+   * @return the event's current target element
+   */
+  public final EventTarget getCurrentEventTarget() {
+    return DOMImpl.impl.eventGetCurrentTarget(this);
+  }
+
+  /**
+   * Returns the element that was the actual target of the given event.
+   * 
+   * @return the target element
+   */
+  public final EventTarget getEventTarget() {
+    return DOMImpl.impl.eventGetTarget(this);
+  }
+
+  /**
+   * Gets the key code associated with this event.
+   * 
+   * <p>
+   * For key press events, this method returns the Unicode value of the
+   * character generated. For key down and key up events, it returns the code
+   * associated with the physical key.
+   * </p>
+   * 
+   * @return the Unicode character or key code.
+   * @see com.google.gwt.event.dom.client.KeyCodes
+   */
+  public final int getKeyCode() {
+    return DOMImpl.impl.eventGetKeyCode(this);
+  }
+
+  /**
+   * Gets whether the META key was depressed when the given event occurred.
+   * 
+   * @return <code>true</code> if META was depressed when the event occurred
+   */
+  public final boolean getMetaKey() {
+    return DOMImpl.impl.eventGetMetaKey(this);
+  }
+
+  /**
+   * Gets the velocity of the mouse wheel associated with the event along the Y
+   * axis.
+   * <p>
+   * The velocity of the event is an artifical measurement for relative
+   * comparisons of wheel activity. It is affected by some non-browser factors,
+   * including choice of input hardware and mouse acceleration settings. The
+   * sign of the velocity measurement agrees with the screen coordinate system;
+   * negative values are towards the origin and positive values are away from
+   * the origin. Standard scrolling speed is approximately ten units per event.
+   * </p>
+   * 
+   * @return The velocity of the mouse wheel.
+   */
+  public final int getMouseWheelVelocityY() {
+    return DOMImpl.impl.eventGetMouseWheelVelocityY(this);
+  }
+
+  /**
+   * Gets the related target for this event.
+   * 
+   * @return the related target
+   */
+  public final EventTarget getRelatedEventTarget() {
+    return DOMImpl.impl.eventGetRelatedTarget(this);
+  }
+
+  /**
+   * Gets the mouse x-position on the user's display.
+   * 
+   * @return the mouse x-position
+   */
+  public final int getScreenX() {
+    return DOMImpl.impl.eventGetScreenX(this);
+  }
+
+  /**
+   * Gets the mouse y-position on the user's display.
+   * 
+   * @return the mouse y-position
+   */
+  public final int getScreenY() {
+    return DOMImpl.impl.eventGetScreenY(this);
+  }
+
+  /**
+   * Gets whether the shift key was depressed when the given event occurred.
+   * 
+   * @return <code>true</code> if shift was depressed when the event occurred
+   */
+  public final boolean getShiftKey() {
+    return DOMImpl.impl.eventGetShiftKey(this);
+  }
+
+  /**
+   * Gets a string representation of this event.
+   * 
+   * We do not override {@link #toString()} because it is final in
+   * {@link com.google.gwt.core.client.JavaScriptObject }.
+   * 
+   * @return the string representation of this event
+   */
+  public final String getString() {
+    return DOMImpl.impl.eventToString(this);
+  }
+
+  /**
+   * Gets the enumerated type of this event.
+   * 
+   * @return the event's enumerated type
+   */
+  public final String getType() {
+    return DOMImpl.impl.eventGetType(this);
+  }
+
+  /**
+   * Prevents the browser from taking its default action for the given event.
+   */
+  public final void preventDefault() {
+    DOMImpl.impl.eventPreventDefault(this);
+  }
+
+  /**
+   * Stops the event from being propagated to parent elements.
+   */
+  public final void stopPropagation() {
+    DOMImpl.impl.eventStopPropagation(this);
+  }
+}
diff --git a/user/src/com/google/gwt/event/dom/client/BlurEvent.java b/user/src/com/google/gwt/event/dom/client/BlurEvent.java
index db0d326..ad762e1 100644
--- a/user/src/com/google/gwt/event/dom/client/BlurEvent.java
+++ b/user/src/com/google/gwt/event/dom/client/BlurEvent.java
@@ -1,57 +1,57 @@
-/*

- * 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.event.dom.client;

-

-/**

- * Represents a native blur event.

- */

-public class BlurEvent extends DomEvent<BlurHandler> {

-

-  /**

-   * Event type for blur events. Represents the meta-data associated with this

-   * event.

-   */

-  private static final Type<BlurHandler> TYPE = new Type<BlurHandler>("blur",

-      new BlurEvent());

-

-  /**

-   * Gets the event type associated with blur events.

-   * 

-   * @return the handler type

-   */

-  public static Type<BlurHandler> getType() {

-    return TYPE;

-  }

-

-  /**

-   * Protected constructor, use

-   * {@link DomEvent#fireNativeEvent(com.google.gwt.dom.client.NativeEvent, com.google.gwt.event.shared.HasHandlers)}

-   * to fire blur events.

-   */

-  protected BlurEvent() {

-  }

-

-  @Override

-  public final Type<BlurHandler> getAssociatedType() {

-    return TYPE;

-  }

-

-  @Override

-  protected void dispatch(BlurHandler handler) {

-    handler.onBlur(this);

-  }

-

-}

+/*
+ * 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.event.dom.client;
+
+/**
+ * Represents a native blur event.
+ */
+public class BlurEvent extends DomEvent<BlurHandler> {
+
+  /**
+   * Event type for blur events. Represents the meta-data associated with this
+   * event.
+   */
+  private static final Type<BlurHandler> TYPE = new Type<BlurHandler>("blur",
+      new BlurEvent());
+
+  /**
+   * Gets the event type associated with blur events.
+   * 
+   * @return the handler type
+   */
+  public static Type<BlurHandler> getType() {
+    return TYPE;
+  }
+
+  /**
+   * Protected constructor, use
+   * {@link DomEvent#fireNativeEvent(com.google.gwt.dom.client.NativeEvent, com.google.gwt.event.shared.HasHandlers)}
+   * to fire blur events.
+   */
+  protected BlurEvent() {
+  }
+
+  @Override
+  public final Type<BlurHandler> getAssociatedType() {
+    return TYPE;
+  }
+
+  @Override
+  protected void dispatch(BlurHandler handler) {
+    handler.onBlur(this);
+  }
+
+}
diff --git a/user/src/com/google/gwt/event/dom/client/ChangeEvent.java b/user/src/com/google/gwt/event/dom/client/ChangeEvent.java
index 7a2ec49..4fe646c 100644
--- a/user/src/com/google/gwt/event/dom/client/ChangeEvent.java
+++ b/user/src/com/google/gwt/event/dom/client/ChangeEvent.java
@@ -1,57 +1,57 @@
-/*

- * 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.event.dom.client;

-

-/**

- * Represents a native change event.

- */

-public class ChangeEvent extends DomEvent<ChangeHandler> {

-

-  /**

-   * Event type for change events. Represents the meta-data associated with this

-   * event.

-   */

-  private static final Type<ChangeHandler> TYPE = new Type<ChangeHandler>(

-      "change", new ChangeEvent());

-

-  /**

-   * Gets the event type associated with change events.

-   * 

-   * @return the handler type

-   */

-  public static Type<ChangeHandler> getType() {

-    return TYPE;

-  }

-

-  /**

-   * Protected constructor, use

-   * {@link DomEvent#fireNativeEvent(com.google.gwt.dom.client.NativeEvent, com.google.gwt.event.shared.HasHandlers)}

-   * to fire change events.

-   */

-  protected ChangeEvent() {

-  }

-

-  @Override

-  public final Type<ChangeHandler> getAssociatedType() {

-    return TYPE;

-  }

-

-  @Override

-  protected void dispatch(ChangeHandler handler) {

-    handler.onChange(this);

-  }

-

-}

+/*
+ * 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.event.dom.client;
+
+/**
+ * Represents a native change event.
+ */
+public class ChangeEvent extends DomEvent<ChangeHandler> {
+
+  /**
+   * Event type for change events. Represents the meta-data associated with this
+   * event.
+   */
+  private static final Type<ChangeHandler> TYPE = new Type<ChangeHandler>(
+      "change", new ChangeEvent());
+
+  /**
+   * Gets the event type associated with change events.
+   * 
+   * @return the handler type
+   */
+  public static Type<ChangeHandler> getType() {
+    return TYPE;
+  }
+
+  /**
+   * Protected constructor, use
+   * {@link DomEvent#fireNativeEvent(com.google.gwt.dom.client.NativeEvent, com.google.gwt.event.shared.HasHandlers)}
+   * to fire change events.
+   */
+  protected ChangeEvent() {
+  }
+
+  @Override
+  public final Type<ChangeHandler> getAssociatedType() {
+    return TYPE;
+  }
+
+  @Override
+  protected void dispatch(ChangeHandler handler) {
+    handler.onChange(this);
+  }
+
+}
diff --git a/user/src/com/google/gwt/event/dom/client/ClickEvent.java b/user/src/com/google/gwt/event/dom/client/ClickEvent.java
index 74fc74e..63e17c2 100644
--- a/user/src/com/google/gwt/event/dom/client/ClickEvent.java
+++ b/user/src/com/google/gwt/event/dom/client/ClickEvent.java
@@ -1,57 +1,57 @@
-/*

- * 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.event.dom.client;

-

-/**

- * Represents a native click event.

- */

-public class ClickEvent extends DomEvent<ClickHandler> {

-

-  /**

-   * Event type for click events. Represents the meta-data associated with this

-   * event.

-   */

-  private static final Type<ClickHandler> TYPE = new Type<ClickHandler>(

-      "click", new ClickEvent());

-

-  /**

-   * Gets the event type associated with click events.

-   * 

-   * @return the handler type

-   */

-  public static Type<ClickHandler> getType() {

-    return TYPE;

-  }

-

-  /**

-   * Protected constructor, use

-   * {@link DomEvent#fireNativeEvent(com.google.gwt.dom.client.NativeEvent, com.google.gwt.event.shared.HasHandlers)}

-   * to fire click events.

-   */

-  protected ClickEvent() {

-  }

-

-  @Override

-  public final Type<ClickHandler> getAssociatedType() {

-    return TYPE;

-  }

-

-  @Override

-  protected void dispatch(ClickHandler handler) {

-    handler.onClick(this);

-  }

-

-}

+/*
+ * 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.event.dom.client;
+
+/**
+ * Represents a native click event.
+ */
+public class ClickEvent extends DomEvent<ClickHandler> {
+
+  /**
+   * Event type for click events. Represents the meta-data associated with this
+   * event.
+   */
+  private static final Type<ClickHandler> TYPE = new Type<ClickHandler>(
+      "click", new ClickEvent());
+
+  /**
+   * Gets the event type associated with click events.
+   * 
+   * @return the handler type
+   */
+  public static Type<ClickHandler> getType() {
+    return TYPE;
+  }
+
+  /**
+   * Protected constructor, use
+   * {@link DomEvent#fireNativeEvent(com.google.gwt.dom.client.NativeEvent, com.google.gwt.event.shared.HasHandlers)}
+   * to fire click events.
+   */
+  protected ClickEvent() {
+  }
+
+  @Override
+  public final Type<ClickHandler> getAssociatedType() {
+    return TYPE;
+  }
+
+  @Override
+  protected void dispatch(ClickHandler handler) {
+    handler.onClick(this);
+  }
+
+}
diff --git a/user/src/com/google/gwt/event/dom/client/DoubleClickEvent.java b/user/src/com/google/gwt/event/dom/client/DoubleClickEvent.java
index 20cdf8e..258cb68 100644
--- a/user/src/com/google/gwt/event/dom/client/DoubleClickEvent.java
+++ b/user/src/com/google/gwt/event/dom/client/DoubleClickEvent.java
@@ -1,57 +1,57 @@
-/*

- * 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.event.dom.client;

-

-/**

- * Represents a native double click event.

- */

-public class DoubleClickEvent extends DomEvent<DoubleClickHandler> {

-

-  /**

-   * Event type for double click events. Represents the meta-data associated

-   * with this event.

-   */

-  private static final Type<DoubleClickHandler> TYPE = new Type<DoubleClickHandler>(

-      "dblclick", new DoubleClickEvent());

-

-  /**

-   * Gets the event type associated with double click events.

-   * 

-   * @return the handler type

-   */

-  public static Type<DoubleClickHandler> getType() {

-    return TYPE;

-  }

-

-  /**

-   * Protected constructor, use

-   * {@link DomEvent#fireNativeEvent(com.google.gwt.dom.client.NativeEvent, com.google.gwt.event.shared.HasHandlers)}

-   * to fire double click events.

-   */

-  protected DoubleClickEvent() {

-  }

-

-  @Override

-  public final Type<DoubleClickHandler> getAssociatedType() {

-    return TYPE;

-  }

-

-  @Override

-  protected void dispatch(DoubleClickHandler handler) {

-    handler.onDoubleClick(this);

-  }

-

-}

+/*
+ * 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.event.dom.client;
+
+/**
+ * Represents a native double click event.
+ */
+public class DoubleClickEvent extends DomEvent<DoubleClickHandler> {
+
+  /**
+   * Event type for double click events. Represents the meta-data associated
+   * with this event.
+   */
+  private static final Type<DoubleClickHandler> TYPE = new Type<DoubleClickHandler>(
+      "dblclick", new DoubleClickEvent());
+
+  /**
+   * Gets the event type associated with double click events.
+   * 
+   * @return the handler type
+   */
+  public static Type<DoubleClickHandler> getType() {
+    return TYPE;
+  }
+
+  /**
+   * Protected constructor, use
+   * {@link DomEvent#fireNativeEvent(com.google.gwt.dom.client.NativeEvent, com.google.gwt.event.shared.HasHandlers)}
+   * to fire double click events.
+   */
+  protected DoubleClickEvent() {
+  }
+
+  @Override
+  public final Type<DoubleClickHandler> getAssociatedType() {
+    return TYPE;
+  }
+
+  @Override
+  protected void dispatch(DoubleClickHandler handler) {
+    handler.onDoubleClick(this);
+  }
+
+}
diff --git a/user/src/com/google/gwt/event/dom/client/ErrorEvent.java b/user/src/com/google/gwt/event/dom/client/ErrorEvent.java
index 40a3771..3cfcb2e 100644
--- a/user/src/com/google/gwt/event/dom/client/ErrorEvent.java
+++ b/user/src/com/google/gwt/event/dom/client/ErrorEvent.java
@@ -1,57 +1,57 @@
-/*

- * 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.event.dom.client;

-

-/**

- * Represents a native error event.

- */

-public class ErrorEvent extends DomEvent<ErrorHandler> {

-

-  /**

-   * Event type for error events. Represents the meta-data associated with this

-   * event.

-   */

-  private static final Type<ErrorHandler> TYPE = new Type<ErrorHandler>(

-      "error", new ErrorEvent());

-

-  /**

-   * Gets the event type associated with error events.

-   * 

-   * @return the handler type

-   */

-  public static Type<ErrorHandler> getType() {

-    return TYPE;

-  }

-

-  /**

-   * Protected constructor, use

-   * {@link DomEvent#fireNativeEvent(com.google.gwt.dom.client.NativeEvent, com.google.gwt.event.shared.HasHandlers)}

-   * to fire error events.

-   */

-  protected ErrorEvent() {

-  }

-

-  @Override

-  public final Type<ErrorHandler> getAssociatedType() {

-    return TYPE;

-  }

-

-  @Override

-  protected void dispatch(ErrorHandler handler) {

-    handler.onError(this);

-  }

-

-}

+/*
+ * 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.event.dom.client;
+
+/**
+ * Represents a native error event.
+ */
+public class ErrorEvent extends DomEvent<ErrorHandler> {
+
+  /**
+   * Event type for error events. Represents the meta-data associated with this
+   * event.
+   */
+  private static final Type<ErrorHandler> TYPE = new Type<ErrorHandler>(
+      "error", new ErrorEvent());
+
+  /**
+   * Gets the event type associated with error events.
+   * 
+   * @return the handler type
+   */
+  public static Type<ErrorHandler> getType() {
+    return TYPE;
+  }
+
+  /**
+   * Protected constructor, use
+   * {@link DomEvent#fireNativeEvent(com.google.gwt.dom.client.NativeEvent, com.google.gwt.event.shared.HasHandlers)}
+   * to fire error events.
+   */
+  protected ErrorEvent() {
+  }
+
+  @Override
+  public final Type<ErrorHandler> getAssociatedType() {
+    return TYPE;
+  }
+
+  @Override
+  protected void dispatch(ErrorHandler handler) {
+    handler.onError(this);
+  }
+
+}
diff --git a/user/src/com/google/gwt/event/dom/client/FocusEvent.java b/user/src/com/google/gwt/event/dom/client/FocusEvent.java
index 16df375..f9a86dc 100644
--- a/user/src/com/google/gwt/event/dom/client/FocusEvent.java
+++ b/user/src/com/google/gwt/event/dom/client/FocusEvent.java
@@ -1,57 +1,57 @@
-/*

- * 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.event.dom.client;

-

-/**

- * Represents a native focus event.

- */

-public class FocusEvent extends DomEvent<FocusHandler> {

-

-  /**

-   * Event type for focus events. Represents the meta-data associated with this

-   * event.

-   */

-  private static final Type<FocusHandler> TYPE = new Type<FocusHandler>(

-      "focus", new FocusEvent());

-

-  /**

-   * Gets the event type associated with focus events.

-   * 

-   * @return the handler type

-   */

-  public static Type<FocusHandler> getType() {

-    return TYPE;

-  }

-

-  /**

-   * Protected constructor, use

-   * {@link DomEvent#fireNativeEvent(com.google.gwt.dom.client.NativeEvent, com.google.gwt.event.shared.HasHandlers)}

-   * to fire focus events.

-   */

-  protected FocusEvent() {

-  }

-

-  @Override

-  public final Type<FocusHandler> getAssociatedType() {

-    return TYPE;

-  }

-

-  @Override

-  protected void dispatch(FocusHandler handler) {

-    handler.onFocus(this);

-  }

-

-}

+/*
+ * 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.event.dom.client;
+
+/**
+ * Represents a native focus event.
+ */
+public class FocusEvent extends DomEvent<FocusHandler> {
+
+  /**
+   * Event type for focus events. Represents the meta-data associated with this
+   * event.
+   */
+  private static final Type<FocusHandler> TYPE = new Type<FocusHandler>(
+      "focus", new FocusEvent());
+
+  /**
+   * Gets the event type associated with focus events.
+   * 
+   * @return the handler type
+   */
+  public static Type<FocusHandler> getType() {
+    return TYPE;
+  }
+
+  /**
+   * Protected constructor, use
+   * {@link DomEvent#fireNativeEvent(com.google.gwt.dom.client.NativeEvent, com.google.gwt.event.shared.HasHandlers)}
+   * to fire focus events.
+   */
+  protected FocusEvent() {
+  }
+
+  @Override
+  public final Type<FocusHandler> getAssociatedType() {
+    return TYPE;
+  }
+
+  @Override
+  protected void dispatch(FocusHandler handler) {
+    handler.onFocus(this);
+  }
+
+}
diff --git a/user/src/com/google/gwt/event/dom/client/HandlesAllFocusEvents.java b/user/src/com/google/gwt/event/dom/client/HandlesAllFocusEvents.java
index 0d00ce3..f968c89 100644
--- a/user/src/com/google/gwt/event/dom/client/HandlesAllFocusEvents.java
+++ b/user/src/com/google/gwt/event/dom/client/HandlesAllFocusEvents.java
@@ -1,55 +1,55 @@
-/*

- * 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.event.dom.client;

-

-/**

- * Receiver used to handle all focus events at once.

- */

-public abstract class HandlesAllFocusEvents implements FocusHandler,

-    BlurHandler {

-

-  /**

-   * Convenience method used to handle both focus and blur events from an event

-   * source.

-   * 

-   * @param <H> receiver type, must implement both {@link FocusHandler} and

-   *          {@link BlurHandler} handlers

-   * @param eventSource the event source

-   * @param reciever the receiver implementing both focus and blur handlers

-   */

-  public static <H extends BlurHandler & FocusHandler> void handle(

-      HasAllFocusHandlers eventSource, H reciever) {

-    eventSource.addBlurHandler(reciever);

-    eventSource.addFocusHandler(reciever);

-  }

-

-  /**

-   * Constructor.

-   */

-  public HandlesAllFocusEvents() {

-  }

-

-  /**

-   * Convenience method to handle both focus and blur events from an event

-   * source.

-   * 

-   * @param source the event source

-   */

-  public void handle(HasAllFocusHandlers source) {

-    handle(source, this);

-  }

+/*
+ * 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.event.dom.client;
+
+/**
+ * Receiver used to handle all focus events at once.
+ */
+public abstract class HandlesAllFocusEvents implements FocusHandler,
+    BlurHandler {
+
+  /**
+   * Convenience method used to handle both focus and blur events from an event
+   * source.
+   * 
+   * @param <H> receiver type, must implement both {@link FocusHandler} and
+   *          {@link BlurHandler} handlers
+   * @param eventSource the event source
+   * @param reciever the receiver implementing both focus and blur handlers
+   */
+  public static <H extends BlurHandler & FocusHandler> void handle(
+      HasAllFocusHandlers eventSource, H reciever) {
+    eventSource.addBlurHandler(reciever);
+    eventSource.addFocusHandler(reciever);
+  }
+
+  /**
+   * Constructor.
+   */
+  public HandlesAllFocusEvents() {
+  }
+
+  /**
+   * Convenience method to handle both focus and blur events from an event
+   * source.
+   * 
+   * @param source the event source
+   */
+  public void handle(HasAllFocusHandlers source) {
+    handle(source, this);
+  }
 }
\ No newline at end of file
diff --git a/user/src/com/google/gwt/event/dom/client/HandlesAllKeyEvents.java b/user/src/com/google/gwt/event/dom/client/HandlesAllKeyEvents.java
index 73b5882..f934e3a 100644
--- a/user/src/com/google/gwt/event/dom/client/HandlesAllKeyEvents.java
+++ b/user/src/com/google/gwt/event/dom/client/HandlesAllKeyEvents.java
@@ -1,58 +1,58 @@
-/*

- * 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.event.dom.client;

-

-/**

- * Receiver used to handle all key events at once.

- * 

- * WARNING, PLEASE READ: As this class is intended for developers who wish to

- * handle all key events in GWT, new key handler interfaces will be added to it.

- * Therefore, updates to GWT could cause breaking API changes.

- * 

- */

-public abstract class HandlesAllKeyEvents implements KeyDownHandler,

-    KeyUpHandler, KeyPressHandler {

-

-  /**

-   * Convenience method used to handle all key events from an event source.

-   * 

-   * @param <H> receiver type, must implement all key handlers

-   * @param eventSource the event source

-   * @param reciever the receiver implementing all key handlers

-   */

-  public static <H extends KeyDownHandler & KeyUpHandler & KeyPressHandler> void addHandlers(

-      HasAllKeyHandlers eventSource, H reciever) {

-    eventSource.addKeyDownHandler(reciever);

-    eventSource.addKeyPressHandler(reciever);

-    eventSource.addKeyUpHandler(reciever);

-  }

-

-  /**

-   * Constructor.

-   */

-  public HandlesAllKeyEvents() {

-  }

-

-  /**

-   * Convenience method to handle all key events from an event source.

-   * 

-   * @param source the event source

-   */

-  public final void addKeyHandlersTo(HasAllKeyHandlers source) {

-    addHandlers(source, this);

-  }

-}

+/*
+ * 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.event.dom.client;
+
+/**
+ * Receiver used to handle all key events at once.
+ * 
+ * WARNING, PLEASE READ: As this class is intended for developers who wish to
+ * handle all key events in GWT, new key handler interfaces will be added to it.
+ * Therefore, updates to GWT could cause breaking API changes.
+ * 
+ */
+public abstract class HandlesAllKeyEvents implements KeyDownHandler,
+    KeyUpHandler, KeyPressHandler {
+
+  /**
+   * Convenience method used to handle all key events from an event source.
+   * 
+   * @param <H> receiver type, must implement all key handlers
+   * @param eventSource the event source
+   * @param reciever the receiver implementing all key handlers
+   */
+  public static <H extends KeyDownHandler & KeyUpHandler & KeyPressHandler> void addHandlers(
+      HasAllKeyHandlers eventSource, H reciever) {
+    eventSource.addKeyDownHandler(reciever);
+    eventSource.addKeyPressHandler(reciever);
+    eventSource.addKeyUpHandler(reciever);
+  }
+
+  /**
+   * Constructor.
+   */
+  public HandlesAllKeyEvents() {
+  }
+
+  /**
+   * Convenience method to handle all key events from an event source.
+   * 
+   * @param source the event source
+   */
+  public final void addKeyHandlersTo(HasAllKeyHandlers source) {
+    addHandlers(source, this);
+  }
+}
diff --git a/user/src/com/google/gwt/event/dom/client/HandlesAllMouseEvents.java b/user/src/com/google/gwt/event/dom/client/HandlesAllMouseEvents.java
index 85cc52a..27fe71b 100644
--- a/user/src/com/google/gwt/event/dom/client/HandlesAllMouseEvents.java
+++ b/user/src/com/google/gwt/event/dom/client/HandlesAllMouseEvents.java
@@ -1,62 +1,62 @@
-/*

- * 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.event.dom.client;

-

-/**

- * Receiver used to handle all mouse events at once.

- * 

- * WARNING, PLEASE READ: As this class is intended for developers who wish to

- * handle all mouse events in GWT, new mouse handler interfaces will be added to

- * it. Therefore, updates to GWT could cause breaking API changes.

- * 

- */

-public abstract class HandlesAllMouseEvents implements MouseDownHandler,

-    MouseUpHandler, MouseMoveHandler, MouseOutHandler, MouseOverHandler,

-    MouseWheelHandler {

-

-  /**

-   * Convenience method used to handle all mouse events from an event source.

-   * 

-   * @param <H> receiver type, must implement all mouse handlers

-   * @param source the event source

-   * @param reciever the receiver implementing all mouse handlers

-   */

-  public static <H extends MouseDownHandler & MouseUpHandler & MouseOutHandler & MouseOverHandler & MouseMoveHandler & MouseWheelHandler> void handle(

-      HasAllMouseHandlers source, H reciever) {

-    source.addMouseDownHandler(reciever);

-    source.addMouseUpHandler(reciever);

-    source.addMouseOutHandler(reciever);

-    source.addMouseOverHandler(reciever);

-    source.addMouseMoveHandler(reciever);

-    source.addMouseWheelHandler(reciever);

-  }

-

-  /**

-   * Constructor.

-   */

-  public HandlesAllMouseEvents() {

-  }

-

-  /**

-   * Convenience method to handle all mouse events from an event source.

-   * 

-   * @param eventSource the event source

-   */

-  public void handle(HasAllMouseHandlers eventSource) {

-    handle(eventSource, this);

-  }

+/*
+ * 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.event.dom.client;
+
+/**
+ * Receiver used to handle all mouse events at once.
+ * 
+ * WARNING, PLEASE READ: As this class is intended for developers who wish to
+ * handle all mouse events in GWT, new mouse handler interfaces will be added to
+ * it. Therefore, updates to GWT could cause breaking API changes.
+ * 
+ */
+public abstract class HandlesAllMouseEvents implements MouseDownHandler,
+    MouseUpHandler, MouseMoveHandler, MouseOutHandler, MouseOverHandler,
+    MouseWheelHandler {
+
+  /**
+   * Convenience method used to handle all mouse events from an event source.
+   * 
+   * @param <H> receiver type, must implement all mouse handlers
+   * @param source the event source
+   * @param reciever the receiver implementing all mouse handlers
+   */
+  public static <H extends MouseDownHandler & MouseUpHandler & MouseOutHandler & MouseOverHandler & MouseMoveHandler & MouseWheelHandler> void handle(
+      HasAllMouseHandlers source, H reciever) {
+    source.addMouseDownHandler(reciever);
+    source.addMouseUpHandler(reciever);
+    source.addMouseOutHandler(reciever);
+    source.addMouseOverHandler(reciever);
+    source.addMouseMoveHandler(reciever);
+    source.addMouseWheelHandler(reciever);
+  }
+
+  /**
+   * Constructor.
+   */
+  public HandlesAllMouseEvents() {
+  }
+
+  /**
+   * Convenience method to handle all mouse events from an event source.
+   * 
+   * @param eventSource the event source
+   */
+  public void handle(HasAllMouseHandlers eventSource) {
+    handle(eventSource, this);
+  }
 }
\ No newline at end of file
diff --git a/user/src/com/google/gwt/event/dom/client/HasAllFocusHandlers.java b/user/src/com/google/gwt/event/dom/client/HasAllFocusHandlers.java
index daa1f84..3c34f51 100644
--- a/user/src/com/google/gwt/event/dom/client/HasAllFocusHandlers.java
+++ b/user/src/com/google/gwt/event/dom/client/HasAllFocusHandlers.java
@@ -1,30 +1,30 @@
-/*

- * 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.event.dom.client;

-

-/**

- * This is a convenience interface that includes all focus handlers defined by

- * the core GWT system.

- * 

- * <p>

- * WARNING, PLEASE READ: As this interface is intended for developers who wish

- * to handle all focus events in GWT, in the unlikely event that a new focus

- * event is added, this interface will change.

- * </p>

- */

-public interface HasAllFocusHandlers extends HasFocusHandlers, HasBlurHandlers {

-}

+/*
+ * 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.event.dom.client;
+
+/**
+ * This is a convenience interface that includes all focus handlers defined by
+ * the core GWT system.
+ * 
+ * <p>
+ * WARNING, PLEASE READ: As this interface is intended for developers who wish
+ * to handle all focus events in GWT, in the unlikely event that a new focus
+ * event is added, this interface will change.
+ * </p>
+ */
+public interface HasAllFocusHandlers extends HasFocusHandlers, HasBlurHandlers {
+}
diff --git a/user/src/com/google/gwt/event/dom/client/HasAllKeyHandlers.java b/user/src/com/google/gwt/event/dom/client/HasAllKeyHandlers.java
index 847c0a7..01c975e 100644
--- a/user/src/com/google/gwt/event/dom/client/HasAllKeyHandlers.java
+++ b/user/src/com/google/gwt/event/dom/client/HasAllKeyHandlers.java
@@ -1,32 +1,32 @@
-/*

- * 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.event.dom.client;

-

-/**

- * Convenience interface used to implement all key handlers at once.

- * 

- * <p>

- * WARNING, PLEASE READ: In the unlikely event that more key handler subtypes

- * are added to GWT, this interface will be expanded, so only implement this

- * interface if you wish to have your widget break if a new key event type is

- * introduced.

- * </p>

- */

-public interface HasAllKeyHandlers extends HasKeyUpHandlers,

-    HasKeyDownHandlers, HasKeyPressHandlers {

-

-}

+/*
+ * 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.event.dom.client;
+
+/**
+ * Convenience interface used to implement all key handlers at once.
+ * 
+ * <p>
+ * WARNING, PLEASE READ: In the unlikely event that more key handler subtypes
+ * are added to GWT, this interface will be expanded, so only implement this
+ * interface if you wish to have your widget break if a new key event type is
+ * introduced.
+ * </p>
+ */
+public interface HasAllKeyHandlers extends HasKeyUpHandlers,
+    HasKeyDownHandlers, HasKeyPressHandlers {
+
+}
diff --git a/user/src/com/google/gwt/event/dom/client/HasAllMouseHandlers.java b/user/src/com/google/gwt/event/dom/client/HasAllMouseHandlers.java
index c600a13..73a90f3 100644
--- a/user/src/com/google/gwt/event/dom/client/HasAllMouseHandlers.java
+++ b/user/src/com/google/gwt/event/dom/client/HasAllMouseHandlers.java
@@ -1,32 +1,32 @@
-/*

- * 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.event.dom.client;

-

-/**

- * This is a convenience interface that includes all mouse handlers defined by

- * the core GWT system.

- * <p>

- * WARNING, PLEASE READ: As this interface is intended for developers who wish

- * to handle all mouse events in GWT, new mouse event handlers will be added to

- * it. Therefore, updates can cause breaking API changes.

- * </p>

- */

-public interface HasAllMouseHandlers extends HasMouseDownHandlers,

-    HasMouseUpHandlers, HasMouseOutHandlers, HasMouseOverHandlers,

-    HasMouseMoveHandlers, HasMouseWheelHandlers {

-

-}

+/*
+ * 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.event.dom.client;
+
+/**
+ * This is a convenience interface that includes all mouse handlers defined by
+ * the core GWT system.
+ * <p>
+ * WARNING, PLEASE READ: As this interface is intended for developers who wish
+ * to handle all mouse events in GWT, new mouse event handlers will be added to
+ * it. Therefore, updates can cause breaking API changes.
+ * </p>
+ */
+public interface HasAllMouseHandlers extends HasMouseDownHandlers,
+    HasMouseUpHandlers, HasMouseOutHandlers, HasMouseOverHandlers,
+    HasMouseMoveHandlers, HasMouseWheelHandlers {
+
+}
diff --git a/user/src/com/google/gwt/event/dom/client/HasBlurHandlers.java b/user/src/com/google/gwt/event/dom/client/HasBlurHandlers.java
index ba7b7d8..7ea6078 100644
--- a/user/src/com/google/gwt/event/dom/client/HasBlurHandlers.java
+++ b/user/src/com/google/gwt/event/dom/client/HasBlurHandlers.java
@@ -1,33 +1,33 @@
-/*

- * 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.event.dom.client;

-

-import com.google.gwt.event.shared.HandlerRegistration;

-import com.google.gwt.event.shared.HasHandlers;

-

-/**

- * A widget that implements this interface provides registration for

- * {@link BlurHandler} instances.

- */

-public interface HasBlurHandlers extends HasHandlers {

-  /**

-   * Adds a {@link BlurEvent} handler.

-   * 

-   * @param handler the blur handler

-   * @return {@link HandlerRegistration} used to remove this handler

-   */

-  HandlerRegistration addBlurHandler(BlurHandler handler);

-}

+/*
+ * 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.event.dom.client;
+
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.gwt.event.shared.HasHandlers;
+
+/**
+ * A widget that implements this interface provides registration for
+ * {@link BlurHandler} instances.
+ */
+public interface HasBlurHandlers extends HasHandlers {
+  /**
+   * Adds a {@link BlurEvent} handler.
+   * 
+   * @param handler the blur handler
+   * @return {@link HandlerRegistration} used to remove this handler
+   */
+  HandlerRegistration addBlurHandler(BlurHandler handler);
+}
diff --git a/user/src/com/google/gwt/event/dom/client/HasChangeHandlers.java b/user/src/com/google/gwt/event/dom/client/HasChangeHandlers.java
index c037892..32a48a2 100644
--- a/user/src/com/google/gwt/event/dom/client/HasChangeHandlers.java
+++ b/user/src/com/google/gwt/event/dom/client/HasChangeHandlers.java
@@ -1,33 +1,33 @@
-/*

- * 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.event.dom.client;

-

-import com.google.gwt.event.shared.HandlerRegistration;

-import com.google.gwt.event.shared.HasHandlers;

-

-/**

- * A widget that implements this interface provides registration for

- * {@link ChangeHandler} instances.

- */

-public interface HasChangeHandlers extends HasHandlers {

-  /**

-   * Adds a {@link ChangeEvent} handler.

-   * 

-   * @param handler the change handler

-   * @return {@link HandlerRegistration} used to remove this handler

-   */

-  HandlerRegistration addChangeHandler(ChangeHandler handler);

-}

+/*
+ * 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.event.dom.client;
+
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.gwt.event.shared.HasHandlers;
+
+/**
+ * A widget that implements this interface provides registration for
+ * {@link ChangeHandler} instances.
+ */
+public interface HasChangeHandlers extends HasHandlers {
+  /**
+   * Adds a {@link ChangeEvent} handler.
+   * 
+   * @param handler the change handler
+   * @return {@link HandlerRegistration} used to remove this handler
+   */
+  HandlerRegistration addChangeHandler(ChangeHandler handler);
+}
diff --git a/user/src/com/google/gwt/event/dom/client/HasClickHandlers.java b/user/src/com/google/gwt/event/dom/client/HasClickHandlers.java
index cdc6ce3..14ecd37 100644
--- a/user/src/com/google/gwt/event/dom/client/HasClickHandlers.java
+++ b/user/src/com/google/gwt/event/dom/client/HasClickHandlers.java
@@ -1,33 +1,33 @@
-/*

- * 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.event.dom.client;

-

-import com.google.gwt.event.shared.HandlerRegistration;

-import com.google.gwt.event.shared.HasHandlers;

-

-/**

- * A widget that implements this interface provides registration for

- * {@link ClickHandler} instances.

- */

-public interface HasClickHandlers extends HasHandlers {

-  /**

-   * Adds a {@link ClickEvent} handler.

-   * 

-   * @param handler the click handler

-   * @return {@link HandlerRegistration} used to remove this handler

-   */

-  HandlerRegistration addClickHandler(ClickHandler handler);

-}

+/*
+ * 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.event.dom.client;
+
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.gwt.event.shared.HasHandlers;
+
+/**
+ * A widget that implements this interface provides registration for
+ * {@link ClickHandler} instances.
+ */
+public interface HasClickHandlers extends HasHandlers {
+  /**
+   * Adds a {@link ClickEvent} handler.
+   * 
+   * @param handler the click handler
+   * @return {@link HandlerRegistration} used to remove this handler
+   */
+  HandlerRegistration addClickHandler(ClickHandler handler);
+}
diff --git a/user/src/com/google/gwt/event/dom/client/HasDoubleClickHandlers.java b/user/src/com/google/gwt/event/dom/client/HasDoubleClickHandlers.java
index 646294b..62f893a 100644
--- a/user/src/com/google/gwt/event/dom/client/HasDoubleClickHandlers.java
+++ b/user/src/com/google/gwt/event/dom/client/HasDoubleClickHandlers.java
@@ -1,33 +1,33 @@
-/*

- * 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.event.dom.client;

-

-import com.google.gwt.event.shared.HandlerRegistration;

-import com.google.gwt.event.shared.HasHandlers;

-

-/**

- * A widget that implements this interface provides registration for

- * {@link DoubleClickHandler} instances.

- */

-public interface HasDoubleClickHandlers extends HasHandlers {

-  /**

-   * Adds a {@link DoubleClickEvent} handler.

-   * 

-   * @param handler the double click handler

-   * @return {@link HandlerRegistration} used to remove this handler

-   */

-  HandlerRegistration addDoubleClickHandler(DoubleClickHandler handler);

-}

+/*
+ * 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.event.dom.client;
+
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.gwt.event.shared.HasHandlers;
+
+/**
+ * A widget that implements this interface provides registration for
+ * {@link DoubleClickHandler} instances.
+ */
+public interface HasDoubleClickHandlers extends HasHandlers {
+  /**
+   * Adds a {@link DoubleClickEvent} handler.
+   * 
+   * @param handler the double click handler
+   * @return {@link HandlerRegistration} used to remove this handler
+   */
+  HandlerRegistration addDoubleClickHandler(DoubleClickHandler handler);
+}
diff --git a/user/src/com/google/gwt/event/dom/client/HasErrorHandlers.java b/user/src/com/google/gwt/event/dom/client/HasErrorHandlers.java
index 3d4b473..758b78d 100644
--- a/user/src/com/google/gwt/event/dom/client/HasErrorHandlers.java
+++ b/user/src/com/google/gwt/event/dom/client/HasErrorHandlers.java
@@ -1,33 +1,33 @@
-/*

- * 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.event.dom.client;

-

-import com.google.gwt.event.shared.HandlerRegistration;

-import com.google.gwt.event.shared.HasHandlers;

-

-/**

- * A widget that implements this interface provides registration for

- * {@link ErrorHandler} instances.

- */

-public interface HasErrorHandlers extends HasHandlers {

-  /**

-   * Adds a {@link ErrorEvent} handler.

-   * 

-   * @param handler the error handler

-   * @return {@link HandlerRegistration} used to remove this handler

-   */

-  HandlerRegistration addErrorHandler(ErrorHandler handler);

-}

+/*
+ * 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.event.dom.client;
+
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.gwt.event.shared.HasHandlers;
+
+/**
+ * A widget that implements this interface provides registration for
+ * {@link ErrorHandler} instances.
+ */
+public interface HasErrorHandlers extends HasHandlers {
+  /**
+   * Adds a {@link ErrorEvent} handler.
+   * 
+   * @param handler the error handler
+   * @return {@link HandlerRegistration} used to remove this handler
+   */
+  HandlerRegistration addErrorHandler(ErrorHandler handler);
+}
diff --git a/user/src/com/google/gwt/event/dom/client/HasFocusHandlers.java b/user/src/com/google/gwt/event/dom/client/HasFocusHandlers.java
index 6c19dc2..fe9abfe 100644
--- a/user/src/com/google/gwt/event/dom/client/HasFocusHandlers.java
+++ b/user/src/com/google/gwt/event/dom/client/HasFocusHandlers.java
@@ -1,33 +1,33 @@
-/*

- * 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.event.dom.client;

-

-import com.google.gwt.event.shared.HandlerRegistration;

-import com.google.gwt.event.shared.HasHandlers;

-

-/**

- * A widget that implements this interface provides registration for

- * {@link FocusHandler} instances.

- */

-public interface HasFocusHandlers extends HasHandlers {

-  /**

-   * Adds a {@link FocusEvent} handler.

-   * 

-   * @param handler the focus handler

-   * @return {@link HandlerRegistration} used to remove this handler

-   */

-  HandlerRegistration addFocusHandler(FocusHandler handler);

-}

+/*
+ * 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.event.dom.client;
+
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.gwt.event.shared.HasHandlers;
+
+/**
+ * A widget that implements this interface provides registration for
+ * {@link FocusHandler} instances.
+ */
+public interface HasFocusHandlers extends HasHandlers {
+  /**
+   * Adds a {@link FocusEvent} handler.
+   * 
+   * @param handler the focus handler
+   * @return {@link HandlerRegistration} used to remove this handler
+   */
+  HandlerRegistration addFocusHandler(FocusHandler handler);
+}
diff --git a/user/src/com/google/gwt/event/dom/client/HasKeyDownHandlers.java b/user/src/com/google/gwt/event/dom/client/HasKeyDownHandlers.java
index 6736da6..83b0a20 100644
--- a/user/src/com/google/gwt/event/dom/client/HasKeyDownHandlers.java
+++ b/user/src/com/google/gwt/event/dom/client/HasKeyDownHandlers.java
@@ -1,33 +1,33 @@
-/*

- * 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.event.dom.client;

-

-import com.google.gwt.event.shared.HandlerRegistration;

-import com.google.gwt.event.shared.HasHandlers;

-

-/**

- * A widget that implements this interface provides registration for

- * {@link KeyDownHandler} instances.

- */

-public interface HasKeyDownHandlers extends HasHandlers {

-  /**

-   * Adds a {@link KeyDownEvent} handler.

-   * 

-   * @param handler the key down handler

-   * @return {@link HandlerRegistration} used to remove this handler

-   */

-  HandlerRegistration addKeyDownHandler(KeyDownHandler handler);

-}

+/*
+ * 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.event.dom.client;
+
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.gwt.event.shared.HasHandlers;
+
+/**
+ * A widget that implements this interface provides registration for
+ * {@link KeyDownHandler} instances.
+ */
+public interface HasKeyDownHandlers extends HasHandlers {
+  /**
+   * Adds a {@link KeyDownEvent} handler.
+   * 
+   * @param handler the key down handler
+   * @return {@link HandlerRegistration} used to remove this handler
+   */
+  HandlerRegistration addKeyDownHandler(KeyDownHandler handler);
+}
diff --git a/user/src/com/google/gwt/event/dom/client/HasKeyPressHandlers.java b/user/src/com/google/gwt/event/dom/client/HasKeyPressHandlers.java
index 1fd5cfd..68cae67 100644
--- a/user/src/com/google/gwt/event/dom/client/HasKeyPressHandlers.java
+++ b/user/src/com/google/gwt/event/dom/client/HasKeyPressHandlers.java
@@ -1,33 +1,33 @@
-/*

- * 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.event.dom.client;

-

-import com.google.gwt.event.shared.HandlerRegistration;

-import com.google.gwt.event.shared.HasHandlers;

-

-/**

- * A widget that implements this interface provides registration for

- * {@link KeyPressHandler} instances.

- */

-public interface HasKeyPressHandlers extends HasHandlers {

-  /**

-   * Adds a {@link KeyPressEvent} handler.

-   * 

-   * @param handler the key press handler

-   * @return {@link HandlerRegistration} used to remove this handler

-   */

-  HandlerRegistration addKeyPressHandler(KeyPressHandler handler);

-}

+/*
+ * 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.event.dom.client;
+
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.gwt.event.shared.HasHandlers;
+
+/**
+ * A widget that implements this interface provides registration for
+ * {@link KeyPressHandler} instances.
+ */
+public interface HasKeyPressHandlers extends HasHandlers {
+  /**
+   * Adds a {@link KeyPressEvent} handler.
+   * 
+   * @param handler the key press handler
+   * @return {@link HandlerRegistration} used to remove this handler
+   */
+  HandlerRegistration addKeyPressHandler(KeyPressHandler handler);
+}
diff --git a/user/src/com/google/gwt/event/dom/client/HasKeyUpHandlers.java b/user/src/com/google/gwt/event/dom/client/HasKeyUpHandlers.java
index 3e95ac9..7d43d71 100644
--- a/user/src/com/google/gwt/event/dom/client/HasKeyUpHandlers.java
+++ b/user/src/com/google/gwt/event/dom/client/HasKeyUpHandlers.java
@@ -1,33 +1,33 @@
-/*

- * 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.event.dom.client;

-

-import com.google.gwt.event.shared.HandlerRegistration;

-import com.google.gwt.event.shared.HasHandlers;

-

-/**

- * A widget that implements this interface provides registration for

- * {@link KeyUpHandler} instances.

- */

-public interface HasKeyUpHandlers extends HasHandlers {

-  /**

-   * Adds a {@link KeyUpEvent} handler.

-   * 

-   * @param handler the key up handler

-   * @return {@link HandlerRegistration} used to remove this handler

-   */

-  HandlerRegistration addKeyUpHandler(KeyUpHandler handler);

-}

+/*
+ * 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.event.dom.client;
+
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.gwt.event.shared.HasHandlers;
+
+/**
+ * A widget that implements this interface provides registration for
+ * {@link KeyUpHandler} instances.
+ */
+public interface HasKeyUpHandlers extends HasHandlers {
+  /**
+   * Adds a {@link KeyUpEvent} handler.
+   * 
+   * @param handler the key up handler
+   * @return {@link HandlerRegistration} used to remove this handler
+   */
+  HandlerRegistration addKeyUpHandler(KeyUpHandler handler);
+}
diff --git a/user/src/com/google/gwt/event/dom/client/HasLoadHandlers.java b/user/src/com/google/gwt/event/dom/client/HasLoadHandlers.java
index 20903cd..06239f2 100644
--- a/user/src/com/google/gwt/event/dom/client/HasLoadHandlers.java
+++ b/user/src/com/google/gwt/event/dom/client/HasLoadHandlers.java
@@ -1,33 +1,33 @@
-/*

- * 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.event.dom.client;

-

-import com.google.gwt.event.shared.HandlerRegistration;

-import com.google.gwt.event.shared.HasHandlers;

-

-/**

- * A widget that implements this interface provides registration for

- * {@link LoadHandler} instances.

- */

-public interface HasLoadHandlers extends HasHandlers {

-  /**

-   * Adds a {@link LoadEvent} handler.

-   * 

-   * @param handler the load handler

-   * @return {@link HandlerRegistration} used to remove this handler

-   */

-  HandlerRegistration addLoadHandler(LoadHandler handler);

-}

+/*
+ * 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.event.dom.client;
+
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.gwt.event.shared.HasHandlers;
+
+/**
+ * A widget that implements this interface provides registration for
+ * {@link LoadHandler} instances.
+ */
+public interface HasLoadHandlers extends HasHandlers {
+  /**
+   * Adds a {@link LoadEvent} handler.
+   * 
+   * @param handler the load handler
+   * @return {@link HandlerRegistration} used to remove this handler
+   */
+  HandlerRegistration addLoadHandler(LoadHandler handler);
+}
diff --git a/user/src/com/google/gwt/event/dom/client/HasLoseCaptureHandlers.java b/user/src/com/google/gwt/event/dom/client/HasLoseCaptureHandlers.java
index 48b6a72..93b48e4 100644
--- a/user/src/com/google/gwt/event/dom/client/HasLoseCaptureHandlers.java
+++ b/user/src/com/google/gwt/event/dom/client/HasLoseCaptureHandlers.java
@@ -1,33 +1,33 @@
-/*

- * 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.event.dom.client;

-

-import com.google.gwt.event.shared.HandlerRegistration;

-import com.google.gwt.event.shared.HasHandlers;

-

-/**

- * A widget that implements this interface provides registration for

- * {@link LoseCaptureHandler} instances.

- */

-public interface HasLoseCaptureHandlers extends HasHandlers {

-  /**

-   * Adds a {@link LoseCaptureEvent} handler.

-   * 

-   * @param handler the lose capture handler

-   * @return {@link HandlerRegistration} used to remove this handler

-   */

-  HandlerRegistration addLoseCaptureHandler(LoseCaptureHandler handler);

-}

+/*
+ * 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.event.dom.client;
+
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.gwt.event.shared.HasHandlers;
+
+/**
+ * A widget that implements this interface provides registration for
+ * {@link LoseCaptureHandler} instances.
+ */
+public interface HasLoseCaptureHandlers extends HasHandlers {
+  /**
+   * Adds a {@link LoseCaptureEvent} handler.
+   * 
+   * @param handler the lose capture handler
+   * @return {@link HandlerRegistration} used to remove this handler
+   */
+  HandlerRegistration addLoseCaptureHandler(LoseCaptureHandler handler);
+}
diff --git a/user/src/com/google/gwt/event/dom/client/HasMouseDownHandlers.java b/user/src/com/google/gwt/event/dom/client/HasMouseDownHandlers.java
index ea99a82..16a5b63 100644
--- a/user/src/com/google/gwt/event/dom/client/HasMouseDownHandlers.java
+++ b/user/src/com/google/gwt/event/dom/client/HasMouseDownHandlers.java
@@ -1,33 +1,33 @@
-/*

- * 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.event.dom.client;

-

-import com.google.gwt.event.shared.HandlerRegistration;

-import com.google.gwt.event.shared.HasHandlers;

-

-/**

- * A widget that implements this interface provides registration for

- * {@link MouseDownHandler} instances.

- */

-public interface HasMouseDownHandlers extends HasHandlers {

-  /**

-   * Adds a {@link MouseDownEvent} handler.

-   * 

-   * @param handler the mouse down handler

-   * @return {@link HandlerRegistration} used to remove this handler

-   */

-  HandlerRegistration addMouseDownHandler(MouseDownHandler handler);

-}

+/*
+ * 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.event.dom.client;
+
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.gwt.event.shared.HasHandlers;
+
+/**
+ * A widget that implements this interface provides registration for
+ * {@link MouseDownHandler} instances.
+ */
+public interface HasMouseDownHandlers extends HasHandlers {
+  /**
+   * Adds a {@link MouseDownEvent} handler.
+   * 
+   * @param handler the mouse down handler
+   * @return {@link HandlerRegistration} used to remove this handler
+   */
+  HandlerRegistration addMouseDownHandler(MouseDownHandler handler);
+}
diff --git a/user/src/com/google/gwt/event/dom/client/HasMouseMoveHandlers.java b/user/src/com/google/gwt/event/dom/client/HasMouseMoveHandlers.java
index 19168b7..dca8cb8 100644
--- a/user/src/com/google/gwt/event/dom/client/HasMouseMoveHandlers.java
+++ b/user/src/com/google/gwt/event/dom/client/HasMouseMoveHandlers.java
@@ -1,33 +1,33 @@
-/*

- * 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.event.dom.client;

-

-import com.google.gwt.event.shared.HandlerRegistration;

-import com.google.gwt.event.shared.HasHandlers;

-

-/**

- * A widget that implements this interface provides registration for

- * {@link MouseMoveHandler} instances.

- */

-public interface HasMouseMoveHandlers extends HasHandlers {

-  /**

-   * Adds a {@link MouseMoveEvent} handler.

-   * 

-   * @param handler the mouse move handler

-   * @return {@link HandlerRegistration} used to remove this handler

-   */

-  HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler);

-}

+/*
+ * 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.event.dom.client;
+
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.gwt.event.shared.HasHandlers;
+
+/**
+ * A widget that implements this interface provides registration for
+ * {@link MouseMoveHandler} instances.
+ */
+public interface HasMouseMoveHandlers extends HasHandlers {
+  /**
+   * Adds a {@link MouseMoveEvent} handler.
+   * 
+   * @param handler the mouse move handler
+   * @return {@link HandlerRegistration} used to remove this handler
+   */
+  HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler);
+}
diff --git a/user/src/com/google/gwt/event/dom/client/HasMouseOutHandlers.java b/user/src/com/google/gwt/event/dom/client/HasMouseOutHandlers.java
index e4cf37a..26bf02b 100644
--- a/user/src/com/google/gwt/event/dom/client/HasMouseOutHandlers.java
+++ b/user/src/com/google/gwt/event/dom/client/HasMouseOutHandlers.java
@@ -1,33 +1,33 @@
-/*

- * 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.event.dom.client;

-

-import com.google.gwt.event.shared.HandlerRegistration;

-import com.google.gwt.event.shared.HasHandlers;

-

-/**

- * A widget that implements this interface provides registration for

- * {@link MouseOutHandler} instances.

- */

-public interface HasMouseOutHandlers extends HasHandlers {

-  /**

-   * Adds a {@link MouseOutEvent} handler.

-   * 

-   * @param handler the mouse out handler

-   * @return {@link HandlerRegistration} used to remove this handler

-   */

-  HandlerRegistration addMouseOutHandler(MouseOutHandler handler);

-}

+/*
+ * 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.event.dom.client;
+
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.gwt.event.shared.HasHandlers;
+
+/**
+ * A widget that implements this interface provides registration for
+ * {@link MouseOutHandler} instances.
+ */
+public interface HasMouseOutHandlers extends HasHandlers {
+  /**
+   * Adds a {@link MouseOutEvent} handler.
+   * 
+   * @param handler the mouse out handler
+   * @return {@link HandlerRegistration} used to remove this handler
+   */
+  HandlerRegistration addMouseOutHandler(MouseOutHandler handler);
+}
diff --git a/user/src/com/google/gwt/event/dom/client/HasMouseOverHandlers.java b/user/src/com/google/gwt/event/dom/client/HasMouseOverHandlers.java
index acc52b7..76899e3 100644
--- a/user/src/com/google/gwt/event/dom/client/HasMouseOverHandlers.java
+++ b/user/src/com/google/gwt/event/dom/client/HasMouseOverHandlers.java
@@ -1,33 +1,33 @@
-/*

- * 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.event.dom.client;

-

-import com.google.gwt.event.shared.HandlerRegistration;

-import com.google.gwt.event.shared.HasHandlers;

-

-/**

- * A widget that implements this interface provides registration for

- * {@link MouseOverHandler} instances.

- */

-public interface HasMouseOverHandlers extends HasHandlers {

-  /**

-   * Adds a {@link MouseOverEvent} handler.

-   * 

-   * @param handler the mouse over handler

-   * @return {@link HandlerRegistration} used to remove this handler

-   */

-  HandlerRegistration addMouseOverHandler(MouseOverHandler handler);

-}

+/*
+ * 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.event.dom.client;
+
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.gwt.event.shared.HasHandlers;
+
+/**
+ * A widget that implements this interface provides registration for
+ * {@link MouseOverHandler} instances.
+ */
+public interface HasMouseOverHandlers extends HasHandlers {
+  /**
+   * Adds a {@link MouseOverEvent} handler.
+   * 
+   * @param handler the mouse over handler
+   * @return {@link HandlerRegistration} used to remove this handler
+   */
+  HandlerRegistration addMouseOverHandler(MouseOverHandler handler);
+}
diff --git a/user/src/com/google/gwt/event/dom/client/HasMouseUpHandlers.java b/user/src/com/google/gwt/event/dom/client/HasMouseUpHandlers.java
index b9f0bc4..b2a0a26 100644
--- a/user/src/com/google/gwt/event/dom/client/HasMouseUpHandlers.java
+++ b/user/src/com/google/gwt/event/dom/client/HasMouseUpHandlers.java
@@ -1,33 +1,33 @@
-/*

- * 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.event.dom.client;

-

-import com.google.gwt.event.shared.HandlerRegistration;

-import com.google.gwt.event.shared.HasHandlers;

-

-/**

- * A widget that implements this interface provides registration for

- * {@link MouseUpHandler} instances.

- */

-public interface HasMouseUpHandlers extends HasHandlers {

-  /**

-   * Adds a {@link MouseUpEvent} handler.

-   * 

-   * @param handler the mouse up handler

-   * @return {@link HandlerRegistration} used to remove this handler

-   */

-  HandlerRegistration addMouseUpHandler(MouseUpHandler handler);

-}

+/*
+ * 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.event.dom.client;
+
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.gwt.event.shared.HasHandlers;
+
+/**
+ * A widget that implements this interface provides registration for
+ * {@link MouseUpHandler} instances.
+ */
+public interface HasMouseUpHandlers extends HasHandlers {
+  /**
+   * Adds a {@link MouseUpEvent} handler.
+   * 
+   * @param handler the mouse up handler
+   * @return {@link HandlerRegistration} used to remove this handler
+   */
+  HandlerRegistration addMouseUpHandler(MouseUpHandler handler);
+}
diff --git a/user/src/com/google/gwt/event/dom/client/HasMouseWheelHandlers.java b/user/src/com/google/gwt/event/dom/client/HasMouseWheelHandlers.java
index b681162..7bba2b8 100644
--- a/user/src/com/google/gwt/event/dom/client/HasMouseWheelHandlers.java
+++ b/user/src/com/google/gwt/event/dom/client/HasMouseWheelHandlers.java
@@ -1,33 +1,33 @@
-/*

- * 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.event.dom.client;

-

-import com.google.gwt.event.shared.HandlerRegistration;

-import com.google.gwt.event.shared.HasHandlers;

-

-/**

- * A widget that implements this interface provides registration for

- * {@link MouseWheelHandler} instances.

- */

-public interface HasMouseWheelHandlers extends HasHandlers {

-  /**

-   * Adds a {@link MouseWheelEvent} handler.

-   * 

-   * @param handler the mouse wheel handler

-   * @return {@link HandlerRegistration} used to remove this handler

-   */

-  HandlerRegistration addMouseWheelHandler(MouseWheelHandler handler);

-}

+/*
+ * 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.event.dom.client;
+
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.gwt.event.shared.HasHandlers;
+
+/**
+ * A widget that implements this interface provides registration for
+ * {@link MouseWheelHandler} instances.
+ */
+public interface HasMouseWheelHandlers extends HasHandlers {
+  /**
+   * Adds a {@link MouseWheelEvent} handler.
+   * 
+   * @param handler the mouse wheel handler
+   * @return {@link HandlerRegistration} used to remove this handler
+   */
+  HandlerRegistration addMouseWheelHandler(MouseWheelHandler handler);
+}
diff --git a/user/src/com/google/gwt/event/dom/client/HasScrollHandlers.java b/user/src/com/google/gwt/event/dom/client/HasScrollHandlers.java
index bc229f5..bb8bc5b 100644
--- a/user/src/com/google/gwt/event/dom/client/HasScrollHandlers.java
+++ b/user/src/com/google/gwt/event/dom/client/HasScrollHandlers.java
@@ -1,32 +1,32 @@
-/*

- * 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.event.dom.client;

-

-import com.google.gwt.event.shared.HandlerRegistration;

-

-/**

- * A widget that implements this interface provides registration for

- * {@link ScrollHandler} instances.

- */

-public interface HasScrollHandlers {

-  /**

-   * Adds a {@link ScrollEvent} handler.

-   * 

-   * @param handler the scroll handler

-   * @return {@link HandlerRegistration} used to remove this handler

-   */

-  HandlerRegistration addScrollHandler(ScrollHandler handler);

-}

+/*
+ * 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.event.dom.client;
+
+import com.google.gwt.event.shared.HandlerRegistration;
+
+/**
+ * A widget that implements this interface provides registration for
+ * {@link ScrollHandler} instances.
+ */
+public interface HasScrollHandlers {
+  /**
+   * Adds a {@link ScrollEvent} handler.
+   * 
+   * @param handler the scroll handler
+   * @return {@link HandlerRegistration} used to remove this handler
+   */
+  HandlerRegistration addScrollHandler(ScrollHandler handler);
+}
diff --git a/user/src/com/google/gwt/event/dom/client/KeyCodeEvent.java b/user/src/com/google/gwt/event/dom/client/KeyCodeEvent.java
index 7f29144..c9402f7 100644
--- a/user/src/com/google/gwt/event/dom/client/KeyCodeEvent.java
+++ b/user/src/com/google/gwt/event/dom/client/KeyCodeEvent.java
@@ -1,95 +1,95 @@
-/*

- * 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.event.dom.client;

-

-import com.google.gwt.event.shared.EventHandler;

-

-/**

- * Key up and key down are both events based upon a given key code.

- * 

- * @param <H> handler type

- */

-public abstract class KeyCodeEvent<H extends EventHandler> extends KeyEvent<H> {

-  /**

-   * Does the key code represent an arrow key?

-   * 

-   * @param keyCode the key code

-   * @return if it is an arrow key code

-   */

-  public static boolean isArrow(int keyCode) {

-    switch (keyCode) {

-      case KeyCodes.KEY_DOWN:

-      case KeyCodes.KEY_RIGHT:

-      case KeyCodes.KEY_UP:

-      case KeyCodes.KEY_LEFT:

-        return true;

-      default:

-        return false;

-    }

-  }

-

-  /**

-   * Gets the native key code. These key codes are enumerated in the

-   * {@link KeyCodes} class.

-   * 

-   * @return the key code

-   */

-  public int getNativeKeyCode() {

-    return getNativeEvent().getKeyCode();

-  }

-

-  /**

-   * Is this a key down arrow?

-   * 

-   * @return whether this is a down arrow key event

-   */

-  public boolean isDownArrow() {

-    return getNativeKeyCode() == KeyCodes.KEY_DOWN;

-  }

-

-  /**

-   * Is this a left arrow?

-   * 

-   * @return whether this is a left arrow key event

-   */

-  public boolean isLeftArrow() {

-    return getNativeKeyCode() == KeyCodes.KEY_LEFT;

-  }

-

-  /**

-   * Is this a right arrow?

-   * 

-   * @return whether this is a right arrow key event

-   */

-  public boolean isRightArrow() {

-    return getNativeKeyCode() == KeyCodes.KEY_RIGHT;

-  }

-

-  /**

-   * Is this a up arrow?

-   * 

-   * @return whether this is a right arrow key event

-   */

-  public boolean isUpArrow() {

-    return getNativeKeyCode() == KeyCodes.KEY_UP;

-  }

-

-  @Override

-  public String toDebugString() {

-    return super.toDebugString() + "[" + getNativeKeyCode() + "]";

-  }

-}

+/*
+ * 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.event.dom.client;
+
+import com.google.gwt.event.shared.EventHandler;
+
+/**
+ * Key up and key down are both events based upon a given key code.
+ * 
+ * @param <H> handler type
+ */
+public abstract class KeyCodeEvent<H extends EventHandler> extends KeyEvent<H> {
+  /**
+   * Does the key code represent an arrow key?
+   * 
+   * @param keyCode the key code
+   * @return if it is an arrow key code
+   */
+  public static boolean isArrow(int keyCode) {
+    switch (keyCode) {
+      case KeyCodes.KEY_DOWN:
+      case KeyCodes.KEY_RIGHT:
+      case KeyCodes.KEY_UP:
+      case KeyCodes.KEY_LEFT:
+        return true;
+      default:
+        return false;
+    }
+  }
+
+  /**
+   * Gets the native key code. These key codes are enumerated in the
+   * {@link KeyCodes} class.
+   * 
+   * @return the key code
+   */
+  public int getNativeKeyCode() {
+    return getNativeEvent().getKeyCode();
+  }
+
+  /**
+   * Is this a key down arrow?
+   * 
+   * @return whether this is a down arrow key event
+   */
+  public boolean isDownArrow() {
+    return getNativeKeyCode() == KeyCodes.KEY_DOWN;
+  }
+
+  /**
+   * Is this a left arrow?
+   * 
+   * @return whether this is a left arrow key event
+   */
+  public boolean isLeftArrow() {
+    return getNativeKeyCode() == KeyCodes.KEY_LEFT;
+  }
+
+  /**
+   * Is this a right arrow?
+   * 
+   * @return whether this is a right arrow key event
+   */
+  public boolean isRightArrow() {
+    return getNativeKeyCode() == KeyCodes.KEY_RIGHT;
+  }
+
+  /**
+   * Is this a up arrow?
+   * 
+   * @return whether this is a right arrow key event
+   */
+  public boolean isUpArrow() {
+    return getNativeKeyCode() == KeyCodes.KEY_UP;
+  }
+
+  @Override
+  public String toDebugString() {
+    return super.toDebugString() + "[" + getNativeKeyCode() + "]";
+  }
+}
diff --git a/user/src/com/google/gwt/event/dom/client/KeyCodes.java b/user/src/com/google/gwt/event/dom/client/KeyCodes.java
index 25a27f4..5a28ccb 100644
--- a/user/src/com/google/gwt/event/dom/client/KeyCodes.java
+++ b/user/src/com/google/gwt/event/dom/client/KeyCodes.java
@@ -1,107 +1,107 @@
-/*

- * 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.event.dom.client;

-

-/**

- * Contains the native key codes previously defined in

- * {@link com.google.gwt.user.client.ui.KeyboardListener}. When converting

- * keyboard listener instances, developers can use the following static import

- * to access these constants:

- * 

- * <pre> import static com.google.gwt.event.dom.client.KeyCodes.*; </pre>

- * 

- * These constants are defined with an int data type in order to be compatible

- * with the constants defined in

- * {@link com.google.gwt.user.client.ui.KeyboardListener}.

- */

-public class KeyCodes {

-  /**

-   * Alt key code.

-   */

-  public static final int KEY_ALT = 18;

-

-  /**

-   * Backspace key code.

-   */

-  public static final int KEY_BACKSPACE = 8;

-  /**

-   * Control key code.

-   */

-  public static final int KEY_CTRL = 17;

-

-  /**

-   * Delete key code.

-   */

-  public static final int KEY_DELETE = 46;

-

-  /**

-   * Down arrow code.

-   */

-  public static final int KEY_DOWN = 40;

-

-  /**

-   * End key code.

-   */

-  public static final int KEY_END = 35;

-

-  /**

-   * Enter key code.

-   */

-  public static final int KEY_ENTER = 13;

-  /**

-   * Escape key code.

-   */

-  public static final int KEY_ESCAPE = 27;

-  /**

-   * Home key code.

-   */

-  public static final int KEY_HOME = 36;

-  /**

-   * Left key code.

-   */

-  public static final int KEY_LEFT = 37;

-  /**

-   * Page down key code.

-   */

-  public static final int KEY_PAGEDOWN = 34;

-  /**

-   * Page up key code.

-   */

-  public static final int KEY_PAGEUP = 33;

-  /**

-   * Right arrow key code.

-   */

-  public static final int KEY_RIGHT = 39;

-  /**

-   * Shift key code.

-   */

-  public static final int KEY_SHIFT = 16;

-

-  /**

-   * Tab key code.

-   */

-  public static final int KEY_TAB = 9;

-  /**

-   * Up Arrow key code.

-   */

-  public static final int KEY_UP = 38;

-

-  // This class should never be instantiated

-  private KeyCodes() {

-  }

-

-}

+/*
+ * 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.event.dom.client;
+
+/**
+ * Contains the native key codes previously defined in
+ * {@link com.google.gwt.user.client.ui.KeyboardListener}. When converting
+ * keyboard listener instances, developers can use the following static import
+ * to access these constants:
+ * 
+ * <pre> import static com.google.gwt.event.dom.client.KeyCodes.*; </pre>
+ * 
+ * These constants are defined with an int data type in order to be compatible
+ * with the constants defined in
+ * {@link com.google.gwt.user.client.ui.KeyboardListener}.
+ */
+public class KeyCodes {
+  /**
+   * Alt key code.
+   */
+  public static final int KEY_ALT = 18;
+
+  /**
+   * Backspace key code.
+   */
+  public static final int KEY_BACKSPACE = 8;
+  /**
+   * Control key code.
+   */
+  public static final int KEY_CTRL = 17;
+
+  /**
+   * Delete key code.
+   */
+  public static final int KEY_DELETE = 46;
+
+  /**
+   * Down arrow code.
+   */
+  public static final int KEY_DOWN = 40;
+
+  /**
+   * End key code.
+   */
+  public static final int KEY_END = 35;
+
+  /**
+   * Enter key code.
+   */
+  public static final int KEY_ENTER = 13;
+  /**
+   * Escape key code.
+   */
+  public static final int KEY_ESCAPE = 27;
+  /**
+   * Home key code.
+   */
+  public static final int KEY_HOME = 36;
+  /**
+   * Left key code.
+   */
+  public static final int KEY_LEFT = 37;
+  /**
+   * Page down key code.
+   */
+  public static final int KEY_PAGEDOWN = 34;
+  /**
+   * Page up key code.
+   */
+  public static final int KEY_PAGEUP = 33;
+  /**
+   * Right arrow key code.
+   */
+  public static final int KEY_RIGHT = 39;
+  /**
+   * Shift key code.
+   */
+  public static final int KEY_SHIFT = 16;
+
+  /**
+   * Tab key code.
+   */
+  public static final int KEY_TAB = 9;
+  /**
+   * Up Arrow key code.
+   */
+  public static final int KEY_UP = 38;
+
+  // This class should never be instantiated
+  private KeyCodes() {
+  }
+
+}
diff --git a/user/src/com/google/gwt/event/dom/client/KeyDownEvent.java b/user/src/com/google/gwt/event/dom/client/KeyDownEvent.java
index d1175a2..0cc2ee1 100644
--- a/user/src/com/google/gwt/event/dom/client/KeyDownEvent.java
+++ b/user/src/com/google/gwt/event/dom/client/KeyDownEvent.java
@@ -1,57 +1,57 @@
-/*

- * 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.event.dom.client;

-

-/**

- * Represents a native key down event.

- */

-public class KeyDownEvent extends KeyCodeEvent<KeyDownHandler> {

-

-  /**

-   * Event type for key down events. Represents the meta-data associated with

-   * this event.

-   */

-  private static final Type<KeyDownHandler> TYPE = new Type<KeyDownHandler>(

-      "keydown", new KeyDownEvent());

-

-  /**

-   * Gets the event type associated with key down events.

-   * 

-   * @return the handler type

-   */

-  public static Type<KeyDownHandler> getType() {

-    return TYPE;

-  }

-

-  /**

-   * Protected constructor, use

-   * {@link DomEvent#fireNativeEvent(com.google.gwt.dom.client.NativeEvent, com.google.gwt.event.shared.HasHandlers)}

-   * to fire key down events.

-   */

-  protected KeyDownEvent() {

-  }

-

-  @Override

-  public final Type<KeyDownHandler> getAssociatedType() {

-    return TYPE;

-  }

-

-  @Override

-  protected void dispatch(KeyDownHandler handler) {

-    handler.onKeyDown(this);

-  }

-

-}

+/*
+ * 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.event.dom.client;
+
+/**
+ * Represents a native key down event.
+ */
+public class KeyDownEvent extends KeyCodeEvent<KeyDownHandler> {
+
+  /**
+   * Event type for key down events. Represents the meta-data associated with
+   * this event.
+   */
+  private static final Type<KeyDownHandler> TYPE = new Type<KeyDownHandler>(
+      "keydown", new KeyDownEvent());
+
+  /**
+   * Gets the event type associated with key down events.
+   * 
+   * @return the handler type
+   */
+  public static Type<KeyDownHandler> getType() {
+    return TYPE;
+  }
+
+  /**
+   * Protected constructor, use
+   * {@link DomEvent#fireNativeEvent(com.google.gwt.dom.client.NativeEvent, com.google.gwt.event.shared.HasHandlers)}
+   * to fire key down events.
+   */
+  protected KeyDownEvent() {
+  }
+
+  @Override
+  public final Type<KeyDownHandler> getAssociatedType() {
+    return TYPE;
+  }
+
+  @Override
+  protected void dispatch(KeyDownHandler handler) {
+    handler.onKeyDown(this);
+  }
+
+}
diff --git a/user/src/com/google/gwt/event/dom/client/KeyPressEvent.java b/user/src/com/google/gwt/event/dom/client/KeyPressEvent.java
index 496aa6c..a45d637 100644
--- a/user/src/com/google/gwt/event/dom/client/KeyPressEvent.java
+++ b/user/src/com/google/gwt/event/dom/client/KeyPressEvent.java
@@ -1,77 +1,77 @@
-/*

- * 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.event.dom.client;

-

-import com.google.gwt.dom.client.NativeEvent; 

-

-/**

- * Represents a native key press event.

- */

-public class KeyPressEvent extends KeyEvent<KeyPressHandler> {

-

-  /**

-   * Event type for key press events. Represents the meta-data associated with

-   * this event.

-   */

-  private static final Type<KeyPressHandler> TYPE = new Type<KeyPressHandler>(

-      "keypress", new KeyPressEvent());

-

-  /**

-   * Gets the event type associated with key press events.

-   * 

-   * @return the handler type

-   */

-  public static Type<KeyPressHandler> getType() {

-    return TYPE;

-  }

-

-  /**

-   * Protected constructor, use

-   * {@link DomEvent#fireNativeEvent(com.google.gwt.dom.client.NativeEvent, com.google.gwt.event.shared.HasHandlers)}

-   * to fire key press events.

-   */

-  protected KeyPressEvent() {

-  }

-

-  @Override

-  public final Type<KeyPressHandler> getAssociatedType() {

-    return TYPE;

-  }

-

-  /**

-   * Gets the char code for this event.

-   * 

-   * @return the char code

-   */

-  public char getCharCode() {

-    return getCharCode(getNativeEvent());

-  }

-

-  @Override

-  public String toDebugString() {

-    return super.toDebugString() + "[" + getCharCode() + "]";

-  }

-

-  @Override

-  protected void dispatch(KeyPressHandler handler) {

-    handler.onKeyPress(this);

-  }

-

-  private native char getCharCode(NativeEvent e)/*-{

-    return e.charCode || e.keyCode;

-  }-*/;

-

-}

+/*
+ * 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.event.dom.client;
+
+import com.google.gwt.dom.client.NativeEvent; 
+
+/**
+ * Represents a native key press event.
+ */
+public class KeyPressEvent extends KeyEvent<KeyPressHandler> {
+
+  /**
+   * Event type for key press events. Represents the meta-data associated with
+   * this event.
+   */
+  private static final Type<KeyPressHandler> TYPE = new Type<KeyPressHandler>(
+      "keypress", new KeyPressEvent());
+
+  /**
+   * Gets the event type associated with key press events.
+   * 
+   * @return the handler type
+   */
+  public static Type<KeyPressHandler> getType() {
+    return TYPE;
+  }
+
+  /**
+   * Protected constructor, use
+   * {@link DomEvent#fireNativeEvent(com.google.gwt.dom.client.NativeEvent, com.google.gwt.event.shared.HasHandlers)}
+   * to fire key press events.
+   */
+  protected KeyPressEvent() {
+  }
+
+  @Override
+  public final Type<KeyPressHandler> getAssociatedType() {
+    return TYPE;
+  }
+
+  /**
+   * Gets the char code for this event.
+   * 
+   * @return the char code
+   */
+  public char getCharCode() {
+    return getCharCode(getNativeEvent());
+  }
+
+  @Override
+  public String toDebugString() {
+    return super.toDebugString() + "[" + getCharCode() + "]";
+  }
+
+  @Override
+  protected void dispatch(KeyPressHandler handler) {
+    handler.onKeyPress(this);
+  }
+
+  private native char getCharCode(NativeEvent e)/*-{
+    return e.charCode || e.keyCode;
+  }-*/;
+
+}
diff --git a/user/src/com/google/gwt/event/dom/client/KeyUpEvent.java b/user/src/com/google/gwt/event/dom/client/KeyUpEvent.java
index f728468..2939667 100644
--- a/user/src/com/google/gwt/event/dom/client/KeyUpEvent.java
+++ b/user/src/com/google/gwt/event/dom/client/KeyUpEvent.java
@@ -1,57 +1,57 @@
-/*

- * 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.event.dom.client;

-

-/**

- * Represents a native key up event.

- */

-public class KeyUpEvent extends KeyCodeEvent<KeyUpHandler> {

-

-  /**

-   * Event type for key up events. Represents the meta-data associated with this

-   * event.

-   */

-  private static final Type<KeyUpHandler> TYPE = new Type<KeyUpHandler>(

-      "keyup", new KeyUpEvent());

-

-  /**

-   * Gets the event type associated with key up events.

-   * 

-   * @return the handler type

-   */

-  public static Type<KeyUpHandler> getType() {

-    return TYPE;

-  }

-

-  /**

-   * Protected constructor, use

-   * {@link DomEvent#fireNativeEvent(com.google.gwt.dom.client.NativeEvent, com.google.gwt.event.shared.HasHandlers)}

-   * to fire key up events.

-   */

-  protected KeyUpEvent() {

-  }

-

-  @Override

-  public final Type<KeyUpHandler> getAssociatedType() {

-    return TYPE;

-  }

-

-  @Override

-  protected void dispatch(KeyUpHandler handler) {

-    handler.onKeyUp(this);

-  }

-

-}

+/*
+ * 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.event.dom.client;
+
+/**
+ * Represents a native key up event.
+ */
+public class KeyUpEvent extends KeyCodeEvent<KeyUpHandler> {
+
+  /**
+   * Event type for key up events. Represents the meta-data associated with this
+   * event.
+   */
+  private static final Type<KeyUpHandler> TYPE = new Type<KeyUpHandler>(
+      "keyup", new KeyUpEvent());
+
+  /**
+   * Gets the event type associated with key up events.
+   * 
+   * @return the handler type
+   */
+  public static Type<KeyUpHandler> getType() {
+    return TYPE;
+  }
+
+  /**
+   * Protected constructor, use
+   * {@link DomEvent#fireNativeEvent(com.google.gwt.dom.client.NativeEvent, com.google.gwt.event.shared.HasHandlers)}
+   * to fire key up events.
+   */
+  protected KeyUpEvent() {
+  }
+
+  @Override
+  public final Type<KeyUpHandler> getAssociatedType() {
+    return TYPE;
+  }
+
+  @Override
+  protected void dispatch(KeyUpHandler handler) {
+    handler.onKeyUp(this);
+  }
+
+}
diff --git a/user/src/com/google/gwt/event/dom/client/LoadEvent.java b/user/src/com/google/gwt/event/dom/client/LoadEvent.java
index 00397fb..5b7360d 100644
--- a/user/src/com/google/gwt/event/dom/client/LoadEvent.java
+++ b/user/src/com/google/gwt/event/dom/client/LoadEvent.java
@@ -1,57 +1,57 @@
-/*

- * 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.event.dom.client;

-

-/**

- * Represents a native load event.

- */

-public class LoadEvent extends DomEvent<LoadHandler> {

-

-  /**

-   * Event type for load events. Represents the meta-data associated with this

-   * event.

-   */

-  private static final Type<LoadHandler> TYPE = new Type<LoadHandler>("load",

-      new LoadEvent());

-

-  /**

-   * Gets the event type associated with load events.

-   * 

-   * @return the handler type

-   */

-  public static Type<LoadHandler> getType() {

-    return TYPE;

-  }

-

-  /**

-   * Protected constructor, use

-   * {@link DomEvent#fireNativeEvent(com.google.gwt.dom.client.NativeEvent, com.google.gwt.event.shared.HasHandlers)}

-   * to fire load events.

-   */

-  protected LoadEvent() {

-  }

-

-  @Override

-  public final Type<LoadHandler> getAssociatedType() {

-    return TYPE;

-  }

-

-  @Override

-  protected void dispatch(LoadHandler handler) {

-    handler.onLoad(this);

-  }

-

-}

+/*
+ * 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.event.dom.client;
+
+/**
+ * Represents a native load event.
+ */
+public class LoadEvent extends DomEvent<LoadHandler> {
+
+  /**
+   * Event type for load events. Represents the meta-data associated with this
+   * event.
+   */
+  private static final Type<LoadHandler> TYPE = new Type<LoadHandler>("load",
+      new LoadEvent());
+
+  /**
+   * Gets the event type associated with load events.
+   * 
+   * @return the handler type
+   */
+  public static Type<LoadHandler> getType() {
+    return TYPE;
+  }
+
+  /**
+   * Protected constructor, use
+   * {@link DomEvent#fireNativeEvent(com.google.gwt.dom.client.NativeEvent, com.google.gwt.event.shared.HasHandlers)}
+   * to fire load events.
+   */
+  protected LoadEvent() {
+  }
+
+  @Override
+  public final Type<LoadHandler> getAssociatedType() {
+    return TYPE;
+  }
+
+  @Override
+  protected void dispatch(LoadHandler handler) {
+    handler.onLoad(this);
+  }
+
+}
diff --git a/user/src/com/google/gwt/event/dom/client/LoseCaptureEvent.java b/user/src/com/google/gwt/event/dom/client/LoseCaptureEvent.java
index eef6843..c5926d7 100644
--- a/user/src/com/google/gwt/event/dom/client/LoseCaptureEvent.java
+++ b/user/src/com/google/gwt/event/dom/client/LoseCaptureEvent.java
@@ -1,57 +1,57 @@
-/*

- * 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.event.dom.client;

-

-/**

- * Represents a native lose capture event.

- */

-public class LoseCaptureEvent extends DomEvent<LoseCaptureHandler> {

-

-  /**

-   * Event type for lose capture events. Represents the meta-data associated

-   * with this event.

-   */

-  private static final Type<LoseCaptureHandler> TYPE = new Type<LoseCaptureHandler>(

-      "losecapture", new LoseCaptureEvent());

-

-  /**

-   * Gets the event type associated with lose capture events.

-   * 

-   * @return the handler type

-   */

-  public static Type<LoseCaptureHandler> getType() {

-    return TYPE;

-  }

-

-  /**

-   * Protected constructor, use

-   * {@link DomEvent#fireNativeEvent(com.google.gwt.dom.client.NativeEvent, com.google.gwt.event.shared.HasHandlers)}

-   * to fire lose capture events.

-   */

-  protected LoseCaptureEvent() {

-  }

-

-  @Override

-  public final Type<LoseCaptureHandler> getAssociatedType() {

-    return TYPE;

-  }

-

-  @Override

-  protected void dispatch(LoseCaptureHandler handler) {

-    handler.onLoseCapture(this);

-  }

-

-}

+/*
+ * 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.event.dom.client;
+
+/**
+ * Represents a native lose capture event.
+ */
+public class LoseCaptureEvent extends DomEvent<LoseCaptureHandler> {
+
+  /**
+   * Event type for lose capture events. Represents the meta-data associated
+   * with this event.
+   */
+  private static final Type<LoseCaptureHandler> TYPE = new Type<LoseCaptureHandler>(
+      "losecapture", new LoseCaptureEvent());
+
+  /**
+   * Gets the event type associated with lose capture events.
+   * 
+   * @return the handler type
+   */
+  public static Type<LoseCaptureHandler> getType() {
+    return TYPE;
+  }
+
+  /**
+   * Protected constructor, use
+   * {@link DomEvent#fireNativeEvent(com.google.gwt.dom.client.NativeEvent, com.google.gwt.event.shared.HasHandlers)}
+   * to fire lose capture events.
+   */
+  protected LoseCaptureEvent() {
+  }
+
+  @Override
+  public final Type<LoseCaptureHandler> getAssociatedType() {
+    return TYPE;
+  }
+
+  @Override
+  protected void dispatch(LoseCaptureHandler handler) {
+    handler.onLoseCapture(this);
+  }
+
+}
diff --git a/user/src/com/google/gwt/event/dom/client/MouseDownEvent.java b/user/src/com/google/gwt/event/dom/client/MouseDownEvent.java
index 5dcfff6..29355d7 100644
--- a/user/src/com/google/gwt/event/dom/client/MouseDownEvent.java
+++ b/user/src/com/google/gwt/event/dom/client/MouseDownEvent.java
@@ -1,57 +1,57 @@
-/*

- * 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.event.dom.client;

-

-/**

- * Represents a native mouse down event.

- */

-public class MouseDownEvent extends MouseEvent<MouseDownHandler> {

-

-  /**

-   * Event type for mouse down events. Represents the meta-data associated with

-   * this event.

-   */

-  private static final Type<MouseDownHandler> TYPE = new Type<MouseDownHandler>(

-      "mousedown", new MouseDownEvent());

-

-  /**

-   * Gets the event type associated with mouse down events.

-   * 

-   * @return the handler type

-   */

-  public static Type<MouseDownHandler> getType() {

-    return TYPE;

-  }

-

-  /**

-   * Protected constructor, use

-   * {@link DomEvent#fireNativeEvent(com.google.gwt.dom.client.NativeEvent, com.google.gwt.event.shared.HasHandlers)}

-   * to fire mouse down events.

-   */

-  protected MouseDownEvent() {

-  }

-

-  @Override

-  public final Type<MouseDownHandler> getAssociatedType() {

-    return TYPE;

-  }

-

-  @Override

-  protected void dispatch(MouseDownHandler handler) {

-    handler.onMouseDown(this);

-  }

-

-}

+/*
+ * 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.event.dom.client;
+
+/**
+ * Represents a native mouse down event.
+ */
+public class MouseDownEvent extends MouseEvent<MouseDownHandler> {
+
+  /**
+   * Event type for mouse down events. Represents the meta-data associated with
+   * this event.
+   */
+  private static final Type<MouseDownHandler> TYPE = new Type<MouseDownHandler>(
+      "mousedown", new MouseDownEvent());
+
+  /**
+   * Gets the event type associated with mouse down events.
+   * 
+   * @return the handler type
+   */
+  public static Type<MouseDownHandler> getType() {
+    return TYPE;
+  }
+
+  /**
+   * Protected constructor, use
+   * {@link DomEvent#fireNativeEvent(com.google.gwt.dom.client.NativeEvent, com.google.gwt.event.shared.HasHandlers)}
+   * to fire mouse down events.
+   */
+  protected MouseDownEvent() {
+  }
+
+  @Override
+  public final Type<MouseDownHandler> getAssociatedType() {
+    return TYPE;
+  }
+
+  @Override
+  protected void dispatch(MouseDownHandler handler) {
+    handler.onMouseDown(this);
+  }
+
+}
diff --git a/user/src/com/google/gwt/event/dom/client/MouseMoveEvent.java b/user/src/com/google/gwt/event/dom/client/MouseMoveEvent.java
index cefd26c..674af95 100644
--- a/user/src/com/google/gwt/event/dom/client/MouseMoveEvent.java
+++ b/user/src/com/google/gwt/event/dom/client/MouseMoveEvent.java
@@ -1,57 +1,57 @@
-/*

- * 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.event.dom.client;

-

-/**

- * Represents a native mouse move event.

- */

-public class MouseMoveEvent extends MouseEvent<MouseMoveHandler> {

-

-  /**

-   * Event type for mouse move events. Represents the meta-data associated with

-   * this event.

-   */

-  private static final Type<MouseMoveHandler> TYPE = new Type<MouseMoveHandler>(

-      "mousemove", new MouseMoveEvent());

-

-  /**

-   * Gets the event type associated with mouse move events.

-   * 

-   * @return the handler type

-   */

-  public static Type<MouseMoveHandler> getType() {

-    return TYPE;

-  }

-

-  /**

-   * Protected constructor, use

-   * {@link DomEvent#fireNativeEvent(com.google.gwt.dom.client.NativeEvent, com.google.gwt.event.shared.HasHandlers)}

-   * to fire mouse move events.

-   */

-  protected MouseMoveEvent() {

-  }

-

-  @Override

-  public final Type<MouseMoveHandler> getAssociatedType() {

-    return TYPE;

-  }

-

-  @Override

-  protected void dispatch(MouseMoveHandler handler) {

-    handler.onMouseMove(this);

-  }

-

-}

+/*
+ * 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.event.dom.client;
+
+/**
+ * Represents a native mouse move event.
+ */
+public class MouseMoveEvent extends MouseEvent<MouseMoveHandler> {
+
+  /**
+   * Event type for mouse move events. Represents the meta-data associated with
+   * this event.
+   */
+  private static final Type<MouseMoveHandler> TYPE = new Type<MouseMoveHandler>(
+      "mousemove", new MouseMoveEvent());
+
+  /**
+   * Gets the event type associated with mouse move events.
+   * 
+   * @return the handler type
+   */
+  public static Type<MouseMoveHandler> getType() {
+    return TYPE;
+  }
+
+  /**
+   * Protected constructor, use
+   * {@link DomEvent#fireNativeEvent(com.google.gwt.dom.client.NativeEvent, com.google.gwt.event.shared.HasHandlers)}
+   * to fire mouse move events.
+   */
+  protected MouseMoveEvent() {
+  }
+
+  @Override
+  public final Type<MouseMoveHandler> getAssociatedType() {
+    return TYPE;
+  }
+
+  @Override
+  protected void dispatch(MouseMoveHandler handler) {
+    handler.onMouseMove(this);
+  }
+
+}
diff --git a/user/src/com/google/gwt/event/dom/client/MouseOutEvent.java b/user/src/com/google/gwt/event/dom/client/MouseOutEvent.java
index 7611621..4f18653 100644
--- a/user/src/com/google/gwt/event/dom/client/MouseOutEvent.java
+++ b/user/src/com/google/gwt/event/dom/client/MouseOutEvent.java
@@ -1,67 +1,67 @@
-/*

- * 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.event.dom.client;

-

-import com.google.gwt.dom.client.EventTarget;

-

-/**

- * Represents a native mouse out event.

- */

-public class MouseOutEvent extends MouseEvent<MouseOutHandler> {

-

-  /**

-   * Event type for mouse out events. Represents the meta-data associated with

-   * this event.

-   */

-  private static final Type<MouseOutHandler> TYPE = new Type<MouseOutHandler>(

-      "mouseout", new MouseOutEvent());

-

-  /**

-   * Gets the event type associated with mouse out events.

-   * 

-   * @return the handler type

-   */

-  public static Type<MouseOutHandler> getType() {

-    return TYPE;

-  }

-

-  /**

-   * Protected constructor, use

-   * {@link DomEvent#fireNativeEvent(com.google.gwt.dom.client.NativeEvent, com.google.gwt.event.shared.HasHandlers)}

-   * to fire mouse out events.

-   */

-  protected MouseOutEvent() {

-  }

-

-  @Override

-  public final Type<MouseOutHandler> getAssociatedType() {

-    return TYPE;

-  }

-

-  /**

-   * Gets the target to which the mouse pointer was moved.

-   * 

-   * @return the target to which the mouse pointer was moved

-   */

-  public EventTarget getRelatedTarget() {

-    return getNativeEvent().getRelatedEventTarget();

-  }

-

-  @Override

-  protected void dispatch(MouseOutHandler handler) {

-    handler.onMouseOut(this);

-  }

-}

+/*
+ * 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.event.dom.client;
+
+import com.google.gwt.dom.client.EventTarget;
+
+/**
+ * Represents a native mouse out event.
+ */
+public class MouseOutEvent extends MouseEvent<MouseOutHandler> {
+
+  /**
+   * Event type for mouse out events. Represents the meta-data associated with
+   * this event.
+   */
+  private static final Type<MouseOutHandler> TYPE = new Type<MouseOutHandler>(
+      "mouseout", new MouseOutEvent());
+
+  /**
+   * Gets the event type associated with mouse out events.
+   * 
+   * @return the handler type
+   */
+  public static Type<MouseOutHandler> getType() {
+    return TYPE;
+  }
+
+  /**
+   * Protected constructor, use
+   * {@link DomEvent#fireNativeEvent(com.google.gwt.dom.client.NativeEvent, com.google.gwt.event.shared.HasHandlers)}
+   * to fire mouse out events.
+   */
+  protected MouseOutEvent() {
+  }
+
+  @Override
+  public final Type<MouseOutHandler> getAssociatedType() {
+    return TYPE;
+  }
+
+  /**
+   * Gets the target to which the mouse pointer was moved.
+   * 
+   * @return the target to which the mouse pointer was moved
+   */
+  public EventTarget getRelatedTarget() {
+    return getNativeEvent().getRelatedEventTarget();
+  }
+
+  @Override
+  protected void dispatch(MouseOutHandler handler) {
+    handler.onMouseOut(this);
+  }
+}
diff --git a/user/src/com/google/gwt/event/dom/client/MouseOverEvent.java b/user/src/com/google/gwt/event/dom/client/MouseOverEvent.java
index 0518b82..1811b09 100644
--- a/user/src/com/google/gwt/event/dom/client/MouseOverEvent.java
+++ b/user/src/com/google/gwt/event/dom/client/MouseOverEvent.java
@@ -1,67 +1,67 @@
-/*

- * 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.event.dom.client;

-

-import com.google.gwt.dom.client.EventTarget;

-

-/**

- * Represents a native mouse over event.

- */

-public class MouseOverEvent extends MouseEvent<MouseOverHandler> {

-

-  /**

-   * Event type for mouse over events. Represents the meta-data associated with

-   * this event.

-   */

-  private static final Type<MouseOverHandler> TYPE = new Type<MouseOverHandler>(

-      "mouseover", new MouseOverEvent());

-

-  /**

-   * Gets the event type associated with mouse over events.

-   * 

-   * @return the handler type

-   */

-  public static Type<MouseOverHandler> getType() {

-    return TYPE;

-  }

-

-  /**

-   * Protected constructor, use

-   * {@link DomEvent#fireNativeEvent(com.google.gwt.dom.client.NativeEvent, com.google.gwt.event.shared.HasHandlers)}

-   * to fire mouse over events.

-   */

-  protected MouseOverEvent() {

-  }

-

-  @Override

-  public final Type<MouseOverHandler> getAssociatedType() {

-    return TYPE;

-  }

-

-  /**

-   * Gets the target from which the mouse pointer was moved.

-   * 

-   * @return the target from which the mouse pointer was moved

-   */

-  public EventTarget getRelatedTarget() {

-    return getNativeEvent().getRelatedEventTarget();

-  }

-

-  @Override

-  protected void dispatch(MouseOverHandler handler) {

-    handler.onMouseOver(this);

-  }

-}

+/*
+ * 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.event.dom.client;
+
+import com.google.gwt.dom.client.EventTarget;
+
+/**
+ * Represents a native mouse over event.
+ */
+public class MouseOverEvent extends MouseEvent<MouseOverHandler> {
+
+  /**
+   * Event type for mouse over events. Represents the meta-data associated with
+   * this event.
+   */
+  private static final Type<MouseOverHandler> TYPE = new Type<MouseOverHandler>(
+      "mouseover", new MouseOverEvent());
+
+  /**
+   * Gets the event type associated with mouse over events.
+   * 
+   * @return the handler type
+   */
+  public static Type<MouseOverHandler> getType() {
+    return TYPE;
+  }
+
+  /**
+   * Protected constructor, use
+   * {@link DomEvent#fireNativeEvent(com.google.gwt.dom.client.NativeEvent, com.google.gwt.event.shared.HasHandlers)}
+   * to fire mouse over events.
+   */
+  protected MouseOverEvent() {
+  }
+
+  @Override
+  public final Type<MouseOverHandler> getAssociatedType() {
+    return TYPE;
+  }
+
+  /**
+   * Gets the target from which the mouse pointer was moved.
+   * 
+   * @return the target from which the mouse pointer was moved
+   */
+  public EventTarget getRelatedTarget() {
+    return getNativeEvent().getRelatedEventTarget();
+  }
+
+  @Override
+  protected void dispatch(MouseOverHandler handler) {
+    handler.onMouseOver(this);
+  }
+}
diff --git a/user/src/com/google/gwt/event/dom/client/MouseUpEvent.java b/user/src/com/google/gwt/event/dom/client/MouseUpEvent.java
index a098ff0..f79353c 100644
--- a/user/src/com/google/gwt/event/dom/client/MouseUpEvent.java
+++ b/user/src/com/google/gwt/event/dom/client/MouseUpEvent.java
@@ -1,57 +1,57 @@
-/*

- * 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.event.dom.client;

-

-/**

- * Represents a native mouse up event.

- */

-public class MouseUpEvent extends MouseEvent<MouseUpHandler> {

-

-  /**

-   * Event type for mouse up events. Represents the meta-data associated with

-   * this event.

-   */

-  private static final Type<MouseUpHandler> TYPE = new Type<MouseUpHandler>(

-      "mouseup", new MouseUpEvent());

-

-  /**

-   * Gets the event type associated with mouse up events.

-   * 

-   * @return the handler type

-   */

-  public static Type<MouseUpHandler> getType() {

-    return TYPE;

-  }

-

-  /**

-   * Protected constructor, use

-   * {@link DomEvent#fireNativeEvent(com.google.gwt.dom.client.NativeEvent, com.google.gwt.event.shared.HasHandlers)}

-   * to fire mouse up events.

-   */

-  protected MouseUpEvent() {

-  }

-

-  @Override

-  public final Type<MouseUpHandler> getAssociatedType() {

-    return TYPE;

-  }

-

-  @Override

-  protected void dispatch(MouseUpHandler handler) {

-    handler.onMouseUp(this);

-  }

-

-}

+/*
+ * 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.event.dom.client;
+
+/**
+ * Represents a native mouse up event.
+ */
+public class MouseUpEvent extends MouseEvent<MouseUpHandler> {
+
+  /**
+   * Event type for mouse up events. Represents the meta-data associated with
+   * this event.
+   */
+  private static final Type<MouseUpHandler> TYPE = new Type<MouseUpHandler>(
+      "mouseup", new MouseUpEvent());
+
+  /**
+   * Gets the event type associated with mouse up events.
+   * 
+   * @return the handler type
+   */
+  public static Type<MouseUpHandler> getType() {
+    return TYPE;
+  }
+
+  /**
+   * Protected constructor, use
+   * {@link DomEvent#fireNativeEvent(com.google.gwt.dom.client.NativeEvent, com.google.gwt.event.shared.HasHandlers)}
+   * to fire mouse up events.
+   */
+  protected MouseUpEvent() {
+  }
+
+  @Override
+  public final Type<MouseUpHandler> getAssociatedType() {
+    return TYPE;
+  }
+
+  @Override
+  protected void dispatch(MouseUpHandler handler) {
+    handler.onMouseUp(this);
+  }
+
+}
diff --git a/user/src/com/google/gwt/event/dom/client/MouseWheelEvent.java b/user/src/com/google/gwt/event/dom/client/MouseWheelEvent.java
index 4251ccf..647bdb5 100644
--- a/user/src/com/google/gwt/event/dom/client/MouseWheelEvent.java
+++ b/user/src/com/google/gwt/event/dom/client/MouseWheelEvent.java
@@ -1,100 +1,100 @@
-/*

- * 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.event.dom.client;

-

-/**

- * Represents a native mouse wheel event.

- */

-public class MouseWheelEvent extends MouseEvent<MouseWheelHandler> {

-

-  /**

-   * Event type for mouse wheel events. Represents the meta-data associated with

-   * this event.

-   */

-  private static final Type<MouseWheelHandler> TYPE = new Type<MouseWheelHandler>(

-      "mousewheel", new MouseWheelEvent());

-

-  static {

-    /**

-     * Hidden type used to ensure DOMMouseScroll gets registered in the type map.

-     * This is the special name used on Mozilla browsers for what everyone else

-     * calls 'mousewheel'.

-     */

-    new Type<MouseWheelHandler>("DOMMouseScroll", new MouseWheelEvent());

-  }

-

-  /**

-   * Gets the event type associated with mouse wheel events.

-   * 

-   * @return the handler type

-   */

-  public static Type<MouseWheelHandler> getType() {

-    return TYPE;

-  }

-

-  /**

-   * Protected constructor, use

-   * {@link DomEvent#fireNativeEvent(com.google.gwt.dom.client.NativeEvent, com.google.gwt.event.shared.HasHandlers)}

-   * to fire mouse wheel events.

-   */

-  protected MouseWheelEvent() {

-  }

-

-  @Override

-  public final Type<MouseWheelHandler> getAssociatedType() {

-    return TYPE;

-  }

-

-  /**

-   * Get the change in the mouse wheel position along the Y-axis; positive if

-   * the mouse wheel is moving north (toward the top of the screen) or negative

-   * if the mouse wheel is moving south (toward the bottom of the screen).

-   * 

-   * Note that delta values are not normalized across browsers or OSes.

-   * 

-   * @return the delta of the mouse wheel along the y axis

-   */

-  public int getDeltaY() {

-    return getNativeEvent().getMouseWheelVelocityY();

-  }

-

-  /**

-   * Convenience method that returns <code>true</code> if {@link #getDeltaY()}

-   * is a negative value (ie, the velocity is directed toward the top of the

-   * screen).

-   * 

-   * @return true if the velocity is directed toward the top of the screen

-   */

-  public boolean isNorth() {

-    return getDeltaY() < 0;

-  }

-

-  /**

-   * Convenience method that returns <code>true</code> if {@link #getDeltaY()}

-   * is a positive value (ie, the velocity is directed toward the bottom of the

-   * screen).

-   * 

-   * @return true if the velocity is directed toward the bottom of the screen

-   */

-  public boolean isSouth() {

-    return getDeltaY() > 0;

-  }

-

-  @Override

-  protected void dispatch(MouseWheelHandler handler) {

-    handler.onMouseWheel(this);

-  }

-}

+/*
+ * 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.event.dom.client;
+
+/**
+ * Represents a native mouse wheel event.
+ */
+public class MouseWheelEvent extends MouseEvent<MouseWheelHandler> {
+
+  /**
+   * Event type for mouse wheel events. Represents the meta-data associated with
+   * this event.
+   */
+  private static final Type<MouseWheelHandler> TYPE = new Type<MouseWheelHandler>(
+      "mousewheel", new MouseWheelEvent());
+
+  static {
+    /**
+     * Hidden type used to ensure DOMMouseScroll gets registered in the type map.
+     * This is the special name used on Mozilla browsers for what everyone else
+     * calls 'mousewheel'.
+     */
+    new Type<MouseWheelHandler>("DOMMouseScroll", new MouseWheelEvent());
+  }
+
+  /**
+   * Gets the event type associated with mouse wheel events.
+   * 
+   * @return the handler type
+   */
+  public static Type<MouseWheelHandler> getType() {
+    return TYPE;
+  }
+
+  /**
+   * Protected constructor, use
+   * {@link DomEvent#fireNativeEvent(com.google.gwt.dom.client.NativeEvent, com.google.gwt.event.shared.HasHandlers)}
+   * to fire mouse wheel events.
+   */
+  protected MouseWheelEvent() {
+  }
+
+  @Override
+  public final Type<MouseWheelHandler> getAssociatedType() {
+    return TYPE;
+  }
+
+  /**
+   * Get the change in the mouse wheel position along the Y-axis; positive if
+   * the mouse wheel is moving north (toward the top of the screen) or negative
+   * if the mouse wheel is moving south (toward the bottom of the screen).
+   * 
+   * Note that delta values are not normalized across browsers or OSes.
+   * 
+   * @return the delta of the mouse wheel along the y axis
+   */
+  public int getDeltaY() {
+    return getNativeEvent().getMouseWheelVelocityY();
+  }
+
+  /**
+   * Convenience method that returns <code>true</code> if {@link #getDeltaY()}
+   * is a negative value (ie, the velocity is directed toward the top of the
+   * screen).
+   * 
+   * @return true if the velocity is directed toward the top of the screen
+   */
+  public boolean isNorth() {
+    return getDeltaY() < 0;
+  }
+
+  /**
+   * Convenience method that returns <code>true</code> if {@link #getDeltaY()}
+   * is a positive value (ie, the velocity is directed toward the bottom of the
+   * screen).
+   * 
+   * @return true if the velocity is directed toward the bottom of the screen
+   */
+  public boolean isSouth() {
+    return getDeltaY() > 0;
+  }
+
+  @Override
+  protected void dispatch(MouseWheelHandler handler) {
+    handler.onMouseWheel(this);
+  }
+}
diff --git a/user/src/com/google/gwt/event/dom/client/ScrollEvent.java b/user/src/com/google/gwt/event/dom/client/ScrollEvent.java
index 8451ce9..405ae4f 100644
--- a/user/src/com/google/gwt/event/dom/client/ScrollEvent.java
+++ b/user/src/com/google/gwt/event/dom/client/ScrollEvent.java
@@ -1,57 +1,57 @@
-/*

- * 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.event.dom.client;

-

-/**

- * Represents a native scroll event.

- */

-public class ScrollEvent extends DomEvent<ScrollHandler> {

-

-  /**

-   * Event type for scroll events. Represents the meta-data associated with this

-   * event.

-   */

-  private static final Type<ScrollHandler> TYPE = new Type<ScrollHandler>(

-      "scroll", new ScrollEvent());

-

-  /**

-   * Gets the event type associated with scroll events.

-   * 

-   * @return the handler type

-   */

-  public static Type<ScrollHandler> getType() {

-    return TYPE;

-  }

-

-  /**

-   * Protected constructor, use

-   * {@link DomEvent#fireNativeEvent(com.google.gwt.dom.client.NativeEvent, com.google.gwt.event.shared.HasHandlers)}

-   * to fire scroll events.

-   */

-  protected ScrollEvent() {

-  }

-

-  @Override

-  public final Type<ScrollHandler> getAssociatedType() {

-    return TYPE;

-  }

-

-  @Override

-  protected void dispatch(ScrollHandler handler) {

-    handler.onScroll(this);

-  }

-

-}

+/*
+ * 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.event.dom.client;
+
+/**
+ * Represents a native scroll event.
+ */
+public class ScrollEvent extends DomEvent<ScrollHandler> {
+
+  /**
+   * Event type for scroll events. Represents the meta-data associated with this
+   * event.
+   */
+  private static final Type<ScrollHandler> TYPE = new Type<ScrollHandler>(
+      "scroll", new ScrollEvent());
+
+  /**
+   * Gets the event type associated with scroll events.
+   * 
+   * @return the handler type
+   */
+  public static Type<ScrollHandler> getType() {
+    return TYPE;
+  }
+
+  /**
+   * Protected constructor, use
+   * {@link DomEvent#fireNativeEvent(com.google.gwt.dom.client.NativeEvent, com.google.gwt.event.shared.HasHandlers)}
+   * to fire scroll events.
+   */
+  protected ScrollEvent() {
+  }
+
+  @Override
+  public final Type<ScrollHandler> getAssociatedType() {
+    return TYPE;
+  }
+
+  @Override
+  protected void dispatch(ScrollHandler handler) {
+    handler.onScroll(this);
+  }
+
+}
diff --git a/user/src/com/google/gwt/event/logical/shared/CloseEvent.java b/user/src/com/google/gwt/event/logical/shared/CloseEvent.java
index aa71fd1..7e9e4ca 100644
--- a/user/src/com/google/gwt/event/logical/shared/CloseEvent.java
+++ b/user/src/com/google/gwt/event/logical/shared/CloseEvent.java
@@ -1,114 +1,114 @@
-/*

- * 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.event.logical.shared;

-

-import com.google.gwt.event.shared.GwtEvent;

-

-/**

- * Represents a close event.

- * 

- * @param <T> the type being closed

- */

-public class CloseEvent<T> extends GwtEvent<CloseHandler<T>> {

-

-  /**

-   * Handler type.

-   */

-  private static Type<CloseHandler<?>> TYPE;

-

-  /**

-   * Fires a close event on all registered handlers in the handler manager. If

-   * no such handlers exist, this method will do nothing.

-   * 

-   * @param <T> the target type

-   * @param source the source of the handlers

-   * @param target the target

-   */

-  public static <T> void fire(HasCloseHandlers<T> source, T target) {

-    fire(source, target, false);

-  }

-

-  /**

-   * Fires a close event on all registered handlers in the handler manager.

-   * 

-   * @param <T> the target type

-   * @param source the source of the handlers

-   * @param target the target

-   * @param autoClosed was the target closed automatically

-   */

-  public static <T> void fire(HasCloseHandlers<T> source, T target,

-      boolean autoClosed) {

-    if (TYPE != null) {

-      CloseEvent<T> event = new CloseEvent<T>(target, autoClosed);

-      source.fireEvent(event);

-    }

-  }

-

-  /**

-   * Gets the type associated with this event.

-   * 

-   * @return returns the handler type

-   */

-  public static Type<CloseHandler<?>> getType() {

-    return TYPE != null ? TYPE : (TYPE = new Type<CloseHandler<?>>());

-  }

-

-  private final T target;

-

-  private final boolean autoClosed;

-

-  /**

-   * Creates a new close event.

-   * 

-   * @param target the target

-   * @param autoClosed whether it is auto closed

-   */

-  protected CloseEvent(T target, boolean autoClosed) {

-    this.autoClosed = autoClosed;

-    this.target = target;

-  }

-

-  // The instance knows its of type T, but the TYPE

-  // field itself does not, so we have to do an unsafe cast here.

-  @SuppressWarnings("unchecked")

-  @Override

-  public final Type<CloseHandler<T>> getAssociatedType() {

-    return (Type) TYPE;

-  }

-

-  /**

-   * Gets the target.

-   * 

-   * @return the target

-   */

-  public T getTarget() {

-    return target;

-  }

-

-  /**

-   * Was the target automatically closed?

-   * 

-   * @return auto closed

-   */

-  public boolean isAutoClosed() {

-    return autoClosed;

-  }

-

-  @Override

-  protected void dispatch(CloseHandler<T> handler) {

-    handler.onClose(this);

-  }

-}

+/*
+ * 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.event.logical.shared;
+
+import com.google.gwt.event.shared.GwtEvent;
+
+/**
+ * Represents a close event.
+ * 
+ * @param <T> the type being closed
+ */
+public class CloseEvent<T> extends GwtEvent<CloseHandler<T>> {
+
+  /**
+   * Handler type.
+   */
+  private static Type<CloseHandler<?>> TYPE;
+
+  /**
+   * Fires a close event on all registered handlers in the handler manager. If
+   * no such handlers exist, this method will do nothing.
+   * 
+   * @param <T> the target type
+   * @param source the source of the handlers
+   * @param target the target
+   */
+  public static <T> void fire(HasCloseHandlers<T> source, T target) {
+    fire(source, target, false);
+  }
+
+  /**
+   * Fires a close event on all registered handlers in the handler manager.
+   * 
+   * @param <T> the target type
+   * @param source the source of the handlers
+   * @param target the target
+   * @param autoClosed was the target closed automatically
+   */
+  public static <T> void fire(HasCloseHandlers<T> source, T target,
+      boolean autoClosed) {
+    if (TYPE != null) {
+      CloseEvent<T> event = new CloseEvent<T>(target, autoClosed);
+      source.fireEvent(event);
+    }
+  }
+
+  /**
+   * Gets the type associated with this event.
+   * 
+   * @return returns the handler type
+   */
+  public static Type<CloseHandler<?>> getType() {
+    return TYPE != null ? TYPE : (TYPE = new Type<CloseHandler<?>>());
+  }
+
+  private final T target;
+
+  private final boolean autoClosed;
+
+  /**
+   * Creates a new close event.
+   * 
+   * @param target the target
+   * @param autoClosed whether it is auto closed
+   */
+  protected CloseEvent(T target, boolean autoClosed) {
+    this.autoClosed = autoClosed;
+    this.target = target;
+  }
+
+  // The instance knows its of type T, but the TYPE
+  // field itself does not, so we have to do an unsafe cast here.
+  @SuppressWarnings("unchecked")
+  @Override
+  public final Type<CloseHandler<T>> getAssociatedType() {
+    return (Type) TYPE;
+  }
+
+  /**
+   * Gets the target.
+   * 
+   * @return the target
+   */
+  public T getTarget() {
+    return target;
+  }
+
+  /**
+   * Was the target automatically closed?
+   * 
+   * @return auto closed
+   */
+  public boolean isAutoClosed() {
+    return autoClosed;
+  }
+
+  @Override
+  protected void dispatch(CloseHandler<T> handler) {
+    handler.onClose(this);
+  }
+}
diff --git a/user/src/com/google/gwt/event/logical/shared/CloseHandler.java b/user/src/com/google/gwt/event/logical/shared/CloseHandler.java
index 3b6e062..e82981e 100644
--- a/user/src/com/google/gwt/event/logical/shared/CloseHandler.java
+++ b/user/src/com/google/gwt/event/logical/shared/CloseHandler.java
@@ -1,33 +1,33 @@
-/*

- * 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.event.logical.shared;

-

-import com.google.gwt.event.shared.EventHandler;

-

-/**

- * Handler interface for {@link CloseEvent} events.

- * 

- * @param <T> the type being closed

- */

-public interface CloseHandler<T> extends EventHandler {

-

-  /**

-   * Called when {@link CloseEvent} is fired.

-   * 

-   * @param event the {@link CloseEvent} that was fired

-   */

-  void onClose(CloseEvent<T> event);

-}

+/*
+ * 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.event.logical.shared;
+
+import com.google.gwt.event.shared.EventHandler;
+
+/**
+ * Handler interface for {@link CloseEvent} events.
+ * 
+ * @param <T> the type being closed
+ */
+public interface CloseHandler<T> extends EventHandler {
+
+  /**
+   * Called when {@link CloseEvent} is fired.
+   * 
+   * @param event the {@link CloseEvent} that was fired
+   */
+  void onClose(CloseEvent<T> event);
+}
diff --git a/user/src/com/google/gwt/event/logical/shared/HasCloseHandlers.java b/user/src/com/google/gwt/event/logical/shared/HasCloseHandlers.java
index f9d3dfe..2943941 100644
--- a/user/src/com/google/gwt/event/logical/shared/HasCloseHandlers.java
+++ b/user/src/com/google/gwt/event/logical/shared/HasCloseHandlers.java
@@ -1,35 +1,35 @@
-/*

- * 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.event.logical.shared;

-

-import com.google.gwt.event.shared.HandlerRegistration;

-import com.google.gwt.event.shared.HasHandlers;

-

-/**

- * A widget that implements this interface is a public source of

- * {@link CloseEvent} events.

- * 

- * @param <T> the type being closed

- */

-public interface HasCloseHandlers<T> extends HasHandlers {

-  /**

-   * Adds a {@link CloseEvent} handler.

-   * 

-   * @param handler the handler

-   * @return the registration for the event

-   */

-  HandlerRegistration addCloseHandler(CloseHandler<T> handler);

-}

+/*
+ * 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.event.logical.shared;
+
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.gwt.event.shared.HasHandlers;
+
+/**
+ * A widget that implements this interface is a public source of
+ * {@link CloseEvent} events.
+ * 
+ * @param <T> the type being closed
+ */
+public interface HasCloseHandlers<T> extends HasHandlers {
+  /**
+   * Adds a {@link CloseEvent} handler.
+   * 
+   * @param handler the handler
+   * @return the registration for the event
+   */
+  HandlerRegistration addCloseHandler(CloseHandler<T> handler);
+}
diff --git a/user/src/com/google/gwt/event/logical/shared/HasHighlightHandlers.java b/user/src/com/google/gwt/event/logical/shared/HasHighlightHandlers.java
index a875031..d0827bf 100644
--- a/user/src/com/google/gwt/event/logical/shared/HasHighlightHandlers.java
+++ b/user/src/com/google/gwt/event/logical/shared/HasHighlightHandlers.java
@@ -1,35 +1,35 @@
-/*

- * 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.event.logical.shared;

-

-import com.google.gwt.event.shared.HandlerRegistration;

-import com.google.gwt.event.shared.HasHandlers;

-

-/**

- * A widget that implements this interface is a public source of

- * {@link HighlightEvent} events.

- * 

- * @param <V> the highlighted value type

- */

-public interface HasHighlightHandlers<V> extends HasHandlers {

-  /**

-   * Adds a {@link HighlightEvent} handler.

-   * 

-   * @param handler the handler

-   * @return the registration for the event

-   */

-  HandlerRegistration addHighlightHandler(HighlightHandler<V> handler);

-}

+/*
+ * 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.event.logical.shared;
+
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.gwt.event.shared.HasHandlers;
+
+/**
+ * A widget that implements this interface is a public source of
+ * {@link HighlightEvent} events.
+ * 
+ * @param <V> the highlighted value type
+ */
+public interface HasHighlightHandlers<V> extends HasHandlers {
+  /**
+   * Adds a {@link HighlightEvent} handler.
+   * 
+   * @param handler the handler
+   * @return the registration for the event
+   */
+  HandlerRegistration addHighlightHandler(HighlightHandler<V> handler);
+}
diff --git a/user/src/com/google/gwt/event/logical/shared/HasOpenHandlers.java b/user/src/com/google/gwt/event/logical/shared/HasOpenHandlers.java
index 67139c1..d3130d4 100644
--- a/user/src/com/google/gwt/event/logical/shared/HasOpenHandlers.java
+++ b/user/src/com/google/gwt/event/logical/shared/HasOpenHandlers.java
@@ -1,35 +1,35 @@
-/*

- * 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.event.logical.shared;

-

-import com.google.gwt.event.shared.HandlerRegistration;

-import com.google.gwt.event.shared.HasHandlers;

-

-/**

- * A widget that implements this interface is a public source of

- * {@link OpenEvent} events.

- * 

- * @param <T> the type being opened

- */

-public interface HasOpenHandlers<T> extends HasHandlers {

-  /**

-   * Adds a {@link OpenEvent} handler.

-   * 

-   * @param handler the handler

-   * @return the registration for the event

-   */

-  HandlerRegistration addOpenHandler(OpenHandler<T> handler);

-}

+/*
+ * 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.event.logical.shared;
+
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.gwt.event.shared.HasHandlers;
+
+/**
+ * A widget that implements this interface is a public source of
+ * {@link OpenEvent} events.
+ * 
+ * @param <T> the type being opened
+ */
+public interface HasOpenHandlers<T> extends HasHandlers {
+  /**
+   * Adds a {@link OpenEvent} handler.
+   * 
+   * @param handler the handler
+   * @return the registration for the event
+   */
+  HandlerRegistration addOpenHandler(OpenHandler<T> handler);
+}
diff --git a/user/src/com/google/gwt/event/logical/shared/HasSelectionHandlers.java b/user/src/com/google/gwt/event/logical/shared/HasSelectionHandlers.java
index 7598e05..e3404da 100644
--- a/user/src/com/google/gwt/event/logical/shared/HasSelectionHandlers.java
+++ b/user/src/com/google/gwt/event/logical/shared/HasSelectionHandlers.java
@@ -1,35 +1,35 @@
-/*

- * 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.event.logical.shared;

-

-import com.google.gwt.event.shared.HandlerRegistration;

-import com.google.gwt.event.shared.HasHandlers;

-

-/**

- * A widget that implements this interface is a public source of

- * {@link SelectionEvent} events.

- * 

- * @param <I> the type being selected

- */

-public interface HasSelectionHandlers<I> extends HasHandlers {

-  /**

-   * Adds a {@link SelectionEvent} handler.

-   * 

-   * @param handler the handler

-   * @return the registration for the event

-   */

-  HandlerRegistration addSelectionHandler(SelectionHandler<I> handler);

-}

+/*
+ * 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.event.logical.shared;
+
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.gwt.event.shared.HasHandlers;
+
+/**
+ * A widget that implements this interface is a public source of
+ * {@link SelectionEvent} events.
+ * 
+ * @param <I> the type being selected
+ */
+public interface HasSelectionHandlers<I> extends HasHandlers {
+  /**
+   * Adds a {@link SelectionEvent} handler.
+   * 
+   * @param handler the handler
+   * @return the registration for the event
+   */
+  HandlerRegistration addSelectionHandler(SelectionHandler<I> handler);
+}
diff --git a/user/src/com/google/gwt/event/logical/shared/HasShowRangeHandlers.java b/user/src/com/google/gwt/event/logical/shared/HasShowRangeHandlers.java
index ccedac3..138f8f3 100644
--- a/user/src/com/google/gwt/event/logical/shared/HasShowRangeHandlers.java
+++ b/user/src/com/google/gwt/event/logical/shared/HasShowRangeHandlers.java
@@ -1,35 +1,35 @@
-/*

- * 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.event.logical.shared;

-

-import com.google.gwt.event.shared.HandlerRegistration;

-import com.google.gwt.event.shared.HasHandlers;

-

-/**

- * A widget that implements this interface is a public source of

- * {@link ShowRangeEvent} events.

- * 

- * @param <V> the type of range

- */

-public interface HasShowRangeHandlers<V> extends HasHandlers {

-  /**

-   * Adds a {@link ShowRangeEvent} handler.

-   * 

-   * @param handler the handler

-   * @return the registration for the event

-   */

-  HandlerRegistration addShowRangeHandler(ShowRangeHandler<V> handler);

-}

+/*
+ * 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.event.logical.shared;
+
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.gwt.event.shared.HasHandlers;
+
+/**
+ * A widget that implements this interface is a public source of
+ * {@link ShowRangeEvent} events.
+ * 
+ * @param <V> the type of range
+ */
+public interface HasShowRangeHandlers<V> extends HasHandlers {
+  /**
+   * Adds a {@link ShowRangeEvent} handler.
+   * 
+   * @param handler the handler
+   * @return the registration for the event
+   */
+  HandlerRegistration addShowRangeHandler(ShowRangeHandler<V> handler);
+}
diff --git a/user/src/com/google/gwt/event/logical/shared/HasValueChangeHandlers.java b/user/src/com/google/gwt/event/logical/shared/HasValueChangeHandlers.java
index e893092..187a1d2 100644
--- a/user/src/com/google/gwt/event/logical/shared/HasValueChangeHandlers.java
+++ b/user/src/com/google/gwt/event/logical/shared/HasValueChangeHandlers.java
@@ -1,35 +1,35 @@
-/*

- * 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.event.logical.shared;

-

-import com.google.gwt.event.shared.HandlerRegistration;

-import com.google.gwt.event.shared.HasHandlers;

-

-/**

- * A widget that implements this interface is a public source of

- * {@link ValueChangeEvent} events.

- * 

- * @param <I> the value about to be changed

- */

-public interface HasValueChangeHandlers<I> extends HasHandlers {

-  /**

-   * Adds a {@link ValueChangeEvent} handler.

-   * 

-   * @param handler the handler

-   * @return the registration for the event

-   */

-  HandlerRegistration addValueChangeHandler(ValueChangeHandler<I> handler);

-}

+/*
+ * 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.event.logical.shared;
+
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.gwt.event.shared.HasHandlers;
+
+/**
+ * A widget that implements this interface is a public source of
+ * {@link ValueChangeEvent} events.
+ * 
+ * @param <I> the value about to be changed
+ */
+public interface HasValueChangeHandlers<I> extends HasHandlers {
+  /**
+   * Adds a {@link ValueChangeEvent} handler.
+   * 
+   * @param handler the handler
+   * @return the registration for the event
+   */
+  HandlerRegistration addValueChangeHandler(ValueChangeHandler<I> handler);
+}
diff --git a/user/src/com/google/gwt/event/logical/shared/HighlightEvent.java b/user/src/com/google/gwt/event/logical/shared/HighlightEvent.java
index ab8ed2e..970848e 100644
--- a/user/src/com/google/gwt/event/logical/shared/HighlightEvent.java
+++ b/user/src/com/google/gwt/event/logical/shared/HighlightEvent.java
@@ -1,93 +1,93 @@
-/*

- * 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.event.logical.shared;

-

-import com.google.gwt.event.shared.GwtEvent;

-import com.google.gwt.event.shared.HasHandlers;

-

-/**

- * Represents a highlight event.

- * 

- * @param <V> the highlighted value type

- */

-public class HighlightEvent<V> extends GwtEvent<HighlightHandler<V>> {

-

-  /**

-   * Handler type.

-   */

-  private static Type<HighlightHandler<?>> TYPE;

-

-  /**

-   * Fires a highlight event on all registered handlers in the handler manager.

-   * 

-   * @param <V> the highlighted value type

-   * @param <S> The event source

-   * @param source the source of the handlers

-   * @param highlighted the value highlighted

-   */

-  public static <V, S extends HasHighlightHandlers<V> & HasHandlers> void fire(

-      S source, V highlighted) {

-    if (TYPE != null) {

-      HighlightEvent<V> event = new HighlightEvent<V>(highlighted);

-      source.fireEvent(event);

-    }

-  }

-

-  /**

-   * Gets the type associated with this event.

-   * 

-   * @return returns the handler type

-   */

-  public static Type<HighlightHandler<?>> getType() {

-    if (TYPE == null) {

-      TYPE = new Type<HighlightHandler<?>>();

-    }

-    return TYPE;

-  }

-

-  private final V highlighted;

-

-  /**

-   * Creates a new highlight event.

-   * 

-   * @param highlighted value highlighted

-   */

-  protected HighlightEvent(V highlighted) {

-    this.highlighted = highlighted;

-  }

-

-  // Because of type erasure, our static type is

-  // wild carded, yet the "real" type should use our I param.

-  @SuppressWarnings("unchecked")

-  @Override

-  public final Type<HighlightHandler<V>> getAssociatedType() {

-    return (Type) TYPE;

-  }

-

-  /**

-   * Gets the value highlighted.

-   * 

-   * @return value highlighted

-   */

-  public V getHighlighted() {

-    return highlighted;

-  }

-

-  @Override

-  protected void dispatch(HighlightHandler<V> handler) {

-    handler.onHighlight(this);

-  }

-}

+/*
+ * 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.event.logical.shared;
+
+import com.google.gwt.event.shared.GwtEvent;
+import com.google.gwt.event.shared.HasHandlers;
+
+/**
+ * Represents a highlight event.
+ * 
+ * @param <V> the highlighted value type
+ */
+public class HighlightEvent<V> extends GwtEvent<HighlightHandler<V>> {
+
+  /**
+   * Handler type.
+   */
+  private static Type<HighlightHandler<?>> TYPE;
+
+  /**
+   * Fires a highlight event on all registered handlers in the handler manager.
+   * 
+   * @param <V> the highlighted value type
+   * @param <S> The event source
+   * @param source the source of the handlers
+   * @param highlighted the value highlighted
+   */
+  public static <V, S extends HasHighlightHandlers<V> & HasHandlers> void fire(
+      S source, V highlighted) {
+    if (TYPE != null) {
+      HighlightEvent<V> event = new HighlightEvent<V>(highlighted);
+      source.fireEvent(event);
+    }
+  }
+
+  /**
+   * Gets the type associated with this event.
+   * 
+   * @return returns the handler type
+   */
+  public static Type<HighlightHandler<?>> getType() {
+    if (TYPE == null) {
+      TYPE = new Type<HighlightHandler<?>>();
+    }
+    return TYPE;
+  }
+
+  private final V highlighted;
+
+  /**
+   * Creates a new highlight event.
+   * 
+   * @param highlighted value highlighted
+   */
+  protected HighlightEvent(V highlighted) {
+    this.highlighted = highlighted;
+  }
+
+  // Because of type erasure, our static type is
+  // wild carded, yet the "real" type should use our I param.
+  @SuppressWarnings("unchecked")
+  @Override
+  public final Type<HighlightHandler<V>> getAssociatedType() {
+    return (Type) TYPE;
+  }
+
+  /**
+   * Gets the value highlighted.
+   * 
+   * @return value highlighted
+   */
+  public V getHighlighted() {
+    return highlighted;
+  }
+
+  @Override
+  protected void dispatch(HighlightHandler<V> handler) {
+    handler.onHighlight(this);
+  }
+}
diff --git a/user/src/com/google/gwt/event/logical/shared/HighlightHandler.java b/user/src/com/google/gwt/event/logical/shared/HighlightHandler.java
index effc2ce..fbdf06f 100644
--- a/user/src/com/google/gwt/event/logical/shared/HighlightHandler.java
+++ b/user/src/com/google/gwt/event/logical/shared/HighlightHandler.java
@@ -1,33 +1,33 @@
-/*

- * 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.event.logical.shared;

-

-import com.google.gwt.event.shared.EventHandler;

-

-/**

- * Handler interface for {@link HighlightEvent} events.

- * 

- * @param <V> the highlighted value type

- */

-public interface HighlightHandler<V> extends EventHandler {

-

-  /**

-   * Called when {@link HighlightEvent} is fired.

-   * 

-   * @param event the {@link HighlightEvent} that was fired

-   */

-  void onHighlight(HighlightEvent<V> event);

-}

+/*
+ * 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.event.logical.shared;
+
+import com.google.gwt.event.shared.EventHandler;
+
+/**
+ * Handler interface for {@link HighlightEvent} events.
+ * 
+ * @param <V> the highlighted value type
+ */
+public interface HighlightHandler<V> extends EventHandler {
+
+  /**
+   * Called when {@link HighlightEvent} is fired.
+   * 
+   * @param event the {@link HighlightEvent} that was fired
+   */
+  void onHighlight(HighlightEvent<V> event);
+}
diff --git a/user/src/com/google/gwt/event/logical/shared/OpenEvent.java b/user/src/com/google/gwt/event/logical/shared/OpenEvent.java
index 1e6c20e..21e3e05 100644
--- a/user/src/com/google/gwt/event/logical/shared/OpenEvent.java
+++ b/user/src/com/google/gwt/event/logical/shared/OpenEvent.java
@@ -1,92 +1,92 @@
-/*

- * 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.event.logical.shared;

-

-import com.google.gwt.event.shared.GwtEvent;

-

-/**

- * Represents a open event.

- * 

- * @param <T> the type being opened

- */

-public class OpenEvent<T> extends GwtEvent<OpenHandler<T>> {

-

-  /**

-   * Handler type.

-   */

-  private static Type<OpenHandler<?>> TYPE;

-

-  /**

-   * Fires a open event on all registered handlers in the handler manager.If no

-   * such handlers exist, this method will do nothing.

-   * 

-   * @param <T> the target type

-   * @param source the source of the handlers

-   * @param target the target

-   */

-  public static <T> void fire(HasOpenHandlers<T> source, T target) {

-    if (TYPE != null) {

-      OpenEvent<T> event = new OpenEvent<T>(target);

-      source.fireEvent(event);

-    }

-  }

-

-  /**

-   * Gets the type associated with this event.

-   * 

-   * @return returns the handler type

-   */

-  public static Type<OpenHandler<?>> getType() {

-    if (TYPE == null) {

-      TYPE = new Type<OpenHandler<?>>();

-    }

-    return TYPE;

-  }

-

-  private final T target;

-

-  /**

-   * Creates a new open event.

-   * 

-   * @param target the ui object being opened

-   */

-  protected OpenEvent(T target) {

-    this.target = target;

-  }

-

-  @SuppressWarnings("unchecked")

-  @Override

-  public final Type<OpenHandler<T>> getAssociatedType() {

-    return (Type) TYPE;

-  }

-

-  /**

-   * Gets the target.

-   * 

-   * @return the target

-   */

-  public T getTarget() {

-    return target;

-  }

-

-  // Because of type erasure, our static type is

-  // wild carded, yet the "real" type should use our I param.

-

-  @Override

-  protected void dispatch(OpenHandler<T> handler) {

-    handler.onOpen(this);

-  }

-}

+/*
+ * 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.event.logical.shared;
+
+import com.google.gwt.event.shared.GwtEvent;
+
+/**
+ * Represents a open event.
+ * 
+ * @param <T> the type being opened
+ */
+public class OpenEvent<T> extends GwtEvent<OpenHandler<T>> {
+
+  /**
+   * Handler type.
+   */
+  private static Type<OpenHandler<?>> TYPE;
+
+  /**
+   * Fires a open event on all registered handlers in the handler manager.If no
+   * such handlers exist, this method will do nothing.
+   * 
+   * @param <T> the target type
+   * @param source the source of the handlers
+   * @param target the target
+   */
+  public static <T> void fire(HasOpenHandlers<T> source, T target) {
+    if (TYPE != null) {
+      OpenEvent<T> event = new OpenEvent<T>(target);
+      source.fireEvent(event);
+    }
+  }
+
+  /**
+   * Gets the type associated with this event.
+   * 
+   * @return returns the handler type
+   */
+  public static Type<OpenHandler<?>> getType() {
+    if (TYPE == null) {
+      TYPE = new Type<OpenHandler<?>>();
+    }
+    return TYPE;
+  }
+
+  private final T target;
+
+  /**
+   * Creates a new open event.
+   * 
+   * @param target the ui object being opened
+   */
+  protected OpenEvent(T target) {
+    this.target = target;
+  }
+
+  @SuppressWarnings("unchecked")
+  @Override
+  public final Type<OpenHandler<T>> getAssociatedType() {
+    return (Type) TYPE;
+  }
+
+  /**
+   * Gets the target.
+   * 
+   * @return the target
+   */
+  public T getTarget() {
+    return target;
+  }
+
+  // Because of type erasure, our static type is
+  // wild carded, yet the "real" type should use our I param.
+
+  @Override
+  protected void dispatch(OpenHandler<T> handler) {
+    handler.onOpen(this);
+  }
+}
diff --git a/user/src/com/google/gwt/event/logical/shared/OpenHandler.java b/user/src/com/google/gwt/event/logical/shared/OpenHandler.java
index c2053d6..c3d7581 100644
--- a/user/src/com/google/gwt/event/logical/shared/OpenHandler.java
+++ b/user/src/com/google/gwt/event/logical/shared/OpenHandler.java
@@ -1,33 +1,33 @@
-/*

- * 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.event.logical.shared;

-

-import com.google.gwt.event.shared.EventHandler;

-

-/**

- * Handler interface for {@link OpenEvent} events.

- * 

- * @param <T> the type being opened

- */

-public interface OpenHandler<T> extends EventHandler {

-

-  /**

-   * Called when {@link OpenEvent} is fired.

-   * 

-   * @param event the {@link OpenEvent} that was fired

-   */

-  void onOpen(OpenEvent<T> event);

-}

+/*
+ * 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.event.logical.shared;
+
+import com.google.gwt.event.shared.EventHandler;
+
+/**
+ * Handler interface for {@link OpenEvent} events.
+ * 
+ * @param <T> the type being opened
+ */
+public interface OpenHandler<T> extends EventHandler {
+
+  /**
+   * Called when {@link OpenEvent} is fired.
+   * 
+   * @param event the {@link OpenEvent} that was fired
+   */
+  void onOpen(OpenEvent<T> event);
+}
diff --git a/user/src/com/google/gwt/event/logical/shared/SelectionEvent.java b/user/src/com/google/gwt/event/logical/shared/SelectionEvent.java
index 3514c6a..abe083d 100644
--- a/user/src/com/google/gwt/event/logical/shared/SelectionEvent.java
+++ b/user/src/com/google/gwt/event/logical/shared/SelectionEvent.java
@@ -1,91 +1,91 @@
-/*

- * 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.event.logical.shared;

-

-import com.google.gwt.event.shared.GwtEvent;

-

-/**

- * Represents a selection event.

- * 

- * @param <I> the type being selected

- */

-public class SelectionEvent<I> extends GwtEvent<SelectionHandler<I>> {

-

-  /**

-   * Handler type.

-   */

-  private static Type<SelectionHandler<?>> TYPE;

-

-  /**

-   * Fires a selection event on all registered handlers in the handler

-   * manager.If no such handlers exist, this method will do nothing.

-   * 

-   * @param <I> the selected item type

-   * @param source the source of the handlers

-   * @param selectedItem the selected item

-   */

-  public static <I> void fire(HasSelectionHandlers<I> source, I selectedItem) {

-    if (TYPE != null) {

-      SelectionEvent<I> event = new SelectionEvent<I>(selectedItem);

-      source.fireEvent(event);

-    }

-  }

-

-  /**

-   * Gets the type associated with this event.

-   * 

-   * @return returns the handler type

-   */

-  public static Type<SelectionHandler<?>> getType() {

-    if (TYPE == null) {

-      TYPE = new Type<SelectionHandler<?>>();

-    }

-    return TYPE;

-  }

-

-  private final I selectedItem;

-

-  /**

-   * Creates a new selection event.

-   * 

-   * @param selectedItem selected item

-   */

-  protected SelectionEvent(I selectedItem) {

-    this.selectedItem = selectedItem;

-  }

-

-  // The instance knows its BeforeSelectionHandler is of type I, but the TYPE

-  // field itself does not, so we have to do an unsafe cast here.

-  @SuppressWarnings("unchecked")

-  @Override

-  public final Type<SelectionHandler<I>> getAssociatedType() {

-    return (Type) TYPE;

-  }

-

-  /**

-   * Gets the selected item.

-   * 

-   * @return the selected item

-   */

-  public I getSelectedItem() {

-    return selectedItem;

-  }

-

-  @Override

-  protected void dispatch(SelectionHandler<I> handler) {

-    handler.onSelection(this);

-  }

-}

+/*
+ * 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.event.logical.shared;
+
+import com.google.gwt.event.shared.GwtEvent;
+
+/**
+ * Represents a selection event.
+ * 
+ * @param <I> the type being selected
+ */
+public class SelectionEvent<I> extends GwtEvent<SelectionHandler<I>> {
+
+  /**
+   * Handler type.
+   */
+  private static Type<SelectionHandler<?>> TYPE;
+
+  /**
+   * Fires a selection event on all registered handlers in the handler
+   * manager.If no such handlers exist, this method will do nothing.
+   * 
+   * @param <I> the selected item type
+   * @param source the source of the handlers
+   * @param selectedItem the selected item
+   */
+  public static <I> void fire(HasSelectionHandlers<I> source, I selectedItem) {
+    if (TYPE != null) {
+      SelectionEvent<I> event = new SelectionEvent<I>(selectedItem);
+      source.fireEvent(event);
+    }
+  }
+
+  /**
+   * Gets the type associated with this event.
+   * 
+   * @return returns the handler type
+   */
+  public static Type<SelectionHandler<?>> getType() {
+    if (TYPE == null) {
+      TYPE = new Type<SelectionHandler<?>>();
+    }
+    return TYPE;
+  }
+
+  private final I selectedItem;
+
+  /**
+   * Creates a new selection event.
+   * 
+   * @param selectedItem selected item
+   */
+  protected SelectionEvent(I selectedItem) {
+    this.selectedItem = selectedItem;
+  }
+
+  // The instance knows its BeforeSelectionHandler is of type I, but the TYPE
+  // field itself does not, so we have to do an unsafe cast here.
+  @SuppressWarnings("unchecked")
+  @Override
+  public final Type<SelectionHandler<I>> getAssociatedType() {
+    return (Type) TYPE;
+  }
+
+  /**
+   * Gets the selected item.
+   * 
+   * @return the selected item
+   */
+  public I getSelectedItem() {
+    return selectedItem;
+  }
+
+  @Override
+  protected void dispatch(SelectionHandler<I> handler) {
+    handler.onSelection(this);
+  }
+}
diff --git a/user/src/com/google/gwt/event/logical/shared/SelectionHandler.java b/user/src/com/google/gwt/event/logical/shared/SelectionHandler.java
index 9b83baa..f9f2e07 100644
--- a/user/src/com/google/gwt/event/logical/shared/SelectionHandler.java
+++ b/user/src/com/google/gwt/event/logical/shared/SelectionHandler.java
@@ -1,33 +1,33 @@
-/*

- * 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.event.logical.shared;

-

-import com.google.gwt.event.shared.EventHandler;

-

-/**

- * Handler interface for {@link SelectionEvent} events.

- * 

- * @param <I> the type being selected

- */

-public interface SelectionHandler<I> extends EventHandler {

-

-  /**

-   * Called when {@link SelectionEvent} is fired.

-   * 

-   * @param event the {@link SelectionEvent} that was fired

-   */

-  void onSelection(SelectionEvent<I> event);

-}

+/*
+ * 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.event.logical.shared;
+
+import com.google.gwt.event.shared.EventHandler;
+
+/**
+ * Handler interface for {@link SelectionEvent} events.
+ * 
+ * @param <I> the type being selected
+ */
+public interface SelectionHandler<I> extends EventHandler {
+
+  /**
+   * Called when {@link SelectionEvent} is fired.
+   * 
+   * @param event the {@link SelectionEvent} that was fired
+   */
+  void onSelection(SelectionEvent<I> event);
+}
diff --git a/user/src/com/google/gwt/event/logical/shared/ShowRangeEvent.java b/user/src/com/google/gwt/event/logical/shared/ShowRangeEvent.java
index 81337d9..e3673df 100644
--- a/user/src/com/google/gwt/event/logical/shared/ShowRangeEvent.java
+++ b/user/src/com/google/gwt/event/logical/shared/ShowRangeEvent.java
@@ -1,108 +1,108 @@
-/*

- * 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.event.logical.shared;

-

-import com.google.gwt.event.shared.GwtEvent;

-import com.google.gwt.event.shared.HasHandlers;

-

-/**

- * Represents a show range event. This logical event should be used when a

- * widget displays a range of values to the user.

- * 

- * @param <V> the type of range

- */

-public class ShowRangeEvent<V> extends GwtEvent<ShowRangeHandler<V>> {

-

-  /**

-   * Handler type.

-   */

-  private static Type<ShowRangeHandler<?>> TYPE;

-

-  /**

-   * Fires a show range event on all registered handlers in the handler manager.

-   * 

-   * @param <V> the type of range

-   * @param <S> the event source

-   * @param source the source of the handlers

-   * @param start the start of the range

-   * @param end the end of the range

-   */

-  public static <V, S extends HasShowRangeHandlers<V> & HasHandlers> void fire(

-      S source, V start, V end) {

-    if (TYPE != null) {

-      ShowRangeEvent<V> event = new ShowRangeEvent<V>(start, end);

-      source.fireEvent(event);

-    }

-  }

-

-  /**

-   * Gets the type associated with this event.

-   * 

-   * @return returns the handler type

-   */

-  public static Type<ShowRangeHandler<?>> getType() {

-    if (TYPE == null) {

-      TYPE = new Type<ShowRangeHandler<?>>();

-    }

-    return TYPE;

-  }

-

-  private final V start;

-

-  private final V end;

-

-  /**

-   * Creates a new show range event.

-   * 

-   * @param start start of the range

-   * @param end end of the range

-   */

-  protected ShowRangeEvent(V start, V end) {

-    this.start = start;

-    this.end = end;

-  }

-

-  // Because of type erasure, our static type is

-  // wild carded, yet the "real" type should use our I param.

-  @SuppressWarnings("unchecked")

-  @Override

-  public final Type<ShowRangeHandler<V>> getAssociatedType() {

-    return (Type) TYPE;

-  }

-

-  /**

-   * Gets the end of the range.

-   * 

-   * @return end of the range

-   */

-  public V getEnd() {

-    return end;

-  }

-

-  /**

-   * Gets the start of the range.

-   * 

-   * @return start of the range

-   */

-  public V getStart() {

-    return start;

-  }

-

-  @Override

-  protected void dispatch(ShowRangeHandler<V> handler) {

-    handler.onShowRange(this);

-  }

-}

+/*
+ * 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.event.logical.shared;
+
+import com.google.gwt.event.shared.GwtEvent;
+import com.google.gwt.event.shared.HasHandlers;
+
+/**
+ * Represents a show range event. This logical event should be used when a
+ * widget displays a range of values to the user.
+ * 
+ * @param <V> the type of range
+ */
+public class ShowRangeEvent<V> extends GwtEvent<ShowRangeHandler<V>> {
+
+  /**
+   * Handler type.
+   */
+  private static Type<ShowRangeHandler<?>> TYPE;
+
+  /**
+   * Fires a show range event on all registered handlers in the handler manager.
+   * 
+   * @param <V> the type of range
+   * @param <S> the event source
+   * @param source the source of the handlers
+   * @param start the start of the range
+   * @param end the end of the range
+   */
+  public static <V, S extends HasShowRangeHandlers<V> & HasHandlers> void fire(
+      S source, V start, V end) {
+    if (TYPE != null) {
+      ShowRangeEvent<V> event = new ShowRangeEvent<V>(start, end);
+      source.fireEvent(event);
+    }
+  }
+
+  /**
+   * Gets the type associated with this event.
+   * 
+   * @return returns the handler type
+   */
+  public static Type<ShowRangeHandler<?>> getType() {
+    if (TYPE == null) {
+      TYPE = new Type<ShowRangeHandler<?>>();
+    }
+    return TYPE;
+  }
+
+  private final V start;
+
+  private final V end;
+
+  /**
+   * Creates a new show range event.
+   * 
+   * @param start start of the range
+   * @param end end of the range
+   */
+  protected ShowRangeEvent(V start, V end) {
+    this.start = start;
+    this.end = end;
+  }
+
+  // Because of type erasure, our static type is
+  // wild carded, yet the "real" type should use our I param.
+  @SuppressWarnings("unchecked")
+  @Override
+  public final Type<ShowRangeHandler<V>> getAssociatedType() {
+    return (Type) TYPE;
+  }
+
+  /**
+   * Gets the end of the range.
+   * 
+   * @return end of the range
+   */
+  public V getEnd() {
+    return end;
+  }
+
+  /**
+   * Gets the start of the range.
+   * 
+   * @return start of the range
+   */
+  public V getStart() {
+    return start;
+  }
+
+  @Override
+  protected void dispatch(ShowRangeHandler<V> handler) {
+    handler.onShowRange(this);
+  }
+}
diff --git a/user/src/com/google/gwt/event/logical/shared/ShowRangeHandler.java b/user/src/com/google/gwt/event/logical/shared/ShowRangeHandler.java
index bde468f..068212a 100644
--- a/user/src/com/google/gwt/event/logical/shared/ShowRangeHandler.java
+++ b/user/src/com/google/gwt/event/logical/shared/ShowRangeHandler.java
@@ -1,33 +1,33 @@
-/*

- * 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.event.logical.shared;

-

-import com.google.gwt.event.shared.EventHandler;

-

-/**

- * Handler interface for {@link ShowRangeEvent} events.

- * 

- * @param <V> the type of range

- */

-public interface ShowRangeHandler<V> extends EventHandler {

-

-  /**

-   * Called when {@link ShowRangeEvent} is fired.

-   * 

-   * @param event the {@link ShowRangeEvent} that was fired

-   */

-  void onShowRange(ShowRangeEvent<V> event);

-}

+/*
+ * 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.event.logical.shared;
+
+import com.google.gwt.event.shared.EventHandler;
+
+/**
+ * Handler interface for {@link ShowRangeEvent} events.
+ * 
+ * @param <V> the type of range
+ */
+public interface ShowRangeHandler<V> extends EventHandler {
+
+  /**
+   * Called when {@link ShowRangeEvent} is fired.
+   * 
+   * @param event the {@link ShowRangeEvent} that was fired
+   */
+  void onShowRange(ShowRangeEvent<V> event);
+}
diff --git a/user/src/com/google/gwt/event/logical/shared/ValueChangeEvent.java b/user/src/com/google/gwt/event/logical/shared/ValueChangeEvent.java
index 4b5513e..db3ba26 100644
--- a/user/src/com/google/gwt/event/logical/shared/ValueChangeEvent.java
+++ b/user/src/com/google/gwt/event/logical/shared/ValueChangeEvent.java
@@ -1,130 +1,130 @@
-/*

- * 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.event.logical.shared;

-

-import com.google.gwt.event.shared.GwtEvent;

-

-/**

- * Represents a value change event.

- * 

- * @param <I> the value about to be changed

- */

-public class ValueChangeEvent<I> extends GwtEvent<ValueChangeHandler<I>> {

-

-  /**

-   * Handler type.

-   */

-  private static Type<ValueChangeHandler<?>> TYPE;

-

-  /**

-   * Fires a value change event on all registered handlers in the handler

-   * manager.If no such handlers exist, this method will do nothing.

-   * 

-   * @param <I> the old value type

-   * @param source the source of the handlers

-   * @param value the value

-   */

-  public static <I> void fire(HasValueChangeHandlers<I> source, I value) {

-    if (TYPE != null) {

-      ValueChangeEvent<I> event = new ValueChangeEvent<I>(value);

-      source.fireEvent(event);

-    }

-  }

-

-  /**

-   * Fires value change event if the old value is not equal to the new value.

-   * Use this call rather than making the decision to short circuit yourself for

-   * safe handling of null.

-   * 

-   * @param <I> the old value type

-   * @param source the source of the handlers

-   * @param oldValue the oldValue, may be null

-   * @param newValue the newValue, may be null

-   */

-  public static <I> void fireIfNotEqual(HasValueChangeHandlers<I> source,

-      I oldValue, I newValue) {

-    if (shouldFire(source, oldValue, newValue)) {

-      ValueChangeEvent<I> event = new ValueChangeEvent<I>(newValue);

-      source.fireEvent(event);

-    }

-  }

-

-  /**

-   * Gets the type associated with this event.

-   * 

-   * @return returns the handler type

-   */

-  public static Type<ValueChangeHandler<?>> getType() {

-    if (TYPE == null) {

-      TYPE = new Type<ValueChangeHandler<?>>();

-    }

-    return TYPE;

-  }

-

-  /**

-   * Convenience method to allow subtypes to know when they should fire a value

-   * change event in a null-safe manner.

-   * 

-   * @param <I> value type

-   * @param source the source

-   * @param oldValue the old value

-   * @param newValue the new value

-   * @return whether the event should be fired

-   */

-  protected static <I> boolean shouldFire(HasValueChangeHandlers<I> source,

-      I oldValue, I newValue) {

-    return TYPE != null && oldValue != newValue

-        && (oldValue == null || !oldValue.equals(newValue));

-  }

-

-  private final I value;

-

-  /**

-   * Creates a value change event.

-   * 

-   * @param value the value

-   */

-  protected ValueChangeEvent(I value) {

-    this.value = value;

-  }

-

-  // The instance knows its BeforeSelectionHandler is of type I, but the TYPE

-  // field itself does not, so we have to do an unsafe cast here.

-  @SuppressWarnings("unchecked")

-  @Override

-  public final Type<ValueChangeHandler<I>> getAssociatedType() {

-    return (Type) TYPE;

-  }

-

-  /**

-   * Gets the value.

-   * 

-   * @return the value

-   */

-  public I getValue() {

-    return value;

-  }

- 

-  @Override

-  public String toDebugString() {

-    return super.toDebugString() + getValue();

-  }

-

-  @Override

-  protected void dispatch(ValueChangeHandler<I> handler) {

-    handler.onValueChange(this);

-  }

-}

+/*
+ * 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.event.logical.shared;
+
+import com.google.gwt.event.shared.GwtEvent;
+
+/**
+ * Represents a value change event.
+ * 
+ * @param <I> the value about to be changed
+ */
+public class ValueChangeEvent<I> extends GwtEvent<ValueChangeHandler<I>> {
+
+  /**
+   * Handler type.
+   */
+  private static Type<ValueChangeHandler<?>> TYPE;
+
+  /**
+   * Fires a value change event on all registered handlers in the handler
+   * manager.If no such handlers exist, this method will do nothing.
+   * 
+   * @param <I> the old value type
+   * @param source the source of the handlers
+   * @param value the value
+   */
+  public static <I> void fire(HasValueChangeHandlers<I> source, I value) {
+    if (TYPE != null) {
+      ValueChangeEvent<I> event = new ValueChangeEvent<I>(value);
+      source.fireEvent(event);
+    }
+  }
+
+  /**
+   * Fires value change event if the old value is not equal to the new value.
+   * Use this call rather than making the decision to short circuit yourself for
+   * safe handling of null.
+   * 
+   * @param <I> the old value type
+   * @param source the source of the handlers
+   * @param oldValue the oldValue, may be null
+   * @param newValue the newValue, may be null
+   */
+  public static <I> void fireIfNotEqual(HasValueChangeHandlers<I> source,
+      I oldValue, I newValue) {
+    if (shouldFire(source, oldValue, newValue)) {
+      ValueChangeEvent<I> event = new ValueChangeEvent<I>(newValue);
+      source.fireEvent(event);
+    }
+  }
+
+  /**
+   * Gets the type associated with this event.
+   * 
+   * @return returns the handler type
+   */
+  public static Type<ValueChangeHandler<?>> getType() {
+    if (TYPE == null) {
+      TYPE = new Type<ValueChangeHandler<?>>();
+    }
+    return TYPE;
+  }
+
+  /**
+   * Convenience method to allow subtypes to know when they should fire a value
+   * change event in a null-safe manner.
+   * 
+   * @param <I> value type
+   * @param source the source
+   * @param oldValue the old value
+   * @param newValue the new value
+   * @return whether the event should be fired
+   */
+  protected static <I> boolean shouldFire(HasValueChangeHandlers<I> source,
+      I oldValue, I newValue) {
+    return TYPE != null && oldValue != newValue
+        && (oldValue == null || !oldValue.equals(newValue));
+  }
+
+  private final I value;
+
+  /**
+   * Creates a value change event.
+   * 
+   * @param value the value
+   */
+  protected ValueChangeEvent(I value) {
+    this.value = value;
+  }
+
+  // The instance knows its BeforeSelectionHandler is of type I, but the TYPE
+  // field itself does not, so we have to do an unsafe cast here.
+  @SuppressWarnings("unchecked")
+  @Override
+  public final Type<ValueChangeHandler<I>> getAssociatedType() {
+    return (Type) TYPE;
+  }
+
+  /**
+   * Gets the value.
+   * 
+   * @return the value
+   */
+  public I getValue() {
+    return value;
+  }
+ 
+  @Override
+  public String toDebugString() {
+    return super.toDebugString() + getValue();
+  }
+
+  @Override
+  protected void dispatch(ValueChangeHandler<I> handler) {
+    handler.onValueChange(this);
+  }
+}
diff --git a/user/src/com/google/gwt/event/logical/shared/ValueChangeHandler.java b/user/src/com/google/gwt/event/logical/shared/ValueChangeHandler.java
index 808b97e..9fb4772 100644
--- a/user/src/com/google/gwt/event/logical/shared/ValueChangeHandler.java
+++ b/user/src/com/google/gwt/event/logical/shared/ValueChangeHandler.java
@@ -1,33 +1,33 @@
-/*

- * 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.event.logical.shared;

-

-import com.google.gwt.event.shared.EventHandler;

-

-/**

- * Handler interface for {@link ValueChangeEvent} events.

- * 

- * @param <I> the value about to be changed

- */

-public interface ValueChangeHandler<I> extends EventHandler {

-

-  /**

-   * Called when {@link ValueChangeEvent} is fired.

-   * 

-   * @param event the {@link ValueChangeEvent} that was fired

-   */

-  void onValueChange(ValueChangeEvent<I> event);

-}

+/*
+ * 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.event.logical.shared;
+
+import com.google.gwt.event.shared.EventHandler;
+
+/**
+ * Handler interface for {@link ValueChangeEvent} events.
+ * 
+ * @param <I> the value about to be changed
+ */
+public interface ValueChangeHandler<I> extends EventHandler {
+
+  /**
+   * Called when {@link ValueChangeEvent} is fired.
+   * 
+   * @param event the {@link ValueChangeEvent} that was fired
+   */
+  void onValueChange(ValueChangeEvent<I> event);
+}
diff --git a/user/src/com/google/gwt/event/shared/HandlerRegistration.java b/user/src/com/google/gwt/event/shared/HandlerRegistration.java
index 13344de..9031343 100644
--- a/user/src/com/google/gwt/event/shared/HandlerRegistration.java
+++ b/user/src/com/google/gwt/event/shared/HandlerRegistration.java
@@ -1,35 +1,35 @@
-/*

- * 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.event.shared;

-

-/**

- * Registration returned from a call to

- * {@link HandlerManager#addHandler(com.google.gwt.event.shared.GwtEvent.Type, EventHandler)}

- * . Use the handler registration to remove handlers when they are no longer

- * needed.

- * 

- * Note, this interface is under the control of the {@link HandlerManager} class

- * and may be expanded over time, so extend {@link DefaultHandlerRegistration}

- * if you do not wish to get compiler errors if we extend the handler registry

- * functionality.

- */

-public interface HandlerRegistration {

-  /**

-   * Removes the given handler from its manager.

-   */

-  void removeHandler();

-}

+/*
+ * 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.event.shared;
+
+/**
+ * Registration returned from a call to
+ * {@link HandlerManager#addHandler(com.google.gwt.event.shared.GwtEvent.Type, EventHandler)}
+ * . Use the handler registration to remove handlers when they are no longer
+ * needed.
+ * 
+ * Note, this interface is under the control of the {@link HandlerManager} class
+ * and may be expanded over time, so extend {@link DefaultHandlerRegistration}
+ * if you do not wish to get compiler errors if we extend the handler registry
+ * functionality.
+ */
+public interface HandlerRegistration {
+  /**
+   * Removes the given handler from its manager.
+   */
+  void removeHandler();
+}
diff --git a/user/src/com/google/gwt/event/shared/HasHandlers.java b/user/src/com/google/gwt/event/shared/HasHandlers.java
index 244f5a6..eb91e63 100644
--- a/user/src/com/google/gwt/event/shared/HasHandlers.java
+++ b/user/src/com/google/gwt/event/shared/HasHandlers.java
@@ -1,29 +1,29 @@
-/*

- * 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.event.shared;

-

-/**

- * An object that implements this interface has a collection of event handlers

- * associated with it.

- */

-public interface HasHandlers {

-  /**

-   * Fires the given event to all the appropriate handlers.

-   * 

-   * @param event the event to be fired

-   */

-  void fireEvent(GwtEvent<?> event);

-}

+/*
+ * 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.event.shared;
+
+/**
+ * An object that implements this interface has a collection of event handlers
+ * associated with it.
+ */
+public interface HasHandlers {
+  /**
+   * Fires the given event to all the appropriate handlers.
+   * 
+   * @param event the event to be fired
+   */
+  void fireEvent(GwtEvent<?> event);
+}
diff --git a/user/src/com/google/gwt/http/client/UrlBuilder.java b/user/src/com/google/gwt/http/client/UrlBuilder.java
index 3edd2bb..5d954cd 100644
--- a/user/src/com/google/gwt/http/client/UrlBuilder.java
+++ b/user/src/com/google/gwt/http/client/UrlBuilder.java
@@ -1,243 +1,243 @@
-/*

- * Copyright 2009 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.http.client;

-

-import java.util.HashMap;

-import java.util.Map;

-

-/**

- * Utility class to build a URL from components.

- * 

- * TODO(jlabanca): Add a constructor that parses an existing URL

- */

-public class UrlBuilder {

-

-  /**

-   * The port to use when no port should be specified.

-   */

-  public static final int PORT_UNSPECIFIED = Integer.MIN_VALUE;

-

-  /**

-   * A mapping of query parameters to their values.

-   */

-  private Map<String, String[]> listParamMap = new HashMap<String, String[]>();

-

-  private String protocol = "http";

-  private String host = null;

-  private int port = PORT_UNSPECIFIED;

-  private String path = null;

-  private String hash = null;

-

-  /**

-   * Build the URL and return it as an encoded string.

-   * 

-   * @return the encoded URL string

-   */

-  public String buildString() {

-    StringBuilder url = new StringBuilder();

-

-    // http://

-    url.append(protocol).append("://");

-

-    // http://www.google.com

-    if (host != null) {

-      url.append(host);

-    }

-

-    // http://www.google.com:80

-    if (port != PORT_UNSPECIFIED) {

-      url.append(":").append(port);

-    }

-

-    // http://www.google.com:80/path/to/file.html

-    if (path != null && !"".equals(path)) {

-      url.append("/").append(path);

-    }

-

-    // Generate the query string.

-    // http://www.google.com:80/path/to/file.html?k0=v0&k1=v1

-    char prefix = '?';

-    for (Map.Entry<String, String[]> entry : listParamMap.entrySet()) {

-      for (String val : entry.getValue()) {

-        url.append(prefix).append(entry.getKey()).append('=');

-        if (val != null) {

-          url.append(val);

-        }

-        prefix = '&';

-      }

-    }

-

-    // http://www.google.com:80/path/to/file.html?k0=v0&k1=v1#token

-    if (hash != null) {

-      url.append("#").append(hash);

-    }

-

-    return URL.encode(url.toString());

-  }

-

-  /**

-   * Remove a query parameter from the map.

-   * 

-   * @param name the parameter name

-   */

-  public UrlBuilder removeParameter(String name) {

-    listParamMap.remove(name);

-    return this;

-  }

-

-  /**

-   * Set the hash portion of the location (ex. myAnchor or #myAnchor).

-   * 

-   * @param hash the hash

-   */

-  public UrlBuilder setHash(String hash) {

-    if (hash != null && hash.startsWith("#")) {

-      hash = hash.substring(1);

-    }

-    this.hash = hash;

-    return this;

-  }

-

-  /**

-   * Set the host portion of the location (ex. google.com). You can also specify

-   * the port in this method (ex. localhost:8888).

-   * 

-   * @param host the host

-   */

-  public UrlBuilder setHost(String host) {

-    // Extract the port from the host.

-    if (host != null && host.contains(":")) {

-      String[] parts = host.split(":");

-      if (parts.length > 2) {

-        throw new IllegalArgumentException(

-            "Host contains more than one colon: " + host);

-      }

-      try {

-        setPort(Integer.parseInt(parts[1]));

-      } catch (NumberFormatException e) {

-        throw new IllegalArgumentException("Could not parse port out of host: "

-            + host);

-      }

-      host = parts[0];

-    }

-    this.host = host;

-    return this;

-  }

-

-  /**

-   * <p>

-   * Set a query parameter to a list of values. Each value in the list will be

-   * added as its own key/value pair.

-   * 

-   * <p>

-   * <h3>Example Output</h3>

-   * <code>?mykey=value0&mykey=value1&mykey=value2</code>

-   * </p>

-   * 

-   * @param key the key

-   * @param values the list of values

-   */

-  public UrlBuilder setParameter(String key, String... values) {

-    assertNotNullOrEmpty(key, "Key cannot be null or empty", false);

-    assertNotNull(values,

-        "Values cannot null. Try using removeParameter instead.");

-    if (values.length == 0) {

-      throw new IllegalArgumentException(

-          "Values cannot be empty.  Try using removeParameter instead.");

-    }

-    listParamMap.put(key, values);

-    return this;

-  }

-

-  /**

-   * Set the path portion of the location (ex. path/to/file.html).

-   * 

-   * @param path the path

-   */

-  public UrlBuilder setPath(String path) {

-    if (path != null && path.startsWith("/")) {

-      path = path.substring(1);

-    }

-    this.path = path;

-    return this;

-  }

-

-  /**

-   * Set the port to connect to.

-   * 

-   * @param port the port, or {@link #PORT_UNSPECIFIED}

-   */

-  public UrlBuilder setPort(int port) {

-    this.port = port;

-    return this;

-  }

-

-  /**

-   * Set the protocol portion of the location (ex. http).

-   * 

-   * @param protocol the protocol

-   */

-  public UrlBuilder setProtocol(String protocol) {

-    assertNotNull(protocol, "Protocol cannot be null");

-    if (protocol.endsWith("://")) {

-      protocol = protocol.substring(0, protocol.length() - 3);

-    } else if (protocol.endsWith(":/")) {

-      protocol = protocol.substring(0, protocol.length() - 2);

-    } else if (protocol.endsWith(":")) {

-      protocol = protocol.substring(0, protocol.length() - 1);

-    }

-    if (protocol.contains(":")) {

-      throw new IllegalArgumentException("Invalid protocol: " + protocol);

-    }

-    assertNotNullOrEmpty(protocol, "Protocol cannot be empty", false);

-    this.protocol = protocol;

-    return this;

-  }

-

-  /**

-   * Assert that the value is not null.

-   * 

-   * @param value the value

-   * @param message the message to include with any exceptions

-   * @throws IllegalArgumentException if value is null

-   */

-  private void assertNotNull(Object value, String message)

-      throws IllegalArgumentException {

-    if (value == null) {

-      throw new IllegalArgumentException(message);

-    }

-  }

-

-  /**

-   * Assert that the value is not null or empty.

-   * 

-   * @param value the value

-   * @param message the message to include with any exceptions

-   * @param isState if true, throw a state exception instead

-   * @throws IllegalArgumentException if value is null

-   * @throws IllegalStateException if value is null and isState is true

-   */

-  private void assertNotNullOrEmpty(String value, String message,

-      boolean isState) throws IllegalArgumentException {

-    if (value == null || value.length() == 0) {

-      if (isState) {

-        throw new IllegalStateException(message);

-      } else {

-        throw new IllegalArgumentException(message);

-      }

-    }

-  }

-}

+/*
+ * Copyright 2009 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.http.client;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Utility class to build a URL from components.
+ * 
+ * TODO(jlabanca): Add a constructor that parses an existing URL
+ */
+public class UrlBuilder {
+
+  /**
+   * The port to use when no port should be specified.
+   */
+  public static final int PORT_UNSPECIFIED = Integer.MIN_VALUE;
+
+  /**
+   * A mapping of query parameters to their values.
+   */
+  private Map<String, String[]> listParamMap = new HashMap<String, String[]>();
+
+  private String protocol = "http";
+  private String host = null;
+  private int port = PORT_UNSPECIFIED;
+  private String path = null;
+  private String hash = null;
+
+  /**
+   * Build the URL and return it as an encoded string.
+   * 
+   * @return the encoded URL string
+   */
+  public String buildString() {
+    StringBuilder url = new StringBuilder();
+
+    // http://
+    url.append(protocol).append("://");
+
+    // http://www.google.com
+    if (host != null) {
+      url.append(host);
+    }
+
+    // http://www.google.com:80
+    if (port != PORT_UNSPECIFIED) {
+      url.append(":").append(port);
+    }
+
+    // http://www.google.com:80/path/to/file.html
+    if (path != null && !"".equals(path)) {
+      url.append("/").append(path);
+    }
+
+    // Generate the query string.
+    // http://www.google.com:80/path/to/file.html?k0=v0&k1=v1
+    char prefix = '?';
+    for (Map.Entry<String, String[]> entry : listParamMap.entrySet()) {
+      for (String val : entry.getValue()) {
+        url.append(prefix).append(entry.getKey()).append('=');
+        if (val != null) {
+          url.append(val);
+        }
+        prefix = '&';
+      }
+    }
+
+    // http://www.google.com:80/path/to/file.html?k0=v0&k1=v1#token
+    if (hash != null) {
+      url.append("#").append(hash);
+    }
+
+    return URL.encode(url.toString());
+  }
+
+  /**
+   * Remove a query parameter from the map.
+   * 
+   * @param name the parameter name
+   */
+  public UrlBuilder removeParameter(String name) {
+    listParamMap.remove(name);
+    return this;
+  }
+
+  /**
+   * Set the hash portion of the location (ex. myAnchor or #myAnchor).
+   * 
+   * @param hash the hash
+   */
+  public UrlBuilder setHash(String hash) {
+    if (hash != null && hash.startsWith("#")) {
+      hash = hash.substring(1);
+    }
+    this.hash = hash;
+    return this;
+  }
+
+  /**
+   * Set the host portion of the location (ex. google.com). You can also specify
+   * the port in this method (ex. localhost:8888).
+   * 
+   * @param host the host
+   */
+  public UrlBuilder setHost(String host) {
+    // Extract the port from the host.
+    if (host != null && host.contains(":")) {
+      String[] parts = host.split(":");
+      if (parts.length > 2) {
+        throw new IllegalArgumentException(
+            "Host contains more than one colon: " + host);
+      }
+      try {
+        setPort(Integer.parseInt(parts[1]));
+      } catch (NumberFormatException e) {
+        throw new IllegalArgumentException("Could not parse port out of host: "
+            + host);
+      }
+      host = parts[0];
+    }
+    this.host = host;
+    return this;
+  }
+
+  /**
+   * <p>
+   * Set a query parameter to a list of values. Each value in the list will be
+   * added as its own key/value pair.
+   * 
+   * <p>
+   * <h3>Example Output</h3>
+   * <code>?mykey=value0&mykey=value1&mykey=value2</code>
+   * </p>
+   * 
+   * @param key the key
+   * @param values the list of values
+   */
+  public UrlBuilder setParameter(String key, String... values) {
+    assertNotNullOrEmpty(key, "Key cannot be null or empty", false);
+    assertNotNull(values,
+        "Values cannot null. Try using removeParameter instead.");
+    if (values.length == 0) {
+      throw new IllegalArgumentException(
+          "Values cannot be empty.  Try using removeParameter instead.");
+    }
+    listParamMap.put(key, values);
+    return this;
+  }
+
+  /**
+   * Set the path portion of the location (ex. path/to/file.html).
+   * 
+   * @param path the path
+   */
+  public UrlBuilder setPath(String path) {
+    if (path != null && path.startsWith("/")) {
+      path = path.substring(1);
+    }
+    this.path = path;
+    return this;
+  }
+
+  /**
+   * Set the port to connect to.
+   * 
+   * @param port the port, or {@link #PORT_UNSPECIFIED}
+   */
+  public UrlBuilder setPort(int port) {
+    this.port = port;
+    return this;
+  }
+
+  /**
+   * Set the protocol portion of the location (ex. http).
+   * 
+   * @param protocol the protocol
+   */
+  public UrlBuilder setProtocol(String protocol) {
+    assertNotNull(protocol, "Protocol cannot be null");
+    if (protocol.endsWith("://")) {
+      protocol = protocol.substring(0, protocol.length() - 3);
+    } else if (protocol.endsWith(":/")) {
+      protocol = protocol.substring(0, protocol.length() - 2);
+    } else if (protocol.endsWith(":")) {
+      protocol = protocol.substring(0, protocol.length() - 1);
+    }
+    if (protocol.contains(":")) {
+      throw new IllegalArgumentException("Invalid protocol: " + protocol);
+    }
+    assertNotNullOrEmpty(protocol, "Protocol cannot be empty", false);
+    this.protocol = protocol;
+    return this;
+  }
+
+  /**
+   * Assert that the value is not null.
+   * 
+   * @param value the value
+   * @param message the message to include with any exceptions
+   * @throws IllegalArgumentException if value is null
+   */
+  private void assertNotNull(Object value, String message)
+      throws IllegalArgumentException {
+    if (value == null) {
+      throw new IllegalArgumentException(message);
+    }
+  }
+
+  /**
+   * Assert that the value is not null or empty.
+   * 
+   * @param value the value
+   * @param message the message to include with any exceptions
+   * @param isState if true, throw a state exception instead
+   * @throws IllegalArgumentException if value is null
+   * @throws IllegalStateException if value is null and isState is true
+   */
+  private void assertNotNullOrEmpty(String value, String message,
+      boolean isState) throws IllegalArgumentException {
+    if (value == null || value.length() == 0) {
+      if (isState) {
+        throw new IllegalStateException(message);
+      } else {
+        throw new IllegalArgumentException(message);
+      }
+    }
+  }
+}
diff --git a/user/src/com/google/gwt/i18n/rebind/ClearStaticData.java b/user/src/com/google/gwt/i18n/rebind/ClearStaticData.java
index 1df9c25..b433fc8 100644
--- a/user/src/com/google/gwt/i18n/rebind/ClearStaticData.java
+++ b/user/src/com/google/gwt/i18n/rebind/ClearStaticData.java
@@ -1,28 +1,28 @@
-/*

- * Copyright 2009 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.i18n.rebind;

-

-/**

- * HACK: Allows clearing accumulated static state.

- * 

- * TODO(jat): Make i18n.rebind not pin static state.

- */

-public class ClearStaticData {

-  public static void clear() {

-    ResourceFactory.clearCache();

-    LocaleUtils.clear();

-  }

-}

+/*
+ * Copyright 2009 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.i18n.rebind;
+
+/**
+ * HACK: Allows clearing accumulated static state.
+ * 
+ * TODO(jat): Make i18n.rebind not pin static state.
+ */
+public class ClearStaticData {
+  public static void clear() {
+    ResourceFactory.clearCache();
+    LocaleUtils.clear();
+  }
+}
diff --git a/user/src/com/google/gwt/user/client/BaseListenerWrapper.java b/user/src/com/google/gwt/user/client/BaseListenerWrapper.java
index a196bb2..ec7f8fb 100644
--- a/user/src/com/google/gwt/user/client/BaseListenerWrapper.java
+++ b/user/src/com/google/gwt/user/client/BaseListenerWrapper.java
@@ -1,243 +1,243 @@
-/*

- * 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.user.client;

-

-import com.google.gwt.event.logical.shared.CloseEvent;

-import com.google.gwt.event.logical.shared.CloseHandler;

-import com.google.gwt.event.logical.shared.ResizeEvent;

-import com.google.gwt.event.logical.shared.ResizeHandler;

-import com.google.gwt.event.logical.shared.ValueChangeEvent;

-import com.google.gwt.event.logical.shared.ValueChangeHandler;

-import com.google.gwt.event.shared.EventHandler;

-import com.google.gwt.event.shared.GwtEvent;

-import com.google.gwt.event.shared.HandlerManager;

-import com.google.gwt.event.shared.GwtEvent.Type;

-import com.google.gwt.user.client.Event.NativePreviewEvent;

-import com.google.gwt.user.client.ui.Widget;

-

-/**

- * Legacy listener support hierarchy root.

- * 

- * Note, this class and its subtypes all assume that the handlers are stored in

- * handler managers.

- * 

- * This class, and its children are used to gather the bulk of the legacy glue

- * code in one place, for easy deletion when Listener methods are deleted.

- * 

- * @param <T> listener type to be wrapped

- * @deprecated will be removed in GWT 2.0 with the handler listeners themselves

- */

-@Deprecated

-public abstract class BaseListenerWrapper<T> implements EventHandler {

-

-  static class NativePreview extends BaseListenerWrapper<EventPreview>

-      implements Event.NativePreviewHandler {

-    @Deprecated

-    public static void add(EventPreview listener) {

-      Event.addNativePreviewHandler(new NativePreview(listener));

-    }

-

-    public static void remove(EventPreview listener) {

-      baseRemove(Event.handlers, listener, NativePreviewEvent.getType());

-    }

-

-    private NativePreview(EventPreview listener) {

-      super(listener);

-    }

-

-    public void onPreviewNativeEvent(NativePreviewEvent event) {

-      // The legacy EventHandler should only fire if it is on the top of the

-      // stack (ie. the last one added).

-      if (event.isFirstHandler()) {

-        if (!listener.onEventPreview(Event.as(event.getNativeEvent()))) {

-          event.cancel();

-        }

-      }

-    }

-  }

-

-  static class WrapHistory extends BaseListenerWrapper<HistoryListener>

-      implements ValueChangeHandler<String> {

-    @Deprecated

-    public static void add(HistoryListener listener) {

-      History.addValueChangeHandler(new WrapHistory(listener));

-    }

-

-    public static void remove(HandlerManager manager, HistoryListener listener) {

-      baseRemove(manager, listener, ValueChangeEvent.getType());

-    }

-

-    private WrapHistory(HistoryListener listener) {

-      super(listener);

-    }

-

-    public void onValueChange(ValueChangeEvent<String> event) {

-      listener.onHistoryChanged(event.getValue());

-    }

-  }

-

-  static class WrapWindowClose extends BaseListenerWrapper<WindowCloseListener>

-      implements Window.ClosingHandler, CloseHandler<Window> {

-    @Deprecated

-    public static void add(WindowCloseListener listener) {

-      WrapWindowClose handler = new WrapWindowClose(listener);

-      Window.addWindowClosingHandler(handler);

-      Window.addCloseHandler(handler);

-    }

-

-    public static void remove(HandlerManager manager,

-        WindowCloseListener listener) {

-      baseRemove(manager, listener, Window.ClosingEvent.getType(),

-          CloseEvent.getType());

-    }

-

-    private WrapWindowClose(WindowCloseListener listener) {

-      super(listener);

-    }

-

-    public void onClose(CloseEvent<Window> event) {

-      listener.onWindowClosed();

-    }

-

-    public void onWindowClosing(Window.ClosingEvent event) {

-      String message = listener.onWindowClosing();

-      if (event.getMessage() == null) {

-        event.setMessage(message);

-      }

-    }

-  }

-

-  static class WrapWindowResize extends

-      BaseListenerWrapper<WindowResizeListener> implements ResizeHandler {

-    @Deprecated

-    public static void add(WindowResizeListener listener) {

-      Window.addResizeHandler(new WrapWindowResize(listener));

-    }

-

-    public static void remove(HandlerManager manager,

-        WindowResizeListener listener) {

-      baseRemove(manager, listener, ResizeEvent.getType());

-    }

-

-    private WrapWindowResize(WindowResizeListener listener) {

-      super(listener);

-    }

-

-    public void onResize(ResizeEvent event) {

-      listener.onWindowResized(event.getWidth(), event.getHeight());

-    }

-  }

-

-  static class WrapWindowScroll extends

-      BaseListenerWrapper<WindowScrollListener> implements Window.ScrollHandler {

-    @Deprecated

-    public static void add(WindowScrollListener listener) {

-      Window.addWindowScrollHandler(new WrapWindowScroll(listener));

-    }

-

-    public static void remove(HandlerManager manager,

-        WindowScrollListener listener) {

-      baseRemove(manager, listener, Window.ScrollEvent.getType());

-    }

-

-    private WrapWindowScroll(WindowScrollListener listener) {

-      super(listener);

-    }

-

-    public void onWindowScroll(Window.ScrollEvent event) {

-      listener.onWindowScrolled(event.getScrollLeft(), event.getScrollTop());

-    }

-  }

-

-  /**

-   * Helper method to remove all wrapped listeners from the given event types.

-   * 

-   * @param manager the manager to remove the listener from

-   * @param listener the listener

-   * @param types the event types to remove the listener from

-   * @param <H>

-   */

-  // This is an internal helper method with the current formulation, we have

-  // lost the info needed to make it safe by this point.

-  @SuppressWarnings("unchecked")

-  protected static <H extends EventHandler> void baseRemove(

-      HandlerManager manager, Object listener, Type... types) {

-    if (manager != null) {

-      for (Type<H> key : types) {

-        int handlerCount = manager.getHandlerCount(key);

-        // We are removing things as we traverse, have to go backward

-        for (int i = handlerCount - 1; i >= 0; i--) {

-          H handler = manager.getHandler(key, i);

-          if (handler instanceof BaseListenerWrapper

-              && ((BaseListenerWrapper) handler).listener.equals(listener)) {

-            manager.removeHandler(key, handler);

-          }

-        }

-      }

-    }

-  }

-

-  /**

-   * Listener being wrapped.

-   */

-  final T listener;

-

-  private Widget source;

-

-  /**

-   * Creates a new listener wrapper.

-   * 

-   * @param listener the listener to wrap

-   */

-  protected BaseListenerWrapper(T listener) {

-    this.listener = listener;

-  }

-

-  /**

-   * Sets the widget source to pass to the listeners. Source defaults to

-   * event.getSource() if this method is not used.

-   * 

-   * @param source the source to provide as the listener's source

-   */

-  public void setSource(Widget source) {

-    this.source = source;

-  }

-

-  /**

-   * Gets the listener being wrapped.

-   * 

-   * @return the wrapped listener

-   */

-  protected T getListener() {

-    return listener;

-  }

-

-  /**

-   * Gets the widget source to pass to the listeners. Source defaults to

-   * event.getSource() if not specified by {@link #setSource(Widget)}.

-   * 

-   * @param event the event

-   * @return source the source to provide as the listener's source

-   */

-  protected Widget getSource(GwtEvent<?> event) {

-    if (source == null) {

-      return (Widget) event.getSource();

-    } else {

-      return source;

-    }

-  }

-}

+/*
+ * 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.user.client;
+
+import com.google.gwt.event.logical.shared.CloseEvent;
+import com.google.gwt.event.logical.shared.CloseHandler;
+import com.google.gwt.event.logical.shared.ResizeEvent;
+import com.google.gwt.event.logical.shared.ResizeHandler;
+import com.google.gwt.event.logical.shared.ValueChangeEvent;
+import com.google.gwt.event.logical.shared.ValueChangeHandler;
+import com.google.gwt.event.shared.EventHandler;
+import com.google.gwt.event.shared.GwtEvent;
+import com.google.gwt.event.shared.HandlerManager;
+import com.google.gwt.event.shared.GwtEvent.Type;
+import com.google.gwt.user.client.Event.NativePreviewEvent;
+import com.google.gwt.user.client.ui.Widget;
+
+/**
+ * Legacy listener support hierarchy root.
+ * 
+ * Note, this class and its subtypes all assume that the handlers are stored in
+ * handler managers.
+ * 
+ * This class, and its children are used to gather the bulk of the legacy glue
+ * code in one place, for easy deletion when Listener methods are deleted.
+ * 
+ * @param <T> listener type to be wrapped
+ * @deprecated will be removed in GWT 2.0 with the handler listeners themselves
+ */
+@Deprecated
+public abstract class BaseListenerWrapper<T> implements EventHandler {
+
+  static class NativePreview extends BaseListenerWrapper<EventPreview>
+      implements Event.NativePreviewHandler {
+    @Deprecated
+    public static void add(EventPreview listener) {
+      Event.addNativePreviewHandler(new NativePreview(listener));
+    }
+
+    public static void remove(EventPreview listener) {
+      baseRemove(Event.handlers, listener, NativePreviewEvent.getType());
+    }
+
+    private NativePreview(EventPreview listener) {
+      super(listener);
+    }
+
+    public void onPreviewNativeEvent(NativePreviewEvent event) {
+      // The legacy EventHandler should only fire if it is on the top of the
+      // stack (ie. the last one added).
+      if (event.isFirstHandler()) {
+        if (!listener.onEventPreview(Event.as(event.getNativeEvent()))) {
+          event.cancel();
+        }
+      }
+    }
+  }
+
+  static class WrapHistory extends BaseListenerWrapper<HistoryListener>
+      implements ValueChangeHandler<String> {
+    @Deprecated
+    public static void add(HistoryListener listener) {
+      History.addValueChangeHandler(new WrapHistory(listener));
+    }
+
+    public static void remove(HandlerManager manager, HistoryListener listener) {
+      baseRemove(manager, listener, ValueChangeEvent.getType());
+    }
+
+    private WrapHistory(HistoryListener listener) {
+      super(listener);
+    }
+
+    public void onValueChange(ValueChangeEvent<String> event) {
+      listener.onHistoryChanged(event.getValue());
+    }
+  }
+
+  static class WrapWindowClose extends BaseListenerWrapper<WindowCloseListener>
+      implements Window.ClosingHandler, CloseHandler<Window> {
+    @Deprecated
+    public static void add(WindowCloseListener listener) {
+      WrapWindowClose handler = new WrapWindowClose(listener);
+      Window.addWindowClosingHandler(handler);
+      Window.addCloseHandler(handler);
+    }
+
+    public static void remove(HandlerManager manager,
+        WindowCloseListener listener) {
+      baseRemove(manager, listener, Window.ClosingEvent.getType(),
+          CloseEvent.getType());
+    }
+
+    private WrapWindowClose(WindowCloseListener listener) {
+      super(listener);
+    }
+
+    public void onClose(CloseEvent<Window> event) {
+      listener.onWindowClosed();
+    }
+
+    public void onWindowClosing(Window.ClosingEvent event) {
+      String message = listener.onWindowClosing();
+      if (event.getMessage() == null) {
+        event.setMessage(message);
+      }
+    }
+  }
+
+  static class WrapWindowResize extends
+      BaseListenerWrapper<WindowResizeListener> implements ResizeHandler {
+    @Deprecated
+    public static void add(WindowResizeListener listener) {
+      Window.addResizeHandler(new WrapWindowResize(listener));
+    }
+
+    public static void remove(HandlerManager manager,
+        WindowResizeListener listener) {
+      baseRemove(manager, listener, ResizeEvent.getType());
+    }
+
+    private WrapWindowResize(WindowResizeListener listener) {
+      super(listener);
+    }
+
+    public void onResize(ResizeEvent event) {
+      listener.onWindowResized(event.getWidth(), event.getHeight());
+    }
+  }
+
+  static class WrapWindowScroll extends
+      BaseListenerWrapper<WindowScrollListener> implements Window.ScrollHandler {
+    @Deprecated
+    public static void add(WindowScrollListener listener) {
+      Window.addWindowScrollHandler(new WrapWindowScroll(listener));
+    }
+
+    public static void remove(HandlerManager manager,
+        WindowScrollListener listener) {
+      baseRemove(manager, listener, Window.ScrollEvent.getType());
+    }
+
+    private WrapWindowScroll(WindowScrollListener listener) {
+      super(listener);
+    }
+
+    public void onWindowScroll(Window.ScrollEvent event) {
+      listener.onWindowScrolled(event.getScrollLeft(), event.getScrollTop());
+    }
+  }
+
+  /**
+   * Helper method to remove all wrapped listeners from the given event types.
+   * 
+   * @param manager the manager to remove the listener from
+   * @param listener the listener
+   * @param types the event types to remove the listener from
+   * @param <H>
+   */
+  // This is an internal helper method with the current formulation, we have
+  // lost the info needed to make it safe by this point.
+  @SuppressWarnings("unchecked")
+  protected static <H extends EventHandler> void baseRemove(
+      HandlerManager manager, Object listener, Type... types) {
+    if (manager != null) {
+      for (Type<H> key : types) {
+        int handlerCount = manager.getHandlerCount(key);
+        // We are removing things as we traverse, have to go backward
+        for (int i = handlerCount - 1; i >= 0; i--) {
+          H handler = manager.getHandler(key, i);
+          if (handler instanceof BaseListenerWrapper
+              && ((BaseListenerWrapper) handler).listener.equals(listener)) {
+            manager.removeHandler(key, handler);
+          }
+        }
+      }
+    }
+  }
+
+  /**
+   * Listener being wrapped.
+   */
+  final T listener;
+
+  private Widget source;
+
+  /**
+   * Creates a new listener wrapper.
+   * 
+   * @param listener the listener to wrap
+   */
+  protected BaseListenerWrapper(T listener) {
+    this.listener = listener;
+  }
+
+  /**
+   * Sets the widget source to pass to the listeners. Source defaults to
+   * event.getSource() if this method is not used.
+   * 
+   * @param source the source to provide as the listener's source
+   */
+  public void setSource(Widget source) {
+    this.source = source;
+  }
+
+  /**
+   * Gets the listener being wrapped.
+   * 
+   * @return the wrapped listener
+   */
+  protected T getListener() {
+    return listener;
+  }
+
+  /**
+   * Gets the widget source to pass to the listeners. Source defaults to
+   * event.getSource() if not specified by {@link #setSource(Widget)}.
+   * 
+   * @param event the event
+   * @return source the source to provide as the listener's source
+   */
+  protected Widget getSource(GwtEvent<?> event) {
+    if (source == null) {
+      return (Widget) event.getSource();
+    } else {
+      return source;
+    }
+  }
+}
diff --git a/user/src/com/google/gwt/user/client/impl/ElementMapperImpl.java b/user/src/com/google/gwt/user/client/impl/ElementMapperImpl.java
index e5dba7c..c5163ad 100644
--- a/user/src/com/google/gwt/user/client/impl/ElementMapperImpl.java
+++ b/user/src/com/google/gwt/user/client/impl/ElementMapperImpl.java
@@ -1,124 +1,124 @@
-/*

- * 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.user.client.impl;

-

-import com.google.gwt.user.client.Element;

-import com.google.gwt.user.client.ui.UIObject;

-

-import java.util.ArrayList;

-import java.util.Iterator;

-

-/**

- * Creates a mapping from elements to their associated ui objects.

- * 

- * @param <T> the type that the element is mapped to

- */

-public class ElementMapperImpl<T extends UIObject> {

-

-  private static class FreeNode {

-    int index;

-    ElementMapperImpl.FreeNode next;

-

-    public FreeNode(int index, ElementMapperImpl.FreeNode next) {

-      this.index = index;

-      this.next = next;

-    }

-  }

-

-  private static native void clearIndex(Element elem) /*-{

-    elem["__uiObjectID"] = null;

-  }-*/;

-

-  private static native int getIndex(Element elem) /*-{

-    var index = elem["__uiObjectID"];

-    return (index == null) ? -1 : index;

-  }-*/;

-

-  private static native void setIndex(Element elem, int index) /*-{

-    elem["__uiObjectID"] = index;

-  }-*/;

-

-  private ElementMapperImpl.FreeNode freeList = null;

-

-  private final ArrayList<T> uiObjectList = new ArrayList<T>();

-

-  /**

-   * Returns the uiObject associated with the given element.

-   * 

-   * @param elem uiObject's element

-   * @return the uiObject

-   */

-  public T get(Element elem) {

-    int index = getIndex(elem);

-    if (index < 0) {

-      return null;

-    }

-    return uiObjectList.get(index);

-  }

-

-  /**

-   * Gets the list of ui objects contained in this element mapper.

-   * 

-   * @return the list of ui objects

-   */

-  public ArrayList<T> getObjectList() {

-    return uiObjectList;

-  }

-

-  /**

-   * Creates an iterator from the ui objects stored within.

-   * 

-   * @return an iterator of the ui objects indexed by this element mapper.

-   */

-  public Iterator<T> iterator() {

-    return uiObjectList.iterator();

-  }

-

-  /**

-   * Adds the MappedType.

-   * 

-   * @param uiObject uiObject to add

-   */

-  public void put(T uiObject) {

-    int index;

-    if (freeList == null) {

-      index = uiObjectList.size();

-      uiObjectList.add(uiObject);

-    } else {

-      index = freeList.index;

-      uiObjectList.set(index, uiObject);

-      freeList = freeList.next;

-    }

-    setIndex(uiObject.getElement(), index);

-  }

-

-  /**

-   * Remove the uiObject associated with the given element.

-   * 

-   * @param elem the uiObject's element

-   */

-  public void removeByElement(Element elem) {

-    int index = getIndex(elem);

-    removeImpl(elem, index);

-  }

-

-  private void removeImpl(Element elem, int index) {

-    clearIndex(elem);

-    uiObjectList.set(index, null);

-    freeList = new FreeNode(index, freeList);

-  }

-}

+/*
+ * 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.user.client.impl;
+
+import com.google.gwt.user.client.Element;
+import com.google.gwt.user.client.ui.UIObject;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+/**
+ * Creates a mapping from elements to their associated ui objects.
+ * 
+ * @param <T> the type that the element is mapped to
+ */
+public class ElementMapperImpl<T extends UIObject> {
+
+  private static class FreeNode {
+    int index;
+    ElementMapperImpl.FreeNode next;
+
+    public FreeNode(int index, ElementMapperImpl.FreeNode next) {
+      this.index = index;
+      this.next = next;
+    }
+  }
+
+  private static native void clearIndex(Element elem) /*-{
+    elem["__uiObjectID"] = null;
+  }-*/;
+
+  private static native int getIndex(Element elem) /*-{
+    var index = elem["__uiObjectID"];
+    return (index == null) ? -1 : index;
+  }-*/;
+
+  private static native void setIndex(Element elem, int index) /*-{
+    elem["__uiObjectID"] = index;
+  }-*/;
+
+  private ElementMapperImpl.FreeNode freeList = null;
+
+  private final ArrayList<T> uiObjectList = new ArrayList<T>();
+
+  /**
+   * Returns the uiObject associated with the given element.
+   * 
+   * @param elem uiObject's element
+   * @return the uiObject
+   */
+  public T get(Element elem) {
+    int index = getIndex(elem);
+    if (index < 0) {
+      return null;
+    }
+    return uiObjectList.get(index);
+  }
+
+  /**
+   * Gets the list of ui objects contained in this element mapper.
+   * 
+   * @return the list of ui objects
+   */
+  public ArrayList<T> getObjectList() {
+    return uiObjectList;
+  }
+
+  /**
+   * Creates an iterator from the ui objects stored within.
+   * 
+   * @return an iterator of the ui objects indexed by this element mapper.
+   */
+  public Iterator<T> iterator() {
+    return uiObjectList.iterator();
+  }
+
+  /**
+   * Adds the MappedType.
+   * 
+   * @param uiObject uiObject to add
+   */
+  public void put(T uiObject) {
+    int index;
+    if (freeList == null) {
+      index = uiObjectList.size();
+      uiObjectList.add(uiObject);
+    } else {
+      index = freeList.index;
+      uiObjectList.set(index, uiObject);
+      freeList = freeList.next;
+    }
+    setIndex(uiObject.getElement(), index);
+  }
+
+  /**
+   * Remove the uiObject associated with the given element.
+   * 
+   * @param elem the uiObject's element
+   */
+  public void removeByElement(Element elem) {
+    int index = getIndex(elem);
+    removeImpl(elem, index);
+  }
+
+  private void removeImpl(Element elem, int index) {
+    clearIndex(elem);
+    uiObjectList.set(index, null);
+    freeList = new FreeNode(index, freeList);
+  }
+}
diff --git a/user/src/com/google/gwt/user/client/rpc/core/java/util/LinkedHashMap_CustomFieldSerializer.java b/user/src/com/google/gwt/user/client/rpc/core/java/util/LinkedHashMap_CustomFieldSerializer.java
index cfa4728..222692e 100644
--- a/user/src/com/google/gwt/user/client/rpc/core/java/util/LinkedHashMap_CustomFieldSerializer.java
+++ b/user/src/com/google/gwt/user/client/rpc/core/java/util/LinkedHashMap_CustomFieldSerializer.java
@@ -1,119 +1,119 @@
-/*

- * 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.user.client.rpc.core.java.util;

-

-import com.google.gwt.user.client.rpc.SerializationException;

-import com.google.gwt.user.client.rpc.SerializationStreamReader;

-import com.google.gwt.user.client.rpc.SerializationStreamWriter;

-

-import java.lang.reflect.Field;

-import java.util.LinkedHashMap;

-

-/**

- * Custom field serializer for {@link java.util.LinkedHashMap} for the server

- * (uses reflection).

- */

-public final class LinkedHashMap_CustomFieldSerializer {

-

-  @SuppressWarnings("unchecked") // raw LinkedHashMap

-  public static void deserialize(SerializationStreamReader streamReader,

-      LinkedHashMap instance) throws SerializationException {

-    Map_CustomFieldSerializerBase.deserialize(streamReader, instance);

-  }

-

-  /**

-   * Infers the value of the private accessOrder field of instance by examining

-   * its behavior on a set of test inputs, without using reflection. Note that

-   * this implementation clones the instance, which could be slow.

-   * 

-   * @param instance the instance to check

-   * @return the value of instance.accessOrder

-   */

-  @SuppressWarnings("unchecked") // raw LinkedHashMap

-  public static boolean getAccessOrderNoReflection(LinkedHashMap instance) {    

-    /*

-     * Clone the instance so our modifications won't affect the original.

-     * In particular, if the original overrides removeEldestEntry, adding

-     * elements to the map could cause existing elements to be removed.

-     */

-    instance = (LinkedHashMap) instance.clone();

-    instance.clear();

-

-    /*

-     * We insert key1, then key2, after which we access key1. We then iterate

-     * over the key set and observe the order in which keys are returned. The

-     * iterator will return keys in the order of least recent insertion or

-     * access, depending on the value of the accessOrder field within the

-     * LinkedHashMap instance. If the iterator is ordered by least recent

-     * insertion (accessOrder = false), we will encounter key1 first since key2

-     * has been inserted more recently. If it is ordered by least recent access

-     * (accessOrder = true), we will encounter key2 first, since key1 has been

-     * accessed more recently.

-     */

-    Object key1 = new Object();

-    Object key2 = new Object();

-    instance.put(key1, key1); // INSERT key1

-    instance.put(key2, key2); // INSERT key2

-    instance.get(key1);       // ACCESS key1

-    boolean accessOrder = false;

-    for (Object key : instance.keySet()) {

-      if (key == key1) {

-        break;

-      }

-      if (key == key2) {

-        accessOrder = true;

-        break;

-      }

-    }

-

-    return accessOrder;

-  }

-

-  @SuppressWarnings("unchecked") // raw LinkedHashMap

-  public static LinkedHashMap instantiate(SerializationStreamReader streamReader)

-      throws SerializationException {

-    boolean accessOrder = streamReader.readBoolean();

-    return new LinkedHashMap(16, .75f, accessOrder);

-  }

-

-  @SuppressWarnings("unchecked") // raw LinkedHashMap

-  public static void serialize(SerializationStreamWriter streamWriter,

-      LinkedHashMap instance) throws SerializationException {

-    streamWriter.writeBoolean(getAccessOrder(instance));

-    Map_CustomFieldSerializerBase.serialize(streamWriter, instance);

-  }

-

-  @SuppressWarnings("unchecked") // raw LinkedHashMap

-  private static boolean getAccessOrder(LinkedHashMap instance) {

-    Field accessOrderField;

-    try {

-      accessOrderField = LinkedHashMap.class.getDeclaredField("accessOrder");

-      accessOrderField.setAccessible(true);

-      return ((Boolean) accessOrderField.get(instance)).booleanValue();

-    } catch (SecurityException e) {

-      // fall through

-    } catch (NoSuchFieldException e) {

-      // fall through

-    } catch (IllegalArgumentException e) {

-      // fall through

-    } catch (IllegalAccessException e) {

-      // fall through

-    }

-    

-    // Use a (possibly slower) technique that does not require reflection.

-    return getAccessOrderNoReflection(instance);

-  }

-}

+/*
+ * 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.user.client.rpc.core.java.util;
+
+import com.google.gwt.user.client.rpc.SerializationException;
+import com.google.gwt.user.client.rpc.SerializationStreamReader;
+import com.google.gwt.user.client.rpc.SerializationStreamWriter;
+
+import java.lang.reflect.Field;
+import java.util.LinkedHashMap;
+
+/**
+ * Custom field serializer for {@link java.util.LinkedHashMap} for the server
+ * (uses reflection).
+ */
+public final class LinkedHashMap_CustomFieldSerializer {
+
+  @SuppressWarnings("unchecked") // raw LinkedHashMap
+  public static void deserialize(SerializationStreamReader streamReader,
+      LinkedHashMap instance) throws SerializationException {
+    Map_CustomFieldSerializerBase.deserialize(streamReader, instance);
+  }
+
+  /**
+   * Infers the value of the private accessOrder field of instance by examining
+   * its behavior on a set of test inputs, without using reflection. Note that
+   * this implementation clones the instance, which could be slow.
+   * 
+   * @param instance the instance to check
+   * @return the value of instance.accessOrder
+   */
+  @SuppressWarnings("unchecked") // raw LinkedHashMap
+  public static boolean getAccessOrderNoReflection(LinkedHashMap instance) {    
+    /*
+     * Clone the instance so our modifications won't affect the original.
+     * In particular, if the original overrides removeEldestEntry, adding
+     * elements to the map could cause existing elements to be removed.
+     */
+    instance = (LinkedHashMap) instance.clone();
+    instance.clear();
+
+    /*
+     * We insert key1, then key2, after which we access key1. We then iterate
+     * over the key set and observe the order in which keys are returned. The
+     * iterator will return keys in the order of least recent insertion or
+     * access, depending on the value of the accessOrder field within the
+     * LinkedHashMap instance. If the iterator is ordered by least recent
+     * insertion (accessOrder = false), we will encounter key1 first since key2
+     * has been inserted more recently. If it is ordered by least recent access
+     * (accessOrder = true), we will encounter key2 first, since key1 has been
+     * accessed more recently.
+     */
+    Object key1 = new Object();
+    Object key2 = new Object();
+    instance.put(key1, key1); // INSERT key1
+    instance.put(key2, key2); // INSERT key2
+    instance.get(key1);       // ACCESS key1
+    boolean accessOrder = false;
+    for (Object key : instance.keySet()) {
+      if (key == key1) {
+        break;
+      }
+      if (key == key2) {
+        accessOrder = true;
+        break;
+      }
+    }
+
+    return accessOrder;
+  }
+
+  @SuppressWarnings("unchecked") // raw LinkedHashMap
+  public static LinkedHashMap instantiate(SerializationStreamReader streamReader)
+      throws SerializationException {
+    boolean accessOrder = streamReader.readBoolean();
+    return new LinkedHashMap(16, .75f, accessOrder);
+  }
+
+  @SuppressWarnings("unchecked") // raw LinkedHashMap
+  public static void serialize(SerializationStreamWriter streamWriter,
+      LinkedHashMap instance) throws SerializationException {
+    streamWriter.writeBoolean(getAccessOrder(instance));
+    Map_CustomFieldSerializerBase.serialize(streamWriter, instance);
+  }
+
+  @SuppressWarnings("unchecked") // raw LinkedHashMap
+  private static boolean getAccessOrder(LinkedHashMap instance) {
+    Field accessOrderField;
+    try {
+      accessOrderField = LinkedHashMap.class.getDeclaredField("accessOrder");
+      accessOrderField.setAccessible(true);
+      return ((Boolean) accessOrderField.get(instance)).booleanValue();
+    } catch (SecurityException e) {
+      // fall through
+    } catch (NoSuchFieldException e) {
+      // fall through
+    } catch (IllegalArgumentException e) {
+      // fall through
+    } catch (IllegalAccessException e) {
+      // fall through
+    }
+    
+    // Use a (possibly slower) technique that does not require reflection.
+    return getAccessOrderNoReflection(instance);
+  }
+}
diff --git a/user/src/com/google/gwt/user/client/ui/Focusable.java b/user/src/com/google/gwt/user/client/ui/Focusable.java
index a7828eb..372fa66 100644
--- a/user/src/com/google/gwt/user/client/ui/Focusable.java
+++ b/user/src/com/google/gwt/user/client/ui/Focusable.java
@@ -1,55 +1,55 @@
-/*

- * 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.user.client.ui;

-

-/**

- * A widget that implements this interface can receive keyboard focus.

- */

-public interface Focusable {

-

-  /**

-   * Gets the widget's position in the tab index.

-   * 

-   * @return the widget's tab index

-   */

-  int getTabIndex();

-

-  /**

-   * Sets the widget's 'access key'. This key is used (in conjunction with a

-   * browser-specific modifier key) to automatically focus the widget.

-   * 

-   * @param key the widget's access key

-   */

-  void setAccessKey(char key);

-

-  /**

-   * Explicitly focus/unfocus this widget. Only one widget can have focus at a

-   * time, and the widget that does will receive all keyboard events.

-   * 

-   * @param focused whether this widget should take focus or release it

-   */

-  void setFocus(boolean focused);

-

-  /**

-   * Sets the widget's position in the tab index. If more than one widget has

-   * the same tab index, each such widget will receive focus in an arbitrary

-   * order. Setting the tab index to <code>-1</code> will cause this widget to

-   * be removed from the tab order.

-   * 

-   * @param index the widget's tab index

-   */

-  void setTabIndex(int index);

-}

+/*
+ * 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.user.client.ui;
+
+/**
+ * A widget that implements this interface can receive keyboard focus.
+ */
+public interface Focusable {
+
+  /**
+   * Gets the widget's position in the tab index.
+   * 
+   * @return the widget's tab index
+   */
+  int getTabIndex();
+
+  /**
+   * Sets the widget's 'access key'. This key is used (in conjunction with a
+   * browser-specific modifier key) to automatically focus the widget.
+   * 
+   * @param key the widget's access key
+   */
+  void setAccessKey(char key);
+
+  /**
+   * Explicitly focus/unfocus this widget. Only one widget can have focus at a
+   * time, and the widget that does will receive all keyboard events.
+   * 
+   * @param focused whether this widget should take focus or release it
+   */
+  void setFocus(boolean focused);
+
+  /**
+   * Sets the widget's position in the tab index. If more than one widget has
+   * the same tab index, each such widget will receive focus in an arbitrary
+   * order. Setting the tab index to <code>-1</code> will cause this widget to
+   * be removed from the tab order.
+   * 
+   * @param index the widget's tab index
+   */
+  void setTabIndex(int index);
+}
diff --git a/user/src/com/google/gwt/user/client/ui/LazyPanel.java b/user/src/com/google/gwt/user/client/ui/LazyPanel.java
index 58b0f53..779e035 100644
--- a/user/src/com/google/gwt/user/client/ui/LazyPanel.java
+++ b/user/src/com/google/gwt/user/client/ui/LazyPanel.java
@@ -1,67 +1,67 @@
-/*

- * 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.user.client.ui;

-

-/**

- * Convenience class to help lazy loading. The bulk of a LazyPanel is not

- * instantiated until {@link #setVisible}(true) or {@link #ensureWidget} is

- * called.

- * <p>

- * <h3>Example</h3> {@example com.google.gwt.examples.LazyPanelExample}

- */

-public abstract class LazyPanel extends SimplePanel {

-

-  public LazyPanel() {

-  }

-

-  /**

-   * Create the widget contained within the {@link LazyPanel}.

-   * 

-   * @return the lazy widget

-   */

-  protected abstract Widget createWidget();

-

-  /**

-   * Ensures that the widget has been created by calling {@link #createWidget}

-   * if {@link #getWidget} returns <code>null</code>. Typically it is not

-   * necessary to call this directly, as it is called as a side effect of a

-   * <code>setVisible(true)</code> call.

-   */

-  public void ensureWidget() {

-    Widget widget = getWidget();

-    if (widget == null) {

-      widget = createWidget();

-      setWidget(widget);

-    }

-  }

-

-  @Override

-  /*

-   * Sets whether this object is visible. If <code>visible</code> is

-   * <code>true</code>, creates the sole child widget if necessary by calling

-   * {@link #ensureWidget}.

-   * 

-   * @param visible <code>true</code> to show the object, <code>false</code> to

-   * hide it

-   */

-  public void setVisible(boolean visible) {

-    if (visible) {

-      ensureWidget();

-    }

-    super.setVisible(visible);

-  }

-}

+/*
+ * 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.user.client.ui;
+
+/**
+ * Convenience class to help lazy loading. The bulk of a LazyPanel is not
+ * instantiated until {@link #setVisible}(true) or {@link #ensureWidget} is
+ * called.
+ * <p>
+ * <h3>Example</h3> {@example com.google.gwt.examples.LazyPanelExample}
+ */
+public abstract class LazyPanel extends SimplePanel {
+
+  public LazyPanel() {
+  }
+
+  /**
+   * Create the widget contained within the {@link LazyPanel}.
+   * 
+   * @return the lazy widget
+   */
+  protected abstract Widget createWidget();
+
+  /**
+   * Ensures that the widget has been created by calling {@link #createWidget}
+   * if {@link #getWidget} returns <code>null</code>. Typically it is not
+   * necessary to call this directly, as it is called as a side effect of a
+   * <code>setVisible(true)</code> call.
+   */
+  public void ensureWidget() {
+    Widget widget = getWidget();
+    if (widget == null) {
+      widget = createWidget();
+      setWidget(widget);
+    }
+  }
+
+  @Override
+  /*
+   * Sets whether this object is visible. If <code>visible</code> is
+   * <code>true</code>, creates the sole child widget if necessary by calling
+   * {@link #ensureWidget}.
+   * 
+   * @param visible <code>true</code> to show the object, <code>false</code> to
+   * hide it
+   */
+  public void setVisible(boolean visible) {
+    if (visible) {
+      ensureWidget();
+    }
+    super.setVisible(visible);
+  }
+}
diff --git a/user/src/com/google/gwt/user/client/ui/ListenerWrapper.java b/user/src/com/google/gwt/user/client/ui/ListenerWrapper.java
index fae414a..f75735d 100644
--- a/user/src/com/google/gwt/user/client/ui/ListenerWrapper.java
+++ b/user/src/com/google/gwt/user/client/ui/ListenerWrapper.java
@@ -1,818 +1,818 @@
-/*

- * 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.user.client.ui;

-

-import com.google.gwt.dom.client.Element;

-import com.google.gwt.event.dom.client.BlurEvent;

-import com.google.gwt.event.dom.client.BlurHandler;

-import com.google.gwt.event.dom.client.ChangeEvent;

-import com.google.gwt.event.dom.client.ChangeHandler;

-import com.google.gwt.event.dom.client.ClickEvent;

-import com.google.gwt.event.dom.client.ClickHandler;

-import com.google.gwt.event.dom.client.ErrorEvent;

-import com.google.gwt.event.dom.client.ErrorHandler;

-import com.google.gwt.event.dom.client.FocusEvent;

-import com.google.gwt.event.dom.client.FocusHandler;

-import com.google.gwt.event.dom.client.HandlesAllFocusEvents;

-import com.google.gwt.event.dom.client.HandlesAllKeyEvents;

-import com.google.gwt.event.dom.client.HasAllFocusHandlers;

-import com.google.gwt.event.dom.client.HasAllKeyHandlers;

-import com.google.gwt.event.dom.client.HasChangeHandlers;

-import com.google.gwt.event.dom.client.HasClickHandlers;

-import com.google.gwt.event.dom.client.HasErrorHandlers;

-import com.google.gwt.event.dom.client.HasLoadHandlers;

-import com.google.gwt.event.dom.client.HasMouseDownHandlers;

-import com.google.gwt.event.dom.client.HasMouseMoveHandlers;

-import com.google.gwt.event.dom.client.HasMouseOutHandlers;

-import com.google.gwt.event.dom.client.HasMouseOverHandlers;

-import com.google.gwt.event.dom.client.HasMouseUpHandlers;

-import com.google.gwt.event.dom.client.HasMouseWheelHandlers;

-import com.google.gwt.event.dom.client.HasScrollHandlers;

-import com.google.gwt.event.dom.client.KeyDownEvent;

-import com.google.gwt.event.dom.client.KeyDownHandler;

-import com.google.gwt.event.dom.client.KeyPressEvent;

-import com.google.gwt.event.dom.client.KeyPressHandler;

-import com.google.gwt.event.dom.client.KeyUpEvent;

-import com.google.gwt.event.dom.client.KeyUpHandler;

-import com.google.gwt.event.dom.client.LoadEvent;

-import com.google.gwt.event.dom.client.LoadHandler;

-import com.google.gwt.event.dom.client.MouseDownEvent;

-import com.google.gwt.event.dom.client.MouseDownHandler;

-import com.google.gwt.event.dom.client.MouseMoveEvent;

-import com.google.gwt.event.dom.client.MouseMoveHandler;

-import com.google.gwt.event.dom.client.MouseOutEvent;

-import com.google.gwt.event.dom.client.MouseOutHandler;

-import com.google.gwt.event.dom.client.MouseOverEvent;

-import com.google.gwt.event.dom.client.MouseOverHandler;

-import com.google.gwt.event.dom.client.MouseUpEvent;

-import com.google.gwt.event.dom.client.MouseUpHandler;

-import com.google.gwt.event.dom.client.MouseWheelEvent;

-import com.google.gwt.event.dom.client.MouseWheelHandler;

-import com.google.gwt.event.dom.client.ScrollEvent;

-import com.google.gwt.event.dom.client.ScrollHandler;

-import com.google.gwt.event.logical.shared.BeforeSelectionEvent;

-import com.google.gwt.event.logical.shared.BeforeSelectionHandler;

-import com.google.gwt.event.logical.shared.CloseEvent;

-import com.google.gwt.event.logical.shared.CloseHandler;

-import com.google.gwt.event.logical.shared.HasCloseHandlers;

-import com.google.gwt.event.logical.shared.HasValueChangeHandlers;

-import com.google.gwt.event.logical.shared.OpenEvent;

-import com.google.gwt.event.logical.shared.OpenHandler;

-import com.google.gwt.event.logical.shared.SelectionEvent;

-import com.google.gwt.event.logical.shared.SelectionHandler;

-import com.google.gwt.event.logical.shared.ValueChangeEvent;

-import com.google.gwt.event.logical.shared.ValueChangeHandler;

-import com.google.gwt.event.shared.EventHandler;

-import com.google.gwt.event.shared.HandlerManager;

-import com.google.gwt.event.shared.GwtEvent.Type;

-import com.google.gwt.user.client.BaseListenerWrapper;

-import com.google.gwt.user.client.Event;

-

-import java.util.EventListener;

-

-/**

- * Legacy listener support hierarchy for

- * <code>com.google.gwt.user.client.ui</code>. Gathers the bulk of the legacy

- * glue code in one place, for easy deletion when Listener methods are deleted.

- * 

- * 

- * @param <T> listener type

- * @deprecated will be removed in GWT 2.0 with the handler listeners themselves

- */

-@Deprecated

-public abstract class ListenerWrapper<T> extends BaseListenerWrapper<T> {

-

-  /**

-   * Wrapper for a {@link LoadListener}.

-   */

-  public static class WrappedLoadListener extends ListenerWrapper<LoadListener>

-      implements LoadHandler, ErrorHandler {

-

-    /**

-     * Adds the wrapped listener.

-     * 

-     * @param <S> the source of the events

-     * 

-     * @param source the event source

-     * @param listener the listener

-     * @return the wrapped listener

-     * 

-     * @deprecated will be removed in GWT 2.0 along with the listener classes

-     */

-    @Deprecated

-    public static <S extends HasLoadHandlers & HasErrorHandlers> WrappedLoadListener add(

-        S source, LoadListener listener) {

-      WrappedLoadListener l = new WrappedLoadListener(listener);

-      source.addLoadHandler(l);

-      source.addErrorHandler(l);

-      return l;

-    }

-

-    /**

-     * Removes the wrapped listener.

-     * 

-     * @param eventSource the event source from which to remove the wrapped

-     *          listener

-     * @param listener the listener to remove

-     * @deprecated will be removed in GWT 2.0 along with the listener classes

-     */

-    @Deprecated

-    public static void remove(Widget eventSource, LoadListener listener) {

-      baseRemove(eventSource, listener, LoadEvent.getType(),

-          ErrorEvent.getType());

-    }

-

-    private WrappedLoadListener(LoadListener listener) {

-      super(listener);

-    }

-

-    public void onError(ErrorEvent event) {

-      getListener().onError(getSource(event));

-    }

-

-    public void onLoad(LoadEvent event) {

-      getListener().onLoad(getSource(event));

-    }

-  }

-  /**

-   * Wrapper for a {@link ChangeListener}.

-   * 

-   * @deprecated will be removed in GWT 2.0 along with the listeners being

-   *             wrapped

-   */

-  @Deprecated

-  public static class WrappedChangeListener extends

-      ListenerWrapper<ChangeListener> implements ChangeHandler {

-

-    /**

-     * Adds the wrapped listener.

-     * 

-     * @param source the event source

-     * @param listener the listener

-     * @return the wrapped listener

-     * 

-     * @deprecated will be removed in GWT 2.0 along with the listener classes

-     */

-    @Deprecated

-    public static WrappedChangeListener add(HasChangeHandlers source,

-        ChangeListener listener) {

-      WrappedChangeListener rtn = new WrappedChangeListener(listener);

-      source.addChangeHandler(rtn);

-      return rtn;

-    }

-

-    /**

-     * Removes the wrapped listener.

-     * 

-     * @param eventSource the event source from which to remove the wrapped

-     *          listener

-     * @param listener the listener to remove

-     * @deprecated will be removed in GWT 2.0 along with the listener classes

-     */

-    @Deprecated

-    public static void remove(Widget eventSource, ChangeListener listener) {

-      baseRemove(eventSource, listener, ChangeEvent.getType());

-    }

-

-    WrappedChangeListener(ChangeListener listener) {

-      super(listener);

-    }

-

-    public void onChange(ChangeEvent event) {

-      getListener().onChange(getSource(event));

-    }

-  }

-

-  /**

-   * Wrapper for a {@link ClickListener}.

-   * 

-   * @deprecated will be removed in GWT 2.0 along with the listeners being

-   *             wrapped

-   */

-  @Deprecated

-  public static class WrappedClickListener extends

-      ListenerWrapper<ClickListener> implements ClickHandler {

-

-    /**

-     * Adds the wrapped listener.

-     * 

-     * @param source the event source

-     * @param listener the listener

-     * @return the wrapped listener

-     * 

-     * @deprecated will be removed in GWT 2.0 along with the listener classes

-     */

-    @Deprecated

-    public static WrappedClickListener add(HasClickHandlers source,

-        ClickListener listener) {

-      WrappedClickListener rtn = new WrappedClickListener(listener);

-      source.addClickHandler(rtn);

-      return rtn;

-    }

-

-    /**

-     * Removes the wrapped listener.

-     * 

-     * @param eventSource the event source from which to remove the wrapped

-     *          listener

-     * @param listener the listener to remove

-     * @deprecated will be removed in GWT 2.0 along with the listener classes

-     */

-    @Deprecated

-    public static void remove(Widget eventSource, ClickListener listener) {

-      baseRemove(eventSource, listener, ClickEvent.getType());

-    }

-

-    private WrappedClickListener(ClickListener listener) {

-      super(listener);

-    }

-

-    public void onClick(ClickEvent event) {

-      getListener().onClick(getSource(event));

-    }

-  }

-  /**

-   * Wrapper for a {@link FocusListener}.

-   */

-  public static class WrappedFocusListener extends

-      ListenerWrapper<FocusListener> implements FocusHandler, BlurHandler {

-

-    /**

-     * Adds the wrapped listener.

-     * 

-     * @param eventSource the event source

-     * @param listener the listener

-     * 

-     * @return the wrapped listener

-     * 

-     * @deprecated will be removed in GWT 2.0 along with the listener classes

-     */

-    @Deprecated

-    public static WrappedFocusListener add(HasAllFocusHandlers eventSource,

-        FocusListener listener) {

-      WrappedFocusListener rtn = new WrappedFocusListener(listener);

-      HandlesAllFocusEvents.handle(eventSource, rtn);

-      return rtn;

-    }

-

-    /**

-     * Removes the wrapped listener.

-     * 

-     * @param eventSource the event source from which to remove the wrapped

-     *          listener

-     * @param listener the listener to remove

-     * @deprecated will be removed in GWT 2.0 along with the listener classes

-     */

-    @Deprecated

-    public static void remove(Widget eventSource, FocusListener listener) {

-      baseRemove(eventSource, listener, LoadEvent.getType(),

-          ErrorEvent.getType());

-    }

-

-    private WrappedFocusListener(FocusListener listener) {

-      super(listener);

-    }

-

-    public void onBlur(BlurEvent event) {

-      getListener().onLostFocus(getSource(event));

-    }

-

-    public void onFocus(FocusEvent event) {

-      getListener().onFocus(getSource(event));

-    }

-  }

-

-  /**

-   * Wrapper for a {@link KeyboardListener}.

-   */

-  public static class WrappedKeyboardListener extends

-      ListenerWrapper<KeyboardListener> implements KeyDownHandler,

-      KeyUpHandler, KeyPressHandler {

-

-    /**

-     * Adds the wrapped listener.

-     * 

-     * @param source the event source

-     * @param listener the listener

-     * @return the wrapped listener

-     * 

-     * @deprecated will be removed in GWT 2.0 along with the listener classes

-     */

-    @Deprecated

-    public static WrappedKeyboardListener add(HasAllKeyHandlers source,

-        KeyboardListener listener) {

-      WrappedKeyboardListener b = new WrappedKeyboardListener(listener);

-      HandlesAllKeyEvents.addHandlers(source, b);

-      return b;

-    }

-

-    /**

-     * Removes the wrapped listener.

-     * 

-     * @param eventSource the event source from which to remove the wrapped

-     *          listener

-     * @param listener the listener to remove

-     * @deprecated will be removed in GWT 2.0 along with the listener classes

-     */

-    @Deprecated

-    public static void remove(Widget eventSource, KeyboardListener listener) {

-      ListenerWrapper.baseRemove(eventSource, listener, KeyDownEvent.getType(),

-          KeyUpEvent.getType(), KeyPressEvent.getType());

-    }

-

-    private WrappedKeyboardListener(KeyboardListener listener) {

-      super(listener);

-    }

-

-    public void onKeyDown(KeyDownEvent event) {

-      getListener().onKeyDown(

-          getSource(event),

-          (char) event.getNativeKeyCode(),

-          KeyboardListenerCollection.getKeyboardModifiers(Event.as(event.getNativeEvent())));

-    }

-

-    public void onKeyPress(KeyPressEvent event) {

-      getListener().onKeyPress(

-          getSource(event),

-          (char) event.getNativeEvent().getKeyCode(),

-          KeyboardListenerCollection.getKeyboardModifiers(Event.as(event.getNativeEvent())));

-    }

-

-    public void onKeyUp(KeyUpEvent event) {

-      getSource(event);

-      getListener().onKeyUp(

-          getSource(event),

-          (char) event.getNativeKeyCode(),

-          KeyboardListenerCollection.getKeyboardModifiers(Event.as(event.getNativeEvent())));

-    }

-  }

-

-  /**

-   * Wrapper for a {@link ChangeListener} being converted to a logical

-   * {@link ValueChangeHandler}.

-   * 

-   * @param <V> the type of the value changed

-   * 

-   * @deprecated will be removed in GWT 2.0 along with the listeners being

-   *             wrapped

-   */

-  @Deprecated

-  public static class WrappedLogicalChangeListener<V> extends

-      ListenerWrapper<ChangeListener> implements ValueChangeHandler<V> {

-

-    /**

-     * Adds the wrapped listener.

-     * 

-     * @param <V> the type of value changed

-     * 

-     * @param source the event source

-     * @param listener the listener

-     * @return the wrapped listener

-     * 

-     * @deprecated will be removed in GWT 2.0 along with the listener classes

-     */

-    @Deprecated

-    public static <V> WrappedLogicalChangeListener<V> add(

-        HasValueChangeHandlers<V> source, ChangeListener listener) {

-      WrappedLogicalChangeListener<V> rtn = new WrappedLogicalChangeListener<V>(

-          listener);

-      source.addValueChangeHandler(rtn);

-      return rtn;

-    }

-

-    /**

-     * Removes the wrapped listener.

-     * 

-     * @param eventSource the event source from which to remove the wrapped

-     *          listener

-     * @param listener the listener to remove

-     * @deprecated will be removed in GWT 2.0 along with the listener classes

-     */

-    @Deprecated

-    public static void remove(Widget eventSource, ChangeListener listener) {

-      baseRemove(eventSource, listener, ValueChangeEvent.getType());

-    }

-

-    private WrappedLogicalChangeListener(ChangeListener listener) {

-      super(listener);

-    }

-

-    public void onValueChange(ValueChangeEvent<V> event) {

-      getListener().onChange(getSource(event));

-    }

-  }

-  /**

-   * Wrapper for a {@link MouseListener}.

-   */

-  public static class WrappedMouseListener extends

-      ListenerWrapper<MouseListener> implements MouseDownHandler,

-      MouseUpHandler, MouseOutHandler, MouseOverHandler, MouseMoveHandler {

-    /**

-     * Adds the wrapped listener.

-     * 

-     * @param source the event source

-     * @param listener the listener

-     * @return the wrapped listener

-     * @param <E> source of the handlers

-     * @deprecated will be removed in GWT 2.0 along with the listener classes

-     */

-    @Deprecated

-    public static <E extends HasMouseDownHandlers & HasMouseUpHandlers & HasMouseOutHandlers & HasMouseOverHandlers & HasMouseMoveHandlers> WrappedMouseListener add(

-        E source, MouseListener listener) {

-      WrappedMouseListener handlers = new WrappedMouseListener(listener);

-      source.addMouseDownHandler(handlers);

-      source.addMouseUpHandler(handlers);

-      source.addMouseOutHandler(handlers);

-      source.addMouseOverHandler(handlers);

-      source.addMouseMoveHandler(handlers);

-      return handlers;

-    }

-

-    /**

-     * Removes the wrapped listener.

-     * 

-     * @param eventSource the event source from which to remove the wrapped

-     *          listener

-     * @param listener the listener to remove

-     * @deprecated will be removed in GWT 2.0 along with the listener classes

-     */

-    @Deprecated

-    public static void remove(Widget eventSource, MouseListener listener) {

-      baseRemove(eventSource, listener, MouseDownEvent.getType(),

-          MouseUpEvent.getType(), MouseOverEvent.getType(),

-          MouseOutEvent.getType());

-    }

-

-    private WrappedMouseListener(MouseListener listener) {

-      super(listener);

-    }

-

-    public void onMouseDown(MouseDownEvent event) {

-      Widget source = getSource(event);

-      getListener().onMouseDown(source, event.getX(), event.getY());

-    }

-

-    public void onMouseMove(MouseMoveEvent event) {

-      Widget source = getSource(event);

-      getListener().onMouseMove(source, event.getX(), event.getY());

-    }

-

-    public void onMouseOut(MouseOutEvent event) {

-      getListener().onMouseLeave(getSource(event));

-    }

-

-    public void onMouseOver(MouseOverEvent event) {

-      getListener().onMouseEnter(getSource(event));

-    }

-

-    public void onMouseUp(MouseUpEvent event) {

-      Widget source = getSource(event);

-      getListener().onMouseUp(source, event.getX(), event.getY());

-    }

-  }

-  /**

-   * Wrapper for a {@link MouseWheelListener}.

-   */

-  public static class WrappedMouseWheelListener extends

-      ListenerWrapper<MouseWheelListener> implements MouseWheelHandler {

-    /**

-     * Adds the wrapped listener.

-     * 

-     * @param source the event source

-     * @param listener the listener

-     * @return the wrapped listener

-     * 

-     * @deprecated will be removed in GWT 2.0 along with the listener classes

-     */

-    @Deprecated

-    public static WrappedMouseWheelListener add(HasMouseWheelHandlers source,

-        MouseWheelListener listener) {

-      WrappedMouseWheelListener wrap = new WrappedMouseWheelListener(listener);

-      source.addMouseWheelHandler(new WrappedMouseWheelListener(listener));

-      return wrap;

-    }

-

-    /**

-     * Removes the wrapped listener.

-     * 

-     * @param eventSource the event source from which to remove the wrapped

-     *          listener

-     * @param listener the listener to remove

-     * @deprecated will be removed in GWT 2.0 along with the listener classes

-     */

-    @Deprecated

-    public static void remove(Widget eventSource, MouseWheelListener listener) {

-      baseRemove(eventSource, listener, MouseWheelEvent.getType());

-    }

-

-    private WrappedMouseWheelListener(MouseWheelListener listener) {

-      super(listener);

-    }

-

-    public void onMouseWheel(MouseWheelEvent event) {

-      getListener().onMouseWheel(getSource(event),

-          new MouseWheelVelocity(Event.as(event.getNativeEvent())));

-    }

-  }

-  /**

-   * Wrapper for a {@link ScrollListener}.

-   */

-  public static class WrappedScrollListener extends

-      ListenerWrapper<ScrollListener> implements ScrollHandler {

-

-    /**

-     * Adds the wrapped listener.

-     * 

-     * @param source the event source

-     * @param listener the listener

-     * @return the wrapped listener

-     * 

-     * @deprecated will be removed in GWT 2.0 along with the listener classes

-     */

-    @Deprecated

-    public static WrappedScrollListener add(HasScrollHandlers source,

-        ScrollListener listener) {

-      WrappedScrollListener s = new WrappedScrollListener(listener);

-      source.addScrollHandler(s);

-      return s;

-    }

-

-    /**

-     * Removes the wrapped listener.

-     * 

-     * @param eventSource the event source from which to remove the wrapped

-     *          listener

-     * @param listener the listener to remove

-     * @deprecated will be removed in GWT 2.0 along with the listener classes

-     */

-    @Deprecated

-    public static void remove(Widget eventSource, ScrollListener listener) {

-      baseRemove(eventSource, listener, ScrollEvent.getType(),

-          ErrorEvent.getType());

-    }

-

-    private WrappedScrollListener(ScrollListener listener) {

-      super(listener);

-    }

-

-    public void onScroll(ScrollEvent event) {

-      Widget source = getSource(event);

-      Element elem = source.getElement();

-      getListener().onScroll(getSource(event), elem.getScrollLeft(),

-          elem.getScrollTop());

-    }

-  }

-  static class WrappedOldDisclosureHandler extends

-      ListenerWrapper<DisclosureHandler> implements

-      CloseHandler<DisclosurePanel>, OpenHandler<DisclosurePanel> {

-

-    public static void add(DisclosurePanel source, DisclosureHandler listener) {

-      WrappedOldDisclosureHandler handlers = new WrappedOldDisclosureHandler(

-          listener);

-      source.addOpenHandler(handlers);

-      source.addCloseHandler(handlers);

-    }

-

-    public static void remove(Widget eventSource, DisclosureHandler listener) {

-      baseRemove(eventSource, listener, CloseEvent.getType(),

-          OpenEvent.getType());

-    }

-

-    private WrappedOldDisclosureHandler(DisclosureHandler listener) {

-      super(listener);

-    }

-

-    public void onClose(CloseEvent<DisclosurePanel> event) {

-      getListener().onClose(

-          new DisclosureEvent((DisclosurePanel) event.getSource()));

-    }

-

-    public void onOpen(OpenEvent<DisclosurePanel> event) {

-      getListener().onOpen(

-          new DisclosureEvent((DisclosurePanel) event.getSource()));

-    }

-  }

-

-  static class WrappedOldFormHandler extends ListenerWrapper<FormHandler>

-      implements FormPanel.SubmitHandler, FormPanel.SubmitCompleteHandler {

-

-    public static void add(FormPanel source, FormHandler listener) {

-      WrappedOldFormHandler handlers = new WrappedOldFormHandler(listener);

-      source.addSubmitHandler(handlers);

-      source.addSubmitCompleteHandler(handlers);

-    }

-

-    public static void remove(Widget eventSource, FormHandler listener) {

-      baseRemove(eventSource, listener, FormPanel.SubmitEvent.getType(),

-          FormPanel.SubmitCompleteEvent.getType());

-    }

-

-    private WrappedOldFormHandler(FormHandler listener) {

-      super(listener);

-    }

-

-    public void onSubmit(FormPanel.SubmitEvent event) {

-      FormSubmitEvent fse = new FormSubmitEvent((FormPanel) event.getSource());

-      getListener().onSubmit(fse);

-      if (fse.isSetCancelledCalled()) {

-        event.setCanceled(fse.isCancelled());

-      }

-    }

-

-    public void onSubmitComplete(FormPanel.SubmitCompleteEvent event) {

-      getListener().onSubmitComplete(

-          new FormSubmitCompleteEvent((FormPanel) event.getSource(),

-              event.getResults()));

-    }

-  }

-

-  static class WrappedOldSuggestionHandler extends

-      ListenerWrapper<SuggestionHandler> implements

-      SelectionHandler<SuggestOracle.Suggestion> {

-    /**

-     * @deprecated will be removed in GWT 2.0 along with the listener classes

-     */

-    @Deprecated

-    public static void add(SuggestBox source, SuggestionHandler listener) {

-      source.addSelectionHandler(new WrappedOldSuggestionHandler(listener));

-    }

-

-    public static void remove(Widget eventSource, SuggestionHandler listener) {

-      baseRemove(eventSource, listener, SelectionEvent.getType());

-    }

-

-    private WrappedOldSuggestionHandler(SuggestionHandler listener) {

-      super(listener);

-    }

-

-    public void onSelection(SelectionEvent<SuggestOracle.Suggestion> event) {

-      getListener().onSuggestionSelected(

-          new SuggestionEvent((SuggestBox) event.getSource(),

-              event.getSelectedItem()));

-    }

-  }

-

-  static class WrappedPopupListener extends ListenerWrapper<PopupListener>

-      implements CloseHandler<PopupPanel> {

-

-    public static void add(HasCloseHandlers<PopupPanel> source,

-        PopupListener listener) {

-      source.addCloseHandler(new WrappedPopupListener(listener));

-    }

-

-    public static void remove(Widget eventSource, PopupListener listener) {

-      baseRemove(eventSource, listener, CloseEvent.getType());

-    }

-

-    private WrappedPopupListener(PopupListener listener) {

-      super(listener);

-    }

-

-    public void onClose(CloseEvent<PopupPanel> event) {

-      getListener().onPopupClosed((PopupPanel) event.getSource(),

-          event.isAutoClosed());

-    }

-  }

-

-  static class WrappedTableListener extends ListenerWrapper<TableListener>

-      implements ClickHandler {

-    /**

-     * @deprecated will be removed in GWT 2.0 along with the listener classes

-     */

-    @Deprecated

-    public static void add(HasClickHandlers source, TableListener listener) {

-      source.addClickHandler(new WrappedTableListener(listener));

-    }

-

-    public static void remove(Widget eventSource, TableListener listener) {

-      baseRemove(eventSource, listener, ClickEvent.getType());

-    }

-

-    private WrappedTableListener(TableListener listener) {

-      super(listener);

-    }

-

-    public void onClick(ClickEvent event) {

-      HTMLTable table = (HTMLTable) event.getSource();

-      HTMLTable.Cell cell = table.getCellForEvent(event);

-      if (cell != null) {

-        getListener().onCellClicked(table, cell.getRowIndex(),

-            cell.getCellIndex());

-      }

-    }

-  }

-

-  static class WrappedTabListener extends ListenerWrapper<TabListener>

-      implements SelectionHandler<Integer>, BeforeSelectionHandler<Integer> {

-    /**

-     * @deprecated will be removed in GWT 2.0 along with the listener classes

-     */

-    @Deprecated

-    public static void add(TabBar source, TabListener listener) {

-      WrappedTabListener t = new WrappedTabListener(listener);

-      source.addBeforeSelectionHandler(t);

-      source.addSelectionHandler(t);

-    }

-

-    public static void add(TabPanel source, TabListener listener) {

-      WrappedTabListener t = new WrappedTabListener(listener);

-      source.addBeforeSelectionHandler(t);

-      source.addSelectionHandler(t);

-    }

-

-    public static void remove(Widget eventSource, TabListener listener) {

-      baseRemove(eventSource, listener, SelectionEvent.getType(),

-          BeforeSelectionEvent.getType());

-    }

-

-    private WrappedTabListener(TabListener listener) {

-      super(listener);

-    }

-

-    public void onBeforeSelection(BeforeSelectionEvent<Integer> event) {

-      if (!getListener().onBeforeTabSelected(

-          (SourcesTabEvents) event.getSource(), event.getItem().intValue())) {

-        event.cancel();

-      }

-    }

-

-    public void onSelection(SelectionEvent<Integer> event) {

-      getListener().onTabSelected((SourcesTabEvents) event.getSource(),

-          event.getSelectedItem().intValue());

-    }

-  }

-

-  static class WrappedTreeListener extends ListenerWrapper<TreeListener>

-      implements SelectionHandler<TreeItem>, CloseHandler<TreeItem>,

-      OpenHandler<TreeItem> {

-    /**

-     * @deprecated will be removed in GWT 2.0 along with the listener classes

-     */

-    @Deprecated

-    public static void add(com.google.gwt.user.client.ui.Tree tree,

-        TreeListener listener) {

-      WrappedTreeListener t = new WrappedTreeListener(listener);

-      tree.addSelectionHandler(t);

-      tree.addCloseHandler(t);

-      tree.addOpenHandler(t);

-    }

-

-    public static void remove(Widget eventSource, TreeListener listener) {

-      baseRemove(eventSource, listener, ValueChangeEvent.getType());

-    }

-

-    private WrappedTreeListener(TreeListener listener) {

-      super(listener);

-    }

-

-    public void onClose(CloseEvent<TreeItem> event) {

-      getListener().onTreeItemStateChanged(event.getTarget());

-    }

-

-    public void onOpen(OpenEvent<TreeItem> event) {

-      getListener().onTreeItemStateChanged(event.getTarget());

-    }

-

-    public void onSelection(SelectionEvent<TreeItem> event) {

-      getListener().onTreeItemSelected(event.getSelectedItem());

-    }

-  }

-

-  /**

-   * Convenience method to remove wrapped handlers from a widget.

-   * 

-   * @param <H> event handler type

-   * @param eventSource the event source

-   * @param listener the listener to remove

-   * @param types the event types to remove it from

-   */

-  // This is an internal helper method with the current formulation, we have

-  // lost the info needed to make it safe by this point.

-  @SuppressWarnings("unchecked")

-  protected static <H extends EventHandler> void baseRemove(Widget eventSource,

-      EventListener listener, Type... types) {

-    HandlerManager manager = eventSource.getHandlerManager();

-    if (manager != null) {

-      baseRemove(manager, listener, types);

-    }

-  }

-

-  protected ListenerWrapper(T listener) {

-    super(listener);

-  }

-

-}

+/*
+ * 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.user.client.ui;
+
+import com.google.gwt.dom.client.Element;
+import com.google.gwt.event.dom.client.BlurEvent;
+import com.google.gwt.event.dom.client.BlurHandler;
+import com.google.gwt.event.dom.client.ChangeEvent;
+import com.google.gwt.event.dom.client.ChangeHandler;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.event.dom.client.ErrorEvent;
+import com.google.gwt.event.dom.client.ErrorHandler;
+import com.google.gwt.event.dom.client.FocusEvent;
+import com.google.gwt.event.dom.client.FocusHandler;
+import com.google.gwt.event.dom.client.HandlesAllFocusEvents;
+import com.google.gwt.event.dom.client.HandlesAllKeyEvents;
+import com.google.gwt.event.dom.client.HasAllFocusHandlers;
+import com.google.gwt.event.dom.client.HasAllKeyHandlers;
+import com.google.gwt.event.dom.client.HasChangeHandlers;
+import com.google.gwt.event.dom.client.HasClickHandlers;
+import com.google.gwt.event.dom.client.HasErrorHandlers;
+import com.google.gwt.event.dom.client.HasLoadHandlers;
+import com.google.gwt.event.dom.client.HasMouseDownHandlers;
+import com.google.gwt.event.dom.client.HasMouseMoveHandlers;
+import com.google.gwt.event.dom.client.HasMouseOutHandlers;
+import com.google.gwt.event.dom.client.HasMouseOverHandlers;
+import com.google.gwt.event.dom.client.HasMouseUpHandlers;
+import com.google.gwt.event.dom.client.HasMouseWheelHandlers;
+import com.google.gwt.event.dom.client.HasScrollHandlers;
+import com.google.gwt.event.dom.client.KeyDownEvent;
+import com.google.gwt.event.dom.client.KeyDownHandler;
+import com.google.gwt.event.dom.client.KeyPressEvent;
+import com.google.gwt.event.dom.client.KeyPressHandler;
+import com.google.gwt.event.dom.client.KeyUpEvent;
+import com.google.gwt.event.dom.client.KeyUpHandler;
+import com.google.gwt.event.dom.client.LoadEvent;
+import com.google.gwt.event.dom.client.LoadHandler;
+import com.google.gwt.event.dom.client.MouseDownEvent;
+import com.google.gwt.event.dom.client.MouseDownHandler;
+import com.google.gwt.event.dom.client.MouseMoveEvent;
+import com.google.gwt.event.dom.client.MouseMoveHandler;
+import com.google.gwt.event.dom.client.MouseOutEvent;
+import com.google.gwt.event.dom.client.MouseOutHandler;
+import com.google.gwt.event.dom.client.MouseOverEvent;
+import com.google.gwt.event.dom.client.MouseOverHandler;
+import com.google.gwt.event.dom.client.MouseUpEvent;
+import com.google.gwt.event.dom.client.MouseUpHandler;
+import com.google.gwt.event.dom.client.MouseWheelEvent;
+import com.google.gwt.event.dom.client.MouseWheelHandler;
+import com.google.gwt.event.dom.client.ScrollEvent;
+import com.google.gwt.event.dom.client.ScrollHandler;
+import com.google.gwt.event.logical.shared.BeforeSelectionEvent;
+import com.google.gwt.event.logical.shared.BeforeSelectionHandler;
+import com.google.gwt.event.logical.shared.CloseEvent;
+import com.google.gwt.event.logical.shared.CloseHandler;
+import com.google.gwt.event.logical.shared.HasCloseHandlers;
+import com.google.gwt.event.logical.shared.HasValueChangeHandlers;
+import com.google.gwt.event.logical.shared.OpenEvent;
+import com.google.gwt.event.logical.shared.OpenHandler;
+import com.google.gwt.event.logical.shared.SelectionEvent;
+import com.google.gwt.event.logical.shared.SelectionHandler;
+import com.google.gwt.event.logical.shared.ValueChangeEvent;
+import com.google.gwt.event.logical.shared.ValueChangeHandler;
+import com.google.gwt.event.shared.EventHandler;
+import com.google.gwt.event.shared.HandlerManager;
+import com.google.gwt.event.shared.GwtEvent.Type;
+import com.google.gwt.user.client.BaseListenerWrapper;
+import com.google.gwt.user.client.Event;
+
+import java.util.EventListener;
+
+/**
+ * Legacy listener support hierarchy for
+ * <code>com.google.gwt.user.client.ui</code>. Gathers the bulk of the legacy
+ * glue code in one place, for easy deletion when Listener methods are deleted.
+ * 
+ * 
+ * @param <T> listener type
+ * @deprecated will be removed in GWT 2.0 with the handler listeners themselves
+ */
+@Deprecated
+public abstract class ListenerWrapper<T> extends BaseListenerWrapper<T> {
+
+  /**
+   * Wrapper for a {@link LoadListener}.
+   */
+  public static class WrappedLoadListener extends ListenerWrapper<LoadListener>
+      implements LoadHandler, ErrorHandler {
+
+    /**
+     * Adds the wrapped listener.
+     * 
+     * @param <S> the source of the events
+     * 
+     * @param source the event source
+     * @param listener the listener
+     * @return the wrapped listener
+     * 
+     * @deprecated will be removed in GWT 2.0 along with the listener classes
+     */
+    @Deprecated
+    public static <S extends HasLoadHandlers & HasErrorHandlers> WrappedLoadListener add(
+        S source, LoadListener listener) {
+      WrappedLoadListener l = new WrappedLoadListener(listener);
+      source.addLoadHandler(l);
+      source.addErrorHandler(l);
+      return l;
+    }
+
+    /**
+     * Removes the wrapped listener.
+     * 
+     * @param eventSource the event source from which to remove the wrapped
+     *          listener
+     * @param listener the listener to remove
+     * @deprecated will be removed in GWT 2.0 along with the listener classes
+     */
+    @Deprecated
+    public static void remove(Widget eventSource, LoadListener listener) {
+      baseRemove(eventSource, listener, LoadEvent.getType(),
+          ErrorEvent.getType());
+    }
+
+    private WrappedLoadListener(LoadListener listener) {
+      super(listener);
+    }
+
+    public void onError(ErrorEvent event) {
+      getListener().onError(getSource(event));
+    }
+
+    public void onLoad(LoadEvent event) {
+      getListener().onLoad(getSource(event));
+    }
+  }
+  /**
+   * Wrapper for a {@link ChangeListener}.
+   * 
+   * @deprecated will be removed in GWT 2.0 along with the listeners being
+   *             wrapped
+   */
+  @Deprecated
+  public static class WrappedChangeListener extends
+      ListenerWrapper<ChangeListener> implements ChangeHandler {
+
+    /**
+     * Adds the wrapped listener.
+     * 
+     * @param source the event source
+     * @param listener the listener
+     * @return the wrapped listener
+     * 
+     * @deprecated will be removed in GWT 2.0 along with the listener classes
+     */
+    @Deprecated
+    public static WrappedChangeListener add(HasChangeHandlers source,
+        ChangeListener listener) {
+      WrappedChangeListener rtn = new WrappedChangeListener(listener);
+      source.addChangeHandler(rtn);
+      return rtn;
+    }
+
+    /**
+     * Removes the wrapped listener.
+     * 
+     * @param eventSource the event source from which to remove the wrapped
+     *          listener
+     * @param listener the listener to remove
+     * @deprecated will be removed in GWT 2.0 along with the listener classes
+     */
+    @Deprecated
+    public static void remove(Widget eventSource, ChangeListener listener) {
+      baseRemove(eventSource, listener, ChangeEvent.getType());
+    }
+
+    WrappedChangeListener(ChangeListener listener) {
+      super(listener);
+    }
+
+    public void onChange(ChangeEvent event) {
+      getListener().onChange(getSource(event));
+    }
+  }
+
+  /**
+   * Wrapper for a {@link ClickListener}.
+   * 
+   * @deprecated will be removed in GWT 2.0 along with the listeners being
+   *             wrapped
+   */
+  @Deprecated
+  public static class WrappedClickListener extends
+      ListenerWrapper<ClickListener> implements ClickHandler {
+
+    /**
+     * Adds the wrapped listener.
+     * 
+     * @param source the event source
+     * @param listener the listener
+     * @return the wrapped listener
+     * 
+     * @deprecated will be removed in GWT 2.0 along with the listener classes
+     */
+    @Deprecated
+    public static WrappedClickListener add(HasClickHandlers source,
+        ClickListener listener) {
+      WrappedClickListener rtn = new WrappedClickListener(listener);
+      source.addClickHandler(rtn);
+      return rtn;
+    }
+
+    /**
+     * Removes the wrapped listener.
+     * 
+     * @param eventSource the event source from which to remove the wrapped
+     *          listener
+     * @param listener the listener to remove
+     * @deprecated will be removed in GWT 2.0 along with the listener classes
+     */
+    @Deprecated
+    public static void remove(Widget eventSource, ClickListener listener) {
+      baseRemove(eventSource, listener, ClickEvent.getType());
+    }
+
+    private WrappedClickListener(ClickListener listener) {
+      super(listener);
+    }
+
+    public void onClick(ClickEvent event) {
+      getListener().onClick(getSource(event));
+    }
+  }
+  /**
+   * Wrapper for a {@link FocusListener}.
+   */
+  public static class WrappedFocusListener extends
+      ListenerWrapper<FocusListener> implements FocusHandler, BlurHandler {
+
+    /**
+     * Adds the wrapped listener.
+     * 
+     * @param eventSource the event source
+     * @param listener the listener
+     * 
+     * @return the wrapped listener
+     * 
+     * @deprecated will be removed in GWT 2.0 along with the listener classes
+     */
+    @Deprecated
+    public static WrappedFocusListener add(HasAllFocusHandlers eventSource,
+        FocusListener listener) {
+      WrappedFocusListener rtn = new WrappedFocusListener(listener);
+      HandlesAllFocusEvents.handle(eventSource, rtn);
+      return rtn;
+    }
+
+    /**
+     * Removes the wrapped listener.
+     * 
+     * @param eventSource the event source from which to remove the wrapped
+     *          listener
+     * @param listener the listener to remove
+     * @deprecated will be removed in GWT 2.0 along with the listener classes
+     */
+    @Deprecated
+    public static void remove(Widget eventSource, FocusListener listener) {
+      baseRemove(eventSource, listener, LoadEvent.getType(),
+          ErrorEvent.getType());
+    }
+
+    private WrappedFocusListener(FocusListener listener) {
+      super(listener);
+    }
+
+    public void onBlur(BlurEvent event) {
+      getListener().onLostFocus(getSource(event));
+    }
+
+    public void onFocus(FocusEvent event) {
+      getListener().onFocus(getSource(event));
+    }
+  }
+
+  /**
+   * Wrapper for a {@link KeyboardListener}.
+   */
+  public static class WrappedKeyboardListener extends
+      ListenerWrapper<KeyboardListener> implements KeyDownHandler,
+      KeyUpHandler, KeyPressHandler {
+
+    /**
+     * Adds the wrapped listener.
+     * 
+     * @param source the event source
+     * @param listener the listener
+     * @return the wrapped listener
+     * 
+     * @deprecated will be removed in GWT 2.0 along with the listener classes
+     */
+    @Deprecated
+    public static WrappedKeyboardListener add(HasAllKeyHandlers source,
+        KeyboardListener listener) {
+      WrappedKeyboardListener b = new WrappedKeyboardListener(listener);
+      HandlesAllKeyEvents.addHandlers(source, b);
+      return b;
+    }
+
+    /**
+     * Removes the wrapped listener.
+     * 
+     * @param eventSource the event source from which to remove the wrapped
+     *          listener
+     * @param listener the listener to remove
+     * @deprecated will be removed in GWT 2.0 along with the listener classes
+     */
+    @Deprecated
+    public static void remove(Widget eventSource, KeyboardListener listener) {
+      ListenerWrapper.baseRemove(eventSource, listener, KeyDownEvent.getType(),
+          KeyUpEvent.getType(), KeyPressEvent.getType());
+    }
+
+    private WrappedKeyboardListener(KeyboardListener listener) {
+      super(listener);
+    }
+
+    public void onKeyDown(KeyDownEvent event) {
+      getListener().onKeyDown(
+          getSource(event),
+          (char) event.getNativeKeyCode(),
+          KeyboardListenerCollection.getKeyboardModifiers(Event.as(event.getNativeEvent())));
+    }
+
+    public void onKeyPress(KeyPressEvent event) {
+      getListener().onKeyPress(
+          getSource(event),
+          (char) event.getNativeEvent().getKeyCode(),
+          KeyboardListenerCollection.getKeyboardModifiers(Event.as(event.getNativeEvent())));
+    }
+
+    public void onKeyUp(KeyUpEvent event) {
+      getSource(event);
+      getListener().onKeyUp(
+          getSource(event),
+          (char) event.getNativeKeyCode(),
+          KeyboardListenerCollection.getKeyboardModifiers(Event.as(event.getNativeEvent())));
+    }
+  }
+
+  /**
+   * Wrapper for a {@link ChangeListener} being converted to a logical
+   * {@link ValueChangeHandler}.
+   * 
+   * @param <V> the type of the value changed
+   * 
+   * @deprecated will be removed in GWT 2.0 along with the listeners being
+   *             wrapped
+   */
+  @Deprecated
+  public static class WrappedLogicalChangeListener<V> extends
+      ListenerWrapper<ChangeListener> implements ValueChangeHandler<V> {
+
+    /**
+     * Adds the wrapped listener.
+     * 
+     * @param <V> the type of value changed
+     * 
+     * @param source the event source
+     * @param listener the listener
+     * @return the wrapped listener
+     * 
+     * @deprecated will be removed in GWT 2.0 along with the listener classes
+     */
+    @Deprecated
+    public static <V> WrappedLogicalChangeListener<V> add(
+        HasValueChangeHandlers<V> source, ChangeListener listener) {
+      WrappedLogicalChangeListener<V> rtn = new WrappedLogicalChangeListener<V>(
+          listener);
+      source.addValueChangeHandler(rtn);
+      return rtn;
+    }
+
+    /**
+     * Removes the wrapped listener.
+     * 
+     * @param eventSource the event source from which to remove the wrapped
+     *          listener
+     * @param listener the listener to remove
+     * @deprecated will be removed in GWT 2.0 along with the listener classes
+     */
+    @Deprecated
+    public static void remove(Widget eventSource, ChangeListener listener) {
+      baseRemove(eventSource, listener, ValueChangeEvent.getType());
+    }
+
+    private WrappedLogicalChangeListener(ChangeListener listener) {
+      super(listener);
+    }
+
+    public void onValueChange(ValueChangeEvent<V> event) {
+      getListener().onChange(getSource(event));
+    }
+  }
+  /**
+   * Wrapper for a {@link MouseListener}.
+   */
+  public static class WrappedMouseListener extends
+      ListenerWrapper<MouseListener> implements MouseDownHandler,
+      MouseUpHandler, MouseOutHandler, MouseOverHandler, MouseMoveHandler {
+    /**
+     * Adds the wrapped listener.
+     * 
+     * @param source the event source
+     * @param listener the listener
+     * @return the wrapped listener
+     * @param <E> source of the handlers
+     * @deprecated will be removed in GWT 2.0 along with the listener classes
+     */
+    @Deprecated
+    public static <E extends HasMouseDownHandlers & HasMouseUpHandlers & HasMouseOutHandlers & HasMouseOverHandlers & HasMouseMoveHandlers> WrappedMouseListener add(
+        E source, MouseListener listener) {
+      WrappedMouseListener handlers = new WrappedMouseListener(listener);
+      source.addMouseDownHandler(handlers);
+      source.addMouseUpHandler(handlers);
+      source.addMouseOutHandler(handlers);
+      source.addMouseOverHandler(handlers);
+      source.addMouseMoveHandler(handlers);
+      return handlers;
+    }
+
+    /**
+     * Removes the wrapped listener.
+     * 
+     * @param eventSource the event source from which to remove the wrapped
+     *          listener
+     * @param listener the listener to remove
+     * @deprecated will be removed in GWT 2.0 along with the listener classes
+     */
+    @Deprecated
+    public static void remove(Widget eventSource, MouseListener listener) {
+      baseRemove(eventSource, listener, MouseDownEvent.getType(),
+          MouseUpEvent.getType(), MouseOverEvent.getType(),
+          MouseOutEvent.getType());
+    }
+
+    private WrappedMouseListener(MouseListener listener) {
+      super(listener);
+    }
+
+    public void onMouseDown(MouseDownEvent event) {
+      Widget source = getSource(event);
+      getListener().onMouseDown(source, event.getX(), event.getY());
+    }
+
+    public void onMouseMove(MouseMoveEvent event) {
+      Widget source = getSource(event);
+      getListener().onMouseMove(source, event.getX(), event.getY());
+    }
+
+    public void onMouseOut(MouseOutEvent event) {
+      getListener().onMouseLeave(getSource(event));
+    }
+
+    public void onMouseOver(MouseOverEvent event) {
+      getListener().onMouseEnter(getSource(event));
+    }
+
+    public void onMouseUp(MouseUpEvent event) {
+      Widget source = getSource(event);
+      getListener().onMouseUp(source, event.getX(), event.getY());
+    }
+  }
+  /**
+   * Wrapper for a {@link MouseWheelListener}.
+   */
+  public static class WrappedMouseWheelListener extends
+      ListenerWrapper<MouseWheelListener> implements MouseWheelHandler {
+    /**
+     * Adds the wrapped listener.
+     * 
+     * @param source the event source
+     * @param listener the listener
+     * @return the wrapped listener
+     * 
+     * @deprecated will be removed in GWT 2.0 along with the listener classes
+     */
+    @Deprecated
+    public static WrappedMouseWheelListener add(HasMouseWheelHandlers source,
+        MouseWheelListener listener) {
+      WrappedMouseWheelListener wrap = new WrappedMouseWheelListener(listener);
+      source.addMouseWheelHandler(new WrappedMouseWheelListener(listener));
+      return wrap;
+    }
+
+    /**
+     * Removes the wrapped listener.
+     * 
+     * @param eventSource the event source from which to remove the wrapped
+     *          listener
+     * @param listener the listener to remove
+     * @deprecated will be removed in GWT 2.0 along with the listener classes
+     */
+    @Deprecated
+    public static void remove(Widget eventSource, MouseWheelListener listener) {
+      baseRemove(eventSource, listener, MouseWheelEvent.getType());
+    }
+
+    private WrappedMouseWheelListener(MouseWheelListener listener) {
+      super(listener);
+    }
+
+    public void onMouseWheel(MouseWheelEvent event) {
+      getListener().onMouseWheel(getSource(event),
+          new MouseWheelVelocity(Event.as(event.getNativeEvent())));
+    }
+  }
+  /**
+   * Wrapper for a {@link ScrollListener}.
+   */
+  public static class WrappedScrollListener extends
+      ListenerWrapper<ScrollListener> implements ScrollHandler {
+
+    /**
+     * Adds the wrapped listener.
+     * 
+     * @param source the event source
+     * @param listener the listener
+     * @return the wrapped listener
+     * 
+     * @deprecated will be removed in GWT 2.0 along with the listener classes
+     */
+    @Deprecated
+    public static WrappedScrollListener add(HasScrollHandlers source,
+        ScrollListener listener) {
+      WrappedScrollListener s = new WrappedScrollListener(listener);
+      source.addScrollHandler(s);
+      return s;
+    }
+
+    /**
+     * Removes the wrapped listener.
+     * 
+     * @param eventSource the event source from which to remove the wrapped
+     *          listener
+     * @param listener the listener to remove
+     * @deprecated will be removed in GWT 2.0 along with the listener classes
+     */
+    @Deprecated
+    public static void remove(Widget eventSource, ScrollListener listener) {
+      baseRemove(eventSource, listener, ScrollEvent.getType(),
+          ErrorEvent.getType());
+    }
+
+    private WrappedScrollListener(ScrollListener listener) {
+      super(listener);
+    }
+
+    public void onScroll(ScrollEvent event) {
+      Widget source = getSource(event);
+      Element elem = source.getElement();
+      getListener().onScroll(getSource(event), elem.getScrollLeft(),
+          elem.getScrollTop());
+    }
+  }
+  static class WrappedOldDisclosureHandler extends
+      ListenerWrapper<DisclosureHandler> implements
+      CloseHandler<DisclosurePanel>, OpenHandler<DisclosurePanel> {
+
+    public static void add(DisclosurePanel source, DisclosureHandler listener) {
+      WrappedOldDisclosureHandler handlers = new WrappedOldDisclosureHandler(
+          listener);
+      source.addOpenHandler(handlers);
+      source.addCloseHandler(handlers);
+    }
+
+    public static void remove(Widget eventSource, DisclosureHandler listener) {
+      baseRemove(eventSource, listener, CloseEvent.getType(),
+          OpenEvent.getType());
+    }
+
+    private WrappedOldDisclosureHandler(DisclosureHandler listener) {
+      super(listener);
+    }
+
+    public void onClose(CloseEvent<DisclosurePanel> event) {
+      getListener().onClose(
+          new DisclosureEvent((DisclosurePanel) event.getSource()));
+    }
+
+    public void onOpen(OpenEvent<DisclosurePanel> event) {
+      getListener().onOpen(
+          new DisclosureEvent((DisclosurePanel) event.getSource()));
+    }
+  }
+
+  static class WrappedOldFormHandler extends ListenerWrapper<FormHandler>
+      implements FormPanel.SubmitHandler, FormPanel.SubmitCompleteHandler {
+
+    public static void add(FormPanel source, FormHandler listener) {
+      WrappedOldFormHandler handlers = new WrappedOldFormHandler(listener);
+      source.addSubmitHandler(handlers);
+      source.addSubmitCompleteHandler(handlers);
+    }
+
+    public static void remove(Widget eventSource, FormHandler listener) {
+      baseRemove(eventSource, listener, FormPanel.SubmitEvent.getType(),
+          FormPanel.SubmitCompleteEvent.getType());
+    }
+
+    private WrappedOldFormHandler(FormHandler listener) {
+      super(listener);
+    }
+
+    public void onSubmit(FormPanel.SubmitEvent event) {
+      FormSubmitEvent fse = new FormSubmitEvent((FormPanel) event.getSource());
+      getListener().onSubmit(fse);
+      if (fse.isSetCancelledCalled()) {
+        event.setCanceled(fse.isCancelled());
+      }
+    }
+
+    public void onSubmitComplete(FormPanel.SubmitCompleteEvent event) {
+      getListener().onSubmitComplete(
+          new FormSubmitCompleteEvent((FormPanel) event.getSource(),
+              event.getResults()));
+    }
+  }
+
+  static class WrappedOldSuggestionHandler extends
+      ListenerWrapper<SuggestionHandler> implements
+      SelectionHandler<SuggestOracle.Suggestion> {
+    /**
+     * @deprecated will be removed in GWT 2.0 along with the listener classes
+     */
+    @Deprecated
+    public static void add(SuggestBox source, SuggestionHandler listener) {
+      source.addSelectionHandler(new WrappedOldSuggestionHandler(listener));
+    }
+
+    public static void remove(Widget eventSource, SuggestionHandler listener) {
+      baseRemove(eventSource, listener, SelectionEvent.getType());
+    }
+
+    private WrappedOldSuggestionHandler(SuggestionHandler listener) {
+      super(listener);
+    }
+
+    public void onSelection(SelectionEvent<SuggestOracle.Suggestion> event) {
+      getListener().onSuggestionSelected(
+          new SuggestionEvent((SuggestBox) event.getSource(),
+              event.getSelectedItem()));
+    }
+  }
+
+  static class WrappedPopupListener extends ListenerWrapper<PopupListener>
+      implements CloseHandler<PopupPanel> {
+
+    public static void add(HasCloseHandlers<PopupPanel> source,
+        PopupListener listener) {
+      source.addCloseHandler(new WrappedPopupListener(listener));
+    }
+
+    public static void remove(Widget eventSource, PopupListener listener) {
+      baseRemove(eventSource, listener, CloseEvent.getType());
+    }
+
+    private WrappedPopupListener(PopupListener listener) {
+      super(listener);
+    }
+
+    public void onClose(CloseEvent<PopupPanel> event) {
+      getListener().onPopupClosed((PopupPanel) event.getSource(),
+          event.isAutoClosed());
+    }
+  }
+
+  static class WrappedTableListener extends ListenerWrapper<TableListener>
+      implements ClickHandler {
+    /**
+     * @deprecated will be removed in GWT 2.0 along with the listener classes
+     */
+    @Deprecated
+    public static void add(HasClickHandlers source, TableListener listener) {
+      source.addClickHandler(new WrappedTableListener(listener));
+    }
+
+    public static void remove(Widget eventSource, TableListener listener) {
+      baseRemove(eventSource, listener, ClickEvent.getType());
+    }
+
+    private WrappedTableListener(TableListener listener) {
+      super(listener);
+    }
+
+    public void onClick(ClickEvent event) {
+      HTMLTable table = (HTMLTable) event.getSource();
+      HTMLTable.Cell cell = table.getCellForEvent(event);
+      if (cell != null) {
+        getListener().onCellClicked(table, cell.getRowIndex(),
+            cell.getCellIndex());
+      }
+    }
+  }
+
+  static class WrappedTabListener extends ListenerWrapper<TabListener>
+      implements SelectionHandler<Integer>, BeforeSelectionHandler<Integer> {
+    /**
+     * @deprecated will be removed in GWT 2.0 along with the listener classes
+     */
+    @Deprecated
+    public static void add(TabBar source, TabListener listener) {
+      WrappedTabListener t = new WrappedTabListener(listener);
+      source.addBeforeSelectionHandler(t);
+      source.addSelectionHandler(t);
+    }
+
+    public static void add(TabPanel source, TabListener listener) {
+      WrappedTabListener t = new WrappedTabListener(listener);
+      source.addBeforeSelectionHandler(t);
+      source.addSelectionHandler(t);
+    }
+
+    public static void remove(Widget eventSource, TabListener listener) {
+      baseRemove(eventSource, listener, SelectionEvent.getType(),
+          BeforeSelectionEvent.getType());
+    }
+
+    private WrappedTabListener(TabListener listener) {
+      super(listener);
+    }
+
+    public void onBeforeSelection(BeforeSelectionEvent<Integer> event) {
+      if (!getListener().onBeforeTabSelected(
+          (SourcesTabEvents) event.getSource(), event.getItem().intValue())) {
+        event.cancel();
+      }
+    }
+
+    public void onSelection(SelectionEvent<Integer> event) {
+      getListener().onTabSelected((SourcesTabEvents) event.getSource(),
+          event.getSelectedItem().intValue());
+    }
+  }
+
+  static class WrappedTreeListener extends ListenerWrapper<TreeListener>
+      implements SelectionHandler<TreeItem>, CloseHandler<TreeItem>,
+      OpenHandler<TreeItem> {
+    /**
+     * @deprecated will be removed in GWT 2.0 along with the listener classes
+     */
+    @Deprecated
+    public static void add(com.google.gwt.user.client.ui.Tree tree,
+        TreeListener listener) {
+      WrappedTreeListener t = new WrappedTreeListener(listener);
+      tree.addSelectionHandler(t);
+      tree.addCloseHandler(t);
+      tree.addOpenHandler(t);
+    }
+
+    public static void remove(Widget eventSource, TreeListener listener) {
+      baseRemove(eventSource, listener, ValueChangeEvent.getType());
+    }
+
+    private WrappedTreeListener(TreeListener listener) {
+      super(listener);
+    }
+
+    public void onClose(CloseEvent<TreeItem> event) {
+      getListener().onTreeItemStateChanged(event.getTarget());
+    }
+
+    public void onOpen(OpenEvent<TreeItem> event) {
+      getListener().onTreeItemStateChanged(event.getTarget());
+    }
+
+    public void onSelection(SelectionEvent<TreeItem> event) {
+      getListener().onTreeItemSelected(event.getSelectedItem());
+    }
+  }
+
+  /**
+   * Convenience method to remove wrapped handlers from a widget.
+   * 
+   * @param <H> event handler type
+   * @param eventSource the event source
+   * @param listener the listener to remove
+   * @param types the event types to remove it from
+   */
+  // This is an internal helper method with the current formulation, we have
+  // lost the info needed to make it safe by this point.
+  @SuppressWarnings("unchecked")
+  protected static <H extends EventHandler> void baseRemove(Widget eventSource,
+      EventListener listener, Type... types) {
+    HandlerManager manager = eventSource.getHandlerManager();
+    if (manager != null) {
+      baseRemove(manager, listener, types);
+    }
+  }
+
+  protected ListenerWrapper(T listener) {
+    super(listener);
+  }
+
+}
diff --git a/user/src/com/google/gwt/user/datepicker/client/CalendarModel.java b/user/src/com/google/gwt/user/datepicker/client/CalendarModel.java
index 943230d..0ea4bda 100644
--- a/user/src/com/google/gwt/user/datepicker/client/CalendarModel.java
+++ b/user/src/com/google/gwt/user/datepicker/client/CalendarModel.java
@@ -1,195 +1,195 @@
-/*

- * 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.user.datepicker.client;

-

-import com.google.gwt.i18n.client.DateTimeFormat;

-

-import java.util.Date;

-

-/**

- * Model used to get calendar information for {@link DatePicker} and its

- * subclasses.

- */

-@SuppressWarnings(/* Required to use Date API in gwt */{"deprecation"})

-public class CalendarModel {

-

-  /**

-   * The number of weeks normally displayed in a month.

-   */

-  public static final int WEEKS_IN_MONTH = 6;

-

-  /**

-   * Number of days normally displayed in a week.

-   */

-  public static final int DAYS_IN_WEEK = 7;

-

-  private static final String[] dayOfWeekNames = new String[7];

-

-  private static String[] dayOfMonthNames = new String[32];

-

-  private final Date currentMonth;

-

-  /**

-   * Constructor.

-   */

-  public CalendarModel() {

-    currentMonth = new Date();

-

-    CalendarUtil.setToFirstDayOfMonth(currentMonth);

-

-    // Finding day of week names

-    Date date = new Date();

-    for (int i = 1; i <= 7; i++) {

-      date.setDate(i);

-      int dayOfWeek = date.getDay();

-      dayOfWeekNames[dayOfWeek] = getDayOfWeekFormatter().format(date);

-    }

-

-    // Finding day of month names

-    date.setMonth(0);

-

-    for (int i = 1; i < 32; ++i) {

-      date.setDate(i);

-      dayOfMonthNames[i] = getDayOfMonthFormatter().format(date);

-    }

-  }

-

-  /**

-   * Formats the current specified month. For example "Sep".

-   * 

-   * @return the formatted month

-   */

-  public String formatCurrentMonth() {

-    return getMonthAndYearFormatter().format(currentMonth);

-  }

-

-  /**

-   * Formats a date's day of month. For example "1".

-   * 

-   * @param date the date

-   * @return the formated day of month

-   */

-  public String formatDayOfMonth(Date date) {

-    return dayOfMonthNames[date.getDate()];

-  }

-

-  /**

-   * Format a day in the week. So, for example "Monday".

-   * 

-   * @param dayInWeek the day in week to format

-   * @return the formatted day in week

-   */

-  public String formatDayOfWeek(int dayInWeek) {

-    return dayOfWeekNames[dayInWeek];

-  }

-

-  /**

-   * Gets the first day of the first week in the currently specified month.

-   * 

-   * @return the first day

-   */

-  public Date getCurrentFirstDayOfFirstWeek() {

-    int wkDayOfMonth1st = currentMonth.getDay();

-    int start = CalendarUtil.getStartingDayOfWeek();

-    if (wkDayOfMonth1st == start) {

-      // always return a copy to allow SimpleCalendarView to adjust first

-      // display date

-      return new Date(currentMonth.getTime());

-    } else {

-      Date d = new Date(currentMonth.getTime());

-      int offset = wkDayOfMonth1st - start > 0 ? wkDayOfMonth1st - start

-          : DAYS_IN_WEEK - (start - wkDayOfMonth1st);

-      CalendarUtil.addDaysToDate(d, -offset);

-      return d;

-    }

-  }

-

-  /**

-   * Gets the date representation of the currently specified month. Used to

-   * access both the month and year information.

-   * 

-   * @return the month and year

-   */

-  public Date getCurrentMonth() {

-    return currentMonth;

-  }

-

-  /**

-   * Is a date in the currently specified month?

-   * 

-   * @param date the date

-   * @return date

-   */

-  public boolean isInCurrentMonth(Date date) {

-    return currentMonth.getMonth() == date.getMonth();

-  }

-

-  /**

-   * Sets the currently specified date.

-   * 

-   * @param currentDate the currently specified date

-   */

-  public void setCurrentMonth(Date currentDate) {

-    this.currentMonth.setYear(currentDate.getYear());

-    this.currentMonth.setMonth(currentDate.getMonth());

-  }

-

-  /**

-   * Shifts the currently specified date by the given number of months. The day

-   * of the month will be pinned to the original value as far as possible.

-   * 

-   * @param deltaMonths - number of months to be added to the current date

-   */

-  public void shiftCurrentMonth(int deltaMonths) {

-    CalendarUtil.addMonthsToDate(currentMonth, deltaMonths);

-    refresh();

-  }

-

-  /**

-   * Gets the date of month formatter.

-   * 

-   * @return the day of month formatter

-   */

-  protected DateTimeFormat getDayOfMonthFormatter() {

-    return DateTimeFormat.getFormat("d");

-  }

-

-  /**

-   * Gets the day of week formatter.

-   * 

-   * @return the day of week formatter

-   */

-  protected DateTimeFormat getDayOfWeekFormatter() {

-    return DateTimeFormat.getFormat("ccccc");

-  }

-

-  /**

-   * Gets the month and year formatter.

-   * 

-   * @return the month and year formatter

-   */

-  protected DateTimeFormat getMonthAndYearFormatter() {

-    return DateTimeFormat.getFormat("MMM yyyy");

-  }

-

-  /**

-   * Refresh the current model as needed.

-   */

-  protected void refresh() {

-  }

-

-}

+/*
+ * 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.user.datepicker.client;
+
+import com.google.gwt.i18n.client.DateTimeFormat;
+
+import java.util.Date;
+
+/**
+ * Model used to get calendar information for {@link DatePicker} and its
+ * subclasses.
+ */
+@SuppressWarnings(/* Required to use Date API in gwt */{"deprecation"})
+public class CalendarModel {
+
+  /**
+   * The number of weeks normally displayed in a month.
+   */
+  public static final int WEEKS_IN_MONTH = 6;
+
+  /**
+   * Number of days normally displayed in a week.
+   */
+  public static final int DAYS_IN_WEEK = 7;
+
+  private static final String[] dayOfWeekNames = new String[7];
+
+  private static String[] dayOfMonthNames = new String[32];
+
+  private final Date currentMonth;
+
+  /**
+   * Constructor.
+   */
+  public CalendarModel() {
+    currentMonth = new Date();
+
+    CalendarUtil.setToFirstDayOfMonth(currentMonth);
+
+    // Finding day of week names
+    Date date = new Date();
+    for (int i = 1; i <= 7; i++) {
+      date.setDate(i);
+      int dayOfWeek = date.getDay();
+      dayOfWeekNames[dayOfWeek] = getDayOfWeekFormatter().format(date);
+    }
+
+    // Finding day of month names
+    date.setMonth(0);
+
+    for (int i = 1; i < 32; ++i) {
+      date.setDate(i);
+      dayOfMonthNames[i] = getDayOfMonthFormatter().format(date);
+    }
+  }
+
+  /**
+   * Formats the current specified month. For example "Sep".
+   * 
+   * @return the formatted month
+   */
+  public String formatCurrentMonth() {
+    return getMonthAndYearFormatter().format(currentMonth);
+  }
+
+  /**
+   * Formats a date's day of month. For example "1".
+   * 
+   * @param date the date
+   * @return the formated day of month
+   */
+  public String formatDayOfMonth(Date date) {
+    return dayOfMonthNames[date.getDate()];
+  }
+
+  /**
+   * Format a day in the week. So, for example "Monday".
+   * 
+   * @param dayInWeek the day in week to format
+   * @return the formatted day in week
+   */
+  public String formatDayOfWeek(int dayInWeek) {
+    return dayOfWeekNames[dayInWeek];
+  }
+
+  /**
+   * Gets the first day of the first week in the currently specified month.
+   * 
+   * @return the first day
+   */
+  public Date getCurrentFirstDayOfFirstWeek() {
+    int wkDayOfMonth1st = currentMonth.getDay();
+    int start = CalendarUtil.getStartingDayOfWeek();
+    if (wkDayOfMonth1st == start) {
+      // always return a copy to allow SimpleCalendarView to adjust first
+      // display date
+      return new Date(currentMonth.getTime());
+    } else {
+      Date d = new Date(currentMonth.getTime());
+      int offset = wkDayOfMonth1st - start > 0 ? wkDayOfMonth1st - start
+          : DAYS_IN_WEEK - (start - wkDayOfMonth1st);
+      CalendarUtil.addDaysToDate(d, -offset);
+      return d;
+    }
+  }
+
+  /**
+   * Gets the date representation of the currently specified month. Used to
+   * access both the month and year information.
+   * 
+   * @return the month and year
+   */
+  public Date getCurrentMonth() {
+    return currentMonth;
+  }
+
+  /**
+   * Is a date in the currently specified month?
+   * 
+   * @param date the date
+   * @return date
+   */
+  public boolean isInCurrentMonth(Date date) {
+    return currentMonth.getMonth() == date.getMonth();
+  }
+
+  /**
+   * Sets the currently specified date.
+   * 
+   * @param currentDate the currently specified date
+   */
+  public void setCurrentMonth(Date currentDate) {
+    this.currentMonth.setYear(currentDate.getYear());
+    this.currentMonth.setMonth(currentDate.getMonth());
+  }
+
+  /**
+   * Shifts the currently specified date by the given number of months. The day
+   * of the month will be pinned to the original value as far as possible.
+   * 
+   * @param deltaMonths - number of months to be added to the current date
+   */
+  public void shiftCurrentMonth(int deltaMonths) {
+    CalendarUtil.addMonthsToDate(currentMonth, deltaMonths);
+    refresh();
+  }
+
+  /**
+   * Gets the date of month formatter.
+   * 
+   * @return the day of month formatter
+   */
+  protected DateTimeFormat getDayOfMonthFormatter() {
+    return DateTimeFormat.getFormat("d");
+  }
+
+  /**
+   * Gets the day of week formatter.
+   * 
+   * @return the day of week formatter
+   */
+  protected DateTimeFormat getDayOfWeekFormatter() {
+    return DateTimeFormat.getFormat("ccccc");
+  }
+
+  /**
+   * Gets the month and year formatter.
+   * 
+   * @return the month and year formatter
+   */
+  protected DateTimeFormat getMonthAndYearFormatter() {
+    return DateTimeFormat.getFormat("MMM yyyy");
+  }
+
+  /**
+   * Refresh the current model as needed.
+   */
+  protected void refresh() {
+  }
+
+}
diff --git a/user/src/com/google/gwt/user/datepicker/client/CalendarUtil.java b/user/src/com/google/gwt/user/datepicker/client/CalendarUtil.java
index 81b9ccf..5ad66b2 100644
--- a/user/src/com/google/gwt/user/datepicker/client/CalendarUtil.java
+++ b/user/src/com/google/gwt/user/datepicker/client/CalendarUtil.java
@@ -1,4 +1,4 @@
-/*

+/*
  * Copyright 2008 Google Inc.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
diff --git a/user/src/com/google/gwt/user/datepicker/client/CalendarView.java b/user/src/com/google/gwt/user/datepicker/client/CalendarView.java
index adaa19a..bb168b3 100644
--- a/user/src/com/google/gwt/user/datepicker/client/CalendarView.java
+++ b/user/src/com/google/gwt/user/datepicker/client/CalendarView.java
@@ -1,91 +1,91 @@
-/*

- * 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.user.datepicker.client;

-

-import java.util.Date;

-

-/**

- * The CalendarView is a calendar grid that represents the current view of a

- * {@link DatePicker}. Note, the calendar view only deals with the currently

- * visible dates and all state is flushed when the calendar view is refreshed.

- * 

- */

-public abstract class CalendarView extends DatePickerComponent {

-

-  /**

-   * Constructor.

-   */

-  public CalendarView() {

-  }

-

-  /**

-   * Adds a style name to the cell of the supplied date. This style is only set

-   * until the next time the {@link CalendarView} is refreshed.

-   * 

-   * @param styleName style name to add

-   * @param date date that will have the supplied style added

-   */

-  public abstract void addStyleToDate(String styleName, Date date);

-

-  /**

-   * Returns the first date that is currently shown by the calendar.

-   * 

-   * @return the first date.

-   */

-  public abstract Date getFirstDate();

-

-  /**

-   * Returns the last date that is currently shown by the calendar.

-   * 

-   * @return the last date.

-   */

-  public abstract Date getLastDate();

-

-  /**

-   * Is the cell representing the given date enabled?

-   * 

-   * @param date the date

-   * @return is the date enabled

-   */

-  public abstract boolean isDateEnabled(Date date);

-

-  /**

-   * Removes a visible style name from the cell of the supplied date.

-   * 

-   * @param styleName style name to remove

-   * @param date date that will have the supplied style added

-   */

-  public abstract void removeStyleFromDate(String styleName, Date date);

-

-  /**

-   * Enables or Disables a particular date. by default all valid dates are

-   * enabled after a rendering event. Disabled dates cannot be selected.

-   * 

-   * @param enabled true for enabled, false for disabled

-   * @param date date to enable or disable

-   */

-  public abstract void setEnabledOnDate(boolean enabled, Date date);

-

-  /**

-   * Allows the calendar view to update the date picker's highlighted date.

-   * 

-   * @param date the highlighted date

-   */

-  protected final void setHighlightedDate(Date date) {

-    getDatePicker().setHighlightedDate(date);

-  }

+/*
+ * 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.user.datepicker.client;
+
+import java.util.Date;
+
+/**
+ * The CalendarView is a calendar grid that represents the current view of a
+ * {@link DatePicker}. Note, the calendar view only deals with the currently
+ * visible dates and all state is flushed when the calendar view is refreshed.
+ * 
+ */
+public abstract class CalendarView extends DatePickerComponent {
+
+  /**
+   * Constructor.
+   */
+  public CalendarView() {
+  }
+
+  /**
+   * Adds a style name to the cell of the supplied date. This style is only set
+   * until the next time the {@link CalendarView} is refreshed.
+   * 
+   * @param styleName style name to add
+   * @param date date that will have the supplied style added
+   */
+  public abstract void addStyleToDate(String styleName, Date date);
+
+  /**
+   * Returns the first date that is currently shown by the calendar.
+   * 
+   * @return the first date.
+   */
+  public abstract Date getFirstDate();
+
+  /**
+   * Returns the last date that is currently shown by the calendar.
+   * 
+   * @return the last date.
+   */
+  public abstract Date getLastDate();
+
+  /**
+   * Is the cell representing the given date enabled?
+   * 
+   * @param date the date
+   * @return is the date enabled
+   */
+  public abstract boolean isDateEnabled(Date date);
+
+  /**
+   * Removes a visible style name from the cell of the supplied date.
+   * 
+   * @param styleName style name to remove
+   * @param date date that will have the supplied style added
+   */
+  public abstract void removeStyleFromDate(String styleName, Date date);
+
+  /**
+   * Enables or Disables a particular date. by default all valid dates are
+   * enabled after a rendering event. Disabled dates cannot be selected.
+   * 
+   * @param enabled true for enabled, false for disabled
+   * @param date date to enable or disable
+   */
+  public abstract void setEnabledOnDate(boolean enabled, Date date);
+
+  /**
+   * Allows the calendar view to update the date picker's highlighted date.
+   * 
+   * @param date the highlighted date
+   */
+  protected final void setHighlightedDate(Date date) {
+    getDatePicker().setHighlightedDate(date);
+  }
 }
\ No newline at end of file
diff --git a/user/src/com/google/gwt/user/datepicker/client/CellGridImpl.java b/user/src/com/google/gwt/user/datepicker/client/CellGridImpl.java
index 203bf90..c507003 100644
--- a/user/src/com/google/gwt/user/datepicker/client/CellGridImpl.java
+++ b/user/src/com/google/gwt/user/datepicker/client/CellGridImpl.java
@@ -1,284 +1,284 @@
-/*

- * 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.user.datepicker.client;

-

-import com.google.gwt.dom.client.Element;

-import com.google.gwt.event.dom.client.KeyDownEvent;

-import com.google.gwt.event.dom.client.KeyCodes;

-import com.google.gwt.user.client.DOM;

-import com.google.gwt.user.client.Event;

-import com.google.gwt.user.client.impl.ElementMapperImpl;

-import com.google.gwt.user.client.ui.Grid;

-import com.google.gwt.user.client.ui.UIObject;

-

-import java.util.ArrayList;

-import java.util.Iterator;

-

-/**

- * Highlighting, selectable cell grid. Used to help construct the default

- * calendar view.

- * 

- * @param <V> type of value in grid.

- */

-@SuppressWarnings("unchecked")

-abstract class CellGridImpl<V> extends Grid {

-

-  /**

-   * Cell type.

-   */

-  public abstract class Cell extends UIObject {

-    private boolean enabled = true;

-    private V value;

-    private int index;

-

-    /**

-     * Create a cell grid.

-     * 

-     * @param elem the wrapped element

-     * @param value the value

-     */

-    public Cell(Element elem, V value) {

-      this.value = value;

-      Cell current = this;

-      index = cellList.size();

-      cellList.add(current);

-

-      setElement(elem);

-      elementToCell.put(current);

-    }

-

-    public V getValue() {

-      return value;

-    }

-

-    public boolean isEnabled() {

-      return enabled;

-    }

-

-    public boolean isHighlighted() {

-      return this == highlightedCell;

-    }

-

-    public boolean isSelected() {

-      return selectedCell == this;

-    }

-

-    public final void setEnabled(boolean enabled) {

-      this.enabled = enabled;

-      onEnabled(enabled);

-    }

-

-    public void verticalNavigation(int keyCode) {

-      switch (keyCode) {

-        case KeyCodes.KEY_UP:

-          setHighlighted(previousItem());

-          break;

-        case KeyCodes.KEY_DOWN:

-          setHighlighted(nextItem());

-          break;

-        case KeyCodes.KEY_ESCAPE:

-          // Figure out new event for this.

-          break;

-        case KeyCodes.KEY_ENTER:

-          setSelected(this);

-          break;

-      }

-    }

-

-    protected Cell nextItem() {

-      if (index == getLastIndex()) {

-        return cellList.get(0);

-      } else {

-        return cellList.get(index + 1);

-      }

-    }

-

-    /**

-     * @param enabled

-     */

-    protected void onEnabled(boolean enabled) {

-      updateStyle();

-    }

-

-    /**

-     * @param highlighted

-     */

-    protected void onHighlighted(boolean highlighted) {

-      updateStyle();

-    }

-

-    /**

-     * @param selected

-     */

-    protected void onSelected(boolean selected) {

-      updateStyle();

-    }

-

-    protected Cell previousItem() {

-      if (index != 0) {

-        return cellList.get(index - 1);

-      } else {

-        return cellList.get(getLastIndex());

-      }

-    }

-

-    protected abstract void updateStyle();

-

-    private int getLastIndex() {

-      return cellList.size() - 1;

-    }

-  }

-

-  private Cell highlightedCell;

-

-  private Cell selectedCell;

-  private ElementMapperImpl<Cell> elementToCell = new ElementMapperImpl<Cell>();

-  private ArrayList<Cell> cellList = new ArrayList<Cell>();

-

-  protected CellGridImpl() {

-    setCellPadding(0);

-    setCellSpacing(0);

-    setBorderWidth(0);

-    sinkEvents(Event.ONCLICK | Event.ONMOUSEOVER | Event.ONMOUSEOUT);

-  }

-

-  public Cell getCell(Element element) {

-    // This cast is always valid because both Element types are JSOs and have

-    // no new fields are added in the subclass.

-    return elementToCell.get((com.google.gwt.user.client.Element) element);

-  }

-

-  public Cell getCell(Event e) {

-    // Find out which cell was actually clicked.

-    Element td = getEventTargetCell(e);

-    return td != null

-        ? elementToCell.get((com.google.gwt.user.client.Element) td) : null;

-  }

-

-  public Cell getCell(int i) {

-    return cellList.get(i);

-  }

-

-  public Iterator getCells() {

-    return cellList.iterator();

-  }

-

-  public Cell getHighlightedCell() {

-    return highlightedCell;

-  }

-

-  public int getNumCells() {

-    return cellList.size();

-  }

-

-  public Cell getSelectedCell() {

-    return selectedCell;

-  }

-

-  public V getSelectedValue() {

-    return getValue(selectedCell);

-  }

-

-  public V getValue(Cell cell) {

-    return (cell == null ? null : cell.getValue());

-  }

-

-  @Override

-  public void onBrowserEvent(Event event) {

-    switch (DOM.eventGetType(event)) {

-      case Event.ONCLICK: {

-        Cell cell = getCell(event);

-        if (isActive(cell)) {

-          setSelected(cell);

-        }

-        break;

-      }

-      case Event.ONMOUSEOUT: {

-        Element e = DOM.eventGetFromElement(event);

-        if (e != null) {

-          Cell cell = elementToCell.get((com.google.gwt.user.client.Element) e);

-          if (cell == highlightedCell) {

-            setHighlighted(null);

-          }

-        }

-        break;

-      }

-      case Event.ONMOUSEOVER: {

-        Element e = DOM.eventGetToElement(event);

-        if (e != null) {

-          Cell cell = elementToCell.get((com.google.gwt.user.client.Element) e);

-          if (isActive(cell)) {

-            setHighlighted(cell);

-          }

-        }

-        break;

-      }

-    }

-  }

-

-  @Override

-  public void onUnload() {

-    setHighlighted(null);

-  }

-

-  public final void setHighlighted(Cell nextHighlighted) {

-    if (nextHighlighted == highlightedCell) {

-      return;

-    }

-    Cell oldHighlighted = highlightedCell;

-    highlightedCell = nextHighlighted;

-    if (oldHighlighted != null) {

-      oldHighlighted.onHighlighted(false);

-    }

-    if (highlightedCell != null) {

-      highlightedCell.onHighlighted(true);

-    }

-  }

-

-  public final void setSelected(Cell cell) {

-    Cell last = getSelectedCell();

-    selectedCell = cell;

-

-    if (last != null) {

-      last.onSelected(false);

-    }

-    if (selectedCell != null) {

-      selectedCell.onSelected(true);

-    }

-    onSelected(last, selectedCell);

-  }

-

-  protected void onKeyDown(Cell lastHighlighted, KeyDownEvent event) {

-    if (event.isAnyModifierKeyDown()) {

-      return;

-    }

-    int keyCode = event.getNativeKeyCode();

-    if (lastHighlighted == null) {

-      if (keyCode == KeyCodes.KEY_DOWN && cellList.size() > 0) {

-        setHighlighted(cellList.get(0));

-      }

-    } else {

-      lastHighlighted.verticalNavigation(keyCode);

-    }

-  }

-

-  protected abstract void onSelected(Cell lastSelected, Cell cell);

-

-  private boolean isActive(Cell cell) {

-    return cell != null && cell.isEnabled();

-  }

-}

+/*
+ * 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.user.datepicker.client;
+
+import com.google.gwt.dom.client.Element;
+import com.google.gwt.event.dom.client.KeyDownEvent;
+import com.google.gwt.event.dom.client.KeyCodes;
+import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.Event;
+import com.google.gwt.user.client.impl.ElementMapperImpl;
+import com.google.gwt.user.client.ui.Grid;
+import com.google.gwt.user.client.ui.UIObject;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+/**
+ * Highlighting, selectable cell grid. Used to help construct the default
+ * calendar view.
+ * 
+ * @param <V> type of value in grid.
+ */
+@SuppressWarnings("unchecked")
+abstract class CellGridImpl<V> extends Grid {
+
+  /**
+   * Cell type.
+   */
+  public abstract class Cell extends UIObject {
+    private boolean enabled = true;
+    private V value;
+    private int index;
+
+    /**
+     * Create a cell grid.
+     * 
+     * @param elem the wrapped element
+     * @param value the value
+     */
+    public Cell(Element elem, V value) {
+      this.value = value;
+      Cell current = this;
+      index = cellList.size();
+      cellList.add(current);
+
+      setElement(elem);
+      elementToCell.put(current);
+    }
+
+    public V getValue() {
+      return value;
+    }
+
+    public boolean isEnabled() {
+      return enabled;
+    }
+
+    public boolean isHighlighted() {
+      return this == highlightedCell;
+    }
+
+    public boolean isSelected() {
+      return selectedCell == this;
+    }
+
+    public final void setEnabled(boolean enabled) {
+      this.enabled = enabled;
+      onEnabled(enabled);
+    }
+
+    public void verticalNavigation(int keyCode) {
+      switch (keyCode) {
+        case KeyCodes.KEY_UP:
+          setHighlighted(previousItem());
+          break;
+        case KeyCodes.KEY_DOWN:
+          setHighlighted(nextItem());
+          break;
+        case KeyCodes.KEY_ESCAPE:
+          // Figure out new event for this.
+          break;
+        case KeyCodes.KEY_ENTER:
+          setSelected(this);
+          break;
+      }
+    }
+
+    protected Cell nextItem() {
+      if (index == getLastIndex()) {
+        return cellList.get(0);
+      } else {
+        return cellList.get(index + 1);
+      }
+    }
+
+    /**
+     * @param enabled
+     */
+    protected void onEnabled(boolean enabled) {
+      updateStyle();
+    }
+
+    /**
+     * @param highlighted
+     */
+    protected void onHighlighted(boolean highlighted) {
+      updateStyle();
+    }
+
+    /**
+     * @param selected
+     */
+    protected void onSelected(boolean selected) {
+      updateStyle();
+    }
+
+    protected Cell previousItem() {
+      if (index != 0) {
+        return cellList.get(index - 1);
+      } else {
+        return cellList.get(getLastIndex());
+      }
+    }
+
+    protected abstract void updateStyle();
+
+    private int getLastIndex() {
+      return cellList.size() - 1;
+    }
+  }
+
+  private Cell highlightedCell;
+
+  private Cell selectedCell;
+  private ElementMapperImpl<Cell> elementToCell = new ElementMapperImpl<Cell>();
+  private ArrayList<Cell> cellList = new ArrayList<Cell>();
+
+  protected CellGridImpl() {
+    setCellPadding(0);
+    setCellSpacing(0);
+    setBorderWidth(0);
+    sinkEvents(Event.ONCLICK | Event.ONMOUSEOVER | Event.ONMOUSEOUT);
+  }
+
+  public Cell getCell(Element element) {
+    // This cast is always valid because both Element types are JSOs and have
+    // no new fields are added in the subclass.
+    return elementToCell.get((com.google.gwt.user.client.Element) element);
+  }
+
+  public Cell getCell(Event e) {
+    // Find out which cell was actually clicked.
+    Element td = getEventTargetCell(e);
+    return td != null
+        ? elementToCell.get((com.google.gwt.user.client.Element) td) : null;
+  }
+
+  public Cell getCell(int i) {
+    return cellList.get(i);
+  }
+
+  public Iterator getCells() {
+    return cellList.iterator();
+  }
+
+  public Cell getHighlightedCell() {
+    return highlightedCell;
+  }
+
+  public int getNumCells() {
+    return cellList.size();
+  }
+
+  public Cell getSelectedCell() {
+    return selectedCell;
+  }
+
+  public V getSelectedValue() {
+    return getValue(selectedCell);
+  }
+
+  public V getValue(Cell cell) {
+    return (cell == null ? null : cell.getValue());
+  }
+
+  @Override
+  public void onBrowserEvent(Event event) {
+    switch (DOM.eventGetType(event)) {
+      case Event.ONCLICK: {
+        Cell cell = getCell(event);
+        if (isActive(cell)) {
+          setSelected(cell);
+        }
+        break;
+      }
+      case Event.ONMOUSEOUT: {
+        Element e = DOM.eventGetFromElement(event);
+        if (e != null) {
+          Cell cell = elementToCell.get((com.google.gwt.user.client.Element) e);
+          if (cell == highlightedCell) {
+            setHighlighted(null);
+          }
+        }
+        break;
+      }
+      case Event.ONMOUSEOVER: {
+        Element e = DOM.eventGetToElement(event);
+        if (e != null) {
+          Cell cell = elementToCell.get((com.google.gwt.user.client.Element) e);
+          if (isActive(cell)) {
+            setHighlighted(cell);
+          }
+        }
+        break;
+      }
+    }
+  }
+
+  @Override
+  public void onUnload() {
+    setHighlighted(null);
+  }
+
+  public final void setHighlighted(Cell nextHighlighted) {
+    if (nextHighlighted == highlightedCell) {
+      return;
+    }
+    Cell oldHighlighted = highlightedCell;
+    highlightedCell = nextHighlighted;
+    if (oldHighlighted != null) {
+      oldHighlighted.onHighlighted(false);
+    }
+    if (highlightedCell != null) {
+      highlightedCell.onHighlighted(true);
+    }
+  }
+
+  public final void setSelected(Cell cell) {
+    Cell last = getSelectedCell();
+    selectedCell = cell;
+
+    if (last != null) {
+      last.onSelected(false);
+    }
+    if (selectedCell != null) {
+      selectedCell.onSelected(true);
+    }
+    onSelected(last, selectedCell);
+  }
+
+  protected void onKeyDown(Cell lastHighlighted, KeyDownEvent event) {
+    if (event.isAnyModifierKeyDown()) {
+      return;
+    }
+    int keyCode = event.getNativeKeyCode();
+    if (lastHighlighted == null) {
+      if (keyCode == KeyCodes.KEY_DOWN && cellList.size() > 0) {
+        setHighlighted(cellList.get(0));
+      }
+    } else {
+      lastHighlighted.verticalNavigation(keyCode);
+    }
+  }
+
+  protected abstract void onSelected(Cell lastSelected, Cell cell);
+
+  private boolean isActive(Cell cell) {
+    return cell != null && cell.isEnabled();
+  }
+}
diff --git a/user/src/com/google/gwt/user/datepicker/client/DateChangeEvent.java b/user/src/com/google/gwt/user/datepicker/client/DateChangeEvent.java
index 7c21779..c08c8cc 100644
--- a/user/src/com/google/gwt/user/datepicker/client/DateChangeEvent.java
+++ b/user/src/com/google/gwt/user/datepicker/client/DateChangeEvent.java
@@ -1,62 +1,62 @@
-/*

- * 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.user.datepicker.client;

-

-import com.google.gwt.event.logical.shared.HasValueChangeHandlers;

-import com.google.gwt.event.logical.shared.ValueChangeEvent;

-import com.google.gwt.event.shared.HasHandlers;

-

-import java.util.Date;

-

-/**

- * Creates a new value every time a date is accessed.

- */

-class DateChangeEvent extends ValueChangeEvent<Date> {

-

-  /**

-   * Fires value change event if the old value is not equal to the new value.

-   * Use this call rather than making the decision to short circuit yourself for

-   * safe handling of null.

-   * 

-   * @param <I> the old value type

-   * @param <S> The event source

-   * @param source the source of the handlers

-   * @param oldValue the oldValue, may be null

-   * @param newValue the newValue, may be null

-   */

-  public static <S extends HasValueChangeHandlers<Date> & HasHandlers> void fireIfNotEqualDates(

-      S source, Date oldValue, Date newValue) {

-    if (ValueChangeEvent.shouldFire(source, oldValue, newValue)) {

-      source.fireEvent(new DateChangeEvent(newValue));

-    }

-  }

-

-  /**

-   * Creates a new date value change event.

-   * 

-   * @param value the value

-   */

-  protected DateChangeEvent(Date value) {

-    // The date must be copied in case one handler causes it to change.

-    super(CalendarUtil.copyDate(value));

-  }

-

-  @Override

-  public Date getValue() {

-    return CalendarUtil.copyDate(super.getValue());

-  }

-}

+/*
+ * 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.user.datepicker.client;
+
+import com.google.gwt.event.logical.shared.HasValueChangeHandlers;
+import com.google.gwt.event.logical.shared.ValueChangeEvent;
+import com.google.gwt.event.shared.HasHandlers;
+
+import java.util.Date;
+
+/**
+ * Creates a new value every time a date is accessed.
+ */
+class DateChangeEvent extends ValueChangeEvent<Date> {
+
+  /**
+   * Fires value change event if the old value is not equal to the new value.
+   * Use this call rather than making the decision to short circuit yourself for
+   * safe handling of null.
+   * 
+   * @param <I> the old value type
+   * @param <S> The event source
+   * @param source the source of the handlers
+   * @param oldValue the oldValue, may be null
+   * @param newValue the newValue, may be null
+   */
+  public static <S extends HasValueChangeHandlers<Date> & HasHandlers> void fireIfNotEqualDates(
+      S source, Date oldValue, Date newValue) {
+    if (ValueChangeEvent.shouldFire(source, oldValue, newValue)) {
+      source.fireEvent(new DateChangeEvent(newValue));
+    }
+  }
+
+  /**
+   * Creates a new date value change event.
+   * 
+   * @param value the value
+   */
+  protected DateChangeEvent(Date value) {
+    // The date must be copied in case one handler causes it to change.
+    super(CalendarUtil.copyDate(value));
+  }
+
+  @Override
+  public Date getValue() {
+    return CalendarUtil.copyDate(super.getValue());
+  }
+}
diff --git a/user/src/com/google/gwt/user/datepicker/client/DatePicker.java b/user/src/com/google/gwt/user/datepicker/client/DatePicker.java
index 5ebb67d..740f7ac 100644
--- a/user/src/com/google/gwt/user/datepicker/client/DatePicker.java
+++ b/user/src/com/google/gwt/user/datepicker/client/DatePicker.java
@@ -1,664 +1,664 @@
-/*

- * 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.user.datepicker.client;

-

-import com.google.gwt.event.logical.shared.HasHighlightHandlers;

-import com.google.gwt.event.logical.shared.HasShowRangeHandlers;

-import com.google.gwt.event.logical.shared.HighlightEvent;

-import com.google.gwt.event.logical.shared.HighlightHandler;

-import com.google.gwt.event.logical.shared.ShowRangeEvent;

-import com.google.gwt.event.logical.shared.ShowRangeHandler;

-import com.google.gwt.event.logical.shared.ValueChangeEvent;

-import com.google.gwt.event.logical.shared.ValueChangeHandler;

-import com.google.gwt.event.shared.HandlerRegistration;

-import com.google.gwt.user.client.ui.Composite;

-import com.google.gwt.user.client.ui.HasValue;

-import com.google.gwt.user.client.ui.VerticalPanel;

-

-import java.util.Date;

-import java.util.HashMap;

-import java.util.Map;

-

-/**

- * Standard GWT date picker.

- * 

- * <h3>CSS Style Rules</h3>

- * 

- * <ul class="css">

- * 

- * <li>.gwt-DatePicker { }</li>

- * 

- * <li>.datePickerMonthSelector { the month selector widget }</li>

- * 

- * <li>.datePickerMonth { the month in the month selector widget } <li>

- * 

- * <li>.datePickerPreviousButton { the previous month button } <li>

- * 

- * <li>.datePickerNextButton { the next month button } <li>

- * 

- * <li>.datePickerDays { the portion of the picker that shows the days }</li>

- * 

- * <li>.datePickerWeekdayLabel { the label over weekdays }</li>

- * 

- * <li>.datePickerWeekendLabel { the label over weekends }</li>

- * 

- * <li>.datePickerDay { a single day }</li>

- * 

- * <li>.datePickerDayIsToday { today's date }</li>

- * 

- * <li>.datePickerDayIsWeekend { a weekend day }</li>

- * 

- * <li>.datePickerDayIsFiller { a day in another month }</li>

- * 

- * <li>.datePickerDayIsValue { the selected day }</li>

- * 

- * <li>.datePickerDayIsDisabled { a disabled day }</li>

- * 

- * <li>.datePickerDayIsHighlighted { the currently highlighted day }</li>

- * 

- * <li>.datePickerDayIsValueAndHighlighted { the highlighted day if it is also

- * selected }</li>

- * 

- * </ul>

- * 

- * <p>

- * <h3>Example</h3>

- * {@example com.google.gwt.examples.DatePickerExample}

- * </p>

- */

-public class DatePicker extends Composite implements

-    HasHighlightHandlers<Date>, HasShowRangeHandlers<Date>, HasValue<Date> {

-

-  /**

-   * Convenience class to group css style names.

-   */

-  static class StandardCss {

-

-    static StandardCss DEFAULT = new StandardCss("gwt-DatePicker", "datePicker");

-

-    private String baseName;

-    private String widgetName;

-

-    public StandardCss(String widgetName, String baseName) {

-      this.widgetName = widgetName;

-      this.baseName = baseName;

-    }

-

-    public String datePicker() {

-      return getWidgetStyleName();

-    }

-

-    public String day() {

-      return wrap("Day");

-    }

-

-    public String day(String dayModifier) {

-      return day() + "Is" + dayModifier;

-    }

-

-    public String dayIsDisabled() {

-      return day("Disabled");

-    }

-

-    public String dayIsFiller() {

-      return day("Filler");

-    }

-

-    public String dayIsHighlighted() {

-      return day("Highlighted");

-    }

-

-    public String dayIsToday() {

-      return day("Today");

-    }

-

-    public String dayIsValue() {

-      return day("Value");

-    }

-

-    public String dayIsValueAndHighlighted() {

-      return dayIsValue() + "AndHighlighted";

-    }

-

-    public String dayIsWeekend() {

-      return day("Weekend");

-    }

-

-    public String days() {

-      return wrap("Days");

-    }

-

-    public String daysLabel() {

-      return wrap("DaysLabel");

-    }

-

-    public String getBaseStyleName() {

-      return baseName;

-    }

-

-    public String getWidgetStyleName() {

-      return widgetName;

-    }

-

-    public String month() {

-      return wrap("Month");

-    }

-

-    public String monthSelector() {

-      return wrap("MonthSelector");

-    }

-

-    public String nextButton() {

-      return wrap("NextButton");

-    }

-

-    public String previousButton() {

-      return wrap("PreviousButton");

-    }

-

-    public String weekdayLabel() {

-      return wrap("WeekdayLabel");

-    }

-

-    public String weekendLabel() {

-      return wrap("WeekendLabel");

-    }

-

-    /**

-     * Prepends the base name to the given style.

-     * 

-     * @param style style name

-     * @return style name

-     */

-    protected String wrap(String style) {

-      return baseName + style;

-    }

-  }

-

-  /**

-   * A date highlighted event that copied on read.

-   */

-  private static class DateHighlightEvent extends HighlightEvent<Date> {

-    protected DateHighlightEvent(Date highlighted) {

-      super(highlighted);

-    }

-

-    @Override

-    public Date getHighlighted() {

-      return CalendarUtil.copyDate(super.getHighlighted());

-    }

-  }

-

-  private static class DateStyler {

-    private Map<String, String> info = new HashMap<String, String>();

-

-    public String getStyleName(Date d) {

-      return info.get(genKey(d));

-    }

-

-    public void setStyleName(Date d, String styleName, boolean add) {

-      // Code is easier to maintain if surrounded by " ", and on all browsers

-      // this is a no-op.

-      styleName = " " + styleName + " ";

-      String key = genKey(d);

-      String current = info.get(key);

-

-      if (add) {

-        if (current == null) {

-          info.put(key, styleName);

-        } else if (current.indexOf(styleName) == -1) {

-          info.put(key, current + styleName);

-        }

-      } else {

-        if (current != null) {

-          String newValue = current.replaceAll(styleName, "");

-          if (newValue.trim().length() == 0) {

-            info.remove(key);

-          } else {

-            info.put(key, newValue);

-          }

-        }

-      }

-    }

-

-    @SuppressWarnings("deprecation")

-    private String genKey(Date d) {

-      return d.getYear() + "/" + d.getMonth() + "/" + d.getDate();

-    }

-  }

-

-  private final DateStyler styler = new DateStyler();

-

-  private final MonthSelector monthSelector;

-  private final CalendarView view;

-  private final CalendarModel model;

-  private Date value;

-  private Date highlighted;

-  private StandardCss css = StandardCss.DEFAULT;

-

-  /**

-   * Create a new date picker.

-   */

-  public DatePicker() {

-    this(new DefaultMonthSelector(), new DefaultCalendarView(),

-        new CalendarModel());

-  }

-

-  /**

-   * Creates a new date picker.

-   * 

-   * @param monthSelector the month selector

-   * @param view the view

-   * @param model the model

-   */

-

-  protected DatePicker(MonthSelector monthSelector, CalendarView view,

-      CalendarModel model) {

-

-    this.model = model;

-    this.monthSelector = monthSelector;

-    monthSelector.setDatePicker(this);

-    this.view = view;

-    view.setDatePicker(this);

-

-    view.setup();

-    monthSelector.setup();

-    this.setup();

-

-    setCurrentMonth(new Date());

-    addStyleToDates(css().dayIsToday(), new Date());

-  }

-

-  public HandlerRegistration addHighlightHandler(HighlightHandler<Date> handler) {

-    return addHandler(handler, HighlightEvent.getType());

-  }

-

-  public HandlerRegistration addShowRangeHandler(ShowRangeHandler<Date> handler) {

-    return addHandler(handler, ShowRangeEvent.getType());

-  }

-

-  /**

-   * Adds a show range handler and immediately activate the handler on the

-   * current view.

-   * 

-   * @param handler the handler

-   * @return the handler registration

-   */

-  public HandlerRegistration addShowRangeHandlerAndFire(

-      ShowRangeHandler<Date> handler) {

-    ShowRangeEvent<Date> event = new ShowRangeEvent<Date>(

-        getView().getFirstDate(), getView().getLastDate()) {

-    };

-    handler.onShowRange(event);

-    return addShowRangeHandler(handler);

-  }

-

-  /**

-   * Add a style name to the given dates.

-   */

-  public void addStyleToDates(String styleName, Date date) {

-    styler.setStyleName(date, styleName, true);

-    if (isDateVisible(date)) {

-      getView().addStyleToDate(styleName, date);

-    }

-  }

-

-  /**

-   * Add a style name to the given dates.

-   */

-  public void addStyleToDates(String styleName, Date date, Date... moreDates) {

-    addStyleToDates(styleName, date);

-    for (Date d : moreDates) {

-      addStyleToDates(styleName, d);

-    }

-  }

-

-  /**

-   * Add a style name to the given dates.

-   */

-  public void addStyleToDates(String styleName, Iterable<Date> dates) {

-    for (Date d : dates) {

-      addStyleToDates(styleName, d);

-    }

-  }

-

-  /**

-   * Adds the given style name to the specified dates, which must be visible.

-   * This is only set until the next time the DatePicker is refreshed.

-   */

-  public void addTransientStyleToDates(String styleName, Date date) {

-    assert isDateVisible(date) : date + " must be visible";

-    getView().addStyleToDate(styleName, date);

-  }

-

-  /**

-   * Adds the given style name to the specified dates, which must be visible.

-   * This is only set until the next time the DatePicker is refreshed.

-   */

-  public final void addTransientStyleToDates(String styleName, Date date,

-      Date... moreDates) {

-    addTransientStyleToDates(styleName, date);

-    for (Date d : moreDates) {

-      addTransientStyleToDates(styleName, d);

-    }

-  }

-

-  /**

-   * Adds the given style name to the specified dates, which must be visible.

-   * This is only set until the next time the DatePicker is refreshed.

-   */

-  public final void addTransientStyleToDates(String styleName,

-      Iterable<Date> dates) {

-    for (Date d : dates) {

-      addTransientStyleToDates(styleName, d);

-    }

-  }

-

-  public HandlerRegistration addValueChangeHandler(

-      ValueChangeHandler<Date> handler) {

-    return addHandler(handler, ValueChangeEvent.getType());

-  }

-

-  /**

-   * Gets the current month the date picker is showing.

-   * 

-   * <p>

-   * A datepicker <b> may </b> show days not in the current month. It

-   * <b>must</b> show all days in the current month.

-   * </p>

-   * 

-   * @return the current month

-   * 

-   */

-  public Date getCurrentMonth() {

-    return getModel().getCurrentMonth();

-  }

-

-  /**

-   * Returns the first shown date.

-   * 

-   * @return the first date.

-   */

-  // Final because the view should always control the value of the first date.

-  public final Date getFirstDate() {

-    return view.getFirstDate();

-  }

-

-  /**

-   * Gets the highlighted date (the one the mouse is hovering over), if any.

-   * 

-   * @return the highlighted date

-   */

-  public final Date getHighlightedDate() {

-    return CalendarUtil.copyDate(highlighted);

-  }

-

-  /**

-   * Returns the last shown date.

-   * 

-   * @return the last date.

-   */

-  // Final because the view should always control the value of the last date.

-  public final Date getLastDate() {

-    return view.getLastDate();

-  }

-

-  /**

-   * Gets the style associated with a date (does not include styles set via

-   * {@link #addTransientStyleToDates}).

-   * 

-   * @param date the date

-   * @return the styles associated with this date

-   */

-  public String getStyleOfDate(Date date) {

-    return styler.getStyleName(date);

-  }

-

-  /**

-   * Returns the selected date, or null if none is selected.

-   * 

-   * @return the selected date, or null

-   */

-  public final Date getValue() {

-    return CalendarUtil.copyDate(value);

-  }

-

-  /**

-   * Is the visible date enabled?

-   * 

-   * @param date the date, which must be visible

-   * @return is the date enabled?

-   */

-  public boolean isDateEnabled(Date date) {

-    assert isDateVisible(date) : date + " is not visible";

-    return getView().isDateEnabled(date);

-  }

-

-  /**

-   * Is the date currently shown in the date picker?

-   * 

-   * @param date

-   * @return is the date currently shown

-   */

-  public boolean isDateVisible(Date date) {

-    CalendarView r = getView();

-    Date first = r.getFirstDate();

-    Date last = r.getLastDate();

-    return (date != null && (CalendarUtil.isSameDate(first, date)

-        || CalendarUtil.isSameDate(last, date) || (first.before(date) && last.after(date))));

-  }

-

-  @Override

-  public void onLoad() {

-    ShowRangeEvent.fire(this, getFirstDate(), getLastDate());

-  }

-

-  /**

-   * Removes the styleName from the given dates (even if it is transient).

-   */

-  public void removeStyleFromDates(String styleName, Date date) {

-    styler.setStyleName(date, styleName, false);

-    if (isDateVisible(date)) {

-      getView().removeStyleFromDate(styleName, date);

-    }

-  }

-

-  /**

-   * Removes the styleName from the given dates (even if it is transient).

-   */

-  public void removeStyleFromDates(String styleName, Date date,

-      Date... moreDates) {

-    removeStyleFromDates(styleName, date);

-    for (Date d : moreDates) {

-      removeStyleFromDates(styleName, d);

-    }

-  }

-

-  /**

-   * Removes the styleName from the given dates (even if it is transient).

-   */

-  public void removeStyleFromDates(String styleName, Iterable<Date> dates) {

-    for (Date d : dates) {

-      removeStyleFromDates(styleName, d);

-    }

-  }

-

-  /**

-   * Sets the date picker to show the given month, use {@link #getFirstDate()}

-   * and {@link #getLastDate()} to access the exact date range the date picker

-   * chose to display.

-   * <p>

-   * A datepicker <b> may </b> show days not in the current month. It

-   * <b>must</b> show all days in the current month.

-   * </p>

-   * 

-   * @param month the month to show

-   */

-  public void setCurrentMonth(Date month) {

-    getModel().setCurrentMonth(month);

-    refreshAll();

-  }

-

-  /**

-   * Sets the date picker style name.

-   */

-  @Override

-  public void setStyleName(String styleName) {

-    css = new StandardCss(styleName, "datePicker");

-    super.setStyleName(styleName);

-  }

-

-  /**

-   * Sets a visible date to be enabled or disabled. This is only set until the

-   * next time the DatePicker is refreshed.

-   */

-  public final void setTransientEnabledOnDates(boolean enabled, Date date) {

-    assert isDateVisible(date) : date + " must be visible";

-    getView().setEnabledOnDate(enabled, date);

-  }

-

-  /**

-   * Sets a visible date to be enabled or disabled. This is only set until the

-   * next time the DatePicker is refreshed.

-   */

-  public final void setTransientEnabledOnDates(boolean enabled, Date date,

-      Date... moreDates) {

-    setTransientEnabledOnDates(enabled, date);

-    for (Date d : moreDates) {

-      setTransientEnabledOnDates(enabled, d);

-    }

-  }

-

-  /**

-   * Sets a group of visible dates to be enabled or disabled. This is only set

-   * until the next time the DatePicker is refreshed.

-   */

-  public final void setTransientEnabledOnDates(boolean enabled,

-      Iterable<Date> dates) {

-    for (Date d : dates) {

-      setTransientEnabledOnDates(enabled, d);

-    }

-  }

-

-  /**

-   * Sets the {@link DatePicker}'s value.

-   * 

-   * @param newValue the new value

-   */

-  public final void setValue(Date newValue) {

-    setValue(newValue, false);

-  }

-

-  /**

-   * Sets the {@link DatePicker}'s value.

-   * 

-   * @param newValue the new value for this date picker

-   * @param fireEvents should events be fired.

-   */

-  public final void setValue(Date newValue, boolean fireEvents) {

-    Date oldValue = value;

-

-    if (oldValue != null) {

-      removeStyleFromDates(css().dayIsValue(), oldValue);

-    }

-

-    value = CalendarUtil.copyDate(newValue);

-    if (value != null) {

-      addStyleToDates(css().dayIsValue(), value);

-    }

-    if (fireEvents) {

-      DateChangeEvent.fireIfNotEqualDates(this, oldValue, newValue);

-    }

-  }

-

-  /**

-   * Gets the {@link CalendarModel} associated with this date picker.

-   * 

-   * @return the model

-   */

-  protected final CalendarModel getModel() {

-    return model;

-  }

-

-  /**

-   * Gets the {@link MonthSelector} associated with this date picker.

-   * 

-   * @return the month selector

-   */

-  protected final MonthSelector getMonthSelector() {

-    return monthSelector;

-  }

-

-  /**

-   * Gets the {@link CalendarView} associated with this date picker.

-   * 

-   * @return the view

-   */

-  protected final CalendarView getView() {

-    return view;

-  }

-

-  /**

-   * Refreshes all components of this date picker.

-   */

-  protected final void refreshAll() {

-    highlighted = null;

-    getModel().refresh();

-

-    getView().refresh();

-    getMonthSelector().refresh();

-    if (isAttached()) {

-      ShowRangeEvent.fire(this, getFirstDate(), getLastDate());

-    }

-  }

-

-  /**

-   * Sets up the date picker.

-   */

-  protected void setup() {

-    /*

-     * Use a table (VerticalPanel) to get shrink-to-fit behavior. Divs expand to

-     * fill the available width, so we'd need to give it a size.

-     */

-    VerticalPanel panel = new VerticalPanel();

-    initWidget(panel);

-    setStyleName(panel.getElement(), css.datePicker());

-    setStyleName(css().datePicker());

-    panel.add(this.getMonthSelector());

-    panel.add(this.getView());

-  }

-

-  /**

-   * Gets the css associated with this date picker for use by extended month and

-   * cell grids.

-   * 

-   * @return the css.

-   */

-  final StandardCss css() {

-    return css;

-  }

-

-  /**

-   * Sets the highlighted date.

-   * 

-   * @param highlighted highlighted date

-   */

-  void setHighlightedDate(Date highlighted) {

-    this.highlighted = highlighted;

-    fireEvent(new DateHighlightEvent(highlighted));

-  }

-}

+/*
+ * 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.user.datepicker.client;
+
+import com.google.gwt.event.logical.shared.HasHighlightHandlers;
+import com.google.gwt.event.logical.shared.HasShowRangeHandlers;
+import com.google.gwt.event.logical.shared.HighlightEvent;
+import com.google.gwt.event.logical.shared.HighlightHandler;
+import com.google.gwt.event.logical.shared.ShowRangeEvent;
+import com.google.gwt.event.logical.shared.ShowRangeHandler;
+import com.google.gwt.event.logical.shared.ValueChangeEvent;
+import com.google.gwt.event.logical.shared.ValueChangeHandler;
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.HasValue;
+import com.google.gwt.user.client.ui.VerticalPanel;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Standard GWT date picker.
+ * 
+ * <h3>CSS Style Rules</h3>
+ * 
+ * <ul class="css">
+ * 
+ * <li>.gwt-DatePicker { }</li>
+ * 
+ * <li>.datePickerMonthSelector { the month selector widget }</li>
+ * 
+ * <li>.datePickerMonth { the month in the month selector widget } <li>
+ * 
+ * <li>.datePickerPreviousButton { the previous month button } <li>
+ * 
+ * <li>.datePickerNextButton { the next month button } <li>
+ * 
+ * <li>.datePickerDays { the portion of the picker that shows the days }</li>
+ * 
+ * <li>.datePickerWeekdayLabel { the label over weekdays }</li>
+ * 
+ * <li>.datePickerWeekendLabel { the label over weekends }</li>
+ * 
+ * <li>.datePickerDay { a single day }</li>
+ * 
+ * <li>.datePickerDayIsToday { today's date }</li>
+ * 
+ * <li>.datePickerDayIsWeekend { a weekend day }</li>
+ * 
+ * <li>.datePickerDayIsFiller { a day in another month }</li>
+ * 
+ * <li>.datePickerDayIsValue { the selected day }</li>
+ * 
+ * <li>.datePickerDayIsDisabled { a disabled day }</li>
+ * 
+ * <li>.datePickerDayIsHighlighted { the currently highlighted day }</li>
+ * 
+ * <li>.datePickerDayIsValueAndHighlighted { the highlighted day if it is also
+ * selected }</li>
+ * 
+ * </ul>
+ * 
+ * <p>
+ * <h3>Example</h3>
+ * {@example com.google.gwt.examples.DatePickerExample}
+ * </p>
+ */
+public class DatePicker extends Composite implements
+    HasHighlightHandlers<Date>, HasShowRangeHandlers<Date>, HasValue<Date> {
+
+  /**
+   * Convenience class to group css style names.
+   */
+  static class StandardCss {
+
+    static StandardCss DEFAULT = new StandardCss("gwt-DatePicker", "datePicker");
+
+    private String baseName;
+    private String widgetName;
+
+    public StandardCss(String widgetName, String baseName) {
+      this.widgetName = widgetName;
+      this.baseName = baseName;
+    }
+
+    public String datePicker() {
+      return getWidgetStyleName();
+    }
+
+    public String day() {
+      return wrap("Day");
+    }
+
+    public String day(String dayModifier) {
+      return day() + "Is" + dayModifier;
+    }
+
+    public String dayIsDisabled() {
+      return day("Disabled");
+    }
+
+    public String dayIsFiller() {
+      return day("Filler");
+    }
+
+    public String dayIsHighlighted() {
+      return day("Highlighted");
+    }
+
+    public String dayIsToday() {
+      return day("Today");
+    }
+
+    public String dayIsValue() {
+      return day("Value");
+    }
+
+    public String dayIsValueAndHighlighted() {
+      return dayIsValue() + "AndHighlighted";
+    }
+
+    public String dayIsWeekend() {
+      return day("Weekend");
+    }
+
+    public String days() {
+      return wrap("Days");
+    }
+
+    public String daysLabel() {
+      return wrap("DaysLabel");
+    }
+
+    public String getBaseStyleName() {
+      return baseName;
+    }
+
+    public String getWidgetStyleName() {
+      return widgetName;
+    }
+
+    public String month() {
+      return wrap("Month");
+    }
+
+    public String monthSelector() {
+      return wrap("MonthSelector");
+    }
+
+    public String nextButton() {
+      return wrap("NextButton");
+    }
+
+    public String previousButton() {
+      return wrap("PreviousButton");
+    }
+
+    public String weekdayLabel() {
+      return wrap("WeekdayLabel");
+    }
+
+    public String weekendLabel() {
+      return wrap("WeekendLabel");
+    }
+
+    /**
+     * Prepends the base name to the given style.
+     * 
+     * @param style style name
+     * @return style name
+     */
+    protected String wrap(String style) {
+      return baseName + style;
+    }
+  }
+
+  /**
+   * A date highlighted event that copied on read.
+   */
+  private static class DateHighlightEvent extends HighlightEvent<Date> {
+    protected DateHighlightEvent(Date highlighted) {
+      super(highlighted);
+    }
+
+    @Override
+    public Date getHighlighted() {
+      return CalendarUtil.copyDate(super.getHighlighted());
+    }
+  }
+
+  private static class DateStyler {
+    private Map<String, String> info = new HashMap<String, String>();
+
+    public String getStyleName(Date d) {
+      return info.get(genKey(d));
+    }
+
+    public void setStyleName(Date d, String styleName, boolean add) {
+      // Code is easier to maintain if surrounded by " ", and on all browsers
+      // this is a no-op.
+      styleName = " " + styleName + " ";
+      String key = genKey(d);
+      String current = info.get(key);
+
+      if (add) {
+        if (current == null) {
+          info.put(key, styleName);
+        } else if (current.indexOf(styleName) == -1) {
+          info.put(key, current + styleName);
+        }
+      } else {
+        if (current != null) {
+          String newValue = current.replaceAll(styleName, "");
+          if (newValue.trim().length() == 0) {
+            info.remove(key);
+          } else {
+            info.put(key, newValue);
+          }
+        }
+      }
+    }
+
+    @SuppressWarnings("deprecation")
+    private String genKey(Date d) {
+      return d.getYear() + "/" + d.getMonth() + "/" + d.getDate();
+    }
+  }
+
+  private final DateStyler styler = new DateStyler();
+
+  private final MonthSelector monthSelector;
+  private final CalendarView view;
+  private final CalendarModel model;
+  private Date value;
+  private Date highlighted;
+  private StandardCss css = StandardCss.DEFAULT;
+
+  /**
+   * Create a new date picker.
+   */
+  public DatePicker() {
+    this(new DefaultMonthSelector(), new DefaultCalendarView(),
+        new CalendarModel());
+  }
+
+  /**
+   * Creates a new date picker.
+   * 
+   * @param monthSelector the month selector
+   * @param view the view
+   * @param model the model
+   */
+
+  protected DatePicker(MonthSelector monthSelector, CalendarView view,
+      CalendarModel model) {
+
+    this.model = model;
+    this.monthSelector = monthSelector;
+    monthSelector.setDatePicker(this);
+    this.view = view;
+    view.setDatePicker(this);
+
+    view.setup();
+    monthSelector.setup();
+    this.setup();
+
+    setCurrentMonth(new Date());
+    addStyleToDates(css().dayIsToday(), new Date());
+  }
+
+  public HandlerRegistration addHighlightHandler(HighlightHandler<Date> handler) {
+    return addHandler(handler, HighlightEvent.getType());
+  }
+
+  public HandlerRegistration addShowRangeHandler(ShowRangeHandler<Date> handler) {
+    return addHandler(handler, ShowRangeEvent.getType());
+  }
+
+  /**
+   * Adds a show range handler and immediately activate the handler on the
+   * current view.
+   * 
+   * @param handler the handler
+   * @return the handler registration
+   */
+  public HandlerRegistration addShowRangeHandlerAndFire(
+      ShowRangeHandler<Date> handler) {
+    ShowRangeEvent<Date> event = new ShowRangeEvent<Date>(
+        getView().getFirstDate(), getView().getLastDate()) {
+    };
+    handler.onShowRange(event);
+    return addShowRangeHandler(handler);
+  }
+
+  /**
+   * Add a style name to the given dates.
+   */
+  public void addStyleToDates(String styleName, Date date) {
+    styler.setStyleName(date, styleName, true);
+    if (isDateVisible(date)) {
+      getView().addStyleToDate(styleName, date);
+    }
+  }
+
+  /**
+   * Add a style name to the given dates.
+   */
+  public void addStyleToDates(String styleName, Date date, Date... moreDates) {
+    addStyleToDates(styleName, date);
+    for (Date d : moreDates) {
+      addStyleToDates(styleName, d);
+    }
+  }
+
+  /**
+   * Add a style name to the given dates.
+   */
+  public void addStyleToDates(String styleName, Iterable<Date> dates) {
+    for (Date d : dates) {
+      addStyleToDates(styleName, d);
+    }
+  }
+
+  /**
+   * Adds the given style name to the specified dates, which must be visible.
+   * This is only set until the next time the DatePicker is refreshed.
+   */
+  public void addTransientStyleToDates(String styleName, Date date) {
+    assert isDateVisible(date) : date + " must be visible";
+    getView().addStyleToDate(styleName, date);
+  }
+
+  /**
+   * Adds the given style name to the specified dates, which must be visible.
+   * This is only set until the next time the DatePicker is refreshed.
+   */
+  public final void addTransientStyleToDates(String styleName, Date date,
+      Date... moreDates) {
+    addTransientStyleToDates(styleName, date);
+    for (Date d : moreDates) {
+      addTransientStyleToDates(styleName, d);
+    }
+  }
+
+  /**
+   * Adds the given style name to the specified dates, which must be visible.
+   * This is only set until the next time the DatePicker is refreshed.
+   */
+  public final void addTransientStyleToDates(String styleName,
+      Iterable<Date> dates) {
+    for (Date d : dates) {
+      addTransientStyleToDates(styleName, d);
+    }
+  }
+
+  public HandlerRegistration addValueChangeHandler(
+      ValueChangeHandler<Date> handler) {
+    return addHandler(handler, ValueChangeEvent.getType());
+  }
+
+  /**
+   * Gets the current month the date picker is showing.
+   * 
+   * <p>
+   * A datepicker <b> may </b> show days not in the current month. It
+   * <b>must</b> show all days in the current month.
+   * </p>
+   * 
+   * @return the current month
+   * 
+   */
+  public Date getCurrentMonth() {
+    return getModel().getCurrentMonth();
+  }
+
+  /**
+   * Returns the first shown date.
+   * 
+   * @return the first date.
+   */
+  // Final because the view should always control the value of the first date.
+  public final Date getFirstDate() {
+    return view.getFirstDate();
+  }
+
+  /**
+   * Gets the highlighted date (the one the mouse is hovering over), if any.
+   * 
+   * @return the highlighted date
+   */
+  public final Date getHighlightedDate() {
+    return CalendarUtil.copyDate(highlighted);
+  }
+
+  /**
+   * Returns the last shown date.
+   * 
+   * @return the last date.
+   */
+  // Final because the view should always control the value of the last date.
+  public final Date getLastDate() {
+    return view.getLastDate();
+  }
+
+  /**
+   * Gets the style associated with a date (does not include styles set via
+   * {@link #addTransientStyleToDates}).
+   * 
+   * @param date the date
+   * @return the styles associated with this date
+   */
+  public String getStyleOfDate(Date date) {
+    return styler.getStyleName(date);
+  }
+
+  /**
+   * Returns the selected date, or null if none is selected.
+   * 
+   * @return the selected date, or null
+   */
+  public final Date getValue() {
+    return CalendarUtil.copyDate(value);
+  }
+
+  /**
+   * Is the visible date enabled?
+   * 
+   * @param date the date, which must be visible
+   * @return is the date enabled?
+   */
+  public boolean isDateEnabled(Date date) {
+    assert isDateVisible(date) : date + " is not visible";
+    return getView().isDateEnabled(date);
+  }
+
+  /**
+   * Is the date currently shown in the date picker?
+   * 
+   * @param date
+   * @return is the date currently shown
+   */
+  public boolean isDateVisible(Date date) {
+    CalendarView r = getView();
+    Date first = r.getFirstDate();
+    Date last = r.getLastDate();
+    return (date != null && (CalendarUtil.isSameDate(first, date)
+        || CalendarUtil.isSameDate(last, date) || (first.before(date) && last.after(date))));
+  }
+
+  @Override
+  public void onLoad() {
+    ShowRangeEvent.fire(this, getFirstDate(), getLastDate());
+  }
+
+  /**
+   * Removes the styleName from the given dates (even if it is transient).
+   */
+  public void removeStyleFromDates(String styleName, Date date) {
+    styler.setStyleName(date, styleName, false);
+    if (isDateVisible(date)) {
+      getView().removeStyleFromDate(styleName, date);
+    }
+  }
+
+  /**
+   * Removes the styleName from the given dates (even if it is transient).
+   */
+  public void removeStyleFromDates(String styleName, Date date,
+      Date... moreDates) {
+    removeStyleFromDates(styleName, date);
+    for (Date d : moreDates) {
+      removeStyleFromDates(styleName, d);
+    }
+  }
+
+  /**
+   * Removes the styleName from the given dates (even if it is transient).
+   */
+  public void removeStyleFromDates(String styleName, Iterable<Date> dates) {
+    for (Date d : dates) {
+      removeStyleFromDates(styleName, d);
+    }
+  }
+
+  /**
+   * Sets the date picker to show the given month, use {@link #getFirstDate()}
+   * and {@link #getLastDate()} to access the exact date range the date picker
+   * chose to display.
+   * <p>
+   * A datepicker <b> may </b> show days not in the current month. It
+   * <b>must</b> show all days in the current month.
+   * </p>
+   * 
+   * @param month the month to show
+   */
+  public void setCurrentMonth(Date month) {
+    getModel().setCurrentMonth(month);
+    refreshAll();
+  }
+
+  /**
+   * Sets the date picker style name.
+   */
+  @Override
+  public void setStyleName(String styleName) {
+    css = new StandardCss(styleName, "datePicker");
+    super.setStyleName(styleName);
+  }
+
+  /**
+   * Sets a visible date to be enabled or disabled. This is only set until the
+   * next time the DatePicker is refreshed.
+   */
+  public final void setTransientEnabledOnDates(boolean enabled, Date date) {
+    assert isDateVisible(date) : date + " must be visible";
+    getView().setEnabledOnDate(enabled, date);
+  }
+
+  /**
+   * Sets a visible date to be enabled or disabled. This is only set until the
+   * next time the DatePicker is refreshed.
+   */
+  public final void setTransientEnabledOnDates(boolean enabled, Date date,
+      Date... moreDates) {
+    setTransientEnabledOnDates(enabled, date);
+    for (Date d : moreDates) {
+      setTransientEnabledOnDates(enabled, d);
+    }
+  }
+
+  /**
+   * Sets a group of visible dates to be enabled or disabled. This is only set
+   * until the next time the DatePicker is refreshed.
+   */
+  public final void setTransientEnabledOnDates(boolean enabled,
+      Iterable<Date> dates) {
+    for (Date d : dates) {
+      setTransientEnabledOnDates(enabled, d);
+    }
+  }
+
+  /**
+   * Sets the {@link DatePicker}'s value.
+   * 
+   * @param newValue the new value
+   */
+  public final void setValue(Date newValue) {
+    setValue(newValue, false);
+  }
+
+  /**
+   * Sets the {@link DatePicker}'s value.
+   * 
+   * @param newValue the new value for this date picker
+   * @param fireEvents should events be fired.
+   */
+  public final void setValue(Date newValue, boolean fireEvents) {
+    Date oldValue = value;
+
+    if (oldValue != null) {
+      removeStyleFromDates(css().dayIsValue(), oldValue);
+    }
+
+    value = CalendarUtil.copyDate(newValue);
+    if (value != null) {
+      addStyleToDates(css().dayIsValue(), value);
+    }
+    if (fireEvents) {
+      DateChangeEvent.fireIfNotEqualDates(this, oldValue, newValue);
+    }
+  }
+
+  /**
+   * Gets the {@link CalendarModel} associated with this date picker.
+   * 
+   * @return the model
+   */
+  protected final CalendarModel getModel() {
+    return model;
+  }
+
+  /**
+   * Gets the {@link MonthSelector} associated with this date picker.
+   * 
+   * @return the month selector
+   */
+  protected final MonthSelector getMonthSelector() {
+    return monthSelector;
+  }
+
+  /**
+   * Gets the {@link CalendarView} associated with this date picker.
+   * 
+   * @return the view
+   */
+  protected final CalendarView getView() {
+    return view;
+  }
+
+  /**
+   * Refreshes all components of this date picker.
+   */
+  protected final void refreshAll() {
+    highlighted = null;
+    getModel().refresh();
+
+    getView().refresh();
+    getMonthSelector().refresh();
+    if (isAttached()) {
+      ShowRangeEvent.fire(this, getFirstDate(), getLastDate());
+    }
+  }
+
+  /**
+   * Sets up the date picker.
+   */
+  protected void setup() {
+    /*
+     * Use a table (VerticalPanel) to get shrink-to-fit behavior. Divs expand to
+     * fill the available width, so we'd need to give it a size.
+     */
+    VerticalPanel panel = new VerticalPanel();
+    initWidget(panel);
+    setStyleName(panel.getElement(), css.datePicker());
+    setStyleName(css().datePicker());
+    panel.add(this.getMonthSelector());
+    panel.add(this.getView());
+  }
+
+  /**
+   * Gets the css associated with this date picker for use by extended month and
+   * cell grids.
+   * 
+   * @return the css.
+   */
+  final StandardCss css() {
+    return css;
+  }
+
+  /**
+   * Sets the highlighted date.
+   * 
+   * @param highlighted highlighted date
+   */
+  void setHighlightedDate(Date highlighted) {
+    this.highlighted = highlighted;
+    fireEvent(new DateHighlightEvent(highlighted));
+  }
+}
diff --git a/user/src/com/google/gwt/user/datepicker/client/DatePickerComponent.java b/user/src/com/google/gwt/user/datepicker/client/DatePickerComponent.java
index 6250316..c42e1ef 100644
--- a/user/src/com/google/gwt/user/datepicker/client/DatePickerComponent.java
+++ b/user/src/com/google/gwt/user/datepicker/client/DatePickerComponent.java
@@ -1,69 +1,69 @@
-/*

- * 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.user.datepicker.client;

-

-import com.google.gwt.user.client.ui.Composite;

-

-/**

- * Package protected class used to combine functionality for the

- * {@link MonthSelector} and {@link CalendarView} components.

- * 

- */

-abstract class DatePickerComponent extends Composite {

-  private DatePicker datePicker;

-

-  public CalendarModel getModel() {

-    return datePicker.getModel();

-  }

-

-  protected void addMonths(int numMonths) {

-    getModel().shiftCurrentMonth(numMonths);

-    getDatePicker().refreshAll();

-  }

-

-  protected DatePicker getDatePicker() {

-    return datePicker;

-  }

-

-  /**

-   * Refresh the component. Usually called because the model's current date has

-   * changed. In general, only should be called by {@link DatePicker}. Use

-   * refreshAll() if you need to refresh all components.

-   */

-  protected abstract void refresh();

-

-  /**

-   * Refreshes the {@link DatePicker}, {@link CalendarView}, and

-   * {@link CalendarModel}.

-   */

-  protected void refreshAll() {

-    getDatePicker().refreshAll();

-  }

-

-  /**

-   * Set up the component.

-   */

-  protected abstract void setup();

-

-  DatePicker.StandardCss css() {

-    return datePicker.css();

-  }

-

-  void setDatePicker(DatePicker me) {

-    this.datePicker = me;

-  }

-}

+/*
+ * 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.user.datepicker.client;
+
+import com.google.gwt.user.client.ui.Composite;
+
+/**
+ * Package protected class used to combine functionality for the
+ * {@link MonthSelector} and {@link CalendarView} components.
+ * 
+ */
+abstract class DatePickerComponent extends Composite {
+  private DatePicker datePicker;
+
+  public CalendarModel getModel() {
+    return datePicker.getModel();
+  }
+
+  protected void addMonths(int numMonths) {
+    getModel().shiftCurrentMonth(numMonths);
+    getDatePicker().refreshAll();
+  }
+
+  protected DatePicker getDatePicker() {
+    return datePicker;
+  }
+
+  /**
+   * Refresh the component. Usually called because the model's current date has
+   * changed. In general, only should be called by {@link DatePicker}. Use
+   * refreshAll() if you need to refresh all components.
+   */
+  protected abstract void refresh();
+
+  /**
+   * Refreshes the {@link DatePicker}, {@link CalendarView}, and
+   * {@link CalendarModel}.
+   */
+  protected void refreshAll() {
+    getDatePicker().refreshAll();
+  }
+
+  /**
+   * Set up the component.
+   */
+  protected abstract void setup();
+
+  DatePicker.StandardCss css() {
+    return datePicker.css();
+  }
+
+  void setDatePicker(DatePicker me) {
+    this.datePicker = me;
+  }
+}
diff --git a/user/src/com/google/gwt/user/datepicker/client/DefaultMonthSelector.java b/user/src/com/google/gwt/user/datepicker/client/DefaultMonthSelector.java
index 611b354..388707f 100644
--- a/user/src/com/google/gwt/user/datepicker/client/DefaultMonthSelector.java
+++ b/user/src/com/google/gwt/user/datepicker/client/DefaultMonthSelector.java
@@ -1,84 +1,84 @@
-/*

- * 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.user.datepicker.client;

-

-import com.google.gwt.event.dom.client.ClickEvent;

-import com.google.gwt.event.dom.client.ClickHandler;

-import com.google.gwt.user.client.ui.Grid;

-import com.google.gwt.user.client.ui.PushButton;

-import com.google.gwt.user.client.ui.HTMLTable.CellFormatter;

-

-/**

- * A simple {@link MonthSelector} used for the default date picker. Not

- * extensible as we wish to evolve it freely over time.

- */

-

-public final class DefaultMonthSelector extends MonthSelector {

-

-  private PushButton backwards;

-  private PushButton forwards;

-  private Grid grid;

-

-  /**

-   * Constructor.

-   */

-  public DefaultMonthSelector() {

-  }

- 

-  @Override

-  protected void refresh() {

-    String formattedMonth = getModel().formatCurrentMonth();

-    grid.setText(0, 1, formattedMonth);

-  }

-

-  @Override

-  protected void setup() {

-    // Set up backwards.

-    backwards = new PushButton();

-    backwards.addClickHandler(new ClickHandler() {

-      public void onClick(ClickEvent event) {

-        addMonths(-1);

-      }

-    });

-

-    backwards.getUpFace().setHTML("&laquo;");

-    backwards.setStyleName(css().previousButton());

-

-    forwards = new PushButton();

-    forwards.getUpFace().setHTML("&raquo;");

-    forwards.setStyleName(css().nextButton());

-    forwards.addClickHandler(new ClickHandler() {

-      public void onClick(ClickEvent event) {

-        addMonths(+1);

-      }

-    });

-

-    // Set up grid.

-    grid = new Grid(1, 3);

-    grid.setWidget(0, 0, backwards);

-    grid.setWidget(0, 2, forwards);

-

-    CellFormatter formatter = grid.getCellFormatter();

-    formatter.setStyleName(0, 1, css().month());

-    formatter.setWidth(0, 0, "1");

-    formatter.setWidth(0, 1, "100%");

-    formatter.setWidth(0, 2, "1");

-    grid.setStyleName(css().monthSelector());

-    initWidget(grid);

-  }

-

-}

+/*
+ * 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.user.datepicker.client;
+
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.user.client.ui.Grid;
+import com.google.gwt.user.client.ui.PushButton;
+import com.google.gwt.user.client.ui.HTMLTable.CellFormatter;
+
+/**
+ * A simple {@link MonthSelector} used for the default date picker. Not
+ * extensible as we wish to evolve it freely over time.
+ */
+
+public final class DefaultMonthSelector extends MonthSelector {
+
+  private PushButton backwards;
+  private PushButton forwards;
+  private Grid grid;
+
+  /**
+   * Constructor.
+   */
+  public DefaultMonthSelector() {
+  }
+ 
+  @Override
+  protected void refresh() {
+    String formattedMonth = getModel().formatCurrentMonth();
+    grid.setText(0, 1, formattedMonth);
+  }
+
+  @Override
+  protected void setup() {
+    // Set up backwards.
+    backwards = new PushButton();
+    backwards.addClickHandler(new ClickHandler() {
+      public void onClick(ClickEvent event) {
+        addMonths(-1);
+      }
+    });
+
+    backwards.getUpFace().setHTML("&laquo;");
+    backwards.setStyleName(css().previousButton());
+
+    forwards = new PushButton();
+    forwards.getUpFace().setHTML("&raquo;");
+    forwards.setStyleName(css().nextButton());
+    forwards.addClickHandler(new ClickHandler() {
+      public void onClick(ClickEvent event) {
+        addMonths(+1);
+      }
+    });
+
+    // Set up grid.
+    grid = new Grid(1, 3);
+    grid.setWidget(0, 0, backwards);
+    grid.setWidget(0, 2, forwards);
+
+    CellFormatter formatter = grid.getCellFormatter();
+    formatter.setStyleName(0, 1, css().month());
+    formatter.setWidth(0, 0, "1");
+    formatter.setWidth(0, 1, "100%");
+    formatter.setWidth(0, 2, "1");
+    grid.setStyleName(css().monthSelector());
+    initWidget(grid);
+  }
+
+}
diff --git a/user/src/com/google/gwt/user/datepicker/client/MonthSelector.java b/user/src/com/google/gwt/user/datepicker/client/MonthSelector.java
index 25e3dc7..43b4b15 100644
--- a/user/src/com/google/gwt/user/datepicker/client/MonthSelector.java
+++ b/user/src/com/google/gwt/user/datepicker/client/MonthSelector.java
@@ -1,22 +1,22 @@
-/*

- * 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.user.datepicker.client;

-

-/**

- * Abstract month selector widget.

- */

-public abstract class MonthSelector extends DatePickerComponent {

+/*
+ * 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.user.datepicker.client;
+
+/**
+ * Abstract month selector widget.
+ */
+public abstract class MonthSelector extends DatePickerComponent {
 }
\ No newline at end of file
diff --git a/user/src/com/google/gwt/user/rebind/rpc/ProblemReport.java b/user/src/com/google/gwt/user/rebind/rpc/ProblemReport.java
index 63b77a7..d8a82f4 100644
--- a/user/src/com/google/gwt/user/rebind/rpc/ProblemReport.java
+++ b/user/src/com/google/gwt/user/rebind/rpc/ProblemReport.java
@@ -1,269 +1,269 @@
-/*

- * 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.user.rebind.rpc;

-

-import com.google.gwt.core.ext.TreeLogger;

-import com.google.gwt.core.ext.TreeLogger.Type;

-import com.google.gwt.core.ext.typeinfo.JClassType;

-

-import java.util.ArrayList;

-import java.util.Comparator;

-import java.util.List;

-import java.util.Map;

-import java.util.TreeMap;

-

-/**

- * A collection of reported problems; these are accumulated during the

- * SerializableTypeOracleBuilder's isSerializable analysis, and what to do about

- * the problems is decided only later.

- */

-public class ProblemReport {

-

-  /**

-   * Priority of problems.  {@link #FATAL}  problems will fail a build that

-   * would otherwise have succeeded, for example because of a bad custom

-   * serializer used only as a subclass of a superclass with other viable

-   * subtypes.  {@link #DEFAULT} problems might or might not be fatal,

-   * depending on overall results accumulated later.  {@link #AUXILIARY}

-   * problems are not fatal, and often not even problems by themselves, but

-   * diagnostics related to default problems (e.g. type filtration, which

-   * might suppress an intended-to-serialize class).

-   */

-  public enum Priority { FATAL, DEFAULT, AUXILIARY}

-

-  /**

-   * An individual report, which may require multiple entries (expressed as

-   * logs under a branchpoint), but relates to an individual issue.

-   */

-  public static class Problem {

-    private String message;

-    private List<String> childMessages;

-

-    private Problem(String message, String[] children) {

-      this.message = message;

-      // most problems don't have sub-messages, so init at zero size

-      childMessages = new ArrayList<String>(children.length);

-      for (int i = 0; i < children.length; i++) {

-        childMessages.add(children[i]);

-      }

-    }

-

-    public void addChild(String message) {

-      childMessages.add(message);

-    }

-

-    public String getPrimaryMessage() {

-      return message;

-    }

-

-    public Iterable<String> getSubMessages() {

-      return childMessages;

-    }

-

-    public boolean hasSubMessages() {

-      return !childMessages.isEmpty();

-    }

-  }

-

-  private Map<JClassType, List<Problem>> allProblems;

-  private Map<JClassType, List<Problem>> auxiliaries;

-  private Map<JClassType, List<Problem>> fatalProblems;

-  private JClassType contextType;

-

-  /**

-   * Creates a new, empty, context-less ProblemReport.

-   */

-  public ProblemReport() {

-    Comparator<JClassType> comparator = new Comparator<JClassType>() {

-        public int compare(JClassType o1, JClassType o2) {

-          assert o1 != null;

-          assert o2 != null;

-          return o1.getParameterizedQualifiedSourceName().compareTo(

-              o2.getParameterizedQualifiedSourceName());

-        }

-      };

-    allProblems = new TreeMap<JClassType, List<Problem>>(comparator);

-    auxiliaries = new TreeMap<JClassType, List<Problem>>(comparator);

-    fatalProblems = new TreeMap<JClassType, List<Problem>>(comparator);

-    contextType = null;

-  }

-

-  /**

-   * Adds a problem for a given type.  This also sorts the problems into

-   * collections by priority.

-   *

-   * @param type the problematic type

-   * @param message the description of the problem

-   * @param priority priority of the problem.

-   * @param extraLines additional continuation lines for the message, usually

-   *    for additional explanations.

-   */

-  public Problem add(JClassType type, String message, Priority priority, 

-      String... extraLines) {

-    String contextString = "";

-    if (contextType != null) {

-      contextString = " (reached via " +

-          contextType.getParameterizedQualifiedSourceName() + ")";

-    }

-    message = message + contextString;

-    Problem entry = new Problem(message, extraLines);

-    if (priority == Priority.AUXILIARY) {

-      addToMap(type, entry, auxiliaries);

-      return entry;

-    }

-

-    // both FATAL and DEFAULT problems go in allProblems...

-    addToMap(type, entry, allProblems);

-

-    // only FATAL problems go in fatalProblems...

-    if (priority == Priority.FATAL) {

-      addToMap(type, entry, fatalProblems);

-    }

-    return entry;

-  }

-

-  public String getWorstMessageForType(JClassType type) {

-    List<Problem> list = fatalProblems.get(type);

-    if (list == null) {

-      list = allProblems.get(type);

-      if (list == null) {

-        list = auxiliaries.get(type);

-      }

-    }

-    if (list == null) {

-      return null;

-    }

-    return list.get(0).getPrimaryMessage() + (list.size() > 1 ? ", etc." : "");

-  }

-

-  /**

-   * Were any problems reported as "fatal"?

-   */

-  public boolean hasFatalProblems() {

-    return !fatalProblems.isEmpty();

-  }

-

-  /**

-   * Reports all problems to the logger supplied, at the log level supplied.

-   * The problems are assured of being reported in lexographic order of

-   * type names.

-   *

-   * @param logger logger to receive problem reports

-   * @param problemLevel severity level at which to report problems.

-   * @param auxLevel severity level at which to report any auxiliary messages.

-   */

-  public void report(TreeLogger logger, TreeLogger.Type problemLevel,

-      TreeLogger.Type auxLevel) {

-    doReport(logger, auxLevel, auxiliaries);

-    doReport(logger, problemLevel, allProblems);

-  }

-

-  /**

-   * Reports only urgent problems to the logger supplied, at the log level

-   * supplied.  The problems are assured of being reported in lexographic

-   * order of type names.

-   *

-   * @param logger logger to receive problem reports

-   * @param level severity level at which to report problems.

-   */

-  public void reportFatalProblems(TreeLogger logger, TreeLogger.Type level) {

-    doReport(logger, level, fatalProblems);

-  }

-

-  /**

-   * Sets the context type currently being analyzed.  Problems found will

-   * include reference to this context, until reset with another call to this

-   * method.  Context may be cancelled with a {@code null} value here.

-   *

-   * @param newContext the type under analysis

-   */

-  public void setContextType(JClassType newContext) {

-    contextType = newContext;

-  }

-

-  /**

-   * Test accessor returning list of auxiliary "problems" logged against a

-   * given type.

-   *

-   * @param type type to fetch problems for

-   * @return {@code null} if no auxiliaries were logged.  Otherwise, a list

-   *   of strings describing messages, including the context in which the

-   *   problem was found.

-   */

-  List<Problem> getAuxiliaryMessagesForType(JClassType type) {

-    List<Problem> list = auxiliaries.get(type);

-    if (list == null) {

-      list = new ArrayList<Problem>(0);

-    }

-    return list;

-  }

-

-  /**

-   * Test accessor returning list of problems logged against a given type.

-   *

-   * @param type type to fetch problems for

-   * @return {@code null} if no problems were logged.  Otherwise, a list

-   *   of strings describing problems, including the context in which the

-   *   problem was found.

-   */

-  List<Problem> getProblemsForType(JClassType type) {

-    List<Problem> list = allProblems.get(type);

-    if (list == null) {

-      list = new ArrayList<Problem>(0);

-    }

-    return list;

-  }

-

-  /**

-   * Adds an entry to one of the problem maps.

-   *

-   * @param type the type to add

-   * @param message the message to add for {@code type}

-   * @param map the map to add to

-   */

-  private void addToMap(JClassType type, Problem problem,

-      Map<JClassType, List<Problem>> map) {

-    List<Problem> list = map.get(type);

-    if (list == null) {

-      list = new ArrayList<Problem>();

-      map.put(type, list);

-    }

-    list.add(problem);

-  }

-

-  /**

-   * Logs all of the problems from one of the problem maps.

-   *

-   * @param logger the logger to log to

-   * @param level the level for messages

-   * @param problems the problems to log

-   */

-  private void doReport(TreeLogger logger, Type level,

-      Map<JClassType, List<Problem>> problems) {

-    for (List<Problem> problemList : problems.values()) {

-      for (Problem problem : problemList) {

-        if (problem.hasSubMessages()) {

-          TreeLogger sublogger = logger.branch(level, problem.getPrimaryMessage());

-          for (String sub : problem.getSubMessages()) {

-            sublogger.log(level, sub);

-          }

-        } else {

-          logger.log(level, problem.getPrimaryMessage());

-        }

-      }

-    }

-  }

-}

+/*
+ * 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.user.rebind.rpc;
+
+import com.google.gwt.core.ext.TreeLogger;
+import com.google.gwt.core.ext.TreeLogger.Type;
+import com.google.gwt.core.ext.typeinfo.JClassType;
+
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+
+/**
+ * A collection of reported problems; these are accumulated during the
+ * SerializableTypeOracleBuilder's isSerializable analysis, and what to do about
+ * the problems is decided only later.
+ */
+public class ProblemReport {
+
+  /**
+   * Priority of problems.  {@link #FATAL}  problems will fail a build that
+   * would otherwise have succeeded, for example because of a bad custom
+   * serializer used only as a subclass of a superclass with other viable
+   * subtypes.  {@link #DEFAULT} problems might or might not be fatal,
+   * depending on overall results accumulated later.  {@link #AUXILIARY}
+   * problems are not fatal, and often not even problems by themselves, but
+   * diagnostics related to default problems (e.g. type filtration, which
+   * might suppress an intended-to-serialize class).
+   */
+  public enum Priority { FATAL, DEFAULT, AUXILIARY}
+
+  /**
+   * An individual report, which may require multiple entries (expressed as
+   * logs under a branchpoint), but relates to an individual issue.
+   */
+  public static class Problem {
+    private String message;
+    private List<String> childMessages;
+
+    private Problem(String message, String[] children) {
+      this.message = message;
+      // most problems don't have sub-messages, so init at zero size
+      childMessages = new ArrayList<String>(children.length);
+      for (int i = 0; i < children.length; i++) {
+        childMessages.add(children[i]);
+      }
+    }
+
+    public void addChild(String message) {
+      childMessages.add(message);
+    }
+
+    public String getPrimaryMessage() {
+      return message;
+    }
+
+    public Iterable<String> getSubMessages() {
+      return childMessages;
+    }
+
+    public boolean hasSubMessages() {
+      return !childMessages.isEmpty();
+    }
+  }
+
+  private Map<JClassType, List<Problem>> allProblems;
+  private Map<JClassType, List<Problem>> auxiliaries;
+  private Map<JClassType, List<Problem>> fatalProblems;
+  private JClassType contextType;
+
+  /**
+   * Creates a new, empty, context-less ProblemReport.
+   */
+  public ProblemReport() {
+    Comparator<JClassType> comparator = new Comparator<JClassType>() {
+        public int compare(JClassType o1, JClassType o2) {
+          assert o1 != null;
+          assert o2 != null;
+          return o1.getParameterizedQualifiedSourceName().compareTo(
+              o2.getParameterizedQualifiedSourceName());
+        }
+      };
+    allProblems = new TreeMap<JClassType, List<Problem>>(comparator);
+    auxiliaries = new TreeMap<JClassType, List<Problem>>(comparator);
+    fatalProblems = new TreeMap<JClassType, List<Problem>>(comparator);
+    contextType = null;
+  }
+
+  /**
+   * Adds a problem for a given type.  This also sorts the problems into
+   * collections by priority.
+   *
+   * @param type the problematic type
+   * @param message the description of the problem
+   * @param priority priority of the problem.
+   * @param extraLines additional continuation lines for the message, usually
+   *    for additional explanations.
+   */
+  public Problem add(JClassType type, String message, Priority priority, 
+      String... extraLines) {
+    String contextString = "";
+    if (contextType != null) {
+      contextString = " (reached via " +
+          contextType.getParameterizedQualifiedSourceName() + ")";
+    }
+    message = message + contextString;
+    Problem entry = new Problem(message, extraLines);
+    if (priority == Priority.AUXILIARY) {
+      addToMap(type, entry, auxiliaries);
+      return entry;
+    }
+
+    // both FATAL and DEFAULT problems go in allProblems...
+    addToMap(type, entry, allProblems);
+
+    // only FATAL problems go in fatalProblems...
+    if (priority == Priority.FATAL) {
+      addToMap(type, entry, fatalProblems);
+    }
+    return entry;
+  }
+
+  public String getWorstMessageForType(JClassType type) {
+    List<Problem> list = fatalProblems.get(type);
+    if (list == null) {
+      list = allProblems.get(type);
+      if (list == null) {
+        list = auxiliaries.get(type);
+      }
+    }
+    if (list == null) {
+      return null;
+    }
+    return list.get(0).getPrimaryMessage() + (list.size() > 1 ? ", etc." : "");
+  }
+
+  /**
+   * Were any problems reported as "fatal"?
+   */
+  public boolean hasFatalProblems() {
+    return !fatalProblems.isEmpty();
+  }
+
+  /**
+   * Reports all problems to the logger supplied, at the log level supplied.
+   * The problems are assured of being reported in lexographic order of
+   * type names.
+   *
+   * @param logger logger to receive problem reports
+   * @param problemLevel severity level at which to report problems.
+   * @param auxLevel severity level at which to report any auxiliary messages.
+   */
+  public void report(TreeLogger logger, TreeLogger.Type problemLevel,
+      TreeLogger.Type auxLevel) {
+    doReport(logger, auxLevel, auxiliaries);
+    doReport(logger, problemLevel, allProblems);
+  }
+
+  /**
+   * Reports only urgent problems to the logger supplied, at the log level
+   * supplied.  The problems are assured of being reported in lexographic
+   * order of type names.
+   *
+   * @param logger logger to receive problem reports
+   * @param level severity level at which to report problems.
+   */
+  public void reportFatalProblems(TreeLogger logger, TreeLogger.Type level) {
+    doReport(logger, level, fatalProblems);
+  }
+
+  /**
+   * Sets the context type currently being analyzed.  Problems found will
+   * include reference to this context, until reset with another call to this
+   * method.  Context may be cancelled with a {@code null} value here.
+   *
+   * @param newContext the type under analysis
+   */
+  public void setContextType(JClassType newContext) {
+    contextType = newContext;
+  }
+
+  /**
+   * Test accessor returning list of auxiliary "problems" logged against a
+   * given type.
+   *
+   * @param type type to fetch problems for
+   * @return {@code null} if no auxiliaries were logged.  Otherwise, a list
+   *   of strings describing messages, including the context in which the
+   *   problem was found.
+   */
+  List<Problem> getAuxiliaryMessagesForType(JClassType type) {
+    List<Problem> list = auxiliaries.get(type);
+    if (list == null) {
+      list = new ArrayList<Problem>(0);
+    }
+    return list;
+  }
+
+  /**
+   * Test accessor returning list of problems logged against a given type.
+   *
+   * @param type type to fetch problems for
+   * @return {@code null} if no problems were logged.  Otherwise, a list
+   *   of strings describing problems, including the context in which the
+   *   problem was found.
+   */
+  List<Problem> getProblemsForType(JClassType type) {
+    List<Problem> list = allProblems.get(type);
+    if (list == null) {
+      list = new ArrayList<Problem>(0);
+    }
+    return list;
+  }
+
+  /**
+   * Adds an entry to one of the problem maps.
+   *
+   * @param type the type to add
+   * @param message the message to add for {@code type}
+   * @param map the map to add to
+   */
+  private void addToMap(JClassType type, Problem problem,
+      Map<JClassType, List<Problem>> map) {
+    List<Problem> list = map.get(type);
+    if (list == null) {
+      list = new ArrayList<Problem>();
+      map.put(type, list);
+    }
+    list.add(problem);
+  }
+
+  /**
+   * Logs all of the problems from one of the problem maps.
+   *
+   * @param logger the logger to log to
+   * @param level the level for messages
+   * @param problems the problems to log
+   */
+  private void doReport(TreeLogger logger, Type level,
+      Map<JClassType, List<Problem>> problems) {
+    for (List<Problem> problemList : problems.values()) {
+      for (Problem problem : problemList) {
+        if (problem.hasSubMessages()) {
+          TreeLogger sublogger = logger.branch(level, problem.getPrimaryMessage());
+          for (String sub : problem.getSubMessages()) {
+            sublogger.log(level, sub);
+          }
+        } else {
+          logger.log(level, problem.getPrimaryMessage());
+        }
+      }
+    }
+  }
+}
diff --git a/user/test/com/google/gwt/emultest/java/util/LinkedHashMapTest.java b/user/test/com/google/gwt/emultest/java/util/LinkedHashMapTest.java
index 3ba7ca6..332e6b2 100644
--- a/user/test/com/google/gwt/emultest/java/util/LinkedHashMapTest.java
+++ b/user/test/com/google/gwt/emultest/java/util/LinkedHashMapTest.java
@@ -1,780 +1,780 @@
-/*

- * 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.emultest.java.util;

-

-import com.google.gwt.core.client.GWT;

-

-import org.apache.commons.collections.TestMap;

-

-import java.util.Collection;

-import java.util.Iterator;

-import java.util.Map;

-import java.util.Set;

-import java.util.Map.Entry;

-import java.util.LinkedHashMap;

-

-/**

- * Tests <code>LinkedHashMap</code>.

- */

-public class LinkedHashMapTest extends TestMap {

-  // should be a method-level class, however to avoid serialization warning made

-  // static instead.

-  static class TestRemoveEldestMap<K, V> extends LinkedHashMap<K, V> {

-

-    public K expectedKey;

-    public boolean removeEldest;

-

-    public TestRemoveEldestMap() {

-      this(false);

-    }

-

-    public TestRemoveEldestMap(boolean accessOrder) {

-      super(1, .5f, accessOrder);

-    }

-

-    @Override

-    public boolean removeEldestEntry(Map.Entry<K, V> entry) {

-      if (removeEldest) {

-        assertEquals(expectedKey, entry.getKey());

-        return true;

-      } else {

-        return false;

-      }

-    }

-  }

-

-  private static final int CAPACITY_16 = 16;

-  private static final int CAPACITY_NEG_ONE_HALF = -1;

-  private static final int CAPACITY_ZERO = 0;

-  private static final Integer INTEGER_1 = new Integer(1);

-  private static final Integer INTEGER_11 = new Integer(11);

-  private static final Integer INTEGER_2 = new Integer(2);

-  private static final Integer INTEGER_22 = new Integer(22);

-  private static final Integer INTEGER_3 = new Integer(3);

-  private static final Integer INTEGER_33 = new Integer(33);

-  private static final Integer INTEGER_ZERO_KEY = new Integer(0);

-  private static final String INTEGER_ZERO_VALUE = "integer zero";

-  private static final String KEY_1 = "key1";

-  private static final String KEY_2 = "key2";

-  private static final String KEY_3 = "key3";

-  private static final String KEY_4 = "key4";

-  private static final String KEY_KEY = "key";

-  private static final String KEY_TEST_CONTAINS_KEY = "testContainsKey";

-  private static final String KEY_TEST_CONTAINS_VALUE = "testContainsValue";

-  private static final String KEY_TEST_ENTRY_SET = "testEntrySet";

-  private static final String KEY_TEST_GET = "testGet";

-  private static final String KEY_TEST_KEY_SET = "testKeySet";

-  private static final String KEY_TEST_PUT = "testPut";

-  private static final String KEY_TEST_REMOVE = "testRemove";

-  private static final float LOAD_FACTOR_NEG_ONE = -1.0F;

-  private static final float LOAD_FACTOR_ONE_HALF = 0.5F;

-  private static final float LOAD_FACTOR_ONE_TENTH = 0.1F;

-  private static final float LOAD_FACTOR_ZERO = 0.0F;

-  private static final Object ODD_ZERO_KEY = new Object() {

-    @Override

-    public int hashCode() {

-      return 0;

-    }

-  };

-  private static final String ODD_ZERO_VALUE = "odd zero";

-  private static final int SIZE_ONE = 1;

-  private static final int SIZE_THREE = 3;

-  private static final int SIZE_TWO = 2;

-  private static final int SIZE_ZERO = 0;

-  private static final String STRING_ZERO_KEY = "0";

-  private static final String STRING_ZERO_VALUE = "string zero";

-  private static final String VALUE_1 = "val1";

-  private static final String VALUE_2 = "val2";

-  private static final String VALUE_3 = "val3";

-  private static final String VALUE_4 = "val4";

-  private static final String VALUE_TEST_CONTAINS_DOES_NOT_EXIST = "does not exist";

-  private static final Integer VALUE_TEST_CONTAINS_KEY = new Integer(5);

-  private static final String VALUE_TEST_ENTRY_SET_1 = KEY_TEST_ENTRY_SET

-      + " - value1";

-  private static final String VALUE_TEST_ENTRY_SET_2 = KEY_TEST_ENTRY_SET

-      + " - value2";

-  private static final String VALUE_TEST_GET = KEY_TEST_GET + " - Value";

-  private static final String VALUE_TEST_KEY_SET = KEY_TEST_KEY_SET

-      + " - value";

-  private static final String VALUE_TEST_PUT_1 = KEY_TEST_PUT + " - value 1";

-  private static final String VALUE_TEST_PUT_2 = KEY_TEST_PUT + " - value 2";

-  private static final String VALUE_TEST_REMOVE = KEY_TEST_REMOVE + " - value";

-  private static final String VALUE_VAL = "value";

-

-  /**

-   * Check the state of a newly constructed, empty LinkedHashMap.

-   * 

-   * @param hashMap

-   */

-  @SuppressWarnings("unchecked") // raw LinkedHashMap

-  private static void checkEmptyLinkedHashMapAssumptions(LinkedHashMap hashMap) {

-    assertNotNull(hashMap);

-    assertTrue(hashMap.isEmpty());

-

-    assertNotNull(hashMap.values());

-    assertTrue(hashMap.values().isEmpty());

-    assertTrue(hashMap.values().size() == 0);

-

-    assertNotNull(hashMap.keySet());

-    assertTrue(hashMap.keySet().isEmpty());

-    assertTrue(hashMap.keySet().size() == 0);

-

-    assertNotNull(hashMap.entrySet());

-    assertTrue(hashMap.entrySet().isEmpty());

-    assertTrue(hashMap.entrySet().size() == 0);

-

-    assertNotNull(hashMap.entrySet().iterator());

-    assertFalse(hashMap.entrySet().iterator().hasNext());

-  }

-

-  @Override

-  public String getModuleName() {

-    return "com.google.gwt.emultest.EmulSuite";

-  }

-

-  public void testAddEqualKeys() {

-    final LinkedHashMap<Number, Object> expected = new LinkedHashMap<Number, Object>();

-    assertEquals(expected.size(), 0);

-    iterateThrough(expected);

-    expected.put(new Long(45), new Object());

-    assertEquals(expected.size(), 1);

-    iterateThrough(expected);

-    expected.put(new Integer(45), new Object());

-    assertNotSame(new Integer(45), new Long(45));

-    assertEquals(expected.size(), 2);

-    iterateThrough(expected);

-  }

-

-  public void testAddWatch() {

-    LinkedHashMap<String, String> m = new LinkedHashMap<String, String>();

-    m.put("watch", "watch");

-    assertEquals(m.get("watch"), "watch");

-  }

-

-  /*

-   * Test method for 'java.util.LinkedHashMap.clear()'

-   */

-  public void testClear() {

-    LinkedHashMap<String, String> hashMap = new LinkedHashMap<String, String>();

-    checkEmptyLinkedHashMapAssumptions(hashMap);

-

-    hashMap.put("Hello", "Bye");

-    assertFalse(hashMap.isEmpty());

-    assertTrue(hashMap.size() == SIZE_ONE);

-

-    hashMap.clear();

-    assertTrue(hashMap.isEmpty());

-    assertTrue(hashMap.size() == 0);

-  }

-

-  /*

-   * Test method for 'java.util.LinkedHashMap.clone()'

-   */

-  // public void donttestClone() {

-  // LinkedHashMap srcMap = new LinkedHashMap();

-  // checkEmptyLinkedHashMapAssumptions(srcMap);

-  //

-  // // Check empty clone behavior

-  // LinkedHashMap dstMap = (LinkedHashMap) srcMap.clone();

-  // assertNotNull(dstMap);

-  // assertEquals(dstMap.size(), srcMap.size());

-  // // assertTrue(dstMap.values().toArray().equals(srcMap.values().toArray()));

-  // assertTrue(dstMap.keySet().equals(srcMap.keySet()));

-  // assertTrue(dstMap.entrySet().equals(srcMap.entrySet()));

-  //

-  // // Check non-empty clone behavior

-  // srcMap.put(KEY_1, VALUE_1);

-  // srcMap.put(KEY_2, VALUE_2);

-  // srcMap.put(KEY_3, VALUE_3);

-  // dstMap = (LinkedHashMap) srcMap.clone();

-  // assertNotNull(dstMap);

-  // assertEquals(dstMap.size(), srcMap.size());

-  //

-  // assertTrue(dstMap.keySet().equals(srcMap.keySet()));

-  //

-  // assertTrue(dstMap.entrySet().equals(srcMap.entrySet()));

-  // }

-  /*

-   * Test method for 'java.util.LinkedHashMap.containsKey(Object)'

-   */

-  public void testContainsKey() {

-    LinkedHashMap<String, Integer> hashMap = new LinkedHashMap<String, Integer>();

-    checkEmptyLinkedHashMapAssumptions(hashMap);

-

-    assertFalse(hashMap.containsKey(KEY_TEST_CONTAINS_KEY));

-    hashMap.put(KEY_TEST_CONTAINS_KEY, VALUE_TEST_CONTAINS_KEY);

-    assertTrue(hashMap.containsKey(KEY_TEST_CONTAINS_KEY));

-    assertFalse(hashMap.containsKey(VALUE_TEST_CONTAINS_DOES_NOT_EXIST));

-

-    assertFalse(hashMap.containsKey(null));

-    hashMap.put(null, VALUE_TEST_CONTAINS_KEY);

-    assertTrue(hashMap.containsKey(null));

-  }

-

-  /*

-   * Test method for 'java.util.LinkedHashMap.containsValue(Object)'

-   */

-  public void testContainsValue() {

-    LinkedHashMap<String, Integer> hashMap = new LinkedHashMap<String, Integer>();

-    checkEmptyLinkedHashMapAssumptions(hashMap);

-

-    assertFalse("check contains of empty map",

-        hashMap.containsValue(VALUE_TEST_CONTAINS_KEY));

-    hashMap.put(KEY_TEST_CONTAINS_VALUE, VALUE_TEST_CONTAINS_KEY);

-    assertTrue("check contains of map with element",

-        hashMap.containsValue(VALUE_TEST_CONTAINS_KEY));

-    assertFalse("check contains of map other element",

-        hashMap.containsValue(VALUE_TEST_CONTAINS_DOES_NOT_EXIST));

-

-    assertFalse(hashMap.containsValue(null));

-    hashMap.put(KEY_TEST_CONTAINS_VALUE, null);

-    assertTrue(hashMap.containsValue(null));

-  }

-

-  /*

-   * Test method for 'java.util.LinkedHashMap.entrySet()'

-   */

-  public void testEntrySet() {

-    LinkedHashMap<String, String> hashMap = new LinkedHashMap<String, String>();

-    checkEmptyLinkedHashMapAssumptions(hashMap);

-

-    Set<Entry<String, String>> entrySet = hashMap.entrySet();

-    assertNotNull(entrySet);

-

-    // Check that the entry set looks right

-    hashMap.put(KEY_TEST_ENTRY_SET, VALUE_TEST_ENTRY_SET_1);

-    entrySet = hashMap.entrySet();

-    assertEquals(entrySet.size(), SIZE_ONE);

-    Iterator<Entry<String, String>> itSet = entrySet.iterator();

-    Map.Entry<String, String> entry = itSet.next();

-    assertEquals(entry.getKey(), KEY_TEST_ENTRY_SET);

-    assertEquals(entry.getValue(), VALUE_TEST_ENTRY_SET_1);

-

-    // Check that entries in the entrySet are update correctly on overwrites

-    hashMap.put(KEY_TEST_ENTRY_SET, VALUE_TEST_ENTRY_SET_2);

-    entrySet = hashMap.entrySet();

-    assertEquals(entrySet.size(), SIZE_ONE);

-    itSet = entrySet.iterator();

-    entry = itSet.next();

-    assertEquals(entry.getKey(), KEY_TEST_ENTRY_SET);

-    assertEquals(entry.getValue(), VALUE_TEST_ENTRY_SET_2);

-

-    // Check that entries are updated on removes

-    hashMap.remove(KEY_TEST_ENTRY_SET);

-    checkEmptyLinkedHashMapAssumptions(hashMap);

-  }

-

-  /*

-   * Used to test the entrySet remove method.

-   */

-  public void testEntrySetRemove() {

-    LinkedHashMap<String, String> hashMap = new LinkedHashMap<String, String>();

-    hashMap.put("A", "B");

-    LinkedHashMap<String, String> dummy = new LinkedHashMap<String, String>();

-    dummy.put("A", "b");

-    Entry<String, String> bogus = dummy.entrySet().iterator().next();

-    Set<Entry<String, String>> entrySet = hashMap.entrySet();

-    boolean removed = entrySet.remove(bogus);

-    assertEquals(removed, false);

-    assertEquals(hashMap.get("A"), "B");

-  }

-

-  /*

-   * Test method for 'java.util.AbstractMap.equals(Object)'

-   */

-  // public void testEquals() {

-  // LinkedHashMap hashMap = new LinkedHashMap();

-  // checkEmptyLinkedHashMapAssumptions(hashMap);

-  //

-  // hashMap.put(KEY_KEY, VALUE_VAL);

-  //

-  // LinkedHashMap copyMap = (LinkedHashMap) hashMap.clone();

-  //

-  // assertTrue(hashMap.equals(copyMap));

-  // hashMap.put(VALUE_VAL, KEY_KEY);

-  // assertFalse(hashMap.equals(copyMap));

-  // }

-  /*

-   * Test method for 'java.lang.Object.finalize()'.

-   */

-  public void testFinalize() {

-    // no tests for finalize

-  }

-

-  /*

-   * Test method for 'java.util.LinkedHashMap.get(Object)'.

-   */

-  public void testGet() {

-    LinkedHashMap<String, String> hashMap = new LinkedHashMap<String, String>();

-    checkEmptyLinkedHashMapAssumptions(hashMap);

-

-    assertNull(hashMap.get(KEY_TEST_GET));

-    hashMap.put(KEY_TEST_GET, VALUE_TEST_GET);

-    assertNotNull(hashMap.get(KEY_TEST_GET));

-

-    assertNull(hashMap.get(null));

-    hashMap.put(null, VALUE_TEST_GET);

-    assertNotNull(hashMap.get(null));

-

-    hashMap.put(null, null);

-    assertNull(hashMap.get(null));

-  }

-

-  /*

-   * Test method for 'java.util.AbstractMap.hashCode()'.

-   */

-  public void testHashCode() {

-    LinkedHashMap<String, String> hashMap = new LinkedHashMap<String, String>();

-    checkEmptyLinkedHashMapAssumptions(hashMap);

-

-    // Check that hashCode changes

-    int hashCode1 = hashMap.hashCode();

-    hashMap.put(KEY_KEY, VALUE_VAL);

-    int hashCode2 = hashMap.hashCode();

-

-    assertTrue(hashCode1 != hashCode2);

-  }

-

-  /*

-   * Test method for 'java.util.AbstractMap.isEmpty()'

-   */

-  public void testIsEmpty() {

-    LinkedHashMap<String, String> srcMap = new LinkedHashMap<String, String>();

-    checkEmptyLinkedHashMapAssumptions(srcMap);

-

-    LinkedHashMap<String, String> dstMap = new LinkedHashMap<String, String>();

-    checkEmptyLinkedHashMapAssumptions(dstMap);

-

-    dstMap.putAll(srcMap);

-    assertTrue(dstMap.isEmpty());

-

-    dstMap.put(KEY_KEY, VALUE_VAL);

-    assertFalse(dstMap.isEmpty());

-

-    dstMap.remove(KEY_KEY);

-    assertTrue(dstMap.isEmpty());

-    assertEquals(dstMap.size(), 0);

-  }

-

-  public void testKeysConflict() {

-    LinkedHashMap<Object, String> hashMap = new LinkedHashMap<Object, String>();

-

-    hashMap.put(STRING_ZERO_KEY, STRING_ZERO_VALUE);

-    hashMap.put(INTEGER_ZERO_KEY, INTEGER_ZERO_VALUE);

-    hashMap.put(ODD_ZERO_KEY, ODD_ZERO_VALUE);

-    assertEquals(hashMap.get(INTEGER_ZERO_KEY), INTEGER_ZERO_VALUE);

-    assertEquals(hashMap.get(ODD_ZERO_KEY), ODD_ZERO_VALUE);

-    assertEquals(hashMap.get(STRING_ZERO_KEY), STRING_ZERO_VALUE);

-    hashMap.remove(INTEGER_ZERO_KEY);

-    assertEquals(hashMap.get(ODD_ZERO_KEY), ODD_ZERO_VALUE);

-    assertEquals(hashMap.get(STRING_ZERO_KEY), STRING_ZERO_VALUE);

-    assertEquals(hashMap.get(INTEGER_ZERO_KEY), null);

-    hashMap.remove(ODD_ZERO_KEY);

-    assertEquals(hashMap.get(INTEGER_ZERO_KEY), null);

-    assertEquals(hashMap.get(ODD_ZERO_KEY), null);

-    assertEquals(hashMap.get(STRING_ZERO_KEY), STRING_ZERO_VALUE);

-    hashMap.remove(STRING_ZERO_KEY);

-    assertEquals(hashMap.get(INTEGER_ZERO_KEY), null);

-    assertEquals(hashMap.get(ODD_ZERO_KEY), null);

-    assertEquals(hashMap.get(STRING_ZERO_KEY), null);

-    assertEquals(hashMap.size(), 0);

-  }

-

-  /*

-   * Test method for 'java.util.LinkedHashMap.keySet()'

-   */

-  public void testKeySet() {

-    LinkedHashMap<String, String> hashMap = new LinkedHashMap<String, String>();

-    checkEmptyLinkedHashMapAssumptions(hashMap);

-

-    Set<String> keySet = hashMap.keySet();

-    assertNotNull(keySet);

-    assertTrue(keySet.isEmpty());

-    assertTrue(keySet.size() == 0);

-

-    hashMap.put(KEY_TEST_KEY_SET, VALUE_TEST_KEY_SET);

-    assertEquals(SIZE_ONE, keySet.size());

-    assertTrue(keySet.contains(KEY_TEST_KEY_SET));

-    assertFalse(keySet.contains(VALUE_TEST_KEY_SET));

-    assertFalse(keySet.contains(KEY_TEST_KEY_SET.toUpperCase()));

-  }

-

-  /*

-   * Test method for 'java.util.LinkedHashMap.LinkedHashMap()'.

-   */

-  public void testLinkedHashMap() {

-    LinkedHashMap<String, String> hashMap = new LinkedHashMap<String, String>();

-    checkEmptyLinkedHashMapAssumptions(hashMap);

-  }

-

-  /*

-   * Test method for 'java.util.LinkedHashMap.LinkedHashMap(int)'

-   */

-  public void testLinkedHashMapInt() {

-    LinkedHashMap<String, String> hashMap = new LinkedHashMap<String, String>(CAPACITY_16);

-    checkEmptyLinkedHashMapAssumptions(hashMap);

-

-    // TODO(mmendez): how do we verify capacity?

-    boolean failed = true;

-    try {

-      new LinkedHashMap<String, String>(-SIZE_ONE);

-    } catch (Throwable ex) {

-      if (ex instanceof IllegalArgumentException) {

-        failed = false;

-      }

-    }

-

-    if (failed) {

-      fail("Failure testing new LinkedHashMap(-1)");

-    }

-

-    LinkedHashMap<String, String> zeroSizedLinkedHashMap = new LinkedHashMap<String, String>(0);

-    assertNotNull(zeroSizedLinkedHashMap);

-  }

-

-  /*

-   * Test method for 'java.util.LinkedHashMap.LinkedHashMap(int, float)'

-   */

-  public void testLinkedHashMapIntFloat() {

-

-    LinkedHashMap<String, String> hashMap = new LinkedHashMap<String, String>(CAPACITY_16,

-        LOAD_FACTOR_ONE_HALF);

-    checkEmptyLinkedHashMapAssumptions(hashMap);

-

-    // TODO(mmendez): how do we verify capacity and load factor?

-

-    // Test new LinkedHashMap(-1, 0.0F)

-    boolean failed = true;

-    try {

-      new LinkedHashMap<String, String>(CAPACITY_NEG_ONE_HALF, LOAD_FACTOR_ZERO);

-    } catch (Throwable ex) {

-      if (ex instanceof IllegalArgumentException) {

-        failed = false;

-      }

-    }

-

-    if (failed) {

-      fail("Failure testing new LinkedHashMap(-1, 0.0F)");

-    }

-

-    // Test new LinkedHashMap(0, -1.0F)

-    failed = true;

-    try {

-      new LinkedHashMap<String, String>(CAPACITY_ZERO, LOAD_FACTOR_NEG_ONE);

-    } catch (Throwable ex) {

-      if (ex instanceof IllegalArgumentException) {

-        failed = false;

-      }

-    }

-

-    if (failed) {

-      fail("Failure testing new LinkedHashMap(0, -1.0F)");

-    }

-

-    // Test new LinkedHashMap(0,0F);

-    hashMap = new LinkedHashMap<String, String>(CAPACITY_ZERO, LOAD_FACTOR_ONE_TENTH);

-    assertNotNull(hashMap);

-  }

-

-  /*

-   * Test method for 'java.util.LinkedHashMap.LinkedHashMap(Map)'

-   */

-  public void testLinkedHashMapMap() {

-    LinkedHashMap<Integer, Integer> srcMap = new LinkedHashMap<Integer, Integer>();

-    assertNotNull(srcMap);

-    checkEmptyLinkedHashMapAssumptions(srcMap);

-

-    srcMap.put(INTEGER_1, INTEGER_11);

-    srcMap.put(INTEGER_2, INTEGER_22);

-    srcMap.put(INTEGER_3, INTEGER_33);

-

-    LinkedHashMap<Integer, Integer> hashMap = cloneLinkedHashMap(srcMap);

-    assertFalse(hashMap.isEmpty());

-    assertTrue(hashMap.size() == SIZE_THREE);

-

-    Collection<Integer> valColl = hashMap.values();

-    assertTrue(valColl.contains(INTEGER_11));

-    assertTrue(valColl.contains(INTEGER_22));

-    assertTrue(valColl.contains(INTEGER_33));

-

-    Collection<Integer> keyColl = hashMap.keySet();

-    assertTrue(keyColl.contains(INTEGER_1));

-    assertTrue(keyColl.contains(INTEGER_2));

-    assertTrue(keyColl.contains(INTEGER_3));

-  }

-

-  public void testLRU() {

-    LinkedHashMap<String, String> m = new LinkedHashMap<String, String>(10,

-        .5f, true);

-    m.put("A", "A");

-    m.put("B", "B");

-    m.put("C", "C");

-    m.put("D", "D");

-    Iterator<Entry<String, String>> entry = m.entrySet().iterator();

-    assertEquals("A", entry.next().getValue());

-    assertEquals("B", entry.next().getValue());

-    assertEquals("C", entry.next().getValue());

-    assertEquals("D", entry.next().getValue());

-    m.get("B");

-    m.get("D");

-    entry = m.entrySet().iterator();

-    assertEquals("A", entry.next().getValue());

-    assertEquals("C", entry.next().getValue());

-    assertEquals("B", entry.next().getValue());

-    assertEquals("D", entry.next().getValue());

-  }

-

-  /*

-   * Test method for 'java.util.LinkedHashMap.put(Object, Object)'

-   */

-  public void testPut() {

-    LinkedHashMap<String, String> hashMap = new LinkedHashMap<String, String>();

-    checkEmptyLinkedHashMapAssumptions(hashMap);

-

-    assertNull(hashMap.put(KEY_TEST_PUT, VALUE_TEST_PUT_1));

-    assertEquals(hashMap.put(KEY_TEST_PUT, VALUE_TEST_PUT_2), VALUE_TEST_PUT_1);

-    assertNull(hashMap.put(null, VALUE_TEST_PUT_1));

-    assertEquals(hashMap.put(null, VALUE_TEST_PUT_2), VALUE_TEST_PUT_1);

-  }

-

-  /**

-   * Test method for 'java.util.LinkedHashMap.putAll(Map)'.

-   */

-  public void testPutAll() {

-    LinkedHashMap<String, String> srcMap = new LinkedHashMap<String, String>();

-    checkEmptyLinkedHashMapAssumptions(srcMap);

-

-    srcMap.put(KEY_1, VALUE_1);

-    srcMap.put(KEY_2, VALUE_2);

-    srcMap.put(KEY_3, VALUE_3);

-

-    // Make sure that the data is copied correctly

-    LinkedHashMap<String, String> dstMap = new LinkedHashMap<String, String>();

-    checkEmptyLinkedHashMapAssumptions(dstMap);

-

-    dstMap.putAll(srcMap);

-    assertEquals(srcMap.size(), dstMap.size());

-    assertTrue(dstMap.containsKey(KEY_1));

-    assertTrue(dstMap.containsValue(VALUE_1));

-    assertFalse(dstMap.containsKey(KEY_1.toUpperCase()));

-    assertFalse(dstMap.containsValue(VALUE_1.toUpperCase()));

-

-    assertTrue(dstMap.containsKey(KEY_2));

-    assertTrue(dstMap.containsValue(VALUE_2));

-    assertFalse(dstMap.containsKey(KEY_2.toUpperCase()));

-    assertFalse(dstMap.containsValue(VALUE_2.toUpperCase()));

-

-    assertTrue(dstMap.containsKey(KEY_3));

-    assertTrue(dstMap.containsValue(VALUE_3));

-    assertFalse(dstMap.containsKey(KEY_3.toUpperCase()));

-    assertFalse(dstMap.containsValue(VALUE_3.toUpperCase()));

-

-    // Check that an empty map does not blow away the contents of the

-    // destination map

-    LinkedHashMap<String, String> emptyMap = new LinkedHashMap<String, String>();

-    checkEmptyLinkedHashMapAssumptions(emptyMap);

-    dstMap.putAll(emptyMap);

-    assertTrue(dstMap.size() == srcMap.size());

-

-    // Check that put all overwrite any existing mapping in the destination map

-    srcMap.put(KEY_1, VALUE_2);

-    srcMap.put(KEY_2, VALUE_3);

-    srcMap.put(KEY_3, VALUE_1);

-

-    dstMap.putAll(srcMap);

-    assertEquals(dstMap.size(), srcMap.size());

-    assertEquals(dstMap.get(KEY_1), VALUE_2);

-    assertEquals(dstMap.get(KEY_2), VALUE_3);

-    assertEquals(dstMap.get(KEY_3), VALUE_1);

-

-    // Check that a putAll does adds data but does not remove it

-

-    srcMap.put(KEY_4, VALUE_4);

-    dstMap.putAll(srcMap);

-    assertEquals(dstMap.size(), srcMap.size());

-    assertTrue(dstMap.containsKey(KEY_4));

-    assertTrue(dstMap.containsValue(VALUE_4));

-    assertEquals(dstMap.get(KEY_1), VALUE_2);

-    assertEquals(dstMap.get(KEY_2), VALUE_3);

-    assertEquals(dstMap.get(KEY_3), VALUE_1);

-    assertEquals(dstMap.get(KEY_4), VALUE_4);

-

-    dstMap.putAll(dstMap);

-  }

-

-  /**

-   * Test method for 'java.util.LinkedHashMap.remove(Object)'.

-   */

-  public void testRemove() {

-    LinkedHashMap<String, String> hashMap = new LinkedHashMap<String, String>();

-    checkEmptyLinkedHashMapAssumptions(hashMap);

-

-    assertNull(hashMap.remove(null));

-    hashMap.put(null, VALUE_TEST_REMOVE);

-    assertNotNull(hashMap.remove(null));

-

-    hashMap.put(KEY_TEST_REMOVE, VALUE_TEST_REMOVE);

-    assertEquals(hashMap.remove(KEY_TEST_REMOVE), VALUE_TEST_REMOVE);

-    assertNull(hashMap.remove(KEY_TEST_REMOVE));

-  }

-

-  public void testRemoveEldest() {

-    TestRemoveEldestMap<String, String> m = new TestRemoveEldestMap<String, String>(false);

-    m.put("A", "A");

-    m.put("B", "B");

-    m.put("C", "C");

-    m.put("D", "D");

-    m.get("B");

-    m.get("D");

-    m.removeEldest = true;

-    m.expectedKey = "A";

-    m.put("E", "E");

-    m.put("B", "New-B");

-    Iterator<Map.Entry<String, String>> entries = m.entrySet().iterator();

-    Map.Entry<String, String> first = entries.next();

-    assertEquals("B", first.getKey());

-    assertEquals("New-B", first.getValue());

-    assertEquals(4, m.size());

-  }

-

-  public void testRemoveEldestMapLRU() {

-    TestRemoveEldestMap<String, String> m = new TestRemoveEldestMap<String, String>(true);

-    m.put("A", "A");

-    m.put("B", "B");

-    m.put("C", "C");

-    m.put("D", "D");

-    m.get("A");

-    m.get("D");

-    m.removeEldest = true;

-    m.expectedKey = "B";

-    m.put("E", "E");

-

-    m.put("C", "New-C");

-    Iterator<Map.Entry<String, String>> entries = m.entrySet().iterator();

-    Map.Entry<String, String> first = entries.next();

-    assertEquals("A", first.getKey());

-    assertEquals("D", entries.next().getKey());

-    assertEquals("E", entries.next().getKey());

-    assertEquals("New-C", entries.next().getValue());

-  }

-

-  /**

-   * Test method for 'java.util.LinkedHashMap.size()'.

-   */

-  public void testSize() {

-    LinkedHashMap<String, String> hashMap = new LinkedHashMap<String, String>();

-    checkEmptyLinkedHashMapAssumptions(hashMap);

-

-    // Test size behavior on put

-    assertEquals(hashMap.size(), SIZE_ZERO);

-    hashMap.put(KEY_1, VALUE_1);

-    assertEquals(hashMap.size(), SIZE_ONE);

-    hashMap.put(KEY_2, VALUE_2);

-    assertEquals(hashMap.size(), SIZE_TWO);

-    hashMap.put(KEY_3, VALUE_3);

-    assertEquals(hashMap.size(), SIZE_THREE);

-

-    // Test size behavior on remove

-    hashMap.remove(KEY_1);

-    assertEquals(hashMap.size(), SIZE_TWO);

-    hashMap.remove(KEY_2);

-    assertEquals(hashMap.size(), SIZE_ONE);

-    hashMap.remove(KEY_3);

-    assertEquals(hashMap.size(), SIZE_ZERO);

-

-    // Test size behavior on putAll

-    hashMap.put(KEY_1, VALUE_1);

-    hashMap.put(KEY_2, VALUE_2);

-    hashMap.put(KEY_3, VALUE_3);

-    LinkedHashMap<String, String> srcMap = cloneLinkedHashMap(hashMap);

-    hashMap.putAll(srcMap);

-    assertEquals(hashMap.size(), SIZE_THREE);

-

-    // Test size behavior on clear

-    hashMap.clear();

-    assertEquals(hashMap.size(), SIZE_ZERO);

-  }

-

-  /**

-   * Test method for 'java.util.AbstractMap.toString()'.

-   */

-  public void testToString() {

-    LinkedHashMap<String, String> hashMap = new LinkedHashMap<String, String>();

-    checkEmptyLinkedHashMapAssumptions(hashMap);

-    hashMap.put(KEY_KEY, VALUE_VAL);

-    String entryString = makeEntryString(KEY_KEY, VALUE_VAL);

-    assertTrue(entryString.equals(hashMap.toString()));

-  }

-

-  /**

-   * Test method for 'java.util.AbstractMap.values()'.

-   */

-  public void testValues() {

-    LinkedHashMap<String, String> hashMap = new LinkedHashMap<String, String>();

-    checkEmptyLinkedHashMapAssumptions(hashMap);

-

-    assertNotNull(hashMap.values());

-

-    hashMap.put(KEY_KEY, VALUE_VAL);

-

-    Collection<String> valColl = hashMap.values();

-    assertNotNull(valColl);

-    assertEquals(valColl.size(), SIZE_ONE);

-

-    Iterator<String> itVal = valColl.iterator();

-    String val = itVal.next();

-    assertEquals(val, VALUE_VAL);

-  }

-

-  @SuppressWarnings("unchecked") // raw Map/LinkedHashMap

-  @Override

-  protected Map makeEmptyMap() {

-    return new LinkedHashMap();

-  }

-

-  /**

-   * This method exists because java 1.5 no longer has

-   * LinkedHashMap(LinkedHashMap), replacing it with LinkedHashMap(Map<?

-   * extends K, ? extends V> m). Nevertheless, we want to use it in web mode to

-   * test that web mode function.

-   * 

-   * @param hashMap the LinkedHashMap to be copied

-   * @return the copy

-   */

-  @SuppressWarnings("unchecked") // raw LinkedHashMap

-  private LinkedHashMap cloneLinkedHashMap(LinkedHashMap hashMap) {

-    if (GWT.isScript()) {

-      return new LinkedHashMap(hashMap);

-    } else {

-      LinkedHashMap m = new LinkedHashMap();

-      m.putAll(hashMap);

-      return m;

-    }

-  }

-

-  private Iterator<Map.Entry<Number, Object>> iterateThrough(

-      final LinkedHashMap<Number, Object> expected) {

-    Iterator<Map.Entry<Number, Object>> iter = expected.entrySet().iterator();

-    for (int i = 0; i < expected.size(); i++) {

-      iter.next();

-    }

-    return iter;

-  }

-

-  private String makeEntryString(final String key, final String value) {

-    return "{" + key + "=" + value + "}";

-  }

-}

+/*
+ * 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.emultest.java.util;
+
+import com.google.gwt.core.client.GWT;
+
+import org.apache.commons.collections.TestMap;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.Map.Entry;
+import java.util.LinkedHashMap;
+
+/**
+ * Tests <code>LinkedHashMap</code>.
+ */
+public class LinkedHashMapTest extends TestMap {
+  // should be a method-level class, however to avoid serialization warning made
+  // static instead.
+  static class TestRemoveEldestMap<K, V> extends LinkedHashMap<K, V> {
+
+    public K expectedKey;
+    public boolean removeEldest;
+
+    public TestRemoveEldestMap() {
+      this(false);
+    }
+
+    public TestRemoveEldestMap(boolean accessOrder) {
+      super(1, .5f, accessOrder);
+    }
+
+    @Override
+    public boolean removeEldestEntry(Map.Entry<K, V> entry) {
+      if (removeEldest) {
+        assertEquals(expectedKey, entry.getKey());
+        return true;
+      } else {
+        return false;
+      }
+    }
+  }
+
+  private static final int CAPACITY_16 = 16;
+  private static final int CAPACITY_NEG_ONE_HALF = -1;
+  private static final int CAPACITY_ZERO = 0;
+  private static final Integer INTEGER_1 = new Integer(1);
+  private static final Integer INTEGER_11 = new Integer(11);
+  private static final Integer INTEGER_2 = new Integer(2);
+  private static final Integer INTEGER_22 = new Integer(22);
+  private static final Integer INTEGER_3 = new Integer(3);
+  private static final Integer INTEGER_33 = new Integer(33);
+  private static final Integer INTEGER_ZERO_KEY = new Integer(0);
+  private static final String INTEGER_ZERO_VALUE = "integer zero";
+  private static final String KEY_1 = "key1";
+  private static final String KEY_2 = "key2";
+  private static final String KEY_3 = "key3";
+  private static final String KEY_4 = "key4";
+  private static final String KEY_KEY = "key";
+  private static final String KEY_TEST_CONTAINS_KEY = "testContainsKey";
+  private static final String KEY_TEST_CONTAINS_VALUE = "testContainsValue";
+  private static final String KEY_TEST_ENTRY_SET = "testEntrySet";
+  private static final String KEY_TEST_GET = "testGet";
+  private static final String KEY_TEST_KEY_SET = "testKeySet";
+  private static final String KEY_TEST_PUT = "testPut";
+  private static final String KEY_TEST_REMOVE = "testRemove";
+  private static final float LOAD_FACTOR_NEG_ONE = -1.0F;
+  private static final float LOAD_FACTOR_ONE_HALF = 0.5F;
+  private static final float LOAD_FACTOR_ONE_TENTH = 0.1F;
+  private static final float LOAD_FACTOR_ZERO = 0.0F;
+  private static final Object ODD_ZERO_KEY = new Object() {
+    @Override
+    public int hashCode() {
+      return 0;
+    }
+  };
+  private static final String ODD_ZERO_VALUE = "odd zero";
+  private static final int SIZE_ONE = 1;
+  private static final int SIZE_THREE = 3;
+  private static final int SIZE_TWO = 2;
+  private static final int SIZE_ZERO = 0;
+  private static final String STRING_ZERO_KEY = "0";
+  private static final String STRING_ZERO_VALUE = "string zero";
+  private static final String VALUE_1 = "val1";
+  private static final String VALUE_2 = "val2";
+  private static final String VALUE_3 = "val3";
+  private static final String VALUE_4 = "val4";
+  private static final String VALUE_TEST_CONTAINS_DOES_NOT_EXIST = "does not exist";
+  private static final Integer VALUE_TEST_CONTAINS_KEY = new Integer(5);
+  private static final String VALUE_TEST_ENTRY_SET_1 = KEY_TEST_ENTRY_SET
+      + " - value1";
+  private static final String VALUE_TEST_ENTRY_SET_2 = KEY_TEST_ENTRY_SET
+      + " - value2";
+  private static final String VALUE_TEST_GET = KEY_TEST_GET + " - Value";
+  private static final String VALUE_TEST_KEY_SET = KEY_TEST_KEY_SET
+      + " - value";
+  private static final String VALUE_TEST_PUT_1 = KEY_TEST_PUT + " - value 1";
+  private static final String VALUE_TEST_PUT_2 = KEY_TEST_PUT + " - value 2";
+  private static final String VALUE_TEST_REMOVE = KEY_TEST_REMOVE + " - value";
+  private static final String VALUE_VAL = "value";
+
+  /**
+   * Check the state of a newly constructed, empty LinkedHashMap.
+   * 
+   * @param hashMap
+   */
+  @SuppressWarnings("unchecked") // raw LinkedHashMap
+  private static void checkEmptyLinkedHashMapAssumptions(LinkedHashMap hashMap) {
+    assertNotNull(hashMap);
+    assertTrue(hashMap.isEmpty());
+
+    assertNotNull(hashMap.values());
+    assertTrue(hashMap.values().isEmpty());
+    assertTrue(hashMap.values().size() == 0);
+
+    assertNotNull(hashMap.keySet());
+    assertTrue(hashMap.keySet().isEmpty());
+    assertTrue(hashMap.keySet().size() == 0);
+
+    assertNotNull(hashMap.entrySet());
+    assertTrue(hashMap.entrySet().isEmpty());
+    assertTrue(hashMap.entrySet().size() == 0);
+
+    assertNotNull(hashMap.entrySet().iterator());
+    assertFalse(hashMap.entrySet().iterator().hasNext());
+  }
+
+  @Override
+  public String getModuleName() {
+    return "com.google.gwt.emultest.EmulSuite";
+  }
+
+  public void testAddEqualKeys() {
+    final LinkedHashMap<Number, Object> expected = new LinkedHashMap<Number, Object>();
+    assertEquals(expected.size(), 0);
+    iterateThrough(expected);
+    expected.put(new Long(45), new Object());
+    assertEquals(expected.size(), 1);
+    iterateThrough(expected);
+    expected.put(new Integer(45), new Object());
+    assertNotSame(new Integer(45), new Long(45));
+    assertEquals(expected.size(), 2);
+    iterateThrough(expected);
+  }
+
+  public void testAddWatch() {
+    LinkedHashMap<String, String> m = new LinkedHashMap<String, String>();
+    m.put("watch", "watch");
+    assertEquals(m.get("watch"), "watch");
+  }
+
+  /*
+   * Test method for 'java.util.LinkedHashMap.clear()'
+   */
+  public void testClear() {
+    LinkedHashMap<String, String> hashMap = new LinkedHashMap<String, String>();
+    checkEmptyLinkedHashMapAssumptions(hashMap);
+
+    hashMap.put("Hello", "Bye");
+    assertFalse(hashMap.isEmpty());
+    assertTrue(hashMap.size() == SIZE_ONE);
+
+    hashMap.clear();
+    assertTrue(hashMap.isEmpty());
+    assertTrue(hashMap.size() == 0);
+  }
+
+  /*
+   * Test method for 'java.util.LinkedHashMap.clone()'
+   */
+  // public void donttestClone() {
+  // LinkedHashMap srcMap = new LinkedHashMap();
+  // checkEmptyLinkedHashMapAssumptions(srcMap);
+  //
+  // // Check empty clone behavior
+  // LinkedHashMap dstMap = (LinkedHashMap) srcMap.clone();
+  // assertNotNull(dstMap);
+  // assertEquals(dstMap.size(), srcMap.size());
+  // // assertTrue(dstMap.values().toArray().equals(srcMap.values().toArray()));
+  // assertTrue(dstMap.keySet().equals(srcMap.keySet()));
+  // assertTrue(dstMap.entrySet().equals(srcMap.entrySet()));
+  //
+  // // Check non-empty clone behavior
+  // srcMap.put(KEY_1, VALUE_1);
+  // srcMap.put(KEY_2, VALUE_2);
+  // srcMap.put(KEY_3, VALUE_3);
+  // dstMap = (LinkedHashMap) srcMap.clone();
+  // assertNotNull(dstMap);
+  // assertEquals(dstMap.size(), srcMap.size());
+  //
+  // assertTrue(dstMap.keySet().equals(srcMap.keySet()));
+  //
+  // assertTrue(dstMap.entrySet().equals(srcMap.entrySet()));
+  // }
+  /*
+   * Test method for 'java.util.LinkedHashMap.containsKey(Object)'
+   */
+  public void testContainsKey() {
+    LinkedHashMap<String, Integer> hashMap = new LinkedHashMap<String, Integer>();
+    checkEmptyLinkedHashMapAssumptions(hashMap);
+
+    assertFalse(hashMap.containsKey(KEY_TEST_CONTAINS_KEY));
+    hashMap.put(KEY_TEST_CONTAINS_KEY, VALUE_TEST_CONTAINS_KEY);
+    assertTrue(hashMap.containsKey(KEY_TEST_CONTAINS_KEY));
+    assertFalse(hashMap.containsKey(VALUE_TEST_CONTAINS_DOES_NOT_EXIST));
+
+    assertFalse(hashMap.containsKey(null));
+    hashMap.put(null, VALUE_TEST_CONTAINS_KEY);
+    assertTrue(hashMap.containsKey(null));
+  }
+
+  /*
+   * Test method for 'java.util.LinkedHashMap.containsValue(Object)'
+   */
+  public void testContainsValue() {
+    LinkedHashMap<String, Integer> hashMap = new LinkedHashMap<String, Integer>();
+    checkEmptyLinkedHashMapAssumptions(hashMap);
+
+    assertFalse("check contains of empty map",
+        hashMap.containsValue(VALUE_TEST_CONTAINS_KEY));
+    hashMap.put(KEY_TEST_CONTAINS_VALUE, VALUE_TEST_CONTAINS_KEY);
+    assertTrue("check contains of map with element",
+        hashMap.containsValue(VALUE_TEST_CONTAINS_KEY));
+    assertFalse("check contains of map other element",
+        hashMap.containsValue(VALUE_TEST_CONTAINS_DOES_NOT_EXIST));
+
+    assertFalse(hashMap.containsValue(null));
+    hashMap.put(KEY_TEST_CONTAINS_VALUE, null);
+    assertTrue(hashMap.containsValue(null));
+  }
+
+  /*
+   * Test method for 'java.util.LinkedHashMap.entrySet()'
+   */
+  public void testEntrySet() {
+    LinkedHashMap<String, String> hashMap = new LinkedHashMap<String, String>();
+    checkEmptyLinkedHashMapAssumptions(hashMap);
+
+    Set<Entry<String, String>> entrySet = hashMap.entrySet();
+    assertNotNull(entrySet);
+
+    // Check that the entry set looks right
+    hashMap.put(KEY_TEST_ENTRY_SET, VALUE_TEST_ENTRY_SET_1);
+    entrySet = hashMap.entrySet();
+    assertEquals(entrySet.size(), SIZE_ONE);
+    Iterator<Entry<String, String>> itSet = entrySet.iterator();
+    Map.Entry<String, String> entry = itSet.next();
+    assertEquals(entry.getKey(), KEY_TEST_ENTRY_SET);
+    assertEquals(entry.getValue(), VALUE_TEST_ENTRY_SET_1);
+
+    // Check that entries in the entrySet are update correctly on overwrites
+    hashMap.put(KEY_TEST_ENTRY_SET, VALUE_TEST_ENTRY_SET_2);
+    entrySet = hashMap.entrySet();
+    assertEquals(entrySet.size(), SIZE_ONE);
+    itSet = entrySet.iterator();
+    entry = itSet.next();
+    assertEquals(entry.getKey(), KEY_TEST_ENTRY_SET);
+    assertEquals(entry.getValue(), VALUE_TEST_ENTRY_SET_2);
+
+    // Check that entries are updated on removes
+    hashMap.remove(KEY_TEST_ENTRY_SET);
+    checkEmptyLinkedHashMapAssumptions(hashMap);
+  }
+
+  /*
+   * Used to test the entrySet remove method.
+   */
+  public void testEntrySetRemove() {
+    LinkedHashMap<String, String> hashMap = new LinkedHashMap<String, String>();
+    hashMap.put("A", "B");
+    LinkedHashMap<String, String> dummy = new LinkedHashMap<String, String>();
+    dummy.put("A", "b");
+    Entry<String, String> bogus = dummy.entrySet().iterator().next();
+    Set<Entry<String, String>> entrySet = hashMap.entrySet();
+    boolean removed = entrySet.remove(bogus);
+    assertEquals(removed, false);
+    assertEquals(hashMap.get("A"), "B");
+  }
+
+  /*
+   * Test method for 'java.util.AbstractMap.equals(Object)'
+   */
+  // public void testEquals() {
+  // LinkedHashMap hashMap = new LinkedHashMap();
+  // checkEmptyLinkedHashMapAssumptions(hashMap);
+  //
+  // hashMap.put(KEY_KEY, VALUE_VAL);
+  //
+  // LinkedHashMap copyMap = (LinkedHashMap) hashMap.clone();
+  //
+  // assertTrue(hashMap.equals(copyMap));
+  // hashMap.put(VALUE_VAL, KEY_KEY);
+  // assertFalse(hashMap.equals(copyMap));
+  // }
+  /*
+   * Test method for 'java.lang.Object.finalize()'.
+   */
+  public void testFinalize() {
+    // no tests for finalize
+  }
+
+  /*
+   * Test method for 'java.util.LinkedHashMap.get(Object)'.
+   */
+  public void testGet() {
+    LinkedHashMap<String, String> hashMap = new LinkedHashMap<String, String>();
+    checkEmptyLinkedHashMapAssumptions(hashMap);
+
+    assertNull(hashMap.get(KEY_TEST_GET));
+    hashMap.put(KEY_TEST_GET, VALUE_TEST_GET);
+    assertNotNull(hashMap.get(KEY_TEST_GET));
+
+    assertNull(hashMap.get(null));
+    hashMap.put(null, VALUE_TEST_GET);
+    assertNotNull(hashMap.get(null));
+
+    hashMap.put(null, null);
+    assertNull(hashMap.get(null));
+  }
+
+  /*
+   * Test method for 'java.util.AbstractMap.hashCode()'.
+   */
+  public void testHashCode() {
+    LinkedHashMap<String, String> hashMap = new LinkedHashMap<String, String>();
+    checkEmptyLinkedHashMapAssumptions(hashMap);
+
+    // Check that hashCode changes
+    int hashCode1 = hashMap.hashCode();
+    hashMap.put(KEY_KEY, VALUE_VAL);
+    int hashCode2 = hashMap.hashCode();
+
+    assertTrue(hashCode1 != hashCode2);
+  }
+
+  /*
+   * Test method for 'java.util.AbstractMap.isEmpty()'
+   */
+  public void testIsEmpty() {
+    LinkedHashMap<String, String> srcMap = new LinkedHashMap<String, String>();
+    checkEmptyLinkedHashMapAssumptions(srcMap);
+
+    LinkedHashMap<String, String> dstMap = new LinkedHashMap<String, String>();
+    checkEmptyLinkedHashMapAssumptions(dstMap);
+
+    dstMap.putAll(srcMap);
+    assertTrue(dstMap.isEmpty());
+
+    dstMap.put(KEY_KEY, VALUE_VAL);
+    assertFalse(dstMap.isEmpty());
+
+    dstMap.remove(KEY_KEY);
+    assertTrue(dstMap.isEmpty());
+    assertEquals(dstMap.size(), 0);
+  }
+
+  public void testKeysConflict() {
+    LinkedHashMap<Object, String> hashMap = new LinkedHashMap<Object, String>();
+
+    hashMap.put(STRING_ZERO_KEY, STRING_ZERO_VALUE);
+    hashMap.put(INTEGER_ZERO_KEY, INTEGER_ZERO_VALUE);
+    hashMap.put(ODD_ZERO_KEY, ODD_ZERO_VALUE);
+    assertEquals(hashMap.get(INTEGER_ZERO_KEY), INTEGER_ZERO_VALUE);
+    assertEquals(hashMap.get(ODD_ZERO_KEY), ODD_ZERO_VALUE);
+    assertEquals(hashMap.get(STRING_ZERO_KEY), STRING_ZERO_VALUE);
+    hashMap.remove(INTEGER_ZERO_KEY);
+    assertEquals(hashMap.get(ODD_ZERO_KEY), ODD_ZERO_VALUE);
+    assertEquals(hashMap.get(STRING_ZERO_KEY), STRING_ZERO_VALUE);
+    assertEquals(hashMap.get(INTEGER_ZERO_KEY), null);
+    hashMap.remove(ODD_ZERO_KEY);
+    assertEquals(hashMap.get(INTEGER_ZERO_KEY), null);
+    assertEquals(hashMap.get(ODD_ZERO_KEY), null);
+    assertEquals(hashMap.get(STRING_ZERO_KEY), STRING_ZERO_VALUE);
+    hashMap.remove(STRING_ZERO_KEY);
+    assertEquals(hashMap.get(INTEGER_ZERO_KEY), null);
+    assertEquals(hashMap.get(ODD_ZERO_KEY), null);
+    assertEquals(hashMap.get(STRING_ZERO_KEY), null);
+    assertEquals(hashMap.size(), 0);
+  }
+
+  /*
+   * Test method for 'java.util.LinkedHashMap.keySet()'
+   */
+  public void testKeySet() {
+    LinkedHashMap<String, String> hashMap = new LinkedHashMap<String, String>();
+    checkEmptyLinkedHashMapAssumptions(hashMap);
+
+    Set<String> keySet = hashMap.keySet();
+    assertNotNull(keySet);
+    assertTrue(keySet.isEmpty());
+    assertTrue(keySet.size() == 0);
+
+    hashMap.put(KEY_TEST_KEY_SET, VALUE_TEST_KEY_SET);
+    assertEquals(SIZE_ONE, keySet.size());
+    assertTrue(keySet.contains(KEY_TEST_KEY_SET));
+    assertFalse(keySet.contains(VALUE_TEST_KEY_SET));
+    assertFalse(keySet.contains(KEY_TEST_KEY_SET.toUpperCase()));
+  }
+
+  /*
+   * Test method for 'java.util.LinkedHashMap.LinkedHashMap()'.
+   */
+  public void testLinkedHashMap() {
+    LinkedHashMap<String, String> hashMap = new LinkedHashMap<String, String>();
+    checkEmptyLinkedHashMapAssumptions(hashMap);
+  }
+
+  /*
+   * Test method for 'java.util.LinkedHashMap.LinkedHashMap(int)'
+   */
+  public void testLinkedHashMapInt() {
+    LinkedHashMap<String, String> hashMap = new LinkedHashMap<String, String>(CAPACITY_16);
+    checkEmptyLinkedHashMapAssumptions(hashMap);
+
+    // TODO(mmendez): how do we verify capacity?
+    boolean failed = true;
+    try {
+      new LinkedHashMap<String, String>(-SIZE_ONE);
+    } catch (Throwable ex) {
+      if (ex instanceof IllegalArgumentException) {
+        failed = false;
+      }
+    }
+
+    if (failed) {
+      fail("Failure testing new LinkedHashMap(-1)");
+    }
+
+    LinkedHashMap<String, String> zeroSizedLinkedHashMap = new LinkedHashMap<String, String>(0);
+    assertNotNull(zeroSizedLinkedHashMap);
+  }
+
+  /*
+   * Test method for 'java.util.LinkedHashMap.LinkedHashMap(int, float)'
+   */
+  public void testLinkedHashMapIntFloat() {
+
+    LinkedHashMap<String, String> hashMap = new LinkedHashMap<String, String>(CAPACITY_16,
+        LOAD_FACTOR_ONE_HALF);
+    checkEmptyLinkedHashMapAssumptions(hashMap);
+
+    // TODO(mmendez): how do we verify capacity and load factor?
+
+    // Test new LinkedHashMap(-1, 0.0F)
+    boolean failed = true;
+    try {
+      new LinkedHashMap<String, String>(CAPACITY_NEG_ONE_HALF, LOAD_FACTOR_ZERO);
+    } catch (Throwable ex) {
+      if (ex instanceof IllegalArgumentException) {
+        failed = false;
+      }
+    }
+
+    if (failed) {
+      fail("Failure testing new LinkedHashMap(-1, 0.0F)");
+    }
+
+    // Test new LinkedHashMap(0, -1.0F)
+    failed = true;
+    try {
+      new LinkedHashMap<String, String>(CAPACITY_ZERO, LOAD_FACTOR_NEG_ONE);
+    } catch (Throwable ex) {
+      if (ex instanceof IllegalArgumentException) {
+        failed = false;
+      }
+    }
+
+    if (failed) {
+      fail("Failure testing new LinkedHashMap(0, -1.0F)");
+    }
+
+    // Test new LinkedHashMap(0,0F);
+    hashMap = new LinkedHashMap<String, String>(CAPACITY_ZERO, LOAD_FACTOR_ONE_TENTH);
+    assertNotNull(hashMap);
+  }
+
+  /*
+   * Test method for 'java.util.LinkedHashMap.LinkedHashMap(Map)'
+   */
+  public void testLinkedHashMapMap() {
+    LinkedHashMap<Integer, Integer> srcMap = new LinkedHashMap<Integer, Integer>();
+    assertNotNull(srcMap);
+    checkEmptyLinkedHashMapAssumptions(srcMap);
+
+    srcMap.put(INTEGER_1, INTEGER_11);
+    srcMap.put(INTEGER_2, INTEGER_22);
+    srcMap.put(INTEGER_3, INTEGER_33);
+
+    LinkedHashMap<Integer, Integer> hashMap = cloneLinkedHashMap(srcMap);
+    assertFalse(hashMap.isEmpty());
+    assertTrue(hashMap.size() == SIZE_THREE);
+
+    Collection<Integer> valColl = hashMap.values();
+    assertTrue(valColl.contains(INTEGER_11));
+    assertTrue(valColl.contains(INTEGER_22));
+    assertTrue(valColl.contains(INTEGER_33));
+
+    Collection<Integer> keyColl = hashMap.keySet();
+    assertTrue(keyColl.contains(INTEGER_1));
+    assertTrue(keyColl.contains(INTEGER_2));
+    assertTrue(keyColl.contains(INTEGER_3));
+  }
+
+  public void testLRU() {
+    LinkedHashMap<String, String> m = new LinkedHashMap<String, String>(10,
+        .5f, true);
+    m.put("A", "A");
+    m.put("B", "B");
+    m.put("C", "C");
+    m.put("D", "D");
+    Iterator<Entry<String, String>> entry = m.entrySet().iterator();
+    assertEquals("A", entry.next().getValue());
+    assertEquals("B", entry.next().getValue());
+    assertEquals("C", entry.next().getValue());
+    assertEquals("D", entry.next().getValue());
+    m.get("B");
+    m.get("D");
+    entry = m.entrySet().iterator();
+    assertEquals("A", entry.next().getValue());
+    assertEquals("C", entry.next().getValue());
+    assertEquals("B", entry.next().getValue());
+    assertEquals("D", entry.next().getValue());
+  }
+
+  /*
+   * Test method for 'java.util.LinkedHashMap.put(Object, Object)'
+   */
+  public void testPut() {
+    LinkedHashMap<String, String> hashMap = new LinkedHashMap<String, String>();
+    checkEmptyLinkedHashMapAssumptions(hashMap);
+
+    assertNull(hashMap.put(KEY_TEST_PUT, VALUE_TEST_PUT_1));
+    assertEquals(hashMap.put(KEY_TEST_PUT, VALUE_TEST_PUT_2), VALUE_TEST_PUT_1);
+    assertNull(hashMap.put(null, VALUE_TEST_PUT_1));
+    assertEquals(hashMap.put(null, VALUE_TEST_PUT_2), VALUE_TEST_PUT_1);
+  }
+
+  /**
+   * Test method for 'java.util.LinkedHashMap.putAll(Map)'.
+   */
+  public void testPutAll() {
+    LinkedHashMap<String, String> srcMap = new LinkedHashMap<String, String>();
+    checkEmptyLinkedHashMapAssumptions(srcMap);
+
+    srcMap.put(KEY_1, VALUE_1);
+    srcMap.put(KEY_2, VALUE_2);
+    srcMap.put(KEY_3, VALUE_3);
+
+    // Make sure that the data is copied correctly
+    LinkedHashMap<String, String> dstMap = new LinkedHashMap<String, String>();
+    checkEmptyLinkedHashMapAssumptions(dstMap);
+
+    dstMap.putAll(srcMap);
+    assertEquals(srcMap.size(), dstMap.size());
+    assertTrue(dstMap.containsKey(KEY_1));
+    assertTrue(dstMap.containsValue(VALUE_1));
+    assertFalse(dstMap.containsKey(KEY_1.toUpperCase()));
+    assertFalse(dstMap.containsValue(VALUE_1.toUpperCase()));
+
+    assertTrue(dstMap.containsKey(KEY_2));
+    assertTrue(dstMap.containsValue(VALUE_2));
+    assertFalse(dstMap.containsKey(KEY_2.toUpperCase()));
+    assertFalse(dstMap.containsValue(VALUE_2.toUpperCase()));
+
+    assertTrue(dstMap.containsKey(KEY_3));
+    assertTrue(dstMap.containsValue(VALUE_3));
+    assertFalse(dstMap.containsKey(KEY_3.toUpperCase()));
+    assertFalse(dstMap.containsValue(VALUE_3.toUpperCase()));
+
+    // Check that an empty map does not blow away the contents of the
+    // destination map
+    LinkedHashMap<String, String> emptyMap = new LinkedHashMap<String, String>();
+    checkEmptyLinkedHashMapAssumptions(emptyMap);
+    dstMap.putAll(emptyMap);
+    assertTrue(dstMap.size() == srcMap.size());
+
+    // Check that put all overwrite any existing mapping in the destination map
+    srcMap.put(KEY_1, VALUE_2);
+    srcMap.put(KEY_2, VALUE_3);
+    srcMap.put(KEY_3, VALUE_1);
+
+    dstMap.putAll(srcMap);
+    assertEquals(dstMap.size(), srcMap.size());
+    assertEquals(dstMap.get(KEY_1), VALUE_2);
+    assertEquals(dstMap.get(KEY_2), VALUE_3);
+    assertEquals(dstMap.get(KEY_3), VALUE_1);
+
+    // Check that a putAll does adds data but does not remove it
+
+    srcMap.put(KEY_4, VALUE_4);
+    dstMap.putAll(srcMap);
+    assertEquals(dstMap.size(), srcMap.size());
+    assertTrue(dstMap.containsKey(KEY_4));
+    assertTrue(dstMap.containsValue(VALUE_4));
+    assertEquals(dstMap.get(KEY_1), VALUE_2);
+    assertEquals(dstMap.get(KEY_2), VALUE_3);
+    assertEquals(dstMap.get(KEY_3), VALUE_1);
+    assertEquals(dstMap.get(KEY_4), VALUE_4);
+
+    dstMap.putAll(dstMap);
+  }
+
+  /**
+   * Test method for 'java.util.LinkedHashMap.remove(Object)'.
+   */
+  public void testRemove() {
+    LinkedHashMap<String, String> hashMap = new LinkedHashMap<String, String>();
+    checkEmptyLinkedHashMapAssumptions(hashMap);
+
+    assertNull(hashMap.remove(null));
+    hashMap.put(null, VALUE_TEST_REMOVE);
+    assertNotNull(hashMap.remove(null));
+
+    hashMap.put(KEY_TEST_REMOVE, VALUE_TEST_REMOVE);
+    assertEquals(hashMap.remove(KEY_TEST_REMOVE), VALUE_TEST_REMOVE);
+    assertNull(hashMap.remove(KEY_TEST_REMOVE));
+  }
+
+  public void testRemoveEldest() {
+    TestRemoveEldestMap<String, String> m = new TestRemoveEldestMap<String, String>(false);
+    m.put("A", "A");
+    m.put("B", "B");
+    m.put("C", "C");
+    m.put("D", "D");
+    m.get("B");
+    m.get("D");
+    m.removeEldest = true;
+    m.expectedKey = "A";
+    m.put("E", "E");
+    m.put("B", "New-B");
+    Iterator<Map.Entry<String, String>> entries = m.entrySet().iterator();
+    Map.Entry<String, String> first = entries.next();
+    assertEquals("B", first.getKey());
+    assertEquals("New-B", first.getValue());
+    assertEquals(4, m.size());
+  }
+
+  public void testRemoveEldestMapLRU() {
+    TestRemoveEldestMap<String, String> m = new TestRemoveEldestMap<String, String>(true);
+    m.put("A", "A");
+    m.put("B", "B");
+    m.put("C", "C");
+    m.put("D", "D");
+    m.get("A");
+    m.get("D");
+    m.removeEldest = true;
+    m.expectedKey = "B";
+    m.put("E", "E");
+
+    m.put("C", "New-C");
+    Iterator<Map.Entry<String, String>> entries = m.entrySet().iterator();
+    Map.Entry<String, String> first = entries.next();
+    assertEquals("A", first.getKey());
+    assertEquals("D", entries.next().getKey());
+    assertEquals("E", entries.next().getKey());
+    assertEquals("New-C", entries.next().getValue());
+  }
+
+  /**
+   * Test method for 'java.util.LinkedHashMap.size()'.
+   */
+  public void testSize() {
+    LinkedHashMap<String, String> hashMap = new LinkedHashMap<String, String>();
+    checkEmptyLinkedHashMapAssumptions(hashMap);
+
+    // Test size behavior on put
+    assertEquals(hashMap.size(), SIZE_ZERO);
+    hashMap.put(KEY_1, VALUE_1);
+    assertEquals(hashMap.size(), SIZE_ONE);
+    hashMap.put(KEY_2, VALUE_2);
+    assertEquals(hashMap.size(), SIZE_TWO);
+    hashMap.put(KEY_3, VALUE_3);
+    assertEquals(hashMap.size(), SIZE_THREE);
+
+    // Test size behavior on remove
+    hashMap.remove(KEY_1);
+    assertEquals(hashMap.size(), SIZE_TWO);
+    hashMap.remove(KEY_2);
+    assertEquals(hashMap.size(), SIZE_ONE);
+    hashMap.remove(KEY_3);
+    assertEquals(hashMap.size(), SIZE_ZERO);
+
+    // Test size behavior on putAll
+    hashMap.put(KEY_1, VALUE_1);
+    hashMap.put(KEY_2, VALUE_2);
+    hashMap.put(KEY_3, VALUE_3);
+    LinkedHashMap<String, String> srcMap = cloneLinkedHashMap(hashMap);
+    hashMap.putAll(srcMap);
+    assertEquals(hashMap.size(), SIZE_THREE);
+
+    // Test size behavior on clear
+    hashMap.clear();
+    assertEquals(hashMap.size(), SIZE_ZERO);
+  }
+
+  /**
+   * Test method for 'java.util.AbstractMap.toString()'.
+   */
+  public void testToString() {
+    LinkedHashMap<String, String> hashMap = new LinkedHashMap<String, String>();
+    checkEmptyLinkedHashMapAssumptions(hashMap);
+    hashMap.put(KEY_KEY, VALUE_VAL);
+    String entryString = makeEntryString(KEY_KEY, VALUE_VAL);
+    assertTrue(entryString.equals(hashMap.toString()));
+  }
+
+  /**
+   * Test method for 'java.util.AbstractMap.values()'.
+   */
+  public void testValues() {
+    LinkedHashMap<String, String> hashMap = new LinkedHashMap<String, String>();
+    checkEmptyLinkedHashMapAssumptions(hashMap);
+
+    assertNotNull(hashMap.values());
+
+    hashMap.put(KEY_KEY, VALUE_VAL);
+
+    Collection<String> valColl = hashMap.values();
+    assertNotNull(valColl);
+    assertEquals(valColl.size(), SIZE_ONE);
+
+    Iterator<String> itVal = valColl.iterator();
+    String val = itVal.next();
+    assertEquals(val, VALUE_VAL);
+  }
+
+  @SuppressWarnings("unchecked") // raw Map/LinkedHashMap
+  @Override
+  protected Map makeEmptyMap() {
+    return new LinkedHashMap();
+  }
+
+  /**
+   * This method exists because java 1.5 no longer has
+   * LinkedHashMap(LinkedHashMap), replacing it with LinkedHashMap(Map<?
+   * extends K, ? extends V> m). Nevertheless, we want to use it in web mode to
+   * test that web mode function.
+   * 
+   * @param hashMap the LinkedHashMap to be copied
+   * @return the copy
+   */
+  @SuppressWarnings("unchecked") // raw LinkedHashMap
+  private LinkedHashMap cloneLinkedHashMap(LinkedHashMap hashMap) {
+    if (GWT.isScript()) {
+      return new LinkedHashMap(hashMap);
+    } else {
+      LinkedHashMap m = new LinkedHashMap();
+      m.putAll(hashMap);
+      return m;
+    }
+  }
+
+  private Iterator<Map.Entry<Number, Object>> iterateThrough(
+      final LinkedHashMap<Number, Object> expected) {
+    Iterator<Map.Entry<Number, Object>> iter = expected.entrySet().iterator();
+    for (int i = 0; i < expected.size(); i++) {
+      iter.next();
+    }
+    return iter;
+  }
+
+  private String makeEntryString(final String key, final String value) {
+    return "{" + key + "=" + value + "}";
+  }
+}
diff --git a/user/test/com/google/gwt/event/shared/HandlerManagerTest.java b/user/test/com/google/gwt/event/shared/HandlerManagerTest.java
index 9d9dbaf..9709aa3 100644
--- a/user/test/com/google/gwt/event/shared/HandlerManagerTest.java
+++ b/user/test/com/google/gwt/event/shared/HandlerManagerTest.java
@@ -1,312 +1,312 @@
-/*

- * 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.event.shared;

-

-import com.google.gwt.core.client.GWT;

-import com.google.gwt.event.dom.client.ClickEvent;

-import com.google.gwt.event.dom.client.MouseDownEvent;

-import com.google.gwt.event.dom.client.MouseDownHandler;

-

-/**

- * Handler manager test.

- */

-public class HandlerManagerTest extends HandlerTestBase {

-

-  public void testAddHandlers() {

-

-    HandlerManager manager = new HandlerManager("bogus source");

-    addHandlers(manager);

-  }

-

-  private void addHandlers(HandlerManager manager) {

-    manager.addHandler(MouseDownEvent.getType(), mouse1);

-    manager.addHandler(MouseDownEvent.getType(), mouse2);

-    manager.addHandler(MouseDownEvent.getType(), adaptor1);

-    manager.fireEvent(new MouseDownEvent() {

-    });

-    assertEquals(3, manager.getHandlerCount(MouseDownEvent.getType()));

-    assertFired(mouse1, mouse2, adaptor1);

-    manager.addHandler(MouseDownEvent.getType(), mouse3);

-    assertEquals(4, manager.getHandlerCount(MouseDownEvent.getType()));

-

-    manager.addHandler(MouseDownEvent.getType(), mouse1);

-    manager.addHandler(MouseDownEvent.getType(), mouse2);

-    manager.addHandler(MouseDownEvent.getType(), adaptor1);

-

-    // You can indeed add handlers twice, they will only be removed one at a

-    // time though.

-    assertEquals(7, manager.getHandlerCount(MouseDownEvent.getType()));

-    manager.addHandler(ClickEvent.getType(), adaptor1);

-    manager.addHandler(ClickEvent.getType(), click1);

-    manager.addHandler(ClickEvent.getType(), click2);

-

-    assertEquals(7, manager.getHandlerCount(MouseDownEvent.getType()));

-    assertEquals(3, manager.getHandlerCount(ClickEvent.getType()));

-

-    reset();

-    manager.fireEvent(new MouseDownEvent() {

-    });

-    assertFired(mouse1, mouse2, mouse3, adaptor1);

-    assertNotFired(click1, click2);

-  }

-

-  @SuppressWarnings("deprecation")

-  public void testRemoveHandlers() {

-    HandlerManager manager = new HandlerManager("bogus source");

-    addHandlers(manager);

-    // Gets rid of first instance.

-    manager.removeHandler(MouseDownEvent.getType(), adaptor1);

-    manager.fireEvent(new MouseDownEvent() {

-    });

-    assertFired(mouse1, mouse2, mouse3, adaptor1);

-    assertNotFired(click1, click2);

-

-    // Gets rid of second instance.

-    manager.removeHandler(MouseDownEvent.getType(), adaptor1);

-    reset();

-    manager.fireEvent(new MouseDownEvent() {

-    });

-

-    assertFired(mouse1, mouse2, mouse3);

-    assertNotFired(adaptor1, click1, click2);

-

-    // Checks to see if click events are still working.

-    reset();

-    manager.fireEvent(new ClickEvent() {

-    });

-

-    assertNotFired(mouse1, mouse2, mouse3);

-    assertFired(click1, click2, adaptor1);

-  }

-

-  public void testConcurrentAdd() {

-    final HandlerManager manager = new HandlerManager("bogus source");

-    final MouseDownHandler two = new MouseDownHandler() {

-      public void onMouseDown(MouseDownEvent event) {

-        add(this);

-      }

-    };

-    MouseDownHandler one = new MouseDownHandler() {

-      public void onMouseDown(MouseDownEvent event) {

-        manager.addHandler(MouseDownEvent.getType(), two);

-        add(this);

-      }

-    };

-    manager.addHandler(MouseDownEvent.getType(), one);

-    manager.addHandler(MouseDownEvent.getType(), mouse1);

-    manager.addHandler(MouseDownEvent.getType(), mouse2);

-    manager.addHandler(MouseDownEvent.getType(), mouse3);

-    manager.fireEvent(new MouseDownEvent() {

-    });

-    assertFired(one, mouse1, mouse2, mouse3);

-    assertNotFired(two);

-

-    reset();

-    manager.fireEvent(new MouseDownEvent() {

-    });

-    assertFired(one, two, mouse1, mouse2, mouse3);

-  }

-

-  class ShyHandler implements MouseDownHandler {

-    HandlerRegistration r;

-

-    public void onMouseDown(MouseDownEvent event) {

-      add(this);

-      r.removeHandler();

-    }

-  }

-

-  public void testConcurrentRemove() {

-    final HandlerManager manager = new HandlerManager("bogus source");

-

-    ShyHandler h = new ShyHandler();

-

-    manager.addHandler(MouseDownEvent.getType(), mouse1);

-    h.r = manager.addHandler(MouseDownEvent.getType(), h);

-    manager.addHandler(MouseDownEvent.getType(), mouse2);

-    manager.addHandler(MouseDownEvent.getType(), mouse3);

-

-    manager.fireEvent(new MouseDownEvent() {

-    });

-    assertFired(h, mouse1, mouse2, mouse3);

-    reset();

-    manager.fireEvent(new MouseDownEvent() {

-    });

-    assertFired(mouse1, mouse2, mouse3);

-    assertNotFired(h);

-  }

-

-  public void testConcurrentAddAndRemoveByNastyUsersTryingToHurtUs() {

-    final HandlerManager manager = new HandlerManager("bogus source");

-    final MouseDownHandler two = new MouseDownHandler() {

-      public void onMouseDown(MouseDownEvent event) {

-        add(this);

-      }

-

-      @Override

-      public String toString() {

-        return "two";

-      }

-    };

-    MouseDownHandler one = new MouseDownHandler() {

-      public void onMouseDown(MouseDownEvent event) {

-        manager.addHandler(MouseDownEvent.getType(), two).removeHandler();

-        add(this);

-      }

-

-      @Override

-      public String toString() {

-        return "one";

-      }

-    };

-    manager.addHandler(MouseDownEvent.getType(), one);

-    manager.addHandler(MouseDownEvent.getType(), mouse1);

-    manager.addHandler(MouseDownEvent.getType(), mouse2);

-    manager.addHandler(MouseDownEvent.getType(), mouse3);

-    manager.fireEvent(new MouseDownEvent() {

-    });

-    assertFired(one, mouse1, mouse2, mouse3);

-    assertNotFired(two);

-

-    reset();

-    manager.fireEvent(new MouseDownEvent() {

-    });

-    assertFired(one, mouse1, mouse2, mouse3);

-    assertNotFired(two);

-  }

-

-  @SuppressWarnings("deprecation")

-  public void testConcurrentAddAfterRemoveIsNotClobbered() {

-    final HandlerManager manager = new HandlerManager("bogus source");

-

-    MouseDownHandler one = new MouseDownHandler() {

-      public void onMouseDown(MouseDownEvent event) {

-        manager.removeHandler(MouseDownEvent.getType(), mouse1);

-        manager.addHandler(MouseDownEvent.getType(), mouse1);

-        add(this);

-      }

-    };

-    manager.addHandler(MouseDownEvent.getType(), one);

-

-    if (!GWT.isScript()) {

-      try {

-        manager.fireEvent(new MouseDownEvent() {

-        });

-        fail("Should have thrown on remove");

-      } catch (AssertionError e) { /* pass */

-      }

-      return;

-    }

-

-    // Web mode, no asserts, so remove will quietly succeed.

-    manager.fireEvent(new MouseDownEvent() {

-    });

-    assertFired(one);

-    reset();

-    manager.fireEvent(new MouseDownEvent() {

-    });

-    assertFired(one, mouse1);

-  }

-

-  public void testMultiFiring() {

-

-    HandlerManager manager = new HandlerManager("source1");

-

-    final HandlerManager manager2 = new HandlerManager("source2");

-

-    manager.addHandler(MouseDownEvent.getType(), mouse1);

-

-    manager.addHandler(MouseDownEvent.getType(), new MouseDownHandler() {

-

-      public void onMouseDown(MouseDownEvent event) {

-        manager2.fireEvent(event);

-      }

-

-    });

-    manager.addHandler(MouseDownEvent.getType(), mouse3);

-    manager2.addHandler(MouseDownEvent.getType(), adaptor1);

-    manager2.addHandler(MouseDownEvent.getType(), new MouseDownHandler() {

-

-      public void onMouseDown(MouseDownEvent event) {

-        assertEquals("source2", event.getSource());

-      }

-

-    });

-    manager.addHandler(MouseDownEvent.getType(), new MouseDownHandler() {

-

-      public void onMouseDown(MouseDownEvent event) {

-        assertEquals("source1", event.getSource());

-      }

-

-    });

-

-    reset();

-    manager.fireEvent(new MouseDownEvent() {

-    });

-    assertFired(mouse1, adaptor1, mouse3);

-  }

-

-  public void testRemoveUnhandledType() {

-    final HandlerManager manager = new HandlerManager("bogus source");

-    HandlerRegistration reg = manager.addHandler(MouseDownEvent.getType(),

-        mouse1);

-    reg.removeHandler();

-

-    if (!GWT.isScript()) {

-      try {

-        reg.removeHandler();

-        fail("Should have thrown assertion error");

-      } catch (AssertionError e) {

-        /* pass */

-      }

-    } else {

-      reg.removeHandler();

-      /* pass, we didn't hit an NPE */

-    }

-  }

-

-  public void testReverseOrder() {

-    // Add some handlers to a manager

-    final HandlerManager manager = new HandlerManager("source1", true);

-    final MouseDownHandler handler0 = new MouseDownHandler() {

-      public void onMouseDown(MouseDownEvent event) {

-        add(this);

-      }

-    };

-    final MouseDownHandler handler1 = new MouseDownHandler() {

-      public void onMouseDown(MouseDownEvent event) {

-        assertNotFired(handler0);

-        add(this);

-      }

-    };

-    final MouseDownHandler handler2 = new MouseDownHandler() {

-      public void onMouseDown(MouseDownEvent event) {

-        assertNotFired(handler0, handler1);

-        add(this);

-      }

-    };

-    manager.addHandler(MouseDownEvent.getType(), handler0);

-    manager.addHandler(MouseDownEvent.getType(), handler1);

-    manager.addHandler(MouseDownEvent.getType(), handler2);

-

-    // Fire the event

-    reset();

-    manager.fireEvent(new MouseDownEvent() {

-    });

-    assertFired(handler0, handler1, handler2);

-  }

-}

+/*
+ * 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.event.shared;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.MouseDownEvent;
+import com.google.gwt.event.dom.client.MouseDownHandler;
+
+/**
+ * Handler manager test.
+ */
+public class HandlerManagerTest extends HandlerTestBase {
+
+  public void testAddHandlers() {
+
+    HandlerManager manager = new HandlerManager("bogus source");
+    addHandlers(manager);
+  }
+
+  private void addHandlers(HandlerManager manager) {
+    manager.addHandler(MouseDownEvent.getType(), mouse1);
+    manager.addHandler(MouseDownEvent.getType(), mouse2);
+    manager.addHandler(MouseDownEvent.getType(), adaptor1);
+    manager.fireEvent(new MouseDownEvent() {
+    });
+    assertEquals(3, manager.getHandlerCount(MouseDownEvent.getType()));
+    assertFired(mouse1, mouse2, adaptor1);
+    manager.addHandler(MouseDownEvent.getType(), mouse3);
+    assertEquals(4, manager.getHandlerCount(MouseDownEvent.getType()));
+
+    manager.addHandler(MouseDownEvent.getType(), mouse1);
+    manager.addHandler(MouseDownEvent.getType(), mouse2);
+    manager.addHandler(MouseDownEvent.getType(), adaptor1);
+
+    // You can indeed add handlers twice, they will only be removed one at a
+    // time though.
+    assertEquals(7, manager.getHandlerCount(MouseDownEvent.getType()));
+    manager.addHandler(ClickEvent.getType(), adaptor1);
+    manager.addHandler(ClickEvent.getType(), click1);
+    manager.addHandler(ClickEvent.getType(), click2);
+
+    assertEquals(7, manager.getHandlerCount(MouseDownEvent.getType()));
+    assertEquals(3, manager.getHandlerCount(ClickEvent.getType()));
+
+    reset();
+    manager.fireEvent(new MouseDownEvent() {
+    });
+    assertFired(mouse1, mouse2, mouse3, adaptor1);
+    assertNotFired(click1, click2);
+  }
+
+  @SuppressWarnings("deprecation")
+  public void testRemoveHandlers() {
+    HandlerManager manager = new HandlerManager("bogus source");
+    addHandlers(manager);
+    // Gets rid of first instance.
+    manager.removeHandler(MouseDownEvent.getType(), adaptor1);
+    manager.fireEvent(new MouseDownEvent() {
+    });
+    assertFired(mouse1, mouse2, mouse3, adaptor1);
+    assertNotFired(click1, click2);
+
+    // Gets rid of second instance.
+    manager.removeHandler(MouseDownEvent.getType(), adaptor1);
+    reset();
+    manager.fireEvent(new MouseDownEvent() {
+    });
+
+    assertFired(mouse1, mouse2, mouse3);
+    assertNotFired(adaptor1, click1, click2);
+
+    // Checks to see if click events are still working.
+    reset();
+    manager.fireEvent(new ClickEvent() {
+    });
+
+    assertNotFired(mouse1, mouse2, mouse3);
+    assertFired(click1, click2, adaptor1);
+  }
+
+  public void testConcurrentAdd() {
+    final HandlerManager manager = new HandlerManager("bogus source");
+    final MouseDownHandler two = new MouseDownHandler() {
+      public void onMouseDown(MouseDownEvent event) {
+        add(this);
+      }
+    };
+    MouseDownHandler one = new MouseDownHandler() {
+      public void onMouseDown(MouseDownEvent event) {
+        manager.addHandler(MouseDownEvent.getType(), two);
+        add(this);
+      }
+    };
+    manager.addHandler(MouseDownEvent.getType(), one);
+    manager.addHandler(MouseDownEvent.getType(), mouse1);
+    manager.addHandler(MouseDownEvent.getType(), mouse2);
+    manager.addHandler(MouseDownEvent.getType(), mouse3);
+    manager.fireEvent(new MouseDownEvent() {
+    });
+    assertFired(one, mouse1, mouse2, mouse3);
+    assertNotFired(two);
+
+    reset();
+    manager.fireEvent(new MouseDownEvent() {
+    });
+    assertFired(one, two, mouse1, mouse2, mouse3);
+  }
+
+  class ShyHandler implements MouseDownHandler {
+    HandlerRegistration r;
+
+    public void onMouseDown(MouseDownEvent event) {
+      add(this);
+      r.removeHandler();
+    }
+  }
+
+  public void testConcurrentRemove() {
+    final HandlerManager manager = new HandlerManager("bogus source");
+
+    ShyHandler h = new ShyHandler();
+
+    manager.addHandler(MouseDownEvent.getType(), mouse1);
+    h.r = manager.addHandler(MouseDownEvent.getType(), h);
+    manager.addHandler(MouseDownEvent.getType(), mouse2);
+    manager.addHandler(MouseDownEvent.getType(), mouse3);
+
+    manager.fireEvent(new MouseDownEvent() {
+    });
+    assertFired(h, mouse1, mouse2, mouse3);
+    reset();
+    manager.fireEvent(new MouseDownEvent() {
+    });
+    assertFired(mouse1, mouse2, mouse3);
+    assertNotFired(h);
+  }
+
+  public void testConcurrentAddAndRemoveByNastyUsersTryingToHurtUs() {
+    final HandlerManager manager = new HandlerManager("bogus source");
+    final MouseDownHandler two = new MouseDownHandler() {
+      public void onMouseDown(MouseDownEvent event) {
+        add(this);
+      }
+
+      @Override
+      public String toString() {
+        return "two";
+      }
+    };
+    MouseDownHandler one = new MouseDownHandler() {
+      public void onMouseDown(MouseDownEvent event) {
+        manager.addHandler(MouseDownEvent.getType(), two).removeHandler();
+        add(this);
+      }
+
+      @Override
+      public String toString() {
+        return "one";
+      }
+    };
+    manager.addHandler(MouseDownEvent.getType(), one);
+    manager.addHandler(MouseDownEvent.getType(), mouse1);
+    manager.addHandler(MouseDownEvent.getType(), mouse2);
+    manager.addHandler(MouseDownEvent.getType(), mouse3);
+    manager.fireEvent(new MouseDownEvent() {
+    });
+    assertFired(one, mouse1, mouse2, mouse3);
+    assertNotFired(two);
+
+    reset();
+    manager.fireEvent(new MouseDownEvent() {
+    });
+    assertFired(one, mouse1, mouse2, mouse3);
+    assertNotFired(two);
+  }
+
+  @SuppressWarnings("deprecation")
+  public void testConcurrentAddAfterRemoveIsNotClobbered() {
+    final HandlerManager manager = new HandlerManager("bogus source");
+
+    MouseDownHandler one = new MouseDownHandler() {
+      public void onMouseDown(MouseDownEvent event) {
+        manager.removeHandler(MouseDownEvent.getType(), mouse1);
+        manager.addHandler(MouseDownEvent.getType(), mouse1);
+        add(this);
+      }
+    };
+    manager.addHandler(MouseDownEvent.getType(), one);
+
+    if (!GWT.isScript()) {
+      try {
+        manager.fireEvent(new MouseDownEvent() {
+        });
+        fail("Should have thrown on remove");
+      } catch (AssertionError e) { /* pass */
+      }
+      return;
+    }
+
+    // Web mode, no asserts, so remove will quietly succeed.
+    manager.fireEvent(new MouseDownEvent() {
+    });
+    assertFired(one);
+    reset();
+    manager.fireEvent(new MouseDownEvent() {
+    });
+    assertFired(one, mouse1);
+  }
+
+  public void testMultiFiring() {
+
+    HandlerManager manager = new HandlerManager("source1");
+
+    final HandlerManager manager2 = new HandlerManager("source2");
+
+    manager.addHandler(MouseDownEvent.getType(), mouse1);
+
+    manager.addHandler(MouseDownEvent.getType(), new MouseDownHandler() {
+
+      public void onMouseDown(MouseDownEvent event) {
+        manager2.fireEvent(event);
+      }
+
+    });
+    manager.addHandler(MouseDownEvent.getType(), mouse3);
+    manager2.addHandler(MouseDownEvent.getType(), adaptor1);
+    manager2.addHandler(MouseDownEvent.getType(), new MouseDownHandler() {
+
+      public void onMouseDown(MouseDownEvent event) {
+        assertEquals("source2", event.getSource());
+      }
+
+    });
+    manager.addHandler(MouseDownEvent.getType(), new MouseDownHandler() {
+
+      public void onMouseDown(MouseDownEvent event) {
+        assertEquals("source1", event.getSource());
+      }
+
+    });
+
+    reset();
+    manager.fireEvent(new MouseDownEvent() {
+    });
+    assertFired(mouse1, adaptor1, mouse3);
+  }
+
+  public void testRemoveUnhandledType() {
+    final HandlerManager manager = new HandlerManager("bogus source");
+    HandlerRegistration reg = manager.addHandler(MouseDownEvent.getType(),
+        mouse1);
+    reg.removeHandler();
+
+    if (!GWT.isScript()) {
+      try {
+        reg.removeHandler();
+        fail("Should have thrown assertion error");
+      } catch (AssertionError e) {
+        /* pass */
+      }
+    } else {
+      reg.removeHandler();
+      /* pass, we didn't hit an NPE */
+    }
+  }
+
+  public void testReverseOrder() {
+    // Add some handlers to a manager
+    final HandlerManager manager = new HandlerManager("source1", true);
+    final MouseDownHandler handler0 = new MouseDownHandler() {
+      public void onMouseDown(MouseDownEvent event) {
+        add(this);
+      }
+    };
+    final MouseDownHandler handler1 = new MouseDownHandler() {
+      public void onMouseDown(MouseDownEvent event) {
+        assertNotFired(handler0);
+        add(this);
+      }
+    };
+    final MouseDownHandler handler2 = new MouseDownHandler() {
+      public void onMouseDown(MouseDownEvent event) {
+        assertNotFired(handler0, handler1);
+        add(this);
+      }
+    };
+    manager.addHandler(MouseDownEvent.getType(), handler0);
+    manager.addHandler(MouseDownEvent.getType(), handler1);
+    manager.addHandler(MouseDownEvent.getType(), handler2);
+
+    // Fire the event
+    reset();
+    manager.fireEvent(new MouseDownEvent() {
+    });
+    assertFired(handler0, handler1, handler2);
+  }
+}
diff --git a/user/test/com/google/gwt/event/shared/HandlerTestBase.java b/user/test/com/google/gwt/event/shared/HandlerTestBase.java
index 80e551b..9478653 100644
--- a/user/test/com/google/gwt/event/shared/HandlerTestBase.java
+++ b/user/test/com/google/gwt/event/shared/HandlerTestBase.java
@@ -1,147 +1,147 @@
-/*

- * 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.event.shared;

-

-import com.google.gwt.event.dom.client.ClickEvent;

-import com.google.gwt.event.dom.client.ClickHandler;

-import com.google.gwt.event.dom.client.MouseDownEvent;

-import com.google.gwt.event.dom.client.MouseDownHandler;

-import com.google.gwt.junit.client.GWTTestCase;

-

-import java.util.HashSet;

-

-/**

- * Support code for handler tests.

- */

-public abstract class HandlerTestBase extends GWTTestCase {

-

-  @Override

-  public String getModuleName() {

-    return "com.google.gwt.event.Event";

-  }

-

-  class Adaptor implements ClickHandler, MouseDownHandler {

-

-    public void onClick(ClickEvent event) {

-      add(this);

-    }

-

-    public void onMouseDown(MouseDownEvent event) {

-      add(this);

-    }

-

-    @Override

-    public String toString() {

-      return "adaptor 1";

-    }

-  }

-

-  Adaptor adaptor1 = new Adaptor();

-

-  private HashSet<EventHandler> active = new HashSet<EventHandler>();

-

-  MouseDownHandler mouse1 = new MouseDownHandler() {

-    public void onMouseDown(MouseDownEvent event) {

-      add(mouse1);

-    }

-

-    @Override

-    public String toString() {

-      return "mouse 1";

-    }

-  };

-

-  MouseDownHandler mouse2 = new MouseDownHandler() {

-    public void onMouseDown(MouseDownEvent event) {

-      add(mouse2);

-    }

-

-    @Override

-    public String toString() {

-      return "mouse 2";

-    }

-  };

-

-  MouseDownHandler mouse3 = new MouseDownHandler() {

-    public void onMouseDown(MouseDownEvent event) {

-      add(mouse3);

-    }

-

-    @Override

-    public String toString() {

-      return "mouse 3";

-    }

-  };

-

-  ClickHandler click1 = new ClickHandler() {

-

-    public void onClick(ClickEvent event) {

-      add(click1);

-    }

-

-    @Override

-    public String toString() {

-      return "click 1";

-    }

-  };

-

-  ClickHandler click2 = new ClickHandler() {

-

-    public void onClick(ClickEvent event) {

-      add(click2);

-    }

-

-    @Override

-    public String toString() {

-      return "click 2";

-    }

-  };

-

-  ClickHandler click3 = new ClickHandler() {

-

-    public void onClick(ClickEvent event) {

-      add(click3);

-    }

-

-    @Override

-    public String toString() {

-      return "click 3";

-    }

-  };

-

-  void add(EventHandler handler) {

-    active.add(handler);

-  }

-

-  void assertFired(EventHandler... handler) {

-    for (int i = 0; i < handler.length; i++) {

-      assertTrue(handler[i] + " should have fired", active.contains(handler[i]));

-    }

-  }

-

-  void assertNotFired(EventHandler... handler) {

-    for (int i = 0; i < handler.length; i++) {

-      assertFalse(handler[i] + " should not have fired",

-          active.contains(handler[i]));

-    }

-  }

-

-  void reset() {

-    active.clear();

-  }

-

-}

+/*
+ * 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.event.shared;
+
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.event.dom.client.MouseDownEvent;
+import com.google.gwt.event.dom.client.MouseDownHandler;
+import com.google.gwt.junit.client.GWTTestCase;
+
+import java.util.HashSet;
+
+/**
+ * Support code for handler tests.
+ */
+public abstract class HandlerTestBase extends GWTTestCase {
+
+  @Override
+  public String getModuleName() {
+    return "com.google.gwt.event.Event";
+  }
+
+  class Adaptor implements ClickHandler, MouseDownHandler {
+
+    public void onClick(ClickEvent event) {
+      add(this);
+    }
+
+    public void onMouseDown(MouseDownEvent event) {
+      add(this);
+    }
+
+    @Override
+    public String toString() {
+      return "adaptor 1";
+    }
+  }
+
+  Adaptor adaptor1 = new Adaptor();
+
+  private HashSet<EventHandler> active = new HashSet<EventHandler>();
+
+  MouseDownHandler mouse1 = new MouseDownHandler() {
+    public void onMouseDown(MouseDownEvent event) {
+      add(mouse1);
+    }
+
+    @Override
+    public String toString() {
+      return "mouse 1";
+    }
+  };
+
+  MouseDownHandler mouse2 = new MouseDownHandler() {
+    public void onMouseDown(MouseDownEvent event) {
+      add(mouse2);
+    }
+
+    @Override
+    public String toString() {
+      return "mouse 2";
+    }
+  };
+
+  MouseDownHandler mouse3 = new MouseDownHandler() {
+    public void onMouseDown(MouseDownEvent event) {
+      add(mouse3);
+    }
+
+    @Override
+    public String toString() {
+      return "mouse 3";
+    }
+  };
+
+  ClickHandler click1 = new ClickHandler() {
+
+    public void onClick(ClickEvent event) {
+      add(click1);
+    }
+
+    @Override
+    public String toString() {
+      return "click 1";
+    }
+  };
+
+  ClickHandler click2 = new ClickHandler() {
+
+    public void onClick(ClickEvent event) {
+      add(click2);
+    }
+
+    @Override
+    public String toString() {
+      return "click 2";
+    }
+  };
+
+  ClickHandler click3 = new ClickHandler() {
+
+    public void onClick(ClickEvent event) {
+      add(click3);
+    }
+
+    @Override
+    public String toString() {
+      return "click 3";
+    }
+  };
+
+  void add(EventHandler handler) {
+    active.add(handler);
+  }
+
+  void assertFired(EventHandler... handler) {
+    for (int i = 0; i < handler.length; i++) {
+      assertTrue(handler[i] + " should have fired", active.contains(handler[i]));
+    }
+  }
+
+  void assertNotFired(EventHandler... handler) {
+    for (int i = 0; i < handler.length; i++) {
+      assertFalse(handler[i] + " should not have fired",
+          active.contains(handler[i]));
+    }
+  }
+
+  void reset() {
+    active.clear();
+  }
+
+}
diff --git a/user/test/com/google/gwt/http/client/UrlBuilderTest.java b/user/test/com/google/gwt/http/client/UrlBuilderTest.java
index 51496dc..e072e14 100644
--- a/user/test/com/google/gwt/http/client/UrlBuilderTest.java
+++ b/user/test/com/google/gwt/http/client/UrlBuilderTest.java
@@ -1,335 +1,335 @@
-/*

- * Copyright 2009 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.http.client;

-

-import com.google.gwt.junit.client.GWTTestCase;

-

-import java.util.ArrayList;

-import java.util.List;

-

-/**

- * Test Case for {@link UrlBuilder}.

- */

-public class UrlBuilderTest extends GWTTestCase {

-

-  @Override

-  public String getModuleName() {

-    return "com.google.gwt.http.HttpSuite";

-  }

-

-  /**

-   * Test that the URL is encoded correctly.

-   */

-  public void testBuildStringEncode() {

-    UrlBuilder builder = new UrlBuilder();

-    builder.setHost("google.com");

-    builder.setPath("path to file");

-    builder.setParameter("the key", "the value");

-    assertEquals("http://google.com/path%20to%20file?the%20key=the%20value",

-        builder.buildString());

-  }

-

-  public void testBuildStringEntireUrl() {

-    UrlBuilder builder = new UrlBuilder();

-    builder.setHost("google.com");

-

-    // Host only.

-    assertEquals("http://google.com", builder.buildString());

-

-    // Host:Port

-    builder.setPort(100);

-    assertEquals("http://google.com:100", builder.buildString());

-

-    // Host:Port/Path

-    builder.setPath("path/to/file");

-    assertEquals("http://google.com:100/path/to/file", builder.buildString());

-

-    // Host:Port/Path?Param

-    builder.setParameter("key", "value");

-    assertEquals("http://google.com:100/path/to/file?key=value",

-        builder.buildString());

-

-    // Host:Port/Path?Param#Hash

-    builder.setHash("token");

-    assertEquals("http://google.com:100/path/to/file?key=value#token",

-        builder.buildString());

-  }

-

-  public void testBuildStringEntireUrlWithReturns() {

-    UrlBuilder builder = new UrlBuilder();

-    builder.setHost("google.com").setPort(100).setPath("path/to/file").setParameter(

-        "key", "value").setHash("token");

-    assertEquals("http://google.com:100/path/to/file?key=value#token",

-        builder.buildString());

-  }

-

-  public void testBuildStringParts() {

-    UrlBuilder builder = new UrlBuilder();

-    builder.setHost("google.com");

-

-    // Host only.

-    assertEquals("http://google.com", builder.buildString());

-

-    // Host:Port

-    builder.setPort(100);

-    assertEquals("http://google.com:100", builder.buildString());

-    builder.setPort(UrlBuilder.PORT_UNSPECIFIED);

-

-    // Host/Path

-    builder.setPath("path/to/file");

-    assertEquals("http://google.com/path/to/file", builder.buildString());

-    builder.setPath(null);

-

-    // Host?Param

-    builder.setParameter("key", "value");

-    assertEquals("http://google.com?key=value", builder.buildString());

-    builder.removeParameter("key");

-

-    // Host#Hash

-    builder.setHash("token");

-    assertEquals("http://google.com#token", builder.buildString());

-    builder.setHash(null);

-  }

-

-  public void testSetHash() {

-    UrlBuilder builder = new UrlBuilder();

-    builder.setHost("google.com");

-

-    // Hash not specified

-    assertEquals("http://google.com", builder.buildString());

-

-    // # added if not present

-    builder.setHash("myHash");

-    assertEquals("http://google.com#myHash", builder.buildString());

-

-    // Null hash

-    builder.setHash(null);

-    assertEquals("http://google.com", builder.buildString());

-

-    // # not added if present

-    builder.setHash("#myHash2");

-    assertEquals("http://google.com#myHash2", builder.buildString());

-  }

-

-  public void testSetHost() {

-    UrlBuilder builder = new UrlBuilder();

-

-    // Host not specified.

-    assertEquals("http://", builder.buildString());

-

-    // Null host.

-    builder.setHost(null);

-    assertEquals("http://", builder.buildString());

-

-    // Empty host.

-    builder.setHost("");

-    assertEquals("http://", builder.buildString());

-

-    // google.com

-    builder.setHost("google.com");

-    assertEquals("http://google.com", builder.buildString());

-

-    // google.com:80

-    builder.setHost("google.com:80");

-    assertEquals("http://google.com:80", builder.buildString());

-

-    // google.com:80 with overridden port.

-    builder.setHost("google.com:80");

-    builder.setPort(1000);

-    assertEquals("http://google.com:1000", builder.buildString());

-

-    // google.com:80 with overridden port in host.

-    builder.setPort(1000);

-    builder.setHost("google.com:80");

-    assertEquals("http://google.com:80", builder.buildString());

-

-    // Specify to many ports.

-    // google.com:80:90

-    try {

-      builder.setHost("google.com:80:90");

-      fail("Expected IllegalArgumentException");

-    } catch (IllegalArgumentException e) {

-      // Expected.

-    }

-

-    // Specify invalid port.

-    // google.com:test

-    try {

-      builder.setHost("google.com:test");

-      fail("Expected IllegalArgumentException");

-    } catch (IllegalArgumentException e) {

-      // Expected.

-    }

-  }

-

-  public void testSetParameter() {

-    UrlBuilder builder = new UrlBuilder();

-    builder.setHost("google.com");

-

-    // Parameters not specified.

-    assertEquals("http://google.com", builder.buildString());

-

-    // Simple parameter.

-    builder.setParameter("key", "value");

-    assertEquals("http://google.com?key=value", builder.buildString());

-

-    // Remove simple parameter.

-    builder.removeParameter("key");

-    assertEquals("http://google.com", builder.buildString());

-

-    // List parameter.

-    List<String> values = new ArrayList<String>();

-    builder.setParameter("key", "value0", "value1", "value2");

-    assertEquals("http://google.com?key=value0&key=value1&key=value2",

-        builder.buildString());

-

-    // Remove list parameter.

-    builder.removeParameter("key");

-    assertEquals("http://google.com", builder.buildString());

-

-    // Multiple parameters.

-    builder.setParameter("key0", "value0", "value1", "value2");

-    builder.setParameter("key1", "simpleValue");

-

-    // The order of query params is not defined, so either URL is acceptable.

-    String url = builder.buildString();

-    assertTrue(url.equals("http://google.com?key0=value0&key0=value1&key0=value2&key1=simpleValue")

-        || url.equals("http://google.com?key1=simpleValue&key0=value0&key0=value1&key0=value2"));

-

-    // Empty list of multiple parameters.

-    builder.setParameter("key0", "value0", "value1", "value2");

-    builder.setParameter("key1", "simpleValue");

-    assertTrue(url.equals("http://google.com?key0=value0&key0=value1&key0=value2&key1=simpleValue")

-        || url.equals("http://google.com?key1=simpleValue&key0=value0&key0=value1&key0=value2"));

-  }

-

-  public void testSetParameterToNull() {

-    UrlBuilder builder = new UrlBuilder();

-    builder.setHost("google.com");

-

-    try {

-      builder.setParameter(null, "value");

-      fail("Expected IllegalArgumentException");

-    } catch (IllegalArgumentException e) {

-      // Expected.

-    }

-

-    try {

-      builder.setParameter(null);

-      fail("Expected IllegalArgumentException");

-    } catch (IllegalArgumentException e) {

-      // Expected.

-    }

-

-    try {

-      builder.setParameter("key", new String[0]);

-      fail("Expected IllegalArgumentException");

-    } catch (IllegalArgumentException e) {

-      // Expected.

-    }

-

-    try {

-      builder.setParameter("key", (String[]) null);

-      fail("Expected IllegalArgumentException");

-    } catch (IllegalArgumentException e) {

-      // Expected.

-    }

-

-    // Null values are okay.

-    builder.setParameter("key", (String) null);

-    assertEquals("http://google.com?key=", builder.buildString());

-  }

-

-  public void testSetPath() {

-    UrlBuilder builder = new UrlBuilder();

-    builder.setHost("google.com");

-

-    // Path not specified.

-    assertEquals("http://google.com", builder.buildString());

-

-    // Null path.

-    builder.setPath(null);

-    assertEquals("http://google.com", builder.buildString());

-

-    // Empty path.

-    builder.setPath("");

-    assertEquals("http://google.com", builder.buildString());

-

-    // path/to/file.html

-    builder.setPath("path/to/file.html");

-    assertEquals("http://google.com/path/to/file.html", builder.buildString());

-

-    // /path/to/file.html

-    builder.setPath("/path/to/file.html");

-    assertEquals("http://google.com/path/to/file.html", builder.buildString());

-  }

-

-  public void testSetPort() {

-    UrlBuilder builder = new UrlBuilder();

-    builder.setHost("google.com");

-

-    // Port not specified.

-    assertEquals("http://google.com", builder.buildString());

-

-    // Port 1000.

-    builder.setPort(1000);

-    assertEquals("http://google.com:1000", builder.buildString());

-

-    // PORT_UNSPECIFIED.

-    builder.setPort(UrlBuilder.PORT_UNSPECIFIED);

-    assertEquals("http://google.com", builder.buildString());

-  }

-

-  public void testSetProtocol() {

-    UrlBuilder builder = new UrlBuilder();

-    builder.setHost("google.com");

-

-    // Protocol not specified.

-    assertEquals("http://google.com", builder.buildString());

-

-    // Null host.

-    try {

-      builder.setProtocol(null);

-      fail("Expected IllegalArgumentException");

-    } catch (IllegalArgumentException e) {

-      // Expected.

-    }

-

-    // Empty host.

-    try {

-      builder.setProtocol("");

-      fail("Expected IllegalArgumentException");

-    } catch (IllegalArgumentException e) {

-      // Expected.

-    }

-

-    // ftp

-    builder.setProtocol("ftp");

-    assertEquals("ftp://google.com", builder.buildString());

-

-    // tcp:

-    builder.setProtocol("tcp:");

-    assertEquals("tcp://google.com", builder.buildString());

-

-    // http:/

-    builder.setProtocol("http:/");

-    assertEquals("http://google.com", builder.buildString());

-

-    // http://

-    builder.setProtocol("http://");

-    assertEquals("http://google.com", builder.buildString());

-  }

-}

+/*
+ * Copyright 2009 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.http.client;
+
+import com.google.gwt.junit.client.GWTTestCase;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Test Case for {@link UrlBuilder}.
+ */
+public class UrlBuilderTest extends GWTTestCase {
+
+  @Override
+  public String getModuleName() {
+    return "com.google.gwt.http.HttpSuite";
+  }
+
+  /**
+   * Test that the URL is encoded correctly.
+   */
+  public void testBuildStringEncode() {
+    UrlBuilder builder = new UrlBuilder();
+    builder.setHost("google.com");
+    builder.setPath("path to file");
+    builder.setParameter("the key", "the value");
+    assertEquals("http://google.com/path%20to%20file?the%20key=the%20value",
+        builder.buildString());
+  }
+
+  public void testBuildStringEntireUrl() {
+    UrlBuilder builder = new UrlBuilder();
+    builder.setHost("google.com");
+
+    // Host only.
+    assertEquals("http://google.com", builder.buildString());
+
+    // Host:Port
+    builder.setPort(100);
+    assertEquals("http://google.com:100", builder.buildString());
+
+    // Host:Port/Path
+    builder.setPath("path/to/file");
+    assertEquals("http://google.com:100/path/to/file", builder.buildString());
+
+    // Host:Port/Path?Param
+    builder.setParameter("key", "value");
+    assertEquals("http://google.com:100/path/to/file?key=value",
+        builder.buildString());
+
+    // Host:Port/Path?Param#Hash
+    builder.setHash("token");
+    assertEquals("http://google.com:100/path/to/file?key=value#token",
+        builder.buildString());
+  }
+
+  public void testBuildStringEntireUrlWithReturns() {
+    UrlBuilder builder = new UrlBuilder();
+    builder.setHost("google.com").setPort(100).setPath("path/to/file").setParameter(
+        "key", "value").setHash("token");
+    assertEquals("http://google.com:100/path/to/file?key=value#token",
+        builder.buildString());
+  }
+
+  public void testBuildStringParts() {
+    UrlBuilder builder = new UrlBuilder();
+    builder.setHost("google.com");
+
+    // Host only.
+    assertEquals("http://google.com", builder.buildString());
+
+    // Host:Port
+    builder.setPort(100);
+    assertEquals("http://google.com:100", builder.buildString());
+    builder.setPort(UrlBuilder.PORT_UNSPECIFIED);
+
+    // Host/Path
+    builder.setPath("path/to/file");
+    assertEquals("http://google.com/path/to/file", builder.buildString());
+    builder.setPath(null);
+
+    // Host?Param
+    builder.setParameter("key", "value");
+    assertEquals("http://google.com?key=value", builder.buildString());
+    builder.removeParameter("key");
+
+    // Host#Hash
+    builder.setHash("token");
+    assertEquals("http://google.com#token", builder.buildString());
+    builder.setHash(null);
+  }
+
+  public void testSetHash() {
+    UrlBuilder builder = new UrlBuilder();
+    builder.setHost("google.com");
+
+    // Hash not specified
+    assertEquals("http://google.com", builder.buildString());
+
+    // # added if not present
+    builder.setHash("myHash");
+    assertEquals("http://google.com#myHash", builder.buildString());
+
+    // Null hash
+    builder.setHash(null);
+    assertEquals("http://google.com", builder.buildString());
+
+    // # not added if present
+    builder.setHash("#myHash2");
+    assertEquals("http://google.com#myHash2", builder.buildString());
+  }
+
+  public void testSetHost() {
+    UrlBuilder builder = new UrlBuilder();
+
+    // Host not specified.
+    assertEquals("http://", builder.buildString());
+
+    // Null host.
+    builder.setHost(null);
+    assertEquals("http://", builder.buildString());
+
+    // Empty host.
+    builder.setHost("");
+    assertEquals("http://", builder.buildString());
+
+    // google.com
+    builder.setHost("google.com");
+    assertEquals("http://google.com", builder.buildString());
+
+    // google.com:80
+    builder.setHost("google.com:80");
+    assertEquals("http://google.com:80", builder.buildString());
+
+    // google.com:80 with overridden port.
+    builder.setHost("google.com:80");
+    builder.setPort(1000);
+    assertEquals("http://google.com:1000", builder.buildString());
+
+    // google.com:80 with overridden port in host.
+    builder.setPort(1000);
+    builder.setHost("google.com:80");
+    assertEquals("http://google.com:80", builder.buildString());
+
+    // Specify to many ports.
+    // google.com:80:90
+    try {
+      builder.setHost("google.com:80:90");
+      fail("Expected IllegalArgumentException");
+    } catch (IllegalArgumentException e) {
+      // Expected.
+    }
+
+    // Specify invalid port.
+    // google.com:test
+    try {
+      builder.setHost("google.com:test");
+      fail("Expected IllegalArgumentException");
+    } catch (IllegalArgumentException e) {
+      // Expected.
+    }
+  }
+
+  public void testSetParameter() {
+    UrlBuilder builder = new UrlBuilder();
+    builder.setHost("google.com");
+
+    // Parameters not specified.
+    assertEquals("http://google.com", builder.buildString());
+
+    // Simple parameter.
+    builder.setParameter("key", "value");
+    assertEquals("http://google.com?key=value", builder.buildString());
+
+    // Remove simple parameter.
+    builder.removeParameter("key");
+    assertEquals("http://google.com", builder.buildString());
+
+    // List parameter.
+    List<String> values = new ArrayList<String>();
+    builder.setParameter("key", "value0", "value1", "value2");
+    assertEquals("http://google.com?key=value0&key=value1&key=value2",
+        builder.buildString());
+
+    // Remove list parameter.
+    builder.removeParameter("key");
+    assertEquals("http://google.com", builder.buildString());
+
+    // Multiple parameters.
+    builder.setParameter("key0", "value0", "value1", "value2");
+    builder.setParameter("key1", "simpleValue");
+
+    // The order of query params is not defined, so either URL is acceptable.
+    String url = builder.buildString();
+    assertTrue(url.equals("http://google.com?key0=value0&key0=value1&key0=value2&key1=simpleValue")
+        || url.equals("http://google.com?key1=simpleValue&key0=value0&key0=value1&key0=value2"));
+
+    // Empty list of multiple parameters.
+    builder.setParameter("key0", "value0", "value1", "value2");
+    builder.setParameter("key1", "simpleValue");
+    assertTrue(url.equals("http://google.com?key0=value0&key0=value1&key0=value2&key1=simpleValue")
+        || url.equals("http://google.com?key1=simpleValue&key0=value0&key0=value1&key0=value2"));
+  }
+
+  public void testSetParameterToNull() {
+    UrlBuilder builder = new UrlBuilder();
+    builder.setHost("google.com");
+
+    try {
+      builder.setParameter(null, "value");
+      fail("Expected IllegalArgumentException");
+    } catch (IllegalArgumentException e) {
+      // Expected.
+    }
+
+    try {
+      builder.setParameter(null);
+      fail("Expected IllegalArgumentException");
+    } catch (IllegalArgumentException e) {
+      // Expected.
+    }
+
+    try {
+      builder.setParameter("key", new String[0]);
+      fail("Expected IllegalArgumentException");
+    } catch (IllegalArgumentException e) {
+      // Expected.
+    }
+
+    try {
+      builder.setParameter("key", (String[]) null);
+      fail("Expected IllegalArgumentException");
+    } catch (IllegalArgumentException e) {
+      // Expected.
+    }
+
+    // Null values are okay.
+    builder.setParameter("key", (String) null);
+    assertEquals("http://google.com?key=", builder.buildString());
+  }
+
+  public void testSetPath() {
+    UrlBuilder builder = new UrlBuilder();
+    builder.setHost("google.com");
+
+    // Path not specified.
+    assertEquals("http://google.com", builder.buildString());
+
+    // Null path.
+    builder.setPath(null);
+    assertEquals("http://google.com", builder.buildString());
+
+    // Empty path.
+    builder.setPath("");
+    assertEquals("http://google.com", builder.buildString());
+
+    // path/to/file.html
+    builder.setPath("path/to/file.html");
+    assertEquals("http://google.com/path/to/file.html", builder.buildString());
+
+    // /path/to/file.html
+    builder.setPath("/path/to/file.html");
+    assertEquals("http://google.com/path/to/file.html", builder.buildString());
+  }
+
+  public void testSetPort() {
+    UrlBuilder builder = new UrlBuilder();
+    builder.setHost("google.com");
+
+    // Port not specified.
+    assertEquals("http://google.com", builder.buildString());
+
+    // Port 1000.
+    builder.setPort(1000);
+    assertEquals("http://google.com:1000", builder.buildString());
+
+    // PORT_UNSPECIFIED.
+    builder.setPort(UrlBuilder.PORT_UNSPECIFIED);
+    assertEquals("http://google.com", builder.buildString());
+  }
+
+  public void testSetProtocol() {
+    UrlBuilder builder = new UrlBuilder();
+    builder.setHost("google.com");
+
+    // Protocol not specified.
+    assertEquals("http://google.com", builder.buildString());
+
+    // Null host.
+    try {
+      builder.setProtocol(null);
+      fail("Expected IllegalArgumentException");
+    } catch (IllegalArgumentException e) {
+      // Expected.
+    }
+
+    // Empty host.
+    try {
+      builder.setProtocol("");
+      fail("Expected IllegalArgumentException");
+    } catch (IllegalArgumentException e) {
+      // Expected.
+    }
+
+    // ftp
+    builder.setProtocol("ftp");
+    assertEquals("ftp://google.com", builder.buildString());
+
+    // tcp:
+    builder.setProtocol("tcp:");
+    assertEquals("tcp://google.com", builder.buildString());
+
+    // http:/
+    builder.setProtocol("http:/");
+    assertEquals("http://google.com", builder.buildString());
+
+    // http://
+    builder.setProtocol("http://");
+    assertEquals("http://google.com", builder.buildString());
+  }
+}
diff --git a/user/test/com/google/gwt/i18n/client/NumberFormatBenchmark.java b/user/test/com/google/gwt/i18n/client/NumberFormatBenchmark.java
index 01de5ff..c519a84 100644
--- a/user/test/com/google/gwt/i18n/client/NumberFormatBenchmark.java
+++ b/user/test/com/google/gwt/i18n/client/NumberFormatBenchmark.java
@@ -1,55 +1,55 @@
-/*

- * 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.i18n.client;

-

-import com.google.gwt.benchmarks.client.Benchmark;

-import com.google.gwt.benchmarks.client.IntRange;

-import com.google.gwt.benchmarks.client.Operator;

-import com.google.gwt.benchmarks.client.RangeField;

-

-/**

- * Benchmark for number format.

- */

-public class NumberFormatBenchmark extends Benchmark {

-  final IntRange sizeRange = new IntRange(50, 2000, Operator.ADD, 50);

-

-  /**

-   * Must refer to a valid module that inherits from com.google.gwt.junit.JUnit.

-   */

-  @Override

-  public String getModuleName() {

-    return "com.google.gwt.i18n.I18N";

-  }

-

-  // Required for JUnit

-  public void testCurrency() {

-  }

-

-  /**

-   * Basic test of currency format.

-   * 

-   * @param size the size

-   */

-  public void testCurrency(@RangeField("sizeRange")

-  Integer size) {

-    NumberFormat format = NumberFormat.getCurrencyFormat();

-    int limit = size.intValue();

-    for (int i = 0; i < limit; i++) {

-      format.format(i);

-    }

-  }

-}

+/*
+ * 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.i18n.client;
+
+import com.google.gwt.benchmarks.client.Benchmark;
+import com.google.gwt.benchmarks.client.IntRange;
+import com.google.gwt.benchmarks.client.Operator;
+import com.google.gwt.benchmarks.client.RangeField;
+
+/**
+ * Benchmark for number format.
+ */
+public class NumberFormatBenchmark extends Benchmark {
+  final IntRange sizeRange = new IntRange(50, 2000, Operator.ADD, 50);
+
+  /**
+   * Must refer to a valid module that inherits from com.google.gwt.junit.JUnit.
+   */
+  @Override
+  public String getModuleName() {
+    return "com.google.gwt.i18n.I18N";
+  }
+
+  // Required for JUnit
+  public void testCurrency() {
+  }
+
+  /**
+   * Basic test of currency format.
+   * 
+   * @param size the size
+   */
+  public void testCurrency(@RangeField("sizeRange")
+  Integer size) {
+    NumberFormat format = NumberFormat.getCurrencyFormat();
+    int limit = size.intValue();
+    for (int i = 0; i < limit; i++) {
+      format.format(i);
+    }
+  }
+}
diff --git a/user/test/com/google/gwt/user/client/ui/FileUploadTest.java b/user/test/com/google/gwt/user/client/ui/FileUploadTest.java
index 8663d03..ecdb772 100644
--- a/user/test/com/google/gwt/user/client/ui/FileUploadTest.java
+++ b/user/test/com/google/gwt/user/client/ui/FileUploadTest.java
@@ -1,38 +1,38 @@
-/*

- * Copyright 2009 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.user.client.ui;

-

-import com.google.gwt.junit.client.GWTTestCase;

-

-/**

- * Tests for {@link FileUpload}.

- * 

- */

-public class FileUploadTest extends GWTTestCase {

-

-  public String getModuleName() {

-    return "com.google.gwt.user.User";

-  }

-

-  public void testDisable() {

-    FileUpload fileUpload = new FileUpload();

-    assertTrue(fileUpload.isEnabled());

-    fileUpload.setEnabled(false);

-    assertFalse(fileUpload.isEnabled());

-    fileUpload.setEnabled(true);

-    assertTrue(fileUpload.isEnabled());

-  }

-}

+/*
+ * Copyright 2009 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.user.client.ui;
+
+import com.google.gwt.junit.client.GWTTestCase;
+
+/**
+ * Tests for {@link FileUpload}.
+ * 
+ */
+public class FileUploadTest extends GWTTestCase {
+
+  public String getModuleName() {
+    return "com.google.gwt.user.User";
+  }
+
+  public void testDisable() {
+    FileUpload fileUpload = new FileUpload();
+    assertTrue(fileUpload.isEnabled());
+    fileUpload.setEnabled(false);
+    assertFalse(fileUpload.isEnabled());
+    fileUpload.setEnabled(true);
+    assertTrue(fileUpload.isEnabled());
+  }
+}
diff --git a/user/test/com/google/gwt/user/client/ui/WidgetTest.java b/user/test/com/google/gwt/user/client/ui/WidgetTest.java
index 88f0036..4231ba3 100644
--- a/user/test/com/google/gwt/user/client/ui/WidgetTest.java
+++ b/user/test/com/google/gwt/user/client/ui/WidgetTest.java
@@ -1,175 +1,175 @@
-/*

- * Copyright 2009 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.user.client.ui;

-

-import com.google.gwt.event.dom.client.ChangeEvent;

-import com.google.gwt.event.dom.client.ClickEvent;

-import com.google.gwt.event.dom.client.ClickHandler;

-import com.google.gwt.event.shared.HandlerRegistration;

-import com.google.gwt.junit.client.GWTTestCase;

-

-/**

- * Tests the basic widget infrastructure.

- * 

- */

-public class WidgetTest extends GWTTestCase {

-

-  ClickHandler handlerA = new ClickHandler() {

-

-    public void onClick(ClickEvent event) {

-    }

-  };

-

-  ClickHandler handlerB = new ClickHandler() {

-

-    public void onClick(ClickEvent event) {

-    }

-  };

-

-  @Override

-  public String getModuleName() {

-    return "com.google.gwt.user.User";

-  }

-

-  public void testHandlerCount() {

-    Widget a = new Widget();

-    assertEquals(0, a.getHandlerCount(ClickEvent.getType()));

-    HandlerRegistration r1 = a.addDomHandler(handlerA, ClickEvent.getType());

-    assertEquals(1, a.getHandlerCount(ClickEvent.getType()));

-    HandlerRegistration r2 = a.addHandler(handlerB, ClickEvent.getType());

-    assertEquals(2, a.getHandlerCount(ClickEvent.getType()));

-

-    assertEquals(0, a.getHandlerCount(ChangeEvent.getType()));

-    r1.removeHandler();

-    r2.removeHandler();

-    assertEquals(0, a.getHandlerCount(ClickEvent.getType()));

-  }

-

-  public void testOnAttachWithErrorDoAttachChildren() {

-    // Create a panel that will throw an exception doAttachChildren

-    BadWidget w = new BadWidget();

-    w.setFailAttachChildren(true);

-    assertFalse(w.isAttached());

-    assertNull(w.getParent());

-

-    // Attach the widget.

-    try {

-      RootPanel.get().add(w);

-      fail("Expected AttachDetachException");

-    } catch (AttachDetachException e) {

-      // Expected.

-    }

-    assertTrue(w.isAttached());

-    assertEquals(RootPanel.get(), w.getParent());

-

-    // Detach the widget.

-    RootPanel.get().remove(w);

-    assertFalse(w.isAttached());

-    assertNull(w.getParent());

-  }

-

-  public void testOnAttachWithErrorOnLoad() {

-    // Create a widget that will throw an exception onLoad.

-    BadWidget w = new BadWidget();

-    w.setFailOnLoad(true);

-    assertFalse(w.isAttached());

-    assertNull(w.getParent());

-

-    // Attach the widget.

-    try {

-      RootPanel.get().add(w);

-      fail("Expected IllegalArgumentException");

-    } catch (IllegalArgumentException e) {

-      // Expected.

-    }

-    assertTrue(w.isAttached());

-    assertEquals(RootPanel.get(), w.getParent());

-

-    // Detach the widget.

-    RootPanel.get().remove(w);

-    assertFalse(w.isAttached());

-    assertNull(w.getParent());

-  }

-

-  public void testOnDetachWithErrorDoDetachChildren() {

-    // Create a widget that will throw an exception onUnload.

-    BadWidget w = new BadWidget();

-    w.setFailDetachChildren(true);

-    assertFalse(w.isAttached());

-    assertNull(w.getParent());

-

-    // Attach the widget.

-    RootPanel.get().add(w);

-    assertTrue(w.isAttached());

-    assertEquals(RootPanel.get(), w.getParent());

-

-    // Detach the widget.

-    try {

-      RootPanel.get().remove(w);

-      fail("Expected AttachDetachException");

-    } catch (AttachDetachException e) {

-      // Expected.

-    }

-    assertFalse(w.isAttached());

-    assertNull(w.getParent());

-  }

-

-  public void testOnDetachWithErrorOnUnload() {

-    // Create a widget that will throw an exception onUnload.

-    BadWidget w = new BadWidget();

-    w.setFailOnUnload(true);

-    assertFalse(w.isAttached());

-    assertNull(w.getParent());

-

-    // Attach the widget.

-    RootPanel.get().add(w);

-    assertTrue(w.isAttached());

-    assertEquals(RootPanel.get(), w.getParent());

-

-    // Detach the widget.

-    try {

-      RootPanel.get().remove(w);

-      fail("Expected IllegalArgumentException");

-    } catch (IllegalArgumentException e) {

-      // Expected.

-    }

-    assertFalse(w.isAttached());

-    assertNull(w.getParent());

-  }

-

-  public void testSetParentWithErrorOnUnload() {

-    // Create a widget that will throw an exception onUnload.

-    BadWidget w = new BadWidget();

-    w.setFailOnUnload(true);

-    assertFalse(w.isAttached());

-    assertNull(w.getParent());

-

-    // Attach the widget.

-    RootPanel.get().add(w);

-    assertTrue(w.isAttached());

-    assertEquals(RootPanel.get(), w.getParent());

-

-    // Detach the widget.

-    try {

-      w.removeFromParent();

-      fail("Expected IllegalArgumentException");

-    } catch (IllegalArgumentException e) {

-      // Expected.

-    }

-    assertFalse(w.isAttached());

-    assertNull(w.getParent());

-  }

-}

+/*
+ * Copyright 2009 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.user.client.ui;
+
+import com.google.gwt.event.dom.client.ChangeEvent;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.gwt.junit.client.GWTTestCase;
+
+/**
+ * Tests the basic widget infrastructure.
+ * 
+ */
+public class WidgetTest extends GWTTestCase {
+
+  ClickHandler handlerA = new ClickHandler() {
+
+    public void onClick(ClickEvent event) {
+    }
+  };
+
+  ClickHandler handlerB = new ClickHandler() {
+
+    public void onClick(ClickEvent event) {
+    }
+  };
+
+  @Override
+  public String getModuleName() {
+    return "com.google.gwt.user.User";
+  }
+
+  public void testHandlerCount() {
+    Widget a = new Widget();
+    assertEquals(0, a.getHandlerCount(ClickEvent.getType()));
+    HandlerRegistration r1 = a.addDomHandler(handlerA, ClickEvent.getType());
+    assertEquals(1, a.getHandlerCount(ClickEvent.getType()));
+    HandlerRegistration r2 = a.addHandler(handlerB, ClickEvent.getType());
+    assertEquals(2, a.getHandlerCount(ClickEvent.getType()));
+
+    assertEquals(0, a.getHandlerCount(ChangeEvent.getType()));
+    r1.removeHandler();
+    r2.removeHandler();
+    assertEquals(0, a.getHandlerCount(ClickEvent.getType()));
+  }
+
+  public void testOnAttachWithErrorDoAttachChildren() {
+    // Create a panel that will throw an exception doAttachChildren
+    BadWidget w = new BadWidget();
+    w.setFailAttachChildren(true);
+    assertFalse(w.isAttached());
+    assertNull(w.getParent());
+
+    // Attach the widget.
+    try {
+      RootPanel.get().add(w);
+      fail("Expected AttachDetachException");
+    } catch (AttachDetachException e) {
+      // Expected.
+    }
+    assertTrue(w.isAttached());
+    assertEquals(RootPanel.get(), w.getParent());
+
+    // Detach the widget.
+    RootPanel.get().remove(w);
+    assertFalse(w.isAttached());
+    assertNull(w.getParent());
+  }
+
+  public void testOnAttachWithErrorOnLoad() {
+    // Create a widget that will throw an exception onLoad.
+    BadWidget w = new BadWidget();
+    w.setFailOnLoad(true);
+    assertFalse(w.isAttached());
+    assertNull(w.getParent());
+
+    // Attach the widget.
+    try {
+      RootPanel.get().add(w);
+      fail("Expected IllegalArgumentException");
+    } catch (IllegalArgumentException e) {
+      // Expected.
+    }
+    assertTrue(w.isAttached());
+    assertEquals(RootPanel.get(), w.getParent());
+
+    // Detach the widget.
+    RootPanel.get().remove(w);
+    assertFalse(w.isAttached());
+    assertNull(w.getParent());
+  }
+
+  public void testOnDetachWithErrorDoDetachChildren() {
+    // Create a widget that will throw an exception onUnload.
+    BadWidget w = new BadWidget();
+    w.setFailDetachChildren(true);
+    assertFalse(w.isAttached());
+    assertNull(w.getParent());
+
+    // Attach the widget.
+    RootPanel.get().add(w);
+    assertTrue(w.isAttached());
+    assertEquals(RootPanel.get(), w.getParent());
+
+    // Detach the widget.
+    try {
+      RootPanel.get().remove(w);
+      fail("Expected AttachDetachException");
+    } catch (AttachDetachException e) {
+      // Expected.
+    }
+    assertFalse(w.isAttached());
+    assertNull(w.getParent());
+  }
+
+  public void testOnDetachWithErrorOnUnload() {
+    // Create a widget that will throw an exception onUnload.
+    BadWidget w = new BadWidget();
+    w.setFailOnUnload(true);
+    assertFalse(w.isAttached());
+    assertNull(w.getParent());
+
+    // Attach the widget.
+    RootPanel.get().add(w);
+    assertTrue(w.isAttached());
+    assertEquals(RootPanel.get(), w.getParent());
+
+    // Detach the widget.
+    try {
+      RootPanel.get().remove(w);
+      fail("Expected IllegalArgumentException");
+    } catch (IllegalArgumentException e) {
+      // Expected.
+    }
+    assertFalse(w.isAttached());
+    assertNull(w.getParent());
+  }
+
+  public void testSetParentWithErrorOnUnload() {
+    // Create a widget that will throw an exception onUnload.
+    BadWidget w = new BadWidget();
+    w.setFailOnUnload(true);
+    assertFalse(w.isAttached());
+    assertNull(w.getParent());
+
+    // Attach the widget.
+    RootPanel.get().add(w);
+    assertTrue(w.isAttached());
+    assertEquals(RootPanel.get(), w.getParent());
+
+    // Detach the widget.
+    try {
+      w.removeFromParent();
+      fail("Expected IllegalArgumentException");
+    } catch (IllegalArgumentException e) {
+      // Expected.
+    }
+    assertFalse(w.isAttached());
+    assertNull(w.getParent());
+  }
+}
diff --git a/user/test/com/google/gwt/user/client/ui/WidgetTestBase.java b/user/test/com/google/gwt/user/client/ui/WidgetTestBase.java
index 6204ef4..f436546 100644
--- a/user/test/com/google/gwt/user/client/ui/WidgetTestBase.java
+++ b/user/test/com/google/gwt/user/client/ui/WidgetTestBase.java
@@ -1,40 +1,40 @@
-/*

- * Copyright 2009 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.user.client.ui;

-

-import com.google.gwt.junit.client.GWTTestCase;

-

-/**

- * Convenience class to use user module and a default tear down code for widget

- * tests.

- */

-public class WidgetTestBase extends GWTTestCase {

-  @Override

-  public String getModuleName() {

-    return "com.google.gwt.user.User";

-  }

-

-  /**

-   * A replacement for JUnit's {@link #tearDown()} method. This method runs once

-   * per test method in your subclass, just after your each test method runs and

-   * can be used to perform cleanup. Override this method instead of

-   * {@link #tearDown()}.

-   */

-  @Override

-  protected void gwtTearDown() throws Exception {

-    RootPanel.get().clear();

-  }

-}

+/*
+ * Copyright 2009 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.user.client.ui;
+
+import com.google.gwt.junit.client.GWTTestCase;
+
+/**
+ * Convenience class to use user module and a default tear down code for widget
+ * tests.
+ */
+public class WidgetTestBase extends GWTTestCase {
+  @Override
+  public String getModuleName() {
+    return "com.google.gwt.user.User";
+  }
+
+  /**
+   * A replacement for JUnit's {@link #tearDown()} method. This method runs once
+   * per test method in your subclass, just after your each test method runs and
+   * can be used to perform cleanup. Override this method instead of
+   * {@link #tearDown()}.
+   */
+  @Override
+  protected void gwtTearDown() throws Exception {
+    RootPanel.get().clear();
+  }
+}
diff --git a/user/test/com/google/gwt/user/datepicker/client/DateChangeEventTest.java b/user/test/com/google/gwt/user/datepicker/client/DateChangeEventTest.java
index 7683c67..d2917b3 100644
--- a/user/test/com/google/gwt/user/datepicker/client/DateChangeEventTest.java
+++ b/user/test/com/google/gwt/user/datepicker/client/DateChangeEventTest.java
@@ -1,73 +1,73 @@
-/*

- * 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.user.datepicker.client;

-

-import com.google.gwt.event.logical.shared.ValueChangeEvent;

-import com.google.gwt.event.logical.shared.ValueChangeHandler;

-import com.google.gwt.event.shared.GwtEvent;

-import com.google.gwt.event.shared.HandlerManager;

-import com.google.gwt.event.shared.HandlerRegistration;

-import com.google.gwt.user.client.ui.DateValueChangeTester;

-import com.google.gwt.user.client.ui.HasValue;

-

-import junit.framework.TestCase;

-

-import java.util.Date;

-

-/**

- * Test the DateChangeEvent in isolation from GWT.

- */

-public class DateChangeEventTest extends TestCase {

-

-  private static class MockWidget implements HasValue<Date> {

-    private final HandlerManager handlers = new HandlerManager(this);

-    private Date value;

-

-    public HandlerRegistration addValueChangeHandler(

-        ValueChangeHandler<Date> handler) {

-      return handlers.addHandler(ValueChangeEvent.getType(), handler);

-    }

-

-    public void fireEvent(GwtEvent<?> event) {

-      handlers.fireEvent(event);

-    }

-

-    public HandlerManager getHandlers() {

-      return handlers;

-    }

-

-    public Date getValue() {

-      return value;

-    }

-

-    public void setValue(Date value) {

-      setValue(value, false);

-    }

-

-    public void setValue(Date value, boolean fireEvents) {

-      Date oldValue = this.value;

-      this.value = value;

-      if (fireEvents) {

-        DateChangeEvent.fireIfNotEqualDates(this, oldValue, value);

-      }

-    }

-  }

-

-  public void testValueChangeViaHasValue() {

-    new DateValueChangeTester(new MockWidget()).run();

-  }

-}

+/*
+ * 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.user.datepicker.client;
+
+import com.google.gwt.event.logical.shared.ValueChangeEvent;
+import com.google.gwt.event.logical.shared.ValueChangeHandler;
+import com.google.gwt.event.shared.GwtEvent;
+import com.google.gwt.event.shared.HandlerManager;
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.gwt.user.client.ui.DateValueChangeTester;
+import com.google.gwt.user.client.ui.HasValue;
+
+import junit.framework.TestCase;
+
+import java.util.Date;
+
+/**
+ * Test the DateChangeEvent in isolation from GWT.
+ */
+public class DateChangeEventTest extends TestCase {
+
+  private static class MockWidget implements HasValue<Date> {
+    private final HandlerManager handlers = new HandlerManager(this);
+    private Date value;
+
+    public HandlerRegistration addValueChangeHandler(
+        ValueChangeHandler<Date> handler) {
+      return handlers.addHandler(ValueChangeEvent.getType(), handler);
+    }
+
+    public void fireEvent(GwtEvent<?> event) {
+      handlers.fireEvent(event);
+    }
+
+    public HandlerManager getHandlers() {
+      return handlers;
+    }
+
+    public Date getValue() {
+      return value;
+    }
+
+    public void setValue(Date value) {
+      setValue(value, false);
+    }
+
+    public void setValue(Date value, boolean fireEvents) {
+      Date oldValue = this.value;
+      this.value = value;
+      if (fireEvents) {
+        DateChangeEvent.fireIfNotEqualDates(this, oldValue, value);
+      }
+    }
+  }
+
+  public void testValueChangeViaHasValue() {
+    new DateValueChangeTester(new MockWidget()).run();
+  }
+}