kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From granthe...@apache.org
Subject kudu git commit: [Java] Use Yetus annotations in place of @VisibleForTesting
Date Thu, 19 Apr 2018 19:42:13 GMT
Repository: kudu
Updated Branches:
  refs/heads/master a9271b05d -> abbde75e1


[Java] Use Yetus annotations in place of @VisibleForTesting

We use yetus for marking our intended InterfaceAudience.
This patch replaces Guava’s @VisibleForTesting with
@InterfaceAudience.LimitedPrivate("Test”).

kudu-hive is an exception to the rule because it can not
have any dependencies that are not provided by the
hive-metastore. This limitation is noted in the kudu-hive
build files.

I also elimated an uneccesary usage of ImmutableList
and Lists while making this change. Scala has
straightforward syntax for making lists without Guava.

The primary reason for this change is to use
Yetus as the single annotation library for defining
InterfaceAudience, but this has the added benefit
of eliminating any Guava use in kudu-spark,
kudu-spark-tools which didn’t
have Gauva marked as a dependency.

Change-Id: Ic0d8845e8cbbf5ea81345c46c5487121d1098f91
Reviewed-on: http://gerrit.cloudera.org:8080/10077
Tested-by: Kudu Jenkins
Reviewed-by: Adar Dembo <adar@cloudera.com>
Reviewed-by: Dan Burkert <danburkert@apache.org>


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

Branch: refs/heads/master
Commit: abbde75e12f2275e1a286df60d788e9c5b411bcb
Parents: a9271b0
Author: Grant Henke <granthenke@apache.org>
Authored: Mon Apr 16 10:46:27 2018 -0500
Committer: Grant Henke <granthenke@apache.org>
Committed: Thu Apr 19 19:41:23 2018 +0000

----------------------------------------------------------------------
 java/kudu-client-tools/build.gradle                      |  3 +--
 .../java/org/apache/kudu/client/AsyncKuduClient.java     | 11 +++++------
 .../java/org/apache/kudu/client/AsyncKuduSession.java    |  3 +--
 .../src/main/java/org/apache/kudu/client/Batch.java      |  3 +--
 .../java/org/apache/kudu/client/ConnectToCluster.java    | 11 +++++------
 .../src/main/java/org/apache/kudu/client/Connection.java |  3 +--
 .../java/org/apache/kudu/client/ConnectionCache.java     |  3 +--
 .../src/main/java/org/apache/kudu/client/KuduClient.java |  3 +--
 .../main/java/org/apache/kudu/client/KuduPredicate.java  |  9 ++++-----
 .../src/main/java/org/apache/kudu/client/KuduRpc.java    |  3 +--
 .../main/java/org/apache/kudu/client/KuduScanToken.java  |  3 +--
 .../main/java/org/apache/kudu/client/KuduScanner.java    |  5 ++---
 .../src/main/java/org/apache/kudu/client/Negotiator.java |  3 +--
 .../src/main/java/org/apache/kudu/client/RpcProxy.java   |  3 +--
 .../java/org/apache/kudu/client/SecurityContext.java     |  4 ++--
 .../src/main/java/org/apache/kudu/client/Status.java     |  7 +++----
 .../java/org/apache/kudu/client/TableLocationsCache.java |  3 +--
 .../src/main/java/org/apache/kudu/util/ByteVec.java      |  3 +--
 .../main/java/org/apache/kudu/flume/sink/KuduSink.java   |  3 +--
 java/kudu-spark-tools/build.gradle                       |  1 +
 java/kudu-spark-tools/pom.xml                            |  6 ++++++
 .../org/apache/kudu/spark/tools/ImportExportFiles.scala  |  4 ++--
 .../kudu/spark/tools/IntegrationTestBigLinkedList.scala  |  8 ++++----
 .../org/apache/kudu/spark/kudu/DefaultSourceTest.scala   |  5 ++---
 .../scala/org/apache/kudu/spark/kudu/TestContext.scala   |  5 ++---
 25 files changed, 51 insertions(+), 64 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/abbde75e/java/kudu-client-tools/build.gradle
----------------------------------------------------------------------
diff --git a/java/kudu-client-tools/build.gradle b/java/kudu-client-tools/build.gradle
index b409491..2728287 100644
--- a/java/kudu-client-tools/build.gradle
+++ b/java/kudu-client-tools/build.gradle
@@ -23,9 +23,8 @@ dependencies {
   // This artifact is in compile scope for convenience, as it is typically
   // not included in the job classpath by MapReduce platform providers.
   compile libs.parquetHadoop
-
-  compile libs.yetusAnnotations
   compile libs.slf4jApi
+  compile libs.yetusAnnotations
 
   provided libs.hadoopClient
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/abbde75e/java/kudu-client/src/main/java/org/apache/kudu/client/AsyncKuduClient.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/AsyncKuduClient.java b/java/kudu-client/src/main/java/org/apache/kudu/client/AsyncKuduClient.java
index c4d558f..cebb132 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/AsyncKuduClient.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/AsyncKuduClient.java
@@ -48,7 +48,6 @@ import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 import javax.annotation.concurrent.GuardedBy;
 
-import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Joiner;
 import com.google.common.base.Preconditions;
 import com.google.common.collect.Lists;
@@ -336,7 +335,7 @@ public class AsyncKuduClient implements AutoCloseable {
 
   private final RequestTracker requestTracker;
 
-  @VisibleForTesting
+  @InterfaceAudience.LimitedPrivate("Test")
   final SecurityContext securityContext;
 
   /** A helper to facilitate re-acquiring of authentication token if current one expires.
*/
@@ -895,7 +894,7 @@ public class AsyncKuduClient implements AutoCloseable {
     return requestTracker;
   }
 
-  @VisibleForTesting
+  @InterfaceAudience.LimitedPrivate("Test")
   KuduTable getMasterTable() {
     return masterTable;
   }
@@ -1418,7 +1417,7 @@ public class AsyncKuduClient implements AutoCloseable {
    * @param tableId table for which we remove all cached tablet location and
    *                tablet client entries
    */
-  @VisibleForTesting
+  @InterfaceAudience.LimitedPrivate("Test")
   void emptyTabletsCacheForTable(String tableId) {
     tableLocations.remove(tableId);
   }
@@ -1843,7 +1842,7 @@ public class AsyncKuduClient implements AutoCloseable {
    * @param locations the discovered locations
    * @param ttl the ttl of the locations
    */
-  @VisibleForTesting
+  @InterfaceAudience.LimitedPrivate("Test")
   void discoverTablets(KuduTable table,
                        byte[] requestPartitionKey,
                        int requestedBatchSize,
@@ -2111,7 +2110,7 @@ public class AsyncKuduClient implements AutoCloseable {
   /**
    * @return copy of the current TabletClients list
    */
-  @VisibleForTesting
+  @InterfaceAudience.LimitedPrivate("Test")
   List<Connection> getConnectionListCopy() {
     return connectionCache.getConnectionListCopy();
   }

http://git-wip-us.apache.org/repos/asf/kudu/blob/abbde75e/java/kudu-client/src/main/java/org/apache/kudu/client/AsyncKuduSession.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/AsyncKuduSession.java b/java/kudu-client/src/main/java/org/apache/kudu/client/AsyncKuduSession.java
index 66b58b4..3a92077 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/AsyncKuduSession.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/AsyncKuduSession.java
@@ -32,7 +32,6 @@ import java.util.concurrent.atomic.AtomicReference;
 import javax.annotation.concurrent.GuardedBy;
 import javax.annotation.concurrent.NotThreadSafe;
 
-import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.MoreObjects;
 import com.google.common.base.Preconditions;
 import com.google.common.collect.ImmutableList;
@@ -245,7 +244,7 @@ public class AsyncKuduSession implements SessionConfiguration {
    * Lets us set a specific seed for tests
    * @param seed
    */
-  @VisibleForTesting
+  @InterfaceAudience.LimitedPrivate("Test")
   void setRandomSeed(long seed) {
     this.randomizer.setSeed(seed);
   }

http://git-wip-us.apache.org/repos/asf/kudu/blob/abbde75e/java/kudu-client/src/main/java/org/apache/kudu/client/Batch.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/Batch.java b/java/kudu-client/src/main/java/org/apache/kudu/client/Batch.java
index f5ebd24..def5409 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/Batch.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/Batch.java
@@ -21,7 +21,6 @@ import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 
-import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.MoreObjects;
 import com.google.protobuf.Message;
 import com.google.protobuf.UnsafeByteOperations;
@@ -198,7 +197,7 @@ class Batch extends KuduRpc<BatchResponse> {
    * @param latencyMs blocks response handling thread for some time to simulate
    * write latency
    */
-  @VisibleForTesting
+  @InterfaceAudience.LimitedPrivate("Test")
   static void injectTabletServerErrorAndLatency(TabletServerErrorPB error, int latencyMs)
{
     injectedError = error;
     injectedlatencyMs = latencyMs;

http://git-wip-us.apache.org/repos/asf/kudu/blob/abbde75e/java/kudu-client/src/main/java/org/apache/kudu/client/ConnectToCluster.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/ConnectToCluster.java b/java/kudu-client/src/main/java/org/apache/kudu/client/ConnectToCluster.java
index 911a83d..eac5d37 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/ConnectToCluster.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/ConnectToCluster.java
@@ -24,7 +24,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.AtomicReference;
 
-import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Functions;
 import com.google.common.base.Joiner;
 import com.google.common.base.Preconditions;
@@ -81,12 +80,12 @@ final class ConnectToCluster {
     this.numMasters = masterAddrs.size();
   }
 
-  @VisibleForTesting
+  @InterfaceAudience.LimitedPrivate("Test")
   public Deferred<ConnectToClusterResponse> getDeferred() {
     return responseD;
   }
 
-  @VisibleForTesting
+  @InterfaceAudience.LimitedPrivate("Test")
   List<Exception> getExceptionsReceived() {
     return exceptionsReceived;
   }
@@ -158,7 +157,7 @@ final class ConnectToCluster {
     return connector.responseD;
   }
 
-  @VisibleForTesting
+  @InterfaceAudience.LimitedPrivate("Test")
   List<Deferred<ConnectToMasterResponsePB>> connectToMasters(
       KuduTable masterTable,
       KuduRpc<?> parentRpc,
@@ -193,7 +192,7 @@ final class ConnectToCluster {
    *                    be valid.
    * @return The callback object that can be added to the RPC request.
    */
-  @VisibleForTesting
+  @InterfaceAudience.LimitedPrivate("Test")
   Callback<Void, ConnectToMasterResponsePB> callbackForNode(HostAndPort hostAndPort)
{
     return new ConnectToMasterCB(hostAndPort);
   }
@@ -205,7 +204,7 @@ final class ConnectToCluster {
    *                    purposes.
    * @return The errback object that can be added to the RPC request.
    */
-  @VisibleForTesting
+  @InterfaceAudience.LimitedPrivate("Test")
   Callback<Void, Exception> errbackForNode(HostAndPort hostAndPort) {
     return new ConnectToMasterErrCB(hostAndPort);
   }

http://git-wip-us.apache.org/repos/asf/kudu/blob/abbde75e/java/kudu-client/src/main/java/org/apache/kudu/client/Connection.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/Connection.java b/java/kudu-client/src/main/java/org/apache/kudu/client/Connection.java
index ff04ab0..80e455e 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/Connection.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/Connection.java
@@ -31,7 +31,6 @@ import javax.annotation.Nullable;
 import javax.annotation.concurrent.GuardedBy;
 import javax.net.ssl.SSLException;
 
-import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Preconditions;
 import com.google.common.collect.Lists;
 import com.stumbleupon.async.Callback;
@@ -635,7 +634,7 @@ class Connection extends SimpleChannelUpstreamHandler {
    *
    * @return true iff the connection is in the READY state
    */
-  @VisibleForTesting
+  @InterfaceAudience.LimitedPrivate("Test")
   boolean isReady() {
     lock.lock();
     try {

http://git-wip-us.apache.org/repos/asf/kudu/blob/abbde75e/java/kudu-client/src/main/java/org/apache/kudu/client/ConnectionCache.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/ConnectionCache.java b/java/kudu-client/src/main/java/org/apache/kudu/client/ConnectionCache.java
index c586886..2345b12 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/ConnectionCache.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/ConnectionCache.java
@@ -24,7 +24,6 @@ import java.util.List;
 import java.util.Set;
 import javax.annotation.concurrent.GuardedBy;
 
-import com.google.common.annotations.VisibleForTesting;
 import com.google.common.collect.HashMultimap;
 import com.google.common.collect.ImmutableList;
 import com.stumbleupon.async.Deferred;
@@ -162,7 +161,7 @@ class ConnectionCache {
    *
    * @return a copy of the list of all connections in the connection cache
    */
-  @VisibleForTesting
+  @InterfaceAudience.LimitedPrivate("Test")
   List<Connection> getConnectionListCopy() {
     synchronized (connsByAddress) {
       return ImmutableList.copyOf(connsByAddress.values());

http://git-wip-us.apache.org/repos/asf/kudu/blob/abbde75e/java/kudu-client/src/main/java/org/apache/kudu/client/KuduClient.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/KuduClient.java b/java/kudu-client/src/main/java/org/apache/kudu/client/KuduClient.java
index d56af58..55c0920 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/KuduClient.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/KuduClient.java
@@ -21,7 +21,6 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.Executor;
 
-import com.google.common.annotations.VisibleForTesting;
 import com.stumbleupon.async.Deferred;
 import org.apache.yetus.audience.InterfaceAudience;
 import org.apache.yetus.audience.InterfaceStability;
@@ -44,7 +43,7 @@ public class KuduClient implements AutoCloseable {
   private static final Logger LOG = LoggerFactory.getLogger(AsyncKuduClient.class);
   public static final long NO_TIMESTAMP = -1;
 
-  @VisibleForTesting
+  @InterfaceAudience.LimitedPrivate("Test")
   final AsyncKuduClient asyncClient;
 
   KuduClient(AsyncKuduClient asyncClient) {

http://git-wip-us.apache.org/repos/asf/kudu/blob/abbde75e/java/kudu-client/src/main/java/org/apache/kudu/client/KuduPredicate.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/KuduPredicate.java b/java/kudu-client/src/main/java/org/apache/kudu/client/KuduPredicate.java
index 814b7de..6f17030 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/KuduPredicate.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/KuduPredicate.java
@@ -27,7 +27,6 @@ import java.util.List;
 import java.util.SortedSet;
 import java.util.TreeSet;
 
-import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Joiner;
 import com.google.common.base.Objects;
 import com.google.common.base.Preconditions;
@@ -572,7 +571,7 @@ public class KuduPredicate {
    *              or the equality value if this is an Equality predicate
    * @param upper the upper bound serialized value if this is an Equality predicate
    */
-  @VisibleForTesting
+  @InterfaceAudience.LimitedPrivate("Test")
   KuduPredicate(PredicateType type, ColumnSchema column, byte[] lower, byte[] upper) {
     this.type = type;
     this.column = column;
@@ -599,7 +598,7 @@ public class KuduPredicate {
    * @param column the column to which the predicate applies
    * @return a None predicate
    */
-  @VisibleForTesting
+  @InterfaceAudience.LimitedPrivate("Test")
   static KuduPredicate none(ColumnSchema column) {
     return new KuduPredicate(PredicateType.NONE, column, null, null);
   }
@@ -979,7 +978,7 @@ public class KuduPredicate {
    * @param type an integer type
    * @return the maximum value
    */
-  @VisibleForTesting
+  @InterfaceAudience.LimitedPrivate("Test")
   static long maxIntValue(Type type) {
     switch (type) {
       case INT8:
@@ -1001,7 +1000,7 @@ public class KuduPredicate {
    * @param type an integer type
    * @return the minimum value
    */
-  @VisibleForTesting
+  @InterfaceAudience.LimitedPrivate("Test")
   static long minIntValue(Type type) {
     switch (type) {
       case INT8:

http://git-wip-us.apache.org/repos/asf/kudu/blob/abbde75e/java/kudu-client/src/main/java/org/apache/kudu/client/KuduRpc.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/KuduRpc.java b/java/kudu-client/src/main/java/org/apache/kudu/client/KuduRpc.java
index 21a58aa..135ebec 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/KuduRpc.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/KuduRpc.java
@@ -34,7 +34,6 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
 
-import com.google.common.annotations.VisibleForTesting;
 import com.google.common.collect.ImmutableList;
 import com.google.protobuf.CodedOutputStream;
 import com.google.protobuf.InvalidProtocolBufferException;
@@ -80,7 +79,7 @@ public abstract class KuduRpc<R> {
    * This along with {@link Status#MAX_MESSAGE_LENGTH} dictates how big all the messages
    * in a trace can be.
    */
-  @VisibleForTesting
+  @InterfaceAudience.LimitedPrivate("Test")
   public static final int MAX_TRACES_SIZE = 100;
 
   /**

http://git-wip-us.apache.org/repos/asf/kudu/blob/abbde75e/java/kudu-client/src/main/java/org/apache/kudu/client/KuduScanToken.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/KuduScanToken.java b/java/kudu-client/src/main/java/org/apache/kudu/client/KuduScanToken.java
index a4ee2ab..615deed 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/KuduScanToken.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/KuduScanToken.java
@@ -21,7 +21,6 @@ import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 
-import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.MoreObjects;
 import com.google.common.base.Preconditions;
 import com.google.common.collect.ImmutableList;
@@ -97,7 +96,7 @@ public class KuduScanToken implements Comparable<KuduScanToken> {
    * @return the serialized scan token
    * @throws IOException
    */
-  @VisibleForTesting
+  @InterfaceAudience.LimitedPrivate("Test")
   static byte[] serialize(ScanTokenPB message) throws IOException {
     byte[] buf = new byte[message.getSerializedSize()];
     CodedOutputStream cos = CodedOutputStream.newInstance(buf);

http://git-wip-us.apache.org/repos/asf/kudu/blob/abbde75e/java/kudu-client/src/main/java/org/apache/kudu/client/KuduScanner.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/KuduScanner.java b/java/kudu-client/src/main/java/org/apache/kudu/client/KuduScanner.java
index feec583..d53b6aa 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/KuduScanner.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/KuduScanner.java
@@ -17,7 +17,6 @@
 
 package org.apache.kudu.client;
 
-import com.google.common.annotations.VisibleForTesting;
 import org.apache.yetus.audience.InterfaceAudience;
 import org.apache.yetus.audience.InterfaceStability;
 
@@ -114,7 +113,7 @@ public class KuduScanner {
   /**
    * Returns the RemoteTablet currently being scanned, if any.
    */
-  @VisibleForTesting
+  @InterfaceAudience.LimitedPrivate("Test")
   RemoteTablet currentTablet() {
     return asyncScanner.currentTablet();
   }
@@ -124,7 +123,7 @@ public class KuduScanner {
    *
    * @return the replica selection mechanism
    */
-  @VisibleForTesting
+  @InterfaceAudience.LimitedPrivate("Test")
   ReplicaSelection getReplicaSelection() {
     return asyncScanner.getReplicaSelection();
   }

http://git-wip-us.apache.org/repos/asf/kudu/blob/abbde75e/java/kudu-client/src/main/java/org/apache/kudu/client/Negotiator.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/Negotiator.java b/java/kudu-client/src/main/java/org/apache/kudu/client/Negotiator.java
index 47e4854..cbb502a 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/Negotiator.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/Negotiator.java
@@ -51,7 +51,6 @@ import javax.security.sasl.Sasl;
 import javax.security.sasl.SaslClient;
 import javax.security.sasl.SaslException;
 
-import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Joiner;
 import com.google.common.base.Preconditions;
 import com.google.common.collect.ImmutableSet;
@@ -204,7 +203,7 @@ public class Negotiator extends SimpleChannelUpstreamHandler {
 
   private Certificate peerCert;
 
-  @VisibleForTesting
+  @InterfaceAudience.LimitedPrivate("Test")
   boolean overrideLoopbackForTests;
 
   public Negotiator(String remoteHostname,

http://git-wip-us.apache.org/repos/asf/kudu/blob/abbde75e/java/kudu-client/src/main/java/org/apache/kudu/client/RpcProxy.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/RpcProxy.java b/java/kudu-client/src/main/java/org/apache/kudu/client/RpcProxy.java
index 42379ee..95ecf27 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/RpcProxy.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/RpcProxy.java
@@ -29,7 +29,6 @@ package org.apache.kudu.client;
 import java.util.Set;
 import javax.annotation.Nonnull;
 
-import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Preconditions;
 import com.google.protobuf.Message;
 import com.stumbleupon.async.Callback;
@@ -401,7 +400,7 @@ class RpcProxy {
   /**
    * @return underlying {@link Connection} object representing TCP connection to the server
    */
-  @VisibleForTesting
+  @InterfaceAudience.LimitedPrivate("Test")
   Connection getConnection() {
     return connection;
   }

http://git-wip-us.apache.org/repos/asf/kudu/blob/abbde75e/java/kudu-client/src/main/java/org/apache/kudu/client/SecurityContext.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/SecurityContext.java b/java/kudu-client/src/main/java/org/apache/kudu/client/SecurityContext.java
index d921fc5..2835015 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/SecurityContext.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/SecurityContext.java
@@ -41,7 +41,6 @@ import javax.net.ssl.X509TrustManager;
 import javax.security.auth.Subject;
 import javax.security.auth.kerberos.KerberosPrincipal;
 
-import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Throwables;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.Lists;
@@ -53,6 +52,7 @@ import org.apache.kudu.security.Token.SignedTokenPB;
 import org.apache.kudu.security.Token.TokenPB;
 import org.apache.kudu.util.Pair;
 import org.apache.kudu.util.SecurityUtil;
+import org.apache.yetus.audience.InterfaceAudience;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -118,7 +118,7 @@ class SecurityContext {
   /**
    * The currently trusted CA certs, in DER format.
    */
-  @VisibleForTesting
+  @InterfaceAudience.LimitedPrivate("Test")
   @GuardedBy("this")
   List<ByteString> trustedCertDers = Collections.emptyList();
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/abbde75e/java/kudu-client/src/main/java/org/apache/kudu/client/Status.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/Status.java b/java/kudu-client/src/main/java/org/apache/kudu/client/Status.java
index 210d990..382f11a 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/Status.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/Status.java
@@ -17,7 +17,6 @@
 
 package org.apache.kudu.client;
 
-import com.google.common.annotations.VisibleForTesting;
 import org.apache.yetus.audience.InterfaceAudience;
 import org.apache.yetus.audience.InterfaceStability;
 
@@ -34,11 +33,11 @@ import org.apache.kudu.tserver.Tserver;
 public class Status {
 
   // Limit the message size we get from the servers as it can be quite large.
-  @VisibleForTesting
+  @InterfaceAudience.LimitedPrivate("Test")
   static final int MAX_MESSAGE_LENGTH = 32 * 1024;
-  @VisibleForTesting
+  @InterfaceAudience.LimitedPrivate("Test")
   static final String ABBREVIATION_CHARS = "...";
-  @VisibleForTesting
+  @InterfaceAudience.LimitedPrivate("Test")
   static final int ABBREVIATION_CHARS_LENGTH = ABBREVIATION_CHARS.length();
 
   // Keep a single OK status object else we'll end up instantiating tons of them.

http://git-wip-us.apache.org/repos/asf/kudu/blob/abbde75e/java/kudu-client/src/main/java/org/apache/kudu/client/TableLocationsCache.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/TableLocationsCache.java
b/java/kudu-client/src/main/java/org/apache/kudu/client/TableLocationsCache.java
index 3e299ef..d8e5941 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/TableLocationsCache.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/TableLocationsCache.java
@@ -29,7 +29,6 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
 import javax.annotation.concurrent.GuardedBy;
 import javax.annotation.concurrent.ThreadSafe;
 
-import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.MoreObjects;
 import com.google.common.base.Preconditions;
 import com.google.common.base.Ticker;
@@ -53,7 +52,7 @@ class TableLocationsCache {
   @GuardedBy("rwl")
   private final NavigableMap<byte[], Entry> entries = new TreeMap<>(COMPARATOR);
 
-  @VisibleForTesting
+  @InterfaceAudience.LimitedPrivate("Test")
   static Ticker ticker = Ticker.systemTicker();
 
   public Entry get(byte[] partitionKey) {

http://git-wip-us.apache.org/repos/asf/kudu/blob/abbde75e/java/kudu-client/src/main/java/org/apache/kudu/util/ByteVec.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/util/ByteVec.java b/java/kudu-client/src/main/java/org/apache/kudu/util/ByteVec.java
index baf890b..a5323a4 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/util/ByteVec.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/util/ByteVec.java
@@ -21,7 +21,6 @@ import java.util.Arrays;
 import java.util.List;
 import javax.annotation.concurrent.NotThreadSafe;
 
-import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Preconditions;
 import com.google.common.io.BaseEncoding;
 import com.google.common.primitives.Bytes;
@@ -38,7 +37,7 @@ import org.apache.yetus.audience.InterfaceAudience;
 public final class ByteVec {
 
   /** Default initial capacity for new vectors. */
-  @VisibleForTesting
+  @InterfaceAudience.LimitedPrivate("Test")
   static final int DEFAULT_CAPACITY = 32;
 
   /** data backing the vector. */

http://git-wip-us.apache.org/repos/asf/kudu/blob/abbde75e/java/kudu-flume-sink/src/main/java/org/apache/kudu/flume/sink/KuduSink.java
----------------------------------------------------------------------
diff --git a/java/kudu-flume-sink/src/main/java/org/apache/kudu/flume/sink/KuduSink.java b/java/kudu-flume-sink/src/main/java/org/apache/kudu/flume/sink/KuduSink.java
index d4e58b1..74ff910 100644
--- a/java/kudu-flume-sink/src/main/java/org/apache/kudu/flume/sink/KuduSink.java
+++ b/java/kudu-flume-sink/src/main/java/org/apache/kudu/flume/sink/KuduSink.java
@@ -28,7 +28,6 @@ import static org.apache.kudu.flume.sink.KuduSinkConfigurationConstants.TIMEOUT_
 
 import java.util.List;
 
-import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Preconditions;
 import org.apache.flume.Channel;
 import org.apache.flume.Context;
@@ -115,7 +114,7 @@ public class KuduSink extends AbstractSink implements Configurable {
     this(null);
   }
 
-  @VisibleForTesting
+  @InterfaceAudience.LimitedPrivate("Test")
   @InterfaceAudience.Private
   public KuduSink(KuduClient kuduClient) {
     this.client = kuduClient;

http://git-wip-us.apache.org/repos/asf/kudu/blob/abbde75e/java/kudu-spark-tools/build.gradle
----------------------------------------------------------------------
diff --git a/java/kudu-spark-tools/build.gradle b/java/kudu-spark-tools/build.gradle
index c45b710..d01420b 100644
--- a/java/kudu-spark-tools/build.gradle
+++ b/java/kudu-spark-tools/build.gradle
@@ -31,6 +31,7 @@ dependencies {
   provided libs.scalaLibrary
   provided libs.sparkCore
   provided libs.sparkSql
+  provided libs.yetusAnnotations
 
   testCompile project(path: ":kudu-client", configuration: "shadowTest")
   testCompile project(path: ":kudu-spark", configuration: "test")

http://git-wip-us.apache.org/repos/asf/kudu/blob/abbde75e/java/kudu-spark-tools/pom.xml
----------------------------------------------------------------------
diff --git a/java/kudu-spark-tools/pom.xml b/java/kudu-spark-tools/pom.xml
index 13c8af3..f284ad0 100644
--- a/java/kudu-spark-tools/pom.xml
+++ b/java/kudu-spark-tools/pom.xml
@@ -86,6 +86,12 @@
             <scope>provided</scope>
         </dependency>
         <dependency>
+            <groupId>org.apache.yetus</groupId>
+            <artifactId>audience-annotations</artifactId>
+            <version>${yetus.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
             <groupId>org.scala-lang</groupId>
             <artifactId>scala-library</artifactId>
             <version>${scala.version}</version>

http://git-wip-us.apache.org/repos/asf/kudu/blob/abbde75e/java/kudu-spark-tools/src/main/scala/org/apache/kudu/spark/tools/ImportExportFiles.scala
----------------------------------------------------------------------
diff --git a/java/kudu-spark-tools/src/main/scala/org/apache/kudu/spark/tools/ImportExportFiles.scala
b/java/kudu-spark-tools/src/main/scala/org/apache/kudu/spark/tools/ImportExportFiles.scala
index a09b52d..e31a058 100644
--- a/java/kudu-spark-tools/src/main/scala/org/apache/kudu/spark/tools/ImportExportFiles.scala
+++ b/java/kudu-spark-tools/src/main/scala/org/apache/kudu/spark/tools/ImportExportFiles.scala
@@ -25,7 +25,7 @@ import org.apache.spark.sql.SparkSession
 import org.apache.spark.SparkConf
 import org.slf4j.{Logger, LoggerFactory}
 import org.apache.kudu.spark.kudu._
-import com.google.common.annotations.VisibleForTesting
+import org.apache.yetus.audience.InterfaceAudience
 
 object ImportExportKudu {
   val LOG: Logger = LoggerFactory.getLogger(ImportExportKudu.getClass)
@@ -145,7 +145,7 @@ object ImportExportFiles {
     * Entry point for testing. SparkContext is a singleton,
     * so tests must create and manage their own.
     */
-  @VisibleForTesting
+  @InterfaceAudience.LimitedPrivate(Array("Test"))
   def testMain(args: Array[String], ss: SparkSession): Unit = {
     run(ArgsCls.parse(args), ss)
   }

http://git-wip-us.apache.org/repos/asf/kudu/blob/abbde75e/java/kudu-spark-tools/src/main/scala/org/apache/kudu/spark/tools/IntegrationTestBigLinkedList.scala
----------------------------------------------------------------------
diff --git a/java/kudu-spark-tools/src/main/scala/org/apache/kudu/spark/tools/IntegrationTestBigLinkedList.scala
b/java/kudu-spark-tools/src/main/scala/org/apache/kudu/spark/tools/IntegrationTestBigLinkedList.scala
index 7b1fc31..9ae6e1c 100644
--- a/java/kudu-spark-tools/src/main/scala/org/apache/kudu/spark/tools/IntegrationTestBigLinkedList.scala
+++ b/java/kudu-spark-tools/src/main/scala/org/apache/kudu/spark/tools/IntegrationTestBigLinkedList.scala
@@ -19,13 +19,13 @@ package org.apache.kudu.spark.tools
 
 import java.net.InetAddress
 
-import com.google.common.annotations.VisibleForTesting
 import org.apache.kudu.client.SessionConfiguration.FlushMode
 import org.apache.kudu.client.{KuduClient, KuduSession, KuduTable}
 import org.apache.kudu.mapreduce.tools.BigLinkedListCommon.{Xoroshiro128PlusRandom, _}
 import org.apache.kudu.spark.kudu.KuduContext
 import org.apache.spark.sql.SparkSession
 import org.apache.spark.{SparkConf, TaskContext}
+import org.apache.yetus.audience.InterfaceAudience
 import org.slf4j.{Logger, LoggerFactory}
 
 import scala.util.Try
@@ -181,7 +181,7 @@ object Generator {
     * Entry point for testing. SparkContext is a singleton,
     * so tests must create and manage their own.
     */
-  @VisibleForTesting
+  @InterfaceAudience.LimitedPrivate(Array("Test"))
   def testMain(args: Array[String], ss: SparkSession): Unit = {
     run(Args.parse(args), ss)
   }
@@ -334,7 +334,7 @@ object Verifier {
     } else None
   }
 
-  @VisibleForTesting
+  @InterfaceAudience.LimitedPrivate(Array("Test"))
   def run(args: Args, ss: SparkSession): Counts = {
     import org.apache.kudu.spark.kudu._
     val sql = ss.sqlContext
@@ -416,7 +416,7 @@ object Verifier {
     })
   }
 
-  @VisibleForTesting
+  @InterfaceAudience.LimitedPrivate(Array("Test"))
   def testMain(arguments: Array[String], ss: SparkSession): Counts = {
     run(Args.parse(arguments), ss)
   }

http://git-wip-us.apache.org/repos/asf/kudu/blob/abbde75e/java/kudu-spark/src/test/scala/org/apache/kudu/spark/kudu/DefaultSourceTest.scala
----------------------------------------------------------------------
diff --git a/java/kudu-spark/src/test/scala/org/apache/kudu/spark/kudu/DefaultSourceTest.scala
b/java/kudu-spark/src/test/scala/org/apache/kudu/spark/kudu/DefaultSourceTest.scala
index 4e43a6a..91ebdce 100644
--- a/java/kudu-spark/src/test/scala/org/apache/kudu/spark/kudu/DefaultSourceTest.scala
+++ b/java/kudu-spark/src/test/scala/org/apache/kudu/spark/kudu/DefaultSourceTest.scala
@@ -24,7 +24,6 @@ import scala.collection.JavaConverters._
 import scala.collection.immutable.IndexedSeq
 import scala.util.control.NonFatal
 
-import com.google.common.collect.ImmutableList
 import org.apache.spark.sql.SQLContext
 import org.apache.spark.sql.functions._
 import org.apache.spark.sql.types.{DataTypes, StructField, StructType}
@@ -528,8 +527,8 @@ class DefaultSourceTest extends FunSuite with TestContext with BeforeAndAfter
wi
   test("Test SparkSQL StringStartsWith filters") {
     // This test requires a special table.
     val testTableName = "startswith"
-    val schema = new Schema(ImmutableList.of(
-      new ColumnSchemaBuilder("key", Type.STRING).key(true).build()))
+    val schema = new Schema(List(
+      new ColumnSchemaBuilder("key", Type.STRING).key(true).build()).asJava)
     val tableOptions = new CreateTableOptions().setRangePartitionColumns(List("key").asJava)
       .setNumReplicas(1)
     val testTable = kuduClient.createTable(testTableName, schema, tableOptions)

http://git-wip-us.apache.org/repos/asf/kudu/blob/abbde75e/java/kudu-spark/src/test/scala/org/apache/kudu/spark/kudu/TestContext.scala
----------------------------------------------------------------------
diff --git a/java/kudu-spark/src/test/scala/org/apache/kudu/spark/kudu/TestContext.scala b/java/kudu-spark/src/test/scala/org/apache/kudu/spark/kudu/TestContext.scala
index 414d48e..f00a4b4 100644
--- a/java/kudu-spark/src/test/scala/org/apache/kudu/spark/kudu/TestContext.scala
+++ b/java/kudu-spark/src/test/scala/org/apache/kudu/spark/kudu/TestContext.scala
@@ -22,7 +22,6 @@ import java.util.Date
 import scala.collection.JavaConverters._
 import scala.collection.immutable.IndexedSeq
 
-import com.google.common.collect.ImmutableList
 import org.apache.spark.SparkConf
 import org.scalatest.{BeforeAndAfterAll, Suite}
 
@@ -47,7 +46,7 @@ trait TestContext extends BeforeAndAfterAll { self: Suite =>
   val simpleTableName: String = "simple-test"
 
   lazy val schema: Schema = {
-    val columns = ImmutableList.of(
+    val columns = List(
       new ColumnSchemaBuilder("key", Type.INT32).key(true).build(),
       new ColumnSchemaBuilder("c1_i", Type.INT32).build(),
       new ColumnSchemaBuilder("c2_s", Type.STRING).nullable(true).build(),
@@ -71,7 +70,7 @@ trait TestContext extends BeforeAndAfterAll { self: Suite =>
         .typeAttributes(
           new ColumnTypeAttributesBuilder().precision(DecimalUtil.MAX_DECIMAL128_PRECISION).build()
         ).build())
-      new Schema(columns)
+      new Schema(columns.asJava)
   }
 
   lazy val simpleSchema: Schema = {


Mime
View raw message