accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ctubb...@apache.org
Subject [17/28] git commit: ACCUMULO-2386 Fix use of generics
Date Thu, 19 Jun 2014 02:02:05 GMT
ACCUMULO-2386 Fix use of generics


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/1c7975e6
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/1c7975e6
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/1c7975e6

Branch: refs/heads/1.6.1-SNAPSHOT
Commit: 1c7975e6d78eab1ce57fcc560ca92aede13cea46
Parents: 0501edb
Author: Christopher Tubbs <ctubbsii@apache.org>
Authored: Wed Jun 18 21:39:22 2014 -0400
Committer: Christopher Tubbs <ctubbsii@apache.org>
Committed: Wed Jun 18 21:39:22 2014 -0400

----------------------------------------------------------------------
 .../core/iterators/conf/ColumnToClassMapping.java         | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/1c7975e6/core/src/main/java/org/apache/accumulo/core/iterators/conf/ColumnToClassMapping.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/iterators/conf/ColumnToClassMapping.java
b/core/src/main/java/org/apache/accumulo/core/iterators/conf/ColumnToClassMapping.java
index 97f242b..59063d9 100644
--- a/core/src/main/java/org/apache/accumulo/core/iterators/conf/ColumnToClassMapping.java
+++ b/core/src/main/java/org/apache/accumulo/core/iterators/conf/ColumnToClassMapping.java
@@ -56,16 +56,18 @@ public class ColumnToClassMapping<K> {
       
       Pair<Text,Text> pcic = ColumnSet.decodeColumns(column);
       
-      Class<? extends K> clazz;
+      Class<?> clazz;
       if (context != null && !context.equals(""))
-        clazz = (Class<? extends K>) AccumuloVFSClassLoader.getContextManager().getClassLoader(context).loadClass(className);
+        clazz = AccumuloVFSClassLoader.getContextManager().getClassLoader(context).loadClass(className);
       else
         clazz = AccumuloVFSClassLoader.loadClass(className, c);
       
+      @SuppressWarnings("unchecked")
+      K inst = (K) clazz.newInstance();
       if (pcic.getSecond() == null) {
-        addObject(pcic.getFirst(), clazz.newInstance());
+        addObject(pcic.getFirst(), inst);
       } else {
-        addObject(pcic.getFirst(), pcic.getSecond(), clazz.newInstance());
+        addObject(pcic.getFirst(), pcic.getSecond(), inst);
       }
     }
   }


Mime
View raw message