- Removed the deprecated Range interface; since we're breaking everyone anyway, there's little point in leaving this class around.
- Fixed a bug in BenchmarkGenerator where argumented test method without a no-arg peer would cause invalid code to be generated.
- Added some disabled tests to BenchmarkTest as placeholders for future fixes.

Review by: tobyr (desk check)


git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@1946 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/javadoc/com/google/gwt/examples/benchmarks/ArrayListAndVectorBenchmark.java b/user/javadoc/com/google/gwt/examples/benchmarks/ArrayListAndVectorBenchmark.java
index 5ed5465..65f620e 100644
--- a/user/javadoc/com/google/gwt/examples/benchmarks/ArrayListAndVectorBenchmark.java
+++ b/user/javadoc/com/google/gwt/examples/benchmarks/ArrayListAndVectorBenchmark.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Google Inc.
+ * 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
@@ -18,7 +18,6 @@
 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.Range;
 
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -46,13 +45,13 @@
     public static final Position NONE = new Position("no location specified");
     public static final Position VARIED = new Position("in varied locations");
 
-    public static final Range positions = new Range() {
+    public static final Iterable positions = new Iterable() {
       public Iterator iterator() {
         return Arrays.asList(new Position[] {BEGIN, END, NONE, VARIED}).iterator();
       }
     };
 
-    public static final Range positions2 = new Range() {
+    public static final Iterable positions2 = new Iterable() {
       public Iterator iterator() {
         return Arrays.asList(new Position[] {BEGIN, END, VARIED}).iterator();
       }
diff --git a/user/src/com/google/gwt/benchmarks/client/IntRange.java b/user/src/com/google/gwt/benchmarks/client/IntRange.java
index 0daf451..b3292a5 100644
--- a/user/src/com/google/gwt/benchmarks/client/IntRange.java
+++ b/user/src/com/google/gwt/benchmarks/client/IntRange.java
@@ -20,7 +20,7 @@
  * benchmarks to supply a range of values over an integral parameter, such as
  * size or length.
  */
-public class IntRange implements Range<Integer> {
+public class IntRange implements Iterable<Integer> {
 
   /**
    * Implementation of the Iterator.
diff --git a/user/src/com/google/gwt/benchmarks/client/Range.java b/user/src/com/google/gwt/benchmarks/client/Range.java
deleted file mode 100644
index b4d21fd..0000000
--- a/user/src/com/google/gwt/benchmarks/client/Range.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright 2008 Google Inc.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.google.gwt.benchmarks.client;
-
-/**
- * A range of values for a Benchmark parameter.
- * 
- * A Range produces an Iterator that contains all of the values that a Benchmark
- * parameter should be tested over.
- * 
- * @param <T> the type that this range contains
- * @deprecated This class was introduced before JDK 1.5 support. Just use
- *             {@link Iterable}.
- */
-public interface Range<T> extends Iterable<T> {
-}
diff --git a/user/src/com/google/gwt/benchmarks/rebind/BenchmarkGenerator.java b/user/src/com/google/gwt/benchmarks/rebind/BenchmarkGenerator.java
index 6413c5d..3174958 100644
--- a/user/src/com/google/gwt/benchmarks/rebind/BenchmarkGenerator.java
+++ b/user/src/com/google/gwt/benchmarks/rebind/BenchmarkGenerator.java
@@ -101,8 +101,11 @@
     Map<String, JMethod> notOverloadedMethods = new HashMap<String, JMethod>();
     for (Map.Entry<String, List<JMethod>> entry : methods.entrySet()) {
       List<JMethod> methodOverloads = entry.getValue();
-      if (methodOverloads.size() <= 1) {
-        notOverloadedMethods.put(entry.getKey(), methodOverloads.get(0));
+      if (methodOverloads.size() == 1) {
+        JMethod overload = methodOverloads.get(0);
+        if (overload.getParameters().length == 0) {
+          notOverloadedMethods.put(entry.getKey(), overload);
+        }
       }
     }
 
diff --git a/user/test/com/google/gwt/emultest/java/util/HashMapBenchmark.java b/user/test/com/google/gwt/emultest/java/util/HashMapBenchmark.java
index 50653ea..dca32f7 100644
--- a/user/test/com/google/gwt/emultest/java/util/HashMapBenchmark.java
+++ b/user/test/com/google/gwt/emultest/java/util/HashMapBenchmark.java
@@ -18,7 +18,6 @@
 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.Range;
 import com.google.gwt.benchmarks.client.RangeField;
 import com.google.gwt.benchmarks.client.Setup;
 
@@ -29,10 +28,10 @@
  */
 public class HashMapBenchmark extends Benchmark {
 
-  protected Range baseRange = new IntRange(32, Integer.MAX_VALUE,
+  protected IntRange baseRange = new IntRange(32, Integer.MAX_VALUE,
       Operator.MULTIPLY, 2);
 
-  protected Range containsRange = new IntRange(10, 200, Operator.ADD, 20);
+  protected IntRange containsRange = new IntRange(10, 200, Operator.ADD, 20);
 
   private HashMap<Object, Object> map;
 
diff --git a/user/test/com/google/gwt/junit/client/BenchmarkTest.java b/user/test/com/google/gwt/junit/client/BenchmarkTest.java
index 7540ec9..a5260c8 100644
--- a/user/test/com/google/gwt/junit/client/BenchmarkTest.java
+++ b/user/test/com/google/gwt/junit/client/BenchmarkTest.java
@@ -18,6 +18,7 @@
 
 import com.google.gwt.benchmarks.client.Benchmark;
 import com.google.gwt.benchmarks.client.IntRange;
+import com.google.gwt.benchmarks.client.IterationTimeLimit;
 import com.google.gwt.benchmarks.client.Operator;
 import com.google.gwt.benchmarks.client.RangeEnum;
 import com.google.gwt.benchmarks.client.RangeField;
@@ -49,10 +50,51 @@
   final IntRange veryLargeRange = new IntRange(0, Integer.MAX_VALUE,
       Operator.ADD, 1);
 
+  public void disabledTestTimeLimit() {
+  }
+
+  /**
+   * Tests {@link @IterationTimeLimit}.
+   * 
+   * <p>
+   * TODO(tobyr) Disabled, because it can hang some browsers (Safari at least)
+   * TimeLimits work in general (as evidenced by working benchmarks), but
+   * there's something peculiar about this test causing problems.
+   * </p>
+   * 
+   * @param numIterations
+   */
+  @IterationTimeLimit(1L)
+  public void disabledTestTimeLimit(@RangeField("veryLargeRange")
+  Integer numIterations) {
+
+    somethingExpensive();
+
+    // Make sure we hit the time limit, instead of running through all
+    // iterations.
+    assertTrue(numIterations < Integer.MAX_VALUE);
+  }
+
   public String getModuleName() {
     return "com.google.gwt.junit.JUnit";
   }
 
+  public void disableTestAutoboxing() {
+  }
+
+  /**
+   * Tests that autoboxing works correctly.
+   * 
+   * <p>
+   * TODO(tobyr): this causes the generated code to not compile; should probably
+   * be a warning or error if autoboxing args isn't supported.
+   * </p>
+   */
+  public void disableTestAutoboxing(@SuppressWarnings("unused")
+  @RangeField("intRange")
+  int value) {
+  }
+
   public void testEnumRange() {
   }
 
@@ -100,27 +142,14 @@
     stateString = "running";
   }
 
-  public void testTimeLimit() {
-  }
-
   /**
-   * Tests {@link @IterationTimeLimit}.
-   * 
-   * @param numIterations
+   * Tests that this method without a corresponding zero-arg method won't break
+   * the compile.
    */
-// TODO(tobyr) Disabled, because it can hang some browsers (Safari at least)
-// TimeLimits work in general (as evidenced by working benchmarks), but there's 
-// something peculiar about this test causing problems.
-//  @IterationTimeLimit(1L)
-//  public void testTimeLimit(@RangeField("veryLargeRange")
-//  Integer numIterations) {
-//
-//    somethingExpensive();
-//
-//    // Make sure we hit the time limit, instead of running through all
-//    // iterations.
-//    assertTrue(numIterations < Integer.MAX_VALUE);
-//  }
+  public void testStrayMethodCompiles(@SuppressWarnings("unused")
+  @RangeField("intRange")
+  int value) {
+  }
 
   public void testTwoParameterField() {
   }