From b0a48c9d084e67eedda40ce32b22db9955d80b9b Mon Sep 17 00:00:00 2001 From: Quintin Willison Date: Thu, 1 Oct 2020 18:58:43 +0100 Subject: [PATCH 1/2] Remove unused imports. --- java/src/main/java/io/ably/lib/platform/Platform.java | 1 - .../java/io/ably/lib/http/AsyncHttpScheduler.java | 2 -- .../java/io/ably/lib/http/BasePaginatedQuery.java | 1 - lib/src/main/java/io/ably/lib/http/HttpHelpers.java | 2 -- .../main/java/io/ably/lib/http/PaginatedQuery.java | 11 ----------- .../main/java/io/ably/lib/realtime/AblyRealtime.java | 1 - lib/src/main/java/io/ably/lib/realtime/Presence.java | 1 - lib/src/main/java/io/ably/lib/rest/AblyBase.java | 1 - lib/src/main/java/io/ably/lib/rest/Auth.java | 3 --- lib/src/main/java/io/ably/lib/rest/ChannelBase.java | 2 -- lib/src/main/java/io/ably/lib/rest/DeviceDetails.java | 1 - .../main/java/io/ably/lib/transport/ITransport.java | 1 - .../io/ably/lib/transport/WebSocketTransport.java | 2 -- .../main/java/io/ably/lib/types/ClientOptions.java | 1 - lib/src/main/java/io/ably/lib/types/DeltaExtras.java | 6 ------ .../java/io/ably/lib/types/MessageSerializer.java | 9 --------- lib/src/main/java/io/ably/lib/util/Serialisation.java | 1 - 17 files changed, 46 deletions(-) diff --git a/java/src/main/java/io/ably/lib/platform/Platform.java b/java/src/main/java/io/ably/lib/platform/Platform.java index ee8cdf1a0..bf469aeb9 100644 --- a/java/src/main/java/io/ably/lib/platform/Platform.java +++ b/java/src/main/java/io/ably/lib/platform/Platform.java @@ -1,6 +1,5 @@ package io.ably.lib.platform; -import io.ably.lib.rest.AblyBase; import io.ably.lib.transport.NetworkConnectivity; public class Platform { diff --git a/lib/src/main/java/io/ably/lib/http/AsyncHttpScheduler.java b/lib/src/main/java/io/ably/lib/http/AsyncHttpScheduler.java index 424f2dfd6..58b25c07d 100644 --- a/lib/src/main/java/io/ably/lib/http/AsyncHttpScheduler.java +++ b/lib/src/main/java/io/ably/lib/http/AsyncHttpScheduler.java @@ -1,8 +1,6 @@ package io.ably.lib.http; -import io.ably.lib.types.AblyException; import io.ably.lib.types.ClientOptions; -import io.ably.lib.types.ErrorInfo; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ThreadPoolExecutor; diff --git a/lib/src/main/java/io/ably/lib/http/BasePaginatedQuery.java b/lib/src/main/java/io/ably/lib/http/BasePaginatedQuery.java index dfed450a0..29197e6c8 100644 --- a/lib/src/main/java/io/ably/lib/http/BasePaginatedQuery.java +++ b/lib/src/main/java/io/ably/lib/http/BasePaginatedQuery.java @@ -13,7 +13,6 @@ import io.ably.lib.types.BasePaginatedResult; import io.ably.lib.types.Callback; import io.ably.lib.types.ErrorInfo; -import io.ably.lib.types.Message; import io.ably.lib.types.PaginatedResult; import io.ably.lib.types.Param; diff --git a/lib/src/main/java/io/ably/lib/http/HttpHelpers.java b/lib/src/main/java/io/ably/lib/http/HttpHelpers.java index a12af1f1d..867b9ea7d 100644 --- a/lib/src/main/java/io/ably/lib/http/HttpHelpers.java +++ b/lib/src/main/java/io/ably/lib/http/HttpHelpers.java @@ -4,8 +4,6 @@ import java.net.URL; import io.ably.lib.types.*; -import io.ably.lib.util.Log; -import io.ably.lib.util.Serialisation; import static io.ably.lib.http.HttpUtils.buildURL; diff --git a/lib/src/main/java/io/ably/lib/http/PaginatedQuery.java b/lib/src/main/java/io/ably/lib/http/PaginatedQuery.java index 7d314a450..6bda7ce0c 100644 --- a/lib/src/main/java/io/ably/lib/http/PaginatedQuery.java +++ b/lib/src/main/java/io/ably/lib/http/PaginatedQuery.java @@ -1,17 +1,6 @@ package io.ably.lib.http; -import java.io.UnsupportedEncodingException; -import java.net.URLDecoder; -import java.util.Collection; -import java.util.HashMap; -import java.util.Locale; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - import io.ably.lib.types.AblyException; -import io.ably.lib.types.BasePaginatedResult; -import io.ably.lib.types.Callback; -import io.ably.lib.types.ErrorInfo; import io.ably.lib.types.PaginatedResult; import io.ably.lib.types.Param; diff --git a/lib/src/main/java/io/ably/lib/realtime/AblyRealtime.java b/lib/src/main/java/io/ably/lib/realtime/AblyRealtime.java index 79af02ef6..a6a0bd1e3 100644 --- a/lib/src/main/java/io/ably/lib/realtime/AblyRealtime.java +++ b/lib/src/main/java/io/ably/lib/realtime/AblyRealtime.java @@ -6,7 +6,6 @@ import io.ably.lib.rest.AblyRest; import io.ably.lib.transport.ConnectionManager; -import io.ably.lib.transport.ITransport; import io.ably.lib.types.AblyException; import io.ably.lib.types.ChannelOptions; import io.ably.lib.types.ClientOptions; diff --git a/lib/src/main/java/io/ably/lib/realtime/Presence.java b/lib/src/main/java/io/ably/lib/realtime/Presence.java index e78532504..09c65bcde 100644 --- a/lib/src/main/java/io/ably/lib/realtime/Presence.java +++ b/lib/src/main/java/io/ably/lib/realtime/Presence.java @@ -3,7 +3,6 @@ import io.ably.lib.http.BasePaginatedQuery; import io.ably.lib.http.HttpCore; import io.ably.lib.http.HttpUtils; -import io.ably.lib.http.PaginatedQuery; import io.ably.lib.transport.ConnectionManager; import io.ably.lib.types.AblyException; import io.ably.lib.types.AsyncPaginatedResult; diff --git a/lib/src/main/java/io/ably/lib/rest/AblyBase.java b/lib/src/main/java/io/ably/lib/rest/AblyBase.java index 8341d6079..0ca6edec9 100644 --- a/lib/src/main/java/io/ably/lib/rest/AblyBase.java +++ b/lib/src/main/java/io/ably/lib/rest/AblyBase.java @@ -1,7 +1,6 @@ package io.ably.lib.rest; import java.util.HashMap; -import java.util.Map; import io.ably.annotation.Experimental; import io.ably.lib.http.AsyncHttpScheduler; diff --git a/lib/src/main/java/io/ably/lib/rest/Auth.java b/lib/src/main/java/io/ably/lib/rest/Auth.java index a03e622bf..5baa055b8 100644 --- a/lib/src/main/java/io/ably/lib/rest/Auth.java +++ b/lib/src/main/java/io/ably/lib/rest/Auth.java @@ -13,15 +13,12 @@ import com.google.gson.JsonObject; import com.google.gson.JsonParseException; -import io.ably.lib.http.Http; import io.ably.lib.http.HttpConstants; import io.ably.lib.http.HttpCore; import io.ably.lib.http.HttpHelpers; -import io.ably.lib.http.HttpScheduler; import io.ably.lib.http.HttpUtils; import io.ably.lib.types.AblyException; import io.ably.lib.types.BaseMessage; -import io.ably.lib.types.Callback; import io.ably.lib.types.Capability; import io.ably.lib.types.ClientOptions; import io.ably.lib.types.ErrorInfo; diff --git a/lib/src/main/java/io/ably/lib/rest/ChannelBase.java b/lib/src/main/java/io/ably/lib/rest/ChannelBase.java index 37b0574d0..aa642d16e 100644 --- a/lib/src/main/java/io/ably/lib/rest/ChannelBase.java +++ b/lib/src/main/java/io/ably/lib/rest/ChannelBase.java @@ -5,9 +5,7 @@ import io.ably.lib.http.HttpScheduler; import io.ably.lib.http.HttpCore; import io.ably.lib.http.HttpUtils; -import io.ably.lib.http.PaginatedQuery; import io.ably.lib.realtime.CompletionListener; -import io.ably.lib.http.AsyncPaginatedQuery; import io.ably.lib.types.AblyException; import io.ably.lib.types.AsyncPaginatedResult; import io.ably.lib.types.Callback; diff --git a/lib/src/main/java/io/ably/lib/rest/DeviceDetails.java b/lib/src/main/java/io/ably/lib/rest/DeviceDetails.java index c44b68956..3cb0b501d 100644 --- a/lib/src/main/java/io/ably/lib/rest/DeviceDetails.java +++ b/lib/src/main/java/io/ably/lib/rest/DeviceDetails.java @@ -4,7 +4,6 @@ import com.google.gson.JsonElement; import io.ably.lib.types.ErrorInfo; -import io.ably.lib.types.AblyException; import io.ably.lib.http.HttpCore; import io.ably.lib.util.JsonUtils; import io.ably.lib.util.Serialisation; diff --git a/lib/src/main/java/io/ably/lib/transport/ITransport.java b/lib/src/main/java/io/ably/lib/transport/ITransport.java index 875905ff8..e23ce3b67 100644 --- a/lib/src/main/java/io/ably/lib/transport/ITransport.java +++ b/lib/src/main/java/io/ably/lib/transport/ITransport.java @@ -1,6 +1,5 @@ package io.ably.lib.transport; -import io.ably.lib.realtime.ConnectionState; import io.ably.lib.types.AblyException; import io.ably.lib.types.ClientOptions; import io.ably.lib.types.ErrorInfo; diff --git a/lib/src/main/java/io/ably/lib/transport/WebSocketTransport.java b/lib/src/main/java/io/ably/lib/transport/WebSocketTransport.java index 9bc5e2975..8539690b3 100644 --- a/lib/src/main/java/io/ably/lib/transport/WebSocketTransport.java +++ b/lib/src/main/java/io/ably/lib/transport/WebSocketTransport.java @@ -1,8 +1,6 @@ package io.ably.lib.transport; import io.ably.lib.http.HttpUtils; -import io.ably.lib.realtime.ConnectionState; -import io.ably.lib.transport.ConnectionManager.StateIndication; import io.ably.lib.types.AblyException; import io.ably.lib.types.ErrorInfo; import io.ably.lib.types.Param; diff --git a/lib/src/main/java/io/ably/lib/types/ClientOptions.java b/lib/src/main/java/io/ably/lib/types/ClientOptions.java index 2db22e8c2..8bcb02e23 100644 --- a/lib/src/main/java/io/ably/lib/types/ClientOptions.java +++ b/lib/src/main/java/io/ably/lib/types/ClientOptions.java @@ -6,7 +6,6 @@ import io.ably.lib.util.Log; import io.ably.lib.util.Log.LogHandler; -import java.util.HashMap; import java.util.Map; /** diff --git a/lib/src/main/java/io/ably/lib/types/DeltaExtras.java b/lib/src/main/java/io/ably/lib/types/DeltaExtras.java index 68d5a4f2a..1a10a4be1 100644 --- a/lib/src/main/java/io/ably/lib/types/DeltaExtras.java +++ b/lib/src/main/java/io/ably/lib/types/DeltaExtras.java @@ -1,17 +1,11 @@ package io.ably.lib.types; -import com.google.gson.Gson; -import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.JsonSerializationContext; -import com.google.gson.JsonSerializer; -import io.ably.lib.util.Serialisation; import org.msgpack.core.MessagePacker; import org.msgpack.value.Value; import org.msgpack.value.ValueFactory; import java.io.IOException; -import java.lang.reflect.Type; import java.util.Map; import java.util.Objects; diff --git a/lib/src/main/java/io/ably/lib/types/MessageSerializer.java b/lib/src/main/java/io/ably/lib/types/MessageSerializer.java index 3e2db0e2c..f8540bf1e 100644 --- a/lib/src/main/java/io/ably/lib/types/MessageSerializer.java +++ b/lib/src/main/java/io/ably/lib/types/MessageSerializer.java @@ -1,19 +1,10 @@ package io.ably.lib.types; -import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.Reader; import java.util.HashMap; -import java.util.Iterator; import java.util.Map; -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; import io.ably.lib.http.HttpCore; import io.ably.lib.http.HttpUtils; import io.ably.lib.util.Log; diff --git a/lib/src/main/java/io/ably/lib/util/Serialisation.java b/lib/src/main/java/io/ably/lib/util/Serialisation.java index feeeb188f..d2ae3baad 100644 --- a/lib/src/main/java/io/ably/lib/util/Serialisation.java +++ b/lib/src/main/java/io/ably/lib/util/Serialisation.java @@ -11,7 +11,6 @@ import io.ably.lib.http.HttpCore; import io.ably.lib.platform.Platform; import io.ably.lib.types.AblyException; -import io.ably.lib.types.DeltaExtras; import io.ably.lib.types.ErrorInfo; import io.ably.lib.types.Message; import io.ably.lib.types.MessageExtras; From d7ea99f24862e55a50a6369bf2a33f35c8824de3 Mon Sep 17 00:00:00 2001 From: Quintin Willison Date: Thu, 1 Oct 2020 18:59:13 +0100 Subject: [PATCH 2/2] Add checkstyle rule to enforce no unused imports. --- config/checkstyle/checkstyle.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml index fb2bf6dfd..e11967f0f 100644 --- a/config/checkstyle/checkstyle.xml +++ b/config/checkstyle/checkstyle.xml @@ -10,5 +10,6 @@ +