summaryrefslogtreecommitdiffhomepage
path: root/tunnel/src/main/java/com/wireguard/android
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2020-03-09 12:01:52 -0600
committerJason A. Donenfeld <Jason@zx2c4.com>2020-03-09 12:19:15 -0600
commit8e8643122eb5783d4412c8a81fb03cc789c3f77c (patch)
tree43cc7ea98c33115a7b3bc062104deeb75c580f19 /tunnel/src/main/java/com/wireguard/android
parentc00a0b12e4bf353a20a520c59961b21374050089 (diff)
global: get rid of nonnull gradle hack
Hacking things up via gradle is not right, and package-info.java poses problems with two modules, so instead we just apply it manually to every class. Remember to add this to new classes! Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'tunnel/src/main/java/com/wireguard/android')
-rw-r--r--tunnel/src/main/java/com/wireguard/android/backend/Backend.java3
-rw-r--r--tunnel/src/main/java/com/wireguard/android/backend/BackendException.java3
-rw-r--r--tunnel/src/main/java/com/wireguard/android/backend/GoBackend.java3
-rw-r--r--tunnel/src/main/java/com/wireguard/android/backend/Statistics.java3
-rw-r--r--tunnel/src/main/java/com/wireguard/android/backend/Tunnel.java3
-rw-r--r--tunnel/src/main/java/com/wireguard/android/backend/WgQuickBackend.java3
-rw-r--r--tunnel/src/main/java/com/wireguard/android/util/ModuleLoader.java3
-rw-r--r--tunnel/src/main/java/com/wireguard/android/util/RootShell.java3
-rw-r--r--tunnel/src/main/java/com/wireguard/android/util/SharedLibraryLoader.java3
-rw-r--r--tunnel/src/main/java/com/wireguard/android/util/ToolsInstaller.java3
10 files changed, 30 insertions, 0 deletions
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 ed3a5ebd..853802d2 100644
--- a/tunnel/src/main/java/com/wireguard/android/backend/Backend.java
+++ b/tunnel/src/main/java/com/wireguard/android/backend/Backend.java
@@ -5,6 +5,8 @@
package com.wireguard.android.backend;
+import com.wireguard.util.NonNullForAll;
+
import com.wireguard.config.Config;
import java.util.Collection;
@@ -16,6 +18,7 @@ import androidx.annotation.Nullable;
* Interface for implementations of the WireGuard secure network tunnel.
*/
+@NonNullForAll
public interface Backend {
/**
* Enumerate names of currently-running tunnels.
diff --git a/tunnel/src/main/java/com/wireguard/android/backend/BackendException.java b/tunnel/src/main/java/com/wireguard/android/backend/BackendException.java
index e1e8eaa9..0f60701b 100644
--- a/tunnel/src/main/java/com/wireguard/android/backend/BackendException.java
+++ b/tunnel/src/main/java/com/wireguard/android/backend/BackendException.java
@@ -5,6 +5,9 @@
package com.wireguard.android.backend;
+import com.wireguard.util.NonNullForAll;
+
+@NonNullForAll
public final class BackendException extends Exception {
public enum Reason {
UNKNOWN_KERNEL_MODULE_NAME,
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 6ad5afa4..bf434cf5 100644
--- a/tunnel/src/main/java/com/wireguard/android/backend/GoBackend.java
+++ b/tunnel/src/main/java/com/wireguard/android/backend/GoBackend.java
@@ -5,6 +5,8 @@
package com.wireguard.android.backend;
+import com.wireguard.util.NonNullForAll;
+
import android.content.Context;
import android.content.Intent;
import android.os.Build;
@@ -30,6 +32,7 @@ import java.util.concurrent.TimeoutException;
import java9.util.concurrent.CompletableFuture;
+@NonNullForAll
public final class GoBackend implements Backend {
private static final String TAG = "WireGuard/" + GoBackend.class.getSimpleName();
private static CompletableFuture<VpnService> vpnService = new CompletableFuture<>();
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 2ca87d23..f878a1f0 100644
--- a/tunnel/src/main/java/com/wireguard/android/backend/Statistics.java
+++ b/tunnel/src/main/java/com/wireguard/android/backend/Statistics.java
@@ -5,6 +5,8 @@
package com.wireguard.android.backend;
+import com.wireguard.util.NonNullForAll;
+
import android.os.SystemClock;
import android.util.Pair;
@@ -13,6 +15,7 @@ import com.wireguard.crypto.Key;
import java.util.HashMap;
import java.util.Map;
+@NonNullForAll
public class Statistics {
private long lastTouched = SystemClock.elapsedRealtime();
private final Map<Key, Pair<Long, Long>> peerBytes = new HashMap<>();
diff --git a/tunnel/src/main/java/com/wireguard/android/backend/Tunnel.java b/tunnel/src/main/java/com/wireguard/android/backend/Tunnel.java
index af2f59f7..fccda84f 100644
--- a/tunnel/src/main/java/com/wireguard/android/backend/Tunnel.java
+++ b/tunnel/src/main/java/com/wireguard/android/backend/Tunnel.java
@@ -5,12 +5,15 @@
package com.wireguard.android.backend;
+import com.wireguard.util.NonNullForAll;
+
import java.util.regex.Pattern;
/**
* Represents a WireGuard tunnel.
*/
+@NonNullForAll
public interface Tunnel {
enum State {
DOWN,
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 53fe3d42..c4434e4d 100644
--- a/tunnel/src/main/java/com/wireguard/android/backend/WgQuickBackend.java
+++ b/tunnel/src/main/java/com/wireguard/android/backend/WgQuickBackend.java
@@ -5,6 +5,8 @@
package com.wireguard.android.backend;
+import com.wireguard.util.NonNullForAll;
+
import androidx.annotation.Nullable;
import android.content.Context;
@@ -39,6 +41,7 @@ import java9.util.stream.Stream;
* WireGuard backend that uses {@code wg-quick} to implement tunnel configuration.
*/
+@NonNullForAll
public final class WgQuickBackend implements Backend {
private static final String TAG = "WireGuard/" + WgQuickBackend.class.getSimpleName();
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 f09d9a87..40645a43 100644
--- a/tunnel/src/main/java/com/wireguard/android/util/ModuleLoader.java
+++ b/tunnel/src/main/java/com/wireguard/android/util/ModuleLoader.java
@@ -5,6 +5,8 @@
package com.wireguard.android.util;
+import com.wireguard.util.NonNullForAll;
+
import android.content.Context;
import android.system.OsConstants;
import android.util.Base64;
@@ -36,6 +38,7 @@ import java.util.Map;
import androidx.annotation.Nullable;
+@NonNullForAll
public class ModuleLoader {
private static final String MODULE_PUBLIC_KEY_BASE64 = "RWRmHuT9PSqtwfsLtEx+QS06BJtLgFYteL9WCNjH7yuyu5Y1DieSN7If";
private static final String MODULE_LIST_URL = "https://download.wireguard.com/android-module/modules.txt.sig";
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 1fc2c9f2..eccc61cb 100644
--- a/tunnel/src/main/java/com/wireguard/android/util/RootShell.java
+++ b/tunnel/src/main/java/com/wireguard/android/util/RootShell.java
@@ -5,6 +5,8 @@
package com.wireguard.android.util;
+import com.wireguard.util.NonNullForAll;
+
import android.content.Context;
import androidx.annotation.Nullable;
import android.util.Log;
@@ -24,6 +26,7 @@ import java.util.UUID;
* Helper class for running commands as root.
*/
+@NonNullForAll
public class RootShell {
private static final String SU = "su";
private static final String TAG = "WireGuard/" + RootShell.class.getSimpleName();
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 93e44b64..3c2448fe 100644
--- a/tunnel/src/main/java/com/wireguard/android/util/SharedLibraryLoader.java
+++ b/tunnel/src/main/java/com/wireguard/android/util/SharedLibraryLoader.java
@@ -5,6 +5,8 @@
package com.wireguard.android.util;
+import com.wireguard.util.NonNullForAll;
+
import android.content.Context;
import android.os.Build;
import android.util.Log;
@@ -19,6 +21,7 @@ import java.util.HashSet;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
+@NonNullForAll
public final class SharedLibraryLoader {
private static final String TAG = "WireGuard/" + SharedLibraryLoader.class.getSimpleName();
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 ac18cabf..1ce3fe80 100644
--- a/tunnel/src/main/java/com/wireguard/android/util/ToolsInstaller.java
+++ b/tunnel/src/main/java/com/wireguard/android/util/ToolsInstaller.java
@@ -5,6 +5,8 @@
package com.wireguard.android.util;
+import com.wireguard.util.NonNullForAll;
+
import android.content.Context;
import androidx.annotation.Nullable;
import android.system.OsConstants;
@@ -22,6 +24,7 @@ import java.util.List;
* Helper to install WireGuard tools to the system partition.
*/
+@NonNullForAll
public final class ToolsInstaller {
public static final int ERROR = 0x0;
public static final int MAGISK = 0x4;