You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fluo.apache.org by ct...@apache.org on 2016/09/14 18:49:11 UTC

incubator-fluo git commit: Avoid use of auxiliary class, and other warnings

Repository: incubator-fluo
Updated Branches:
  refs/heads/master cb78079bf -> dcfd1a7e0


Avoid use of auxiliary class, and other warnings

* Move auxiliary AsciiSequence class to own file
* Remove redundant type args (use diamond)
* Suppress warnings in thrift classes


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

Branch: refs/heads/master
Commit: dcfd1a7e0e98a6ad4581cdba2c297e1951af849d
Parents: cb78079
Author: Christopher Tubbs <ct...@apache.org>
Authored: Tue Sep 13 18:28:32 2016 -0400
Committer: Christopher Tubbs <ct...@apache.org>
Committed: Tue Sep 13 18:28:32 2016 -0400

----------------------------------------------------------------------
 .../org/apache/fluo/api/data/AsciiSequence.java | 53 ++++++++++++++++++++
 .../org/apache/fluo/api/data/BytesTest.java     | 37 --------------
 .../apache/fluo/core/impl/TransactionImpl.java  |  2 +-
 .../apache/fluo/core/thrift/OracleService.java  |  1 +
 .../org/apache/fluo/core/thrift/Stamps.java     |  1 +
 .../fluo/core/worker/finder/hash/ScanTask.java  | 13 +++--
 6 files changed, 62 insertions(+), 45 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-fluo/blob/dcfd1a7e/modules/api/src/test/java/org/apache/fluo/api/data/AsciiSequence.java
