Repository: cassandra
Updated Branches:
  refs/heads/trunk a808769fc -> 9bfe61357


Make Stress compiles within eclipse

patch by Benjamin Lerer; reviewed by Jake Luciani for CASSANDRA-10807


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/9b30d657
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/9b30d657
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/9b30d657

Branch: refs/heads/trunk
Commit: 9b30d6572fdb988796788ad4c7b8daabdef4e961
Parents: dff2214
Author: Benjamin Lerer <b.le...@gmail.com>
Authored: Mon Dec 14 10:17:50 2015 +0100
Committer: Benjamin Lerer <b.le...@gmail.com>
Committed: Mon Dec 14 10:22:30 2015 +0100

----------------------------------------------------------------------
 CHANGES.txt                                            |  1 +
 .../cassandra/stress/generate/values/Generator.java    |  4 ++--
 .../apache/cassandra/stress/generate/values/Lists.java | 13 +++++++------
 .../apache/cassandra/stress/generate/values/Sets.java  | 10 +++++-----
 4 files changed, 15 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/9b30d657/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 96f2f4f..091ac52 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.1.13
+ * Make Stress compiles within eclipse (CASSANDRA-10807)
  * Cassandra Daemon should print JVM arguments (CASSANDRA-10764)
  * Allow cancellation of index summary redistribution (CASSANDRA-8805)
  * Disable reloading of GossipingPropertyFileSnitch (CASSANDRA-9474)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/9b30d657/tools/stress/src/org/apache/cassandra/stress/generate/values/Generator.java
----------------------------------------------------------------------
diff --git 
a/tools/stress/src/org/apache/cassandra/stress/generate/values/Generator.java 
b/tools/stress/src/org/apache/cassandra/stress/generate/values/Generator.java
index 00f866a..6b39d08 100644
--- 
a/tools/stress/src/org/apache/cassandra/stress/generate/values/Generator.java
+++ 
b/tools/stress/src/org/apache/cassandra/stress/generate/values/Generator.java
@@ -31,13 +31,13 @@ public abstract class Generator<T>
 
     public final String name;
     public final AbstractType<T> type;
-    public final Class<T> clazz;
+    public final Class<?> clazz;
     final long salt;
     final Distribution identityDistribution;
     final Distribution sizeDistribution;
     public final Distribution clusteringDistribution;
 
-    public Generator(AbstractType<T> type, GeneratorConfig config, String 
name, Class<T> clazz)
+    public Generator(AbstractType<T> type, GeneratorConfig config, String 
name, Class<?> clazz)
     {
         this.type = type;
         this.name = name;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/9b30d657/tools/stress/src/org/apache/cassandra/stress/generate/values/Lists.java
----------------------------------------------------------------------
diff --git 
a/tools/stress/src/org/apache/cassandra/stress/generate/values/Lists.java 
b/tools/stress/src/org/apache/cassandra/stress/generate/values/Lists.java
index bfa58ea..d82e01f 100644
--- a/tools/stress/src/org/apache/cassandra/stress/generate/values/Lists.java
+++ b/tools/stress/src/org/apache/cassandra/stress/generate/values/Lists.java
@@ -26,16 +26,17 @@ import java.util.List;
 
 import org.apache.cassandra.db.marshal.ListType;
 
-public class Lists extends Generator<List>
+public class Lists<T> extends Generator<List<T>>
 {
-    final Generator valueType;
-    final Object[] buffer;
+    final Generator<T> valueType;
+    final T[] buffer;
 
-    public Lists(String name, Generator valueType, GeneratorConfig config)
+    @SuppressWarnings("unchecked")
+    public Lists(String name, Generator<T> valueType, GeneratorConfig config)
     {
         super(ListType.getInstance(valueType.type, true), config, name, 
List.class);
         this.valueType = valueType;
-        buffer = new Object[(int) sizeDistribution.maxValue()];
+        buffer = (T[]) new Object[(int) sizeDistribution.maxValue()];
     }
 
     public void setSeed(long seed)
@@ -45,7 +46,7 @@ public class Lists extends Generator<List>
     }
 
     @Override
-    public List generate()
+    public List<T> generate()
     {
         int size = (int) sizeDistribution.next();
         for (int i = 0 ; i < size ; i++)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/9b30d657/tools/stress/src/org/apache/cassandra/stress/generate/values/Sets.java
----------------------------------------------------------------------
diff --git 
a/tools/stress/src/org/apache/cassandra/stress/generate/values/Sets.java 
b/tools/stress/src/org/apache/cassandra/stress/generate/values/Sets.java
index 5c17b4e..b74d6b2 100644
--- a/tools/stress/src/org/apache/cassandra/stress/generate/values/Sets.java
+++ b/tools/stress/src/org/apache/cassandra/stress/generate/values/Sets.java
@@ -26,11 +26,11 @@ import java.util.Set;
 
 import org.apache.cassandra.db.marshal.SetType;
 
-public class Sets extends Generator<Set>
+public class Sets<T> extends Generator<Set<T>>
 {
-    final Generator valueType;
+    final Generator<T> valueType;
 
-    public Sets(String name, Generator valueType, GeneratorConfig config)
+    public Sets(String name, Generator<T> valueType, GeneratorConfig config)
     {
         super(SetType.getInstance(valueType.type, true), config, name, 
Set.class);
         this.valueType = valueType;
@@ -43,9 +43,9 @@ public class Sets extends Generator<Set>
     }
 
     @Override
-    public Set generate()
+    public Set<T> generate()
     {
-        final Set set = new HashSet();
+        final Set<T> set = new HashSet<T>();
         int size = (int) sizeDistribution.next();
         for (int i = 0 ; i < size ; i++)
             set.add(valueType.generate());

Reply via email to