accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ctubb...@apache.org
Subject [03/25] accumulo git commit: ACCUMULO-3759 More Java 8 compiler warnings
Date Thu, 30 Apr 2015 17:43:39 GMT
ACCUMULO-3759 More Java 8 compiler warnings

* Fix compiler warnings in Java 8 for 1.5 branch


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

Branch: refs/heads/1.6
Commit: e395bc8ced5d740fe4a6e5d3ebb169335f64c044
Parents: 5ac1b52
Author: Christopher Tubbs <ctubbsii@apache.org>
Authored: Thu Apr 30 12:04:50 2015 -0400
Committer: Christopher Tubbs <ctubbsii@apache.org>
Committed: Thu Apr 30 12:04:50 2015 -0400

----------------------------------------------------------------------
 .../core/iterators/AggregatingIterator.java       | 18 ++++++++++--------
 .../aggregation/conf/AggregatorConfiguration.java |  3 +--
 .../iterators/aggregation/conf/AggregatorSet.java |  7 +++----
 .../util/shell/commands/AddSplitsCommand.java     | 18 +++++++++++++-----
 .../core/iterators/AggregatingIteratorTest.java   |  6 ++++--
 .../conf/AggregatorConfigurationTest.java         | 13 ++++++++-----
 .../org/apache/accumulo/server/master/Master.java | 16 ++++++++--------
 .../classloader/vfs/AccumuloVFSClassLoader.java   |  6 +++---
 8 files changed, 50 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/e395bc8c/core/src/main/java/org/apache/accumulo/core/iterators/AggregatingIterator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/iterators/AggregatingIterator.java
b/core/src/main/java/org/apache/accumulo/core/iterators/AggregatingIterator.java
index 28acc2b..13b2710 100644
--- a/core/src/main/java/org/apache/accumulo/core/iterators/AggregatingIterator.java
+++ b/core/src/main/java/org/apache/accumulo/core/iterators/AggregatingIterator.java
@@ -27,7 +27,6 @@ import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.PartialKey;
 import org.apache.accumulo.core.data.Range;
 import org.apache.accumulo.core.data.Value;
-import org.apache.accumulo.core.iterators.aggregation.Aggregator;
 import org.apache.accumulo.core.iterators.conf.ColumnToClassMapping;
 import org.apache.accumulo.start.classloader.vfs.AccumuloVFSClassLoader;
 import org.apache.log4j.Logger;
@@ -42,7 +41,7 @@ import org.apache.log4j.Logger;
 public class AggregatingIterator implements SortedKeyValueIterator<Key,Value>, OptionDescriber
{
 
   private SortedKeyValueIterator<Key,Value> iterator;
-  private ColumnToClassMapping<Aggregator> aggregators;
+  private ColumnToClassMapping<org.apache.accumulo.core.iterators.aggregation.Aggregator>
aggregators;
 
   private Key workKey = new Key();
 
@@ -51,6 +50,7 @@ public class AggregatingIterator implements SortedKeyValueIterator<Key,Value>,
O
   // private boolean propogateDeletes;
   private static final Logger log = Logger.getLogger(AggregatingIterator.class);
 
+  @Override
   public AggregatingIterator deepCopy(IteratorEnvironment env) {
     return new AggregatingIterator(this, env);
   }
@@ -62,7 +62,7 @@ public class AggregatingIterator implements SortedKeyValueIterator<Key,Value>,
O
 
