From 40ebf8006e46f8857340648d7cea234ed699aed7 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Mon, 9 Mar 2020 12:21:35 -0600 Subject: global: optimize imports Signed-off-by: Jason A. Donenfeld --- tunnel/src/main/java/com/wireguard/android/backend/Backend.java | 4 +--- tunnel/src/main/java/com/wireguard/android/backend/GoBackend.java | 7 +++---- .../src/main/java/com/wireguard/android/backend/Statistics.java | 3 +-- .../main/java/com/wireguard/android/backend/WgQuickBackend.java | 8 +++----- tunnel/src/main/java/com/wireguard/android/util/ModuleLoader.java | 3 +-- tunnel/src/main/java/com/wireguard/android/util/RootShell.java | 6 +++--- .../main/java/com/wireguard/android/util/SharedLibraryLoader.java | 4 ++-- .../src/main/java/com/wireguard/android/util/ToolsInstaller.java | 6 +++--- tunnel/src/main/java/com/wireguard/config/BadConfigException.java | 3 +-- tunnel/src/main/java/com/wireguard/config/Config.java | 7 +++---- tunnel/src/main/java/com/wireguard/config/InetEndpoint.java | 3 +-- tunnel/src/main/java/com/wireguard/config/Interface.java | 6 ++---- tunnel/src/main/java/com/wireguard/config/Peer.java | 6 ++---- tunnel/src/main/java/com/wireguard/crypto/Curve25519.java | 4 ++-- tunnel/src/main/java/com/wireguard/crypto/Key.java | 3 +-- 15 files changed, 29 insertions(+), 44 deletions(-) (limited to 'tunnel/src/main/java/com') diff --git a/tunnel/src/main/java/com/wireguard/android/backend/Backend.java b/tunnel/src/main/java/com/wireguard/android/backend/Backend.java index 853802d2..4c18d98b 100644 --- a/tunnel/src/main/java/com/wireguard/android/backend/Backend.java +++ b/tunnel/src/main/java/com/wireguard/android/backend/Backend.java @@ -5,11 +5,9 @@ package com.wireguard.android.backend; -import com.wireguard.util.NonNullForAll; - import com.wireguard.config.Config; +import com.wireguard.util.NonNullForAll; -import java.util.Collection; import java.util.Set; import androidx.annotation.Nullable; diff --git a/tunnel/src/main/java/com/wireguard/android/backend/GoBackend.java b/tunnel/src/main/java/com/wireguard/android/backend/GoBackend.java index bf434cf5..54dc913a 100644 --- a/tunnel/src/main/java/com/wireguard/android/backend/GoBackend.java +++ b/tunnel/src/main/java/com/wireguard/android/backend/GoBackend.java @@ -5,14 +5,10 @@ package com.wireguard.android.backend; -import com.wireguard.util.NonNullForAll; - import android.content.Context; import android.content.Intent; import android.os.Build; import android.os.ParcelFileDescriptor; -import androidx.annotation.Nullable; -import androidx.collection.ArraySet; import android.util.Log; import com.wireguard.android.backend.BackendException.Reason; @@ -23,6 +19,7 @@ import com.wireguard.config.InetNetwork; import com.wireguard.config.Peer; import com.wireguard.crypto.Key; import com.wireguard.crypto.KeyFormatException; +import com.wireguard.util.NonNullForAll; import java.net.InetAddress; import java.util.Collections; @@ -30,6 +27,8 @@ import java.util.Set; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; +import androidx.annotation.Nullable; +import androidx.collection.ArraySet; import java9.util.concurrent.CompletableFuture; @NonNullForAll diff --git a/tunnel/src/main/java/com/wireguard/android/backend/Statistics.java b/tunnel/src/main/java/com/wireguard/android/backend/Statistics.java index f878a1f0..54bbe912 100644 --- a/tunnel/src/main/java/com/wireguard/android/backend/Statistics.java +++ b/tunnel/src/main/java/com/wireguard/android/backend/Statistics.java @@ -5,12 +5,11 @@ package com.wireguard.android.backend; -import com.wireguard.util.NonNullForAll; - import android.os.SystemClock; import android.util.Pair; import com.wireguard.crypto.Key; +import com.wireguard.util.NonNullForAll; import java.util.HashMap; import java.util.Map; diff --git a/tunnel/src/main/java/com/wireguard/android/backend/WgQuickBackend.java b/tunnel/src/main/java/com/wireguard/android/backend/WgQuickBackend.java index c4434e4d..d57a92f9 100644 --- a/tunnel/src/main/java/com/wireguard/android/backend/WgQuickBackend.java +++ b/tunnel/src/main/java/com/wireguard/android/backend/WgQuickBackend.java @@ -5,10 +5,6 @@ package com.wireguard.android.backend; -import com.wireguard.util.NonNullForAll; - -import androidx.annotation.Nullable; - import android.content.Context; import android.util.Log; import android.util.Pair; @@ -19,6 +15,7 @@ import com.wireguard.android.util.RootShell; import com.wireguard.android.util.ToolsInstaller; import com.wireguard.config.Config; import com.wireguard.crypto.Key; +import com.wireguard.util.NonNullForAll; import java.io.File; import java.io.FileOutputStream; @@ -26,14 +23,15 @@ import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; +import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Objects; import java.util.Set; -import java.util.HashMap; +import androidx.annotation.Nullable; import java9.util.stream.Collectors; import java9.util.stream.Stream; diff --git a/tunnel/src/main/java/com/wireguard/android/util/ModuleLoader.java b/tunnel/src/main/java/com/wireguard/android/util/ModuleLoader.java index 40645a43..519ad5cf 100644 --- a/tunnel/src/main/java/com/wireguard/android/util/ModuleLoader.java +++ b/tunnel/src/main/java/com/wireguard/android/util/ModuleLoader.java @@ -5,13 +5,12 @@ package com.wireguard.android.util; -import com.wireguard.util.NonNullForAll; - import android.content.Context; import android.system.OsConstants; import android.util.Base64; import com.wireguard.android.util.RootShell.RootShellException; +import com.wireguard.util.NonNullForAll; import net.i2p.crypto.eddsa.EdDSAEngine; import net.i2p.crypto.eddsa.EdDSAPublicKey; diff --git a/tunnel/src/main/java/com/wireguard/android/util/RootShell.java b/tunnel/src/main/java/com/wireguard/android/util/RootShell.java index eccc61cb..9f941815 100644 --- a/tunnel/src/main/java/com/wireguard/android/util/RootShell.java +++ b/tunnel/src/main/java/com/wireguard/android/util/RootShell.java @@ -5,13 +5,11 @@ package com.wireguard.android.util; -import com.wireguard.util.NonNullForAll; - import android.content.Context; -import androidx.annotation.Nullable; import android.util.Log; import com.wireguard.android.util.RootShell.RootShellException.Reason; +import com.wireguard.util.NonNullForAll; import java.io.BufferedReader; import java.io.File; @@ -22,6 +20,8 @@ import java.nio.charset.StandardCharsets; import java.util.Collection; import java.util.UUID; +import androidx.annotation.Nullable; + /** * Helper class for running commands as root. */ diff --git a/tunnel/src/main/java/com/wireguard/android/util/SharedLibraryLoader.java b/tunnel/src/main/java/com/wireguard/android/util/SharedLibraryLoader.java index 3c2448fe..f4670b14 100644 --- a/tunnel/src/main/java/com/wireguard/android/util/SharedLibraryLoader.java +++ b/tunnel/src/main/java/com/wireguard/android/util/SharedLibraryLoader.java @@ -5,12 +5,12 @@ package com.wireguard.android.util; -import com.wireguard.util.NonNullForAll; - import android.content.Context; import android.os.Build; import android.util.Log; +import com.wireguard.util.NonNullForAll; + import java.io.File; import java.io.FileOutputStream; import java.io.IOException; diff --git a/tunnel/src/main/java/com/wireguard/android/util/ToolsInstaller.java b/tunnel/src/main/java/com/wireguard/android/util/ToolsInstaller.java index 1ce3fe80..f12e755f 100644 --- a/tunnel/src/main/java/com/wireguard/android/util/ToolsInstaller.java +++ b/tunnel/src/main/java/com/wireguard/android/util/ToolsInstaller.java @@ -5,14 +5,12 @@ package com.wireguard.android.util; -import com.wireguard.util.NonNullForAll; - import android.content.Context; -import androidx.annotation.Nullable; import android.system.OsConstants; import android.util.Log; import com.wireguard.android.util.RootShell.RootShellException; +import com.wireguard.util.NonNullForAll; import java.io.File; import java.io.FileNotFoundException; @@ -20,6 +18,8 @@ import java.io.IOException; import java.util.Arrays; import java.util.List; +import androidx.annotation.Nullable; + /** * Helper to install WireGuard tools to the system partition. */ diff --git a/tunnel/src/main/java/com/wireguard/config/BadConfigException.java b/tunnel/src/main/java/com/wireguard/config/BadConfigException.java index 89b3af2c..f1577e91 100644 --- a/tunnel/src/main/java/com/wireguard/config/BadConfigException.java +++ b/tunnel/src/main/java/com/wireguard/config/BadConfigException.java @@ -5,12 +5,11 @@ package com.wireguard.config; +import com.wireguard.crypto.KeyFormatException; import com.wireguard.util.NonNullForAll; import androidx.annotation.Nullable; -import com.wireguard.crypto.KeyFormatException; - @NonNullForAll public class BadConfigException extends Exception { private final Location location; diff --git a/tunnel/src/main/java/com/wireguard/config/Config.java b/tunnel/src/main/java/com/wireguard/config/Config.java index f86eb6fd..c45dccb6 100644 --- a/tunnel/src/main/java/com/wireguard/config/Config.java +++ b/tunnel/src/main/java/com/wireguard/config/Config.java @@ -5,13 +5,10 @@ package com.wireguard.config; -import com.wireguard.util.NonNullForAll; - -import androidx.annotation.Nullable; - import com.wireguard.config.BadConfigException.Location; import com.wireguard.config.BadConfigException.Reason; import com.wireguard.config.BadConfigException.Section; +import com.wireguard.util.NonNullForAll; import java.io.BufferedReader; import java.io.IOException; @@ -25,6 +22,8 @@ import java.util.List; import java.util.Objects; import java.util.Set; +import androidx.annotation.Nullable; + /** * Represents the contents of a wg-quick configuration file, made up of one or more "Interface" * sections (combined together), and zero or more "Peer" sections (treated individually). diff --git a/tunnel/src/main/java/com/wireguard/config/InetEndpoint.java b/tunnel/src/main/java/com/wireguard/config/InetEndpoint.java index 69c60806..0120de0e 100644 --- a/tunnel/src/main/java/com/wireguard/config/InetEndpoint.java +++ b/tunnel/src/main/java/com/wireguard/config/InetEndpoint.java @@ -7,8 +7,6 @@ package com.wireguard.config; import com.wireguard.util.NonNullForAll; -import androidx.annotation.Nullable; - import org.threeten.bp.Duration; import org.threeten.bp.Instant; @@ -19,6 +17,7 @@ import java.net.URISyntaxException; import java.net.UnknownHostException; import java.util.regex.Pattern; +import androidx.annotation.Nullable; import java9.util.Optional; diff --git a/tunnel/src/main/java/com/wireguard/config/Interface.java b/tunnel/src/main/java/com/wireguard/config/Interface.java index efe00ce7..32621d2f 100644 --- a/tunnel/src/main/java/com/wireguard/config/Interface.java +++ b/tunnel/src/main/java/com/wireguard/config/Interface.java @@ -5,16 +5,13 @@ package com.wireguard.config; -import com.wireguard.util.NonNullForAll; - -import androidx.annotation.Nullable; - import com.wireguard.config.BadConfigException.Location; import com.wireguard.config.BadConfigException.Reason; import com.wireguard.config.BadConfigException.Section; import com.wireguard.crypto.Key; import com.wireguard.crypto.KeyFormatException; import com.wireguard.crypto.KeyPair; +import com.wireguard.util.NonNullForAll; import java.net.InetAddress; import java.util.Collection; @@ -25,6 +22,7 @@ import java.util.Locale; import java.util.Objects; import java.util.Set; +import androidx.annotation.Nullable; import java9.util.Lists; import java9.util.Optional; import java9.util.stream.Collectors; diff --git a/tunnel/src/main/java/com/wireguard/config/Peer.java b/tunnel/src/main/java/com/wireguard/config/Peer.java index ef91a306..984dbe9c 100644 --- a/tunnel/src/main/java/com/wireguard/config/Peer.java +++ b/tunnel/src/main/java/com/wireguard/config/Peer.java @@ -5,15 +5,12 @@ package com.wireguard.config; -import com.wireguard.util.NonNullForAll; - -import androidx.annotation.Nullable; - import com.wireguard.config.BadConfigException.Location; import com.wireguard.config.BadConfigException.Reason; import com.wireguard.config.BadConfigException.Section; import com.wireguard.crypto.Key; import com.wireguard.crypto.KeyFormatException; +import com.wireguard.util.NonNullForAll; import java.util.Collection; import java.util.Collections; @@ -22,6 +19,7 @@ import java.util.Locale; import java.util.Objects; import java.util.Set; +import androidx.annotation.Nullable; import java9.util.Optional; /** diff --git a/tunnel/src/main/java/com/wireguard/crypto/Curve25519.java b/tunnel/src/main/java/com/wireguard/crypto/Curve25519.java index 7628c566..efc22d6e 100644 --- a/tunnel/src/main/java/com/wireguard/crypto/Curve25519.java +++ b/tunnel/src/main/java/com/wireguard/crypto/Curve25519.java @@ -8,10 +8,10 @@ package com.wireguard.crypto; import com.wireguard.util.NonNullForAll; -import androidx.annotation.Nullable; - import java.util.Arrays; +import androidx.annotation.Nullable; + /** * Implementation of the Curve25519 elliptic curve algorithm. *

diff --git a/tunnel/src/main/java/com/wireguard/crypto/Key.java b/tunnel/src/main/java/com/wireguard/crypto/Key.java index e46150bd..fe03fa2d 100644 --- a/tunnel/src/main/java/com/wireguard/crypto/Key.java +++ b/tunnel/src/main/java/com/wireguard/crypto/Key.java @@ -5,9 +5,8 @@ package com.wireguard.crypto; -import com.wireguard.util.NonNullForAll; - import com.wireguard.crypto.KeyFormatException.Type; +import com.wireguard.util.NonNullForAll; import java.security.MessageDigest; import java.security.SecureRandom; -- cgit v1.2.3