From 79e45bb740de002997b9c772b5fdeb67ccbfa9ab Mon Sep 17 00:00:00 2001 From: Quintin Willison Date: Thu, 1 Oct 2020 20:03:05 +0100 Subject: [PATCH 1/2] Expand wildcard import statements. --- .../main/java/io/ably/lib/http/HttpCore.java | 10 ++++++++-- .../main/java/io/ably/lib/http/HttpHelpers.java | 5 ++++- .../main/java/io/ably/lib/push/PushBase.java | 12 ++++++++++-- .../java/io/ably/lib/realtime/Presence.java | 12 ++++++++++-- .../main/java/io/ably/lib/rest/AblyBase.java | 17 ++++++++++++++++- .../ably/lib/transport/ConnectionManager.java | 15 ++++++++++++--- .../main/java/io/ably/lib/types/Message.java | 10 ++++++++-- .../java/io/ably/lib/types/PresenceMessage.java | 10 ++++++++-- 8 files changed, 76 insertions(+), 15 deletions(-) diff --git a/lib/src/main/java/io/ably/lib/http/HttpCore.java b/lib/src/main/java/io/ably/lib/http/HttpCore.java index 95ab6e580..744d44111 100644 --- a/lib/src/main/java/io/ably/lib/http/HttpCore.java +++ b/lib/src/main/java/io/ably/lib/http/HttpCore.java @@ -1,8 +1,14 @@ package io.ably.lib.http; -import java.io.*; +import java.io.ByteArrayOutputStream; +import java.io.InputStream; +import java.io.IOException; +import java.io.OutputStream; import java.lang.reflect.Field; -import java.net.*; +import java.net.HttpURLConnection; +import java.net.InetSocketAddress; +import java.net.Proxy; +import java.net.URL; import java.util.HashMap; import java.util.List; import java.util.Map; 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 867b9ea7d..264d5fb79 100644 --- a/lib/src/main/java/io/ably/lib/http/HttpHelpers.java +++ b/lib/src/main/java/io/ably/lib/http/HttpHelpers.java @@ -3,7 +3,10 @@ import java.io.IOException; import java.net.URL; -import io.ably.lib.types.*; +import io.ably.lib.types.AblyException; +import io.ably.lib.types.Callback; +import io.ably.lib.types.ErrorInfo; +import io.ably.lib.types.Param; import static io.ably.lib.http.HttpUtils.buildURL; diff --git a/lib/src/main/java/io/ably/lib/push/PushBase.java b/lib/src/main/java/io/ably/lib/push/PushBase.java index 17ad98f05..15aa737ef 100644 --- a/lib/src/main/java/io/ably/lib/push/PushBase.java +++ b/lib/src/main/java/io/ably/lib/push/PushBase.java @@ -2,11 +2,19 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import io.ably.lib.http.*; +import io.ably.lib.http.BasePaginatedQuery; +import io.ably.lib.http.Http; +import io.ably.lib.http.HttpCore; +import io.ably.lib.http.HttpScheduler; +import io.ably.lib.http.HttpUtils; import io.ably.lib.realtime.CompletionListener; import io.ably.lib.rest.AblyBase; import io.ably.lib.rest.DeviceDetails; -import io.ably.lib.types.*; +import io.ably.lib.types.AblyException; +import io.ably.lib.types.AsyncPaginatedResult; +import io.ably.lib.types.Callback; +import io.ably.lib.types.PaginatedResult; +import io.ably.lib.types.Param; import io.ably.lib.util.Serialisation; import io.ably.lib.util.StringUtils; 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 09c65bcde..fba6bd236 100644 --- a/lib/src/main/java/io/ably/lib/realtime/Presence.java +++ b/lib/src/main/java/io/ably/lib/realtime/Presence.java @@ -14,8 +14,16 @@ import io.ably.lib.types.PresenceSerializer; import io.ably.lib.types.ProtocolMessage; import io.ably.lib.util.Log; - -import java.util.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.EnumMap; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; /** * A class that provides access to presence operations and state for the 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 0ca6edec9..ac6ec6c29 100644 --- a/lib/src/main/java/io/ably/lib/rest/AblyBase.java +++ b/lib/src/main/java/io/ably/lib/rest/AblyBase.java @@ -15,7 +15,22 @@ import io.ably.lib.http.PaginatedQuery; import io.ably.lib.platform.Platform; import io.ably.lib.push.Push; -import io.ably.lib.types.*; +import io.ably.lib.types.AblyException; +import io.ably.lib.types.AsyncHttpPaginatedResponse; +import io.ably.lib.types.AsyncPaginatedResult; +import io.ably.lib.types.Callback; +import io.ably.lib.types.ChannelOptions; +import io.ably.lib.types.ClientOptions; +import io.ably.lib.types.ErrorInfo; +import io.ably.lib.types.HttpPaginatedResponse; +import io.ably.lib.types.Message; +import io.ably.lib.types.MessageSerializer; +import io.ably.lib.types.PaginatedResult; +import io.ably.lib.types.Param; +import io.ably.lib.types.PublishResponse; +import io.ably.lib.types.ReadOnlyMap; +import io.ably.lib.types.Stats; +import io.ably.lib.types.StatsReader; import io.ably.lib.util.Crypto; import io.ably.lib.util.InternalMap; import io.ably.lib.util.Log; diff --git a/lib/src/main/java/io/ably/lib/transport/ConnectionManager.java b/lib/src/main/java/io/ably/lib/transport/ConnectionManager.java index 9a77d58ef..83d77f9e4 100644 --- a/lib/src/main/java/io/ably/lib/transport/ConnectionManager.java +++ b/lib/src/main/java/io/ably/lib/transport/ConnectionManager.java @@ -3,7 +3,12 @@ import io.ably.lib.debug.DebugOptions; import io.ably.lib.debug.DebugOptions.RawProtocolListener; import io.ably.lib.http.HttpHelpers; -import io.ably.lib.realtime.*; +import io.ably.lib.realtime.AblyRealtime; +import io.ably.lib.realtime.Channel; +import io.ably.lib.realtime.CompletionListener; +import io.ably.lib.realtime.Connection; +import io.ably.lib.realtime.ConnectionState; +import io.ably.lib.realtime.ConnectionStateListener; import io.ably.lib.realtime.ConnectionStateListener.ConnectionStateChange; import io.ably.lib.transport.ITransport.ConnectListener; import io.ably.lib.transport.ITransport.TransportParams; @@ -15,8 +20,12 @@ import io.ably.lib.types.ProtocolSerializer; import io.ably.lib.util.Log; import io.ably.lib.transport.NetworkConnectivity.NetworkConnectivityListener; - -import java.util.*; +import java.util.ArrayDeque; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; public class ConnectionManager implements ConnectListener { diff --git a/lib/src/main/java/io/ably/lib/types/Message.java b/lib/src/main/java/io/ably/lib/types/Message.java index 66f1e2409..d77ea29f7 100644 --- a/lib/src/main/java/io/ably/lib/types/Message.java +++ b/lib/src/main/java/io/ably/lib/types/Message.java @@ -3,8 +3,14 @@ import java.io.IOException; import java.lang.reflect.Type; import java.util.Collection; - -import com.google.gson.*; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; import io.ably.lib.util.Serialisation; import org.msgpack.core.MessageFormat; import org.msgpack.core.MessagePacker; diff --git a/lib/src/main/java/io/ably/lib/types/PresenceMessage.java b/lib/src/main/java/io/ably/lib/types/PresenceMessage.java index feb6540e6..51523a31e 100644 --- a/lib/src/main/java/io/ably/lib/types/PresenceMessage.java +++ b/lib/src/main/java/io/ably/lib/types/PresenceMessage.java @@ -2,8 +2,14 @@ import java.io.IOException; import java.lang.reflect.Type; - -import com.google.gson.*; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; import io.ably.lib.util.Serialisation; import org.msgpack.core.MessageFormat; import org.msgpack.core.MessagePacker; From 8200470b4f71c8bcb908947e0a6a8a7cf8305d42 Mon Sep 17 00:00:00 2001 From: Quintin Willison Date: Thu, 1 Oct 2020 20:03:58 +0100 Subject: [PATCH 2/2] Add checkstyle rule to enforce no wildcard imports. --- config/checkstyle/checkstyle.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml index e11967f0f..9a767dcca 100644 --- a/config/checkstyle/checkstyle.xml +++ b/config/checkstyle/checkstyle.xml @@ -11,5 +11,6 @@ +