----------------------------------------------------------------------
diff --git a/modules/api/src/test/java/org/apache/fluo/api/data/AsciiSequence.java b/modules/api/src/test/java/org/apache/fluo/api/data/AsciiSequence.java
new file mode 100644
index 0000000..8ecda71
--- /dev/null
+++ b/modules/api/src/test/java/org/apache/fluo/api/data/AsciiSequence.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You 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 org.apache.fluo.api.data;
+
+import java.nio.charset.StandardCharsets;
+
+class AsciiSequence implements CharSequence {
+
+
+  private final int len;
+  private final int offset;
+  private final byte[] chars;
+
+  public AsciiSequence(byte[] chars, int offset, int len) {
+    this.len = len;
+    this.offset = offset;
+    this.chars = chars;
+  }
+
+  public AsciiSequence(String s) {
+    chars = s.getBytes(StandardCharsets.US_ASCII);
+    len = chars.length;
+    offset = 0;
+  }
+
+  @Override
+  public int length() {
+    return len;
+  }
+
+  @Override
+  public char charAt(int index) {
+    return (char) chars[index];
+  }
+
+  @Override
+  public CharSequence subSequence(int start, int end) {
+    return new AsciiSequence(chars, offset + start, end - start);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-fluo/blob/dcfd1a7e/modules/api/src/test/java/org/apache/fluo/api/data/BytesTest.java
----------------------------------------------------------------------
diff --git a/modules/api/src/test/java/org/apache/fluo/api/data/BytesTest.java b/modules/api/src/test/java/org/apache/fluo/api/data/BytesTest.java
index 8a3baf2..641c9bf 100644
--- a/modules/api/src/test/java/org/apache/fluo/api/data/BytesTest.java
+++ b/modules/api/src/test/java/org/apache/fluo/api/data/BytesTest.java
@@ -26,43 +26,6 @@ import org.apache.fluo.api.data.Bytes;
 import org.junit.Assert;
 import org.junit.Test;
 
-class AsciiSequence implements CharSequence {
-
-
-  private final int len;
-  private final int offset;
-  private final byte[] chars;
-
-  public AsciiSequence(byte[] chars, int offset, int len) {
-    this.len = len;
-    this.offset = offset;
-    this.chars = chars;
-  }
-
-  public AsciiSequence(String s) {
-    chars = s.getBytes(StandardCharsets.US_ASCII);
-    len = chars.length;
-    offset = 0;
-  }
-
-  @Override
-  public int length() {
-    return len;
-  }
-
-  @Override
-  public char charAt(int index) {
-    return (char) chars[index];
-  }
-
-  @Override
-  public CharSequence subSequence(int start, int end) {
-    return new AsciiSequence(chars, offset + start, end - start);
-  }
-
-}
-
-
 /**
  * Unit test for {@link Bytes}
  */

http://git-wip-us.apache.org/repos/asf/incubator-fluo/blob/dcfd1a7e/modules/core/src/main/java/org/apache/fluo/core/impl/TransactionImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/fluo/core/impl/TransactionImpl.java b/modules/core/src/main/java/org/apache/fluo/core/impl/TransactionImpl.java
index d66df36..ebf06a7 100644
--- a/modules/core/src/main/java/org/apache/fluo/core/impl/TransactionImpl.java
+++ b/modules/core/src/main/java/org/apache/fluo/core/impl/TransactionImpl.java
@@ -229,7 +229,7 @@ public class TransactionImpl implements AsyncTransaction, Snapshot {
 
     SnapshotScanner.Opts opts;
     if (shouldCopy) {
-      HashSet<Column> cols = new HashSet<Column>();
+      HashSet<Column> cols = new HashSet<>();
       for (Column column : columns) {
         if (column.isVisibilitySet()) {
           cols.add(new Column(column.getFamily(), column.getQualifier()));

http://git-wip-us.apache.org/repos/asf/incubator-fluo/blob/dcfd1a7e/modules/core/src/main/java/org/apache/fluo/core/thrift/OracleService.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/fluo/core/thrift/OracleService.java b/modules/core/src/main/java/org/apache/fluo/core/thrift/OracleService.java
index 3d6702a..cdfabda 100644
--- a/modules/core/src/main/java/org/apache/fluo/core/thrift/OracleService.java
+++ b/modules/core/src/main/java/org/apache/fluo/core/thrift/OracleService.java
@@ -26,6 +26,7 @@ import org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+@SuppressWarnings({"rawtypes", "unused", "serial", "unchecked"})
 public class OracleService {
 
   public interface Iface {

http://git-wip-us.apache.org/repos/asf/incubator-fluo/blob/dcfd1a7e/modules/core/src/main/java/org/apache/fluo/core/thrift/Stamps.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/fluo/core/thrift/Stamps.java b/modules/core/src/main/java/org/apache/fluo/core/thrift/Stamps.java
index 391609a..af7f257 100644
--- a/modules/core/src/main/java/org/apache/fluo/core/thrift/Stamps.java
+++ b/modules/core/src/main/java/org/apache/fluo/core/thrift/Stamps.java
@@ -21,6 +21,7 @@ import org.apache.thrift.scheme.SchemeFactory;
 import org.apache.thrift.scheme.StandardScheme;
 import org.apache.thrift.scheme.TupleScheme;
 
+@SuppressWarnings({"rawtypes", "unused", "serial", "unchecked"})
 public class Stamps implements org.apache.thrift.TBase<Stamps, Stamps._Fields>,
     java.io.Serializable, Cloneable, Comparable<Stamps> {
   private static final org.apache.thrift.protocol.TStruct STRUCT_DESC =

http://git-wip-us.apache.org/repos/asf/incubator-fluo/blob/dcfd1a7e/modules/core/src/main/java/org/apache/fluo/core/worker/finder/hash/ScanTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/fluo/core/worker/finder/hash/ScanTask.java b/modules/core/src/main/java/org/apache/fluo/core/worker/finder/hash/ScanTask.java
index eb4adf0..e0fa791 100644
--- a/modules/core/src/main/java/org/apache/fluo/core/worker/finder/hash/ScanTask.java
+++ b/modules/core/src/main/java/org/apache/fluo/core/worker/finder/hash/ScanTask.java
@@ -57,13 +57,12 @@ public class ScanTask implements Runnable {
 
   ScanTask(HashNotificationFinder hashWorkFinder, Environment env, AtomicBoolean stopped) {
     this.hwf = hashWorkFinder;
-    this.tabletInfoCache =
-        new TabletInfoCache<TabletData, Supplier<TabletData>>(env, new Supplier<TabletData>() {
-          @Override
-          public TabletData get() {
-            return new TabletData();
-          }
-        });
+    this.tabletInfoCache = new TabletInfoCache<>(env, new Supplier<TabletData>() {
+      @Override
+      public TabletData get() {
+        return new TabletData();
+      }
+    });
     this.env = env;
     this.stopped = stopped;