accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ctubb...@apache.org
Subject [06/16] accumulo git commit: ACCUMULO-4386 Fix trivial compiler warnings
Date Fri, 22 Jul 2016 02:59:00 GMT
ACCUMULO-4386 Fix trivial compiler warnings

Fixes a few trivial compiler warnings when building with JDK8

* Unnecessary cast
* Misuse of auxillary class (use of wrong class in logger)
* Use explicit casts for generic arrays, to highlight lack of type
  safety in generic parameters, and avoid warning about missing generic
  parameters


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

Branch: refs/heads/1.6
Commit: dcc5dffc8ee9badddac85b714ca28123b528b264
Parents: 775f67c
Author: Christopher Tubbs <ctubbsii@apache.org>
Authored: Thu Jul 21 22:21:32 2016 -0400
Committer: Christopher Tubbs <ctubbsii@apache.org>
Committed: Thu Jul 21 22:30:06 2016 -0400

----------------------------------------------------------------------
 .../accumulo/core/file/blockfile/cache/TestLruBlockCache.java    | 2 +-
 .../test/java/org/apache/accumulo/core/util/PartitionerTest.java | 4 ++--
 .../accumulo/examples/simple/filedata/ChunkCombinerTest.java     | 2 +-
 .../apache/accumulo/server/zookeeper/DistributedWorkQueue.java   | 2 +-
 .../org/apache/accumulo/master/tableOps/DeleteNamespace.java     | 4 ++--
 .../src/main/java/org/apache/accumulo/tserver/InMemoryMap.java   | 4 ++--
 .../src/main/java/org/apache/accumulo/tserver/NativeMap.java     | 4 ++--
 start/src/main/java/org/apache/accumulo/start/Main.java          | 4 ++--
 8 files changed, 13 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/dcc5dffc/core/src/test/java/org/apache/accumulo/core/file/blockfile/cache/TestLruBlockCache.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/file/blockfile/cache/TestLruBlockCache.java
b/core/src/test/java/org/apache/accumulo/core/file/blockfile/cache/TestLruBlockCache.java
index 15abbaf..c85164f 100644
--- a/core/src/test/java/org/apache/accumulo/core/file/blockfile/cache/TestLruBlockCache.java
+++ b/core/src/test/java/org/apache/accumulo/core/file/blockfile/cache/TestLruBlockCache.java
@@ -460,7 +460,7 @@ public class TestLruBlockCache extends TestCase {
     int numEntries = (int) Math.ceil((1.2) * maxSize / roughBlockSize);
     long totalOverhead = LruBlockCache.CACHE_FIXED_OVERHEAD + ClassSize.CONCURRENT_HASHMAP
+ (numEntries * ClassSize.CONCURRENT_HASHMAP_ENTRY)
         + (LruBlockCache.DEFAULT_CONCURRENCY_LEVEL * ClassSize.CONCURRENT_HASHMAP_SEGMENT);
-    long negateBlockSize = (long) (totalOverhead / numEntries);
+    long negateBlockSize = totalOverhead / numEntries;
     negateBlockSize += CachedBlock.PER_BLOCK_OVERHEAD;
     return ClassSize.align((long) Math.floor((roughBlockSize - negateBlockSize) * 0.99f));
   }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/dcc5dffc/core/src/test/java/org/apache/accumulo/core/util/PartitionerTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/util/PartitionerTest.java b/core/src/test/java/org/apache/accumulo/core/util/PartitionerTest.java