   public AggregatingIterator() {}
 
-  private void aggregateRowColumn(Aggregator aggr) throws IOException {
+  private void aggregateRowColumn(org.apache.accumulo.core.iterators.aggregation.Aggregator
aggr) throws IOException {
     // this function assumes that first value is not delete
 
     if (iterator.getTopKey().isDeleted())
@@ -90,14 +90,15 @@ public class AggregatingIterator implements SortedKeyValueIterator<Key,Value>,
O
   private void findTop() throws IOException {
     // check if aggregation is needed
     if (iterator.hasTop()) {
-      Aggregator aggr = aggregators.getObject(iterator.getTopKey());
+      org.apache.accumulo.core.iterators.aggregation.Aggregator aggr = aggregators.getObject(iterator.getTopKey());
       if (aggr != null) {
         aggregateRowColumn(aggr);
       }
     }
   }
 
-  public AggregatingIterator(SortedKeyValueIterator<Key,Value> iterator, ColumnToClassMapping<Aggregator>
aggregators) throws IOException {
+  public AggregatingIterator(SortedKeyValueIterator<Key,Value> iterator,
+      ColumnToClassMapping<org.apache.accumulo.core.iterators.aggregation.Aggregator>
aggregators) throws IOException {
     this.iterator = iterator;
     this.aggregators = aggregators;
   }
@@ -167,7 +168,8 @@ public class AggregatingIterator implements SortedKeyValueIterator<Key,Value>,
O
     this.iterator = source;
 
     try {
-      this.aggregators = new ColumnToClassMapping<Aggregator>(options, Aggregator.class);
+      this.aggregators = new ColumnToClassMapping<org.apache.accumulo.core.iterators.aggregation.Aggregator>(options,
+          org.apache.accumulo.core.iterators.aggregation.Aggregator.class);
     } catch (ClassNotFoundException e) {
       log.error(e.toString());
       throw new IllegalArgumentException(e);
@@ -192,9 +194,9 @@ public class AggregatingIterator implements SortedKeyValueIterator<Key,Value>,
O
       String classname = entry.getValue();
       if (classname == null)
         throw new IllegalArgumentException("classname null");
-      Class<? extends Aggregator> clazz;
+      Class<? extends org.apache.accumulo.core.iterators.aggregation.Aggregator> clazz;
       try {
-        clazz = AccumuloVFSClassLoader.loadClass(classname, Aggregator.class);
+        clazz = AccumuloVFSClassLoader.loadClass(classname, org.apache.accumulo.core.iterators.aggregation.Aggregator.class);
         clazz.newInstance();
       } catch (ClassNotFoundException e) {
         throw new IllegalArgumentException("class not found: " + classname);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/e395bc8c/core/src/main/java/org/apache/accumulo/core/iterators/aggregation/conf/AggregatorConfiguration.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/iterators/aggregation/conf/AggregatorConfiguration.java
b/core/src/main/java/org/apache/accumulo/core/iterators/aggregation/conf/AggregatorConfiguration.java
index 41c0374..3432cf5 100644
--- a/core/src/main/java/org/apache/accumulo/core/iterators/aggregation/conf/AggregatorConfiguration.java
+++ b/core/src/main/java/org/apache/accumulo/core/iterators/aggregation/conf/AggregatorConfiguration.java
@@ -16,14 +16,13 @@
  */
 package org.apache.accumulo.core.iterators.aggregation.conf;
 
-import org.apache.accumulo.core.iterators.conf.PerColumnIteratorConfig;
 import org.apache.hadoop.io.Text;
 
 /**
  * @deprecated since 1.4
  */
 @Deprecated
-public class AggregatorConfiguration extends PerColumnIteratorConfig {
+public class AggregatorConfiguration extends org.apache.accumulo.core.iterators.conf.PerColumnIteratorConfig
{
 
   public AggregatorConfiguration(Text columnFamily, String aggClassName) {
     super(columnFamily, aggClassName);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/e395bc8c/core/src/main/java/org/apache/accumulo/core/iterators/aggregation/conf/AggregatorSet.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/iterators/aggregation/conf/AggregatorSet.java
b/core/src/main/java/org/apache/accumulo/core/iterators/aggregation/conf/AggregatorSet.java
index 26e2f11..37798b0 100644
--- a/core/src/main/java/org/apache/accumulo/core/iterators/aggregation/conf/AggregatorSet.java
+++ b/core/src/main/java/org/apache/accumulo/core/iterators/aggregation/conf/AggregatorSet.java
@@ -19,23 +19,22 @@ package org.apache.accumulo.core.iterators.aggregation.conf;
 import java.util.Map;
 
 import org.apache.accumulo.core.data.Key;
-import org.apache.accumulo.core.iterators.aggregation.Aggregator;
 import org.apache.accumulo.core.iterators.conf.ColumnToClassMapping;
 
 /**
  * @deprecated since 1.4
  */
 @Deprecated
-public class AggregatorSet extends ColumnToClassMapping<Aggregator> {
+public class AggregatorSet extends ColumnToClassMapping<org.apache.accumulo.core.iterators.aggregation.Aggregator>
{
   public AggregatorSet(Map<String,String> opts) throws InstantiationException, IllegalAccessException,
ClassNotFoundException {
-    super(opts, Aggregator.class);
+    super(opts, org.apache.accumulo.core.iterators.aggregation.Aggregator.class);
   }
 
   public AggregatorSet() {
     super();
   }
 
-  public Aggregator getAggregator(Key k) {
+  public org.apache.accumulo.core.iterators.aggregation.Aggregator getAggregator(Key k) {
     return getObject(k);
   }
 }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/e395bc8c/core/src/main/java/org/apache/accumulo/core/util/shell/commands/AddSplitsCommand.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/util/shell/commands/AddSplitsCommand.java
b/core/src/main/java/org/apache/accumulo/core/util/shell/commands/AddSplitsCommand.java
index 3eab0a1..c88171a 100644
--- a/core/src/main/java/org/apache/accumulo/core/util/shell/commands/AddSplitsCommand.java
+++ b/core/src/main/java/org/apache/accumulo/core/util/shell/commands/AddSplitsCommand.java
@@ -34,6 +34,7 @@ import org.apache.hadoop.io.Text;
 public class AddSplitsCommand extends Command {
   private Option optSplitsFile, base64Opt;
 
+  @Override
   public int execute(final String fullCommand, final CommandLine cl, final Shell shellState)
throws Exception {
     final String tableName = OptUtil.getTableOpt(cl, shellState);
     final boolean decode = cl.hasOption(base64Opt.getOpt());
@@ -44,11 +45,18 @@ public class AddSplitsCommand extends Command {
       final String f = cl.getOptionValue(optSplitsFile.getOpt());
 
       String line;
-      java.util.Scanner file = new java.util.Scanner(new File(f), UTF_8.name());
-      while (file.hasNextLine()) {
-        line = file.nextLine();
-        if (!line.isEmpty()) {
-          splits.add(decode ? new Text(Base64.decodeBase64(line.getBytes(UTF_8))) : new Text(line));
+      java.util.Scanner file = null;
+      try {
+        file = new java.util.Scanner(new File(f), UTF_8.name());
+        while (file.hasNextLine()) {
+          line = file.nextLine();
+          if (!line.isEmpty()) {
+            splits.add(decode ? new Text(Base64.decodeBase64(line.getBytes(UTF_8))) : new
Text(line));
+          }
+        }
+      } finally {
+        if (file != null) {
+          file.close();
         }
       }
     } else {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/e395bc8c/core/src/test/java/org/apache/accumulo/core/iterators/AggregatingIteratorTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/AggregatingIteratorTest.java
b/core/src/test/java/org/apache/accumulo/core/iterators/AggregatingIteratorTest.java
index 788366a..f1918b4 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/AggregatingIteratorTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/AggregatingIteratorTest.java
@@ -31,7 +31,6 @@ import org.apache.accumulo.core.data.ByteSequence;
 import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.Range;
 import org.apache.accumulo.core.data.Value;
-import org.apache.accumulo.core.iterators.aggregation.Aggregator;
 import org.apache.accumulo.core.iterators.system.MultiIterator;
 import org.apache.hadoop.io.Text;
 
@@ -43,20 +42,23 @@ public class AggregatingIteratorTest extends TestCase {
 
   private static final Collection<ByteSequence> EMPTY_COL_FAMS = new ArrayList<ByteSequence>();
 
-  public static class SummationAggregator implements Aggregator {
+  public static class SummationAggregator implements org.apache.accumulo.core.iterators.aggregation.Aggregator
{
 
     int sum;
 
+    @Override
     public Value aggregate() {
       return new Value((sum + "").getBytes());
     }
 
+    @Override
     public void collect(Value value) {
       int val = Integer.parseInt(value.toString());
 
       sum += val;
     }
 
+    @Override
     public void reset() {
       sum = 0;
 

http://git-wip-us.apache.org/repos/asf/accumulo/blob/e395bc8c/core/src/test/java/org/apache/accumulo/core/iterators/aggregation/conf/AggregatorConfigurationTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/aggregation/conf/AggregatorConfigurationTest.java
b/core/src/test/java/org/apache/accumulo/core/iterators/aggregation/conf/AggregatorConfigurationTest.java
index 1a285bc..6d666a3 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/aggregation/conf/AggregatorConfigurationTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/aggregation/conf/AggregatorConfigurationTest.java
@@ -18,7 +18,6 @@ package org.apache.accumulo.core.iterators.aggregation.conf;
 
 import junit.framework.TestCase;
 
-import org.apache.accumulo.core.iterators.conf.PerColumnIteratorConfig;
 import org.apache.hadoop.io.Text;
 
 /**
@@ -46,18 +45,22 @@ public class AggregatorConfigurationTest extends TestCase {
 
   private void runTest(Text colf) {
     String encodedCols;
-    PerColumnIteratorConfig ac3 = new PerColumnIteratorConfig(colf, "com.foo.SuperAgg");
+    org.apache.accumulo.core.iterators.conf.PerColumnIteratorConfig ac3 = new org.apache.accumulo.core.iterators.conf.PerColumnIteratorConfig(colf,
+        "com.foo.SuperAgg");
     encodedCols = ac3.encodeColumns();
-    PerColumnIteratorConfig ac4 = PerColumnIteratorConfig.decodeColumns(encodedCols, "com.foo.SuperAgg");
+    org.apache.accumulo.core.iterators.conf.PerColumnIteratorConfig ac4 = org.apache.accumulo.core.iterators.conf.PerColumnIteratorConfig.decodeColumns(
+        encodedCols, "com.foo.SuperAgg");
 
     assertEquals(colf, ac4.getColumnFamily());
     assertNull(ac4.getColumnQualifier());
   }
 
   private void runTest(Text colf, Text colq) {
-    PerColumnIteratorConfig ac = new PerColumnIteratorConfig(colf, colq, "com.foo.SuperAgg");
+    org.apache.accumulo.core.iterators.conf.PerColumnIteratorConfig ac = new org.apache.accumulo.core.iterators.conf.PerColumnIteratorConfig(colf,
colq,
+        "com.foo.SuperAgg");
     String encodedCols = ac.encodeColumns();
-    PerColumnIteratorConfig ac2 = PerColumnIteratorConfig.decodeColumns(encodedCols, "com.foo.SuperAgg");
+    org.apache.accumulo.core.iterators.conf.PerColumnIteratorConfig ac2 = org.apache.accumulo.core.iterators.conf.PerColumnIteratorConfig.decodeColumns(
+        encodedCols, "com.foo.SuperAgg");
 
     assertEquals(colf, ac2.getColumnFamily());
     assertEquals(colq, ac2.getColumnQualifier());

http://git-wip-us.apache.org/repos/asf/accumulo/blob/e395bc8c/server/src/main/java/org/apache/accumulo/server/master/Master.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/master/Master.java b/server/src/main/java/org/apache/accumulo/server/master/Master.java
index 61ba7cf..dd94683 100644
--- a/server/src/main/java/org/apache/accumulo/server/master/Master.java
+++ b/server/src/main/java/org/apache/accumulo/server/master/Master.java
@@ -230,17 +230,17 @@ public class Master implements LiveTServerSet.Listener, TableObserver,
CurrentSt
   }
 
   static final boolean X = true;
-  static final boolean _ = false;
+  static final boolean O = false;
   // @formatter:off
   static final boolean transitionOK[][] = {
       //                              INITIAL HAVE_LOCK SAFE_MODE NORMAL UNLOAD_META UNLOAD_ROOT
STOP
-      /* INITIAL */                   {X,     X,        _,        _,      _,         _, 
        X},
-      /* HAVE_LOCK */                 {_,     X,        X,        X,      _,         _, 
        X},
-      /* SAFE_MODE */                 {_,     _,        X,        X,      X,         _, 
        X},
-      /* NORMAL */                    {_,     _,        X,        X,      X,         _, 
        X},
-      /* UNLOAD_METADATA_TABLETS */   {_,     _,        X,        X,      X,         X, 
        X},
-      /* UNLOAD_ROOT_TABLET */        {_,     _,        _,        X,      _,         X, 
        X},
-      /* STOP */                      {_,     _,        _,        _,      _,         _, 
        X}};
+      /* INITIAL */                   {X,     X,        O,        O,      O,         O, 
        X},
+      /* HAVE_LOCK */                 {O,     X,        X,        X,      O,         O, 
        X},
+      /* SAFE_MODE */                 {O,     O,        X,        X,      X,         O, 
        X},
+      /* NORMAL */                    {O,     O,        X,        X,      X,         O, 
        X},
+      /* UNLOAD_METADATA_TABLETS */   {O,     O,        X,        X,      X,         X, 
        X},
+      /* UNLOAD_ROOT_TABLET */        {O,     O,        O,        X,      O,         X, 
        X},
+      /* STOP */                      {O,     O,        O,        O,      O,         O, 
        X}};
   //@formatter:on
   synchronized private void setMasterState(MasterState newState) {
     if (state.equals(newState))

http://git-wip-us.apache.org/repos/asf/accumulo/blob/e395bc8c/start/src/main/java/org/apache/accumulo/start/classloader/vfs/AccumuloVFSClassLoader.java
----------------------------------------------------------------------
diff --git a/start/src/main/java/org/apache/accumulo/start/classloader/vfs/AccumuloVFSClassLoader.java
b/start/src/main/java/org/apache/accumulo/start/classloader/vfs/AccumuloVFSClassLoader.java
index 7fa17d6..0abc79a 100644
--- a/start/src/main/java/org/apache/accumulo/start/classloader/vfs/AccumuloVFSClassLoader.java
+++ b/start/src/main/java/org/apache/accumulo/start/classloader/vfs/AccumuloVFSClassLoader.java
@@ -62,6 +62,7 @@ public class AccumuloVFSClassLoader {
 
   public static class AccumuloVFSClassLoaderShutdownThread implements Runnable {
 
+    @Override
     public void run() {
       try {
         AccumuloVFSClassLoader.close();
@@ -100,7 +101,7 @@ public class AccumuloVFSClassLoader {
 
   public synchronized static <U> Class<? extends U> loadClass(String classname,
Class<U> extension) throws ClassNotFoundException {
     try {
-      return (Class<? extends U>) getClassLoader().loadClass(classname).asSubclass(extension);
+      return getClassLoader().loadClass(classname).asSubclass(extension);
     } catch (IOException e) {
       throw new ClassNotFoundException("IO Error loading class " + classname, e);
     }
@@ -326,10 +327,9 @@ public class AccumuloVFSClassLoader {
 
         if (classLoader instanceof URLClassLoader) {
           // If VFS class loader enabled, but no contexts defined.
-          URLClassLoader ucl = (URLClassLoader) classLoader;
           out.print("Level " + classLoaderDescription + " URL classpath items are:");
 
-          for (URL u : ucl.getURLs()) {
+          for (URL u : ((URLClassLoader) classLoader).getURLs()) {
             out.print("\t" + u.toExternalForm());
           }
 


Mime
View raw message