index c4538ab..b4b7136 100644
--- a/core/src/test/java/org/apache/accumulo/core/util/PartitionerTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/util/PartitionerTest.java
@@ -39,7 +39,7 @@ public class PartitionerTest {
   public void test1() {
 
     @SuppressWarnings("unchecked")
-    Map<ByteSequence,MutableLong>[] groups = new Map[2];
+    Map<ByteSequence,MutableLong>[] groups = (Map<ByteSequence,MutableLong>[])
new Map<?,?>[2];
 
     groups[0] = new HashMap<ByteSequence,MutableLong>();
     groups[0].put(new ArrayByteSequence("cf1"), new MutableLong(1));
@@ -71,7 +71,7 @@ public class PartitionerTest {
 
     List<Mutation> mutations = Arrays.asList(m1, m2, m3, m4, m5);
     @SuppressWarnings("unchecked")
-    List<Mutation>[] partitioned = new List[3];
+    List<Mutation>[] partitioned = (List<Mutation>[]) new List<?>[3];
 
     for (int i = 0; i < partitioned.length; i++) {
       partitioned[i] = new ArrayList<Mutation>();

http://git-wip-us.apache.org/repos/asf/accumulo/blob/dcc5dffc/examples/simple/src/test/java/org/apache/accumulo/examples/simple/filedata/ChunkCombinerTest.java
----------------------------------------------------------------------
diff --git a/examples/simple/src/test/java/org/apache/accumulo/examples/simple/filedata/ChunkCombinerTest.java
b/examples/simple/src/test/java/org/apache/accumulo/examples/simple/filedata/ChunkCombinerTest.java
index 6d1467a..5943d2a 100644
--- a/examples/simple/src/test/java/org/apache/accumulo/examples/simple/filedata/ChunkCombinerTest.java
+++ b/examples/simple/src/test/java/org/apache/accumulo/examples/simple/filedata/ChunkCombinerTest.java
@@ -83,7 +83,7 @@ public class ChunkCombinerTest extends TestCase {
           entry = null;
           continue;
         }
-        if (range.afterEndKey((Key) entry.getKey()))
+        if (range.afterEndKey(entry.getKey()))
           entry = null;
         break;
       }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/dcc5dffc/server/base/src/main/java/org/apache/accumulo/server/zookeeper/DistributedWorkQueue.java
----------------------------------------------------------------------
diff --git a/server/base/src/main/java/org/apache/accumulo/server/zookeeper/DistributedWorkQueue.java
b/server/base/src/main/java/org/apache/accumulo/server/zookeeper/DistributedWorkQueue.java
index 769ab86..f359cec 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/zookeeper/DistributedWorkQueue.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/zookeeper/DistributedWorkQueue.java
@@ -153,7 +153,7 @@ public class DistributedWorkQueue {
 
   public void startProcessing(final Processor processor, ThreadPoolExecutor executorService)
throws KeeperException, InterruptedException {
 
-    threadPool = (ThreadPoolExecutor) executorService;
+    threadPool = executorService;
 
     zoo.mkdirs(path);
     zoo.mkdirs(path + "/" + LOCKS_NODE);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/dcc5dffc/server/master/src/main/java/org/apache/accumulo/master/tableOps/DeleteNamespace.java
----------------------------------------------------------------------
diff --git a/server/master/src/main/java/org/apache/accumulo/master/tableOps/DeleteNamespace.java
b/server/master/src/main/java/org/apache/accumulo/master/tableOps/DeleteNamespace.java
index b6a9578..76dbf2d 100644
--- a/server/master/src/main/java/org/apache/accumulo/master/tableOps/DeleteNamespace.java
+++ b/server/master/src/main/java/org/apache/accumulo/master/tableOps/DeleteNamespace.java
@@ -28,7 +28,7 @@ import org.apache.log4j.Logger;
 
 class NamespaceCleanUp extends MasterRepo {
 
-  final private static Logger log = Logger.getLogger(CleanUp.class);
+  final private static Logger log = Logger.getLogger(NamespaceCleanUp.class);
 
   private static final long serialVersionUID = 1L;
 
@@ -63,7 +63,7 @@ class NamespaceCleanUp extends MasterRepo {
 
     Utils.unreserveNamespace(namespaceId, id, true);
 
-    Logger.getLogger(CleanUp.class).debug("Deleted namespace " + namespaceId);
+    log.debug("Deleted namespace " + namespaceId);
 
     return null;
   }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/dcc5dffc/server/tserver/src/main/java/org/apache/accumulo/tserver/InMemoryMap.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/InMemoryMap.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/InMemoryMap.java
index 792d35a..8febaf2 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/InMemoryMap.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/InMemoryMap.java
@@ -274,9 +274,9 @@ public class InMemoryMap {
 
     @SuppressWarnings("unchecked")
     LocalityGroupMap(Map<String,Set<ByteSequence>> groups, boolean useNativeMap)
{
-      this.groupFams = new Map[groups.size()];
+      this.groupFams = (Map<ByteSequence,MutableLong>[]) new Map<?,?>[groups.size()];
       this.maps = new SimpleMap[groups.size() + 1];
-      this.partitioned = new List[groups.size() + 1];
+      this.partitioned = (List<Mutation>[]) new List<?>[groups.size() + 1];
       this.nonDefaultColumnFamilies = new HashSet<ByteSequence>();
 
       for (int i = 0; i < maps.length; i++) {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/dcc5dffc/server/tserver/src/main/java/org/apache/accumulo/tserver/NativeMap.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/NativeMap.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/NativeMap.java
index 7e1435e..ba5faaa 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/NativeMap.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/NativeMap.java
@@ -275,7 +275,7 @@ public class NativeMap implements Iterable<Map.Entry<Key,Value>>
{
     @SuppressWarnings("unchecked")
     ConcurrentIterator(Key key) {
       // start off with a small read ahead
-      nextEntries = new Entry[1];
+      nextEntries = (Entry<Key,Value>[]) new Entry<?,?>[1];
 
       rlock.lock();
       try {
@@ -299,7 +299,7 @@ public class NativeMap implements Iterable<Map.Entry<Key,Value>>
{
 
       // as we keep filling, increase the read ahead buffer
       if (nextEntries.length < MAX_READ_AHEAD_ENTRIES)
-        nextEntries = new Entry[Math.min(nextEntries.length * 2, MAX_READ_AHEAD_ENTRIES)];
+        nextEntries = (Entry<Key,Value>[]) new Entry<?,?>[Math.min(nextEntries.length
* 2, MAX_READ_AHEAD_ENTRIES)];
 
       while (source.hasNext() && end < nextEntries.length) {
         Entry<Key,Value> ne = source.next();

http://git-wip-us.apache.org/repos/asf/accumulo/blob/dcc5dffc/start/src/main/java/org/apache/accumulo/start/Main.java
----------------------------------------------------------------------
diff --git a/start/src/main/java/org/apache/accumulo/start/Main.java b/start/src/main/java/org/apache/accumulo/start/Main.java
index b9753bf..ac00ed9 100644
--- a/start/src/main/java/org/apache/accumulo/start/Main.java
+++ b/start/src/main/java/org/apache/accumulo/start/Main.java
@@ -40,7 +40,7 @@ public class Main {
 
       Class<?> vfsClassLoader = AccumuloClassLoader.getClassLoader().loadClass("org.apache.accumulo.start.classloader.vfs.AccumuloVFSClassLoader");
 
-      ClassLoader cl = (ClassLoader) vfsClassLoader.getMethod("getClassLoader", new Class[]
{}).invoke(null, new Object[] {});
+      ClassLoader cl = (ClassLoader) vfsClassLoader.getMethod("getClassLoader", new Class<?>[]
{}).invoke(null, new Object[] {});
 
       Class<?> runTMP = null;
 
@@ -70,7 +70,7 @@ public class Main {
       } else if (args[0].equals("minicluster")) {
         runTMP = cl.loadClass("org.apache.accumulo.minicluster.MiniAccumuloRunner");
       } else if (args[0].equals("classpath")) {
-        vfsClassLoader.getMethod("printClassPath", new Class[] {}).invoke(vfsClassLoader,
new Object[] {});
+        vfsClassLoader.getMethod("printClassPath", new Class<?>[] {}).invoke(vfsClassLoader,
new Object[] {});
         return;
       } else if (args[0].equals("version")) {
         runTMP = cl.loadClass("org.apache.accumulo.core.Constants");


Mime
View raw message