diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2020-03-09 12:01:52 -0600 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2020-03-09 12:19:15 -0600 |
commit | 8e8643122eb5783d4412c8a81fb03cc789c3f77c (patch) | |
tree | 43cc7ea98c33115a7b3bc062104deeb75c580f19 /ui/src/main/java/com/wireguard/android/util | |
parent | c00a0b12e4bf353a20a520c59961b21374050089 (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 'ui/src/main/java/com/wireguard/android/util')
10 files changed, 29 insertions, 0 deletions
diff --git a/ui/src/main/java/com/wireguard/android/util/AsyncWorker.java b/ui/src/main/java/com/wireguard/android/util/AsyncWorker.java index 1d041851..f8341976 100644 --- a/ui/src/main/java/com/wireguard/android/util/AsyncWorker.java +++ b/ui/src/main/java/com/wireguard/android/util/AsyncWorker.java @@ -5,6 +5,8 @@ package com.wireguard.android.util; +import com.wireguard.util.NonNullForAll; + import android.os.Handler; import java.util.concurrent.Executor; @@ -16,6 +18,7 @@ import java9.util.concurrent.CompletionStage; * Helper class for running asynchronous tasks and ensuring they are completed on the main thread. */ +@NonNullForAll public class AsyncWorker { private final Executor executor; private final Handler handler; diff --git a/ui/src/main/java/com/wireguard/android/util/ClipboardUtils.java b/ui/src/main/java/com/wireguard/android/util/ClipboardUtils.java index 0df5e96a..649fe261 100644 --- a/ui/src/main/java/com/wireguard/android/util/ClipboardUtils.java +++ b/ui/src/main/java/com/wireguard/android/util/ClipboardUtils.java @@ -5,6 +5,8 @@ package com.wireguard.android.util; +import com.wireguard.util.NonNullForAll; + import android.content.ClipData; import android.content.ClipboardManager; import android.content.Context; @@ -16,6 +18,7 @@ import android.widget.TextView; * Standalone utilities for interacting with the system clipboard. */ +@NonNullForAll public final class ClipboardUtils { private ClipboardUtils() { // Prevent instantiation diff --git a/ui/src/main/java/com/wireguard/android/util/DownloadsFileSaver.java b/ui/src/main/java/com/wireguard/android/util/DownloadsFileSaver.java index 7db46fa9..3f80a562 100644 --- a/ui/src/main/java/com/wireguard/android/util/DownloadsFileSaver.java +++ b/ui/src/main/java/com/wireguard/android/util/DownloadsFileSaver.java @@ -5,6 +5,8 @@ package com.wireguard.android.util; +import com.wireguard.util.NonNullForAll; + import android.content.ContentResolver; import android.content.ContentValues; import android.content.Context; @@ -22,6 +24,7 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; +@NonNullForAll public class DownloadsFileSaver { public static class DownloadsFile { diff --git a/ui/src/main/java/com/wireguard/android/util/ErrorMessages.java b/ui/src/main/java/com/wireguard/android/util/ErrorMessages.java index 481a6ffb..3b818251 100644 --- a/ui/src/main/java/com/wireguard/android/util/ErrorMessages.java +++ b/ui/src/main/java/com/wireguard/android/util/ErrorMessages.java @@ -5,6 +5,8 @@ package com.wireguard.android.util; +import com.wireguard.util.NonNullForAll; + import android.content.res.Resources; import android.os.RemoteException; @@ -29,6 +31,7 @@ import java.util.Map; import java9.util.Maps; +@NonNullForAll public final class ErrorMessages { private static final Map<BadConfigException.Reason, Integer> BCE_REASON_MAP = new EnumMap<>(Maps.of( BadConfigException.Reason.INVALID_KEY, R.string.bad_config_reason_invalid_key, diff --git a/ui/src/main/java/com/wireguard/android/util/ExceptionLoggers.java b/ui/src/main/java/com/wireguard/android/util/ExceptionLoggers.java index 5c7a38c0..3e56bd55 100644 --- a/ui/src/main/java/com/wireguard/android/util/ExceptionLoggers.java +++ b/ui/src/main/java/com/wireguard/android/util/ExceptionLoggers.java @@ -5,6 +5,8 @@ package com.wireguard.android.util; +import com.wireguard.util.NonNullForAll; + import androidx.annotation.Nullable; import android.util.Log; diff --git a/ui/src/main/java/com/wireguard/android/util/FragmentUtils.java b/ui/src/main/java/com/wireguard/android/util/FragmentUtils.java index 5fb9a3bc..50a49fa1 100644 --- a/ui/src/main/java/com/wireguard/android/util/FragmentUtils.java +++ b/ui/src/main/java/com/wireguard/android/util/FragmentUtils.java @@ -4,12 +4,15 @@ */ package com.wireguard.android.util; +import com.wireguard.util.NonNullForAll; + import android.content.Context; import androidx.preference.Preference; import android.view.ContextThemeWrapper; import com.wireguard.android.activity.SettingsActivity; +@NonNullForAll public final class FragmentUtils { private FragmentUtils() { // Prevent instantiation diff --git a/ui/src/main/java/com/wireguard/android/util/ObservableKeyedArrayList.java b/ui/src/main/java/com/wireguard/android/util/ObservableKeyedArrayList.java index 0ba02184..bf16d921 100644 --- a/ui/src/main/java/com/wireguard/android/util/ObservableKeyedArrayList.java +++ b/ui/src/main/java/com/wireguard/android/util/ObservableKeyedArrayList.java @@ -5,6 +5,8 @@ package com.wireguard.android.util; +import com.wireguard.util.NonNullForAll; + import androidx.databinding.ObservableArrayList; import androidx.annotation.Nullable; @@ -21,6 +23,7 @@ import java.util.Objects; * operations, require O(n) time. */ +@NonNullForAll public class ObservableKeyedArrayList<K, E extends Keyed<? extends K>> extends ObservableArrayList<E> implements ObservableKeyedList<K, E> { @Override diff --git a/ui/src/main/java/com/wireguard/android/util/ObservableKeyedList.java b/ui/src/main/java/com/wireguard/android/util/ObservableKeyedList.java index be8ceb9b..1c430493 100644 --- a/ui/src/main/java/com/wireguard/android/util/ObservableKeyedList.java +++ b/ui/src/main/java/com/wireguard/android/util/ObservableKeyedList.java @@ -5,6 +5,8 @@ package com.wireguard.android.util; +import com.wireguard.util.NonNullForAll; + import androidx.databinding.ObservableList; import com.wireguard.util.Keyed; @@ -14,6 +16,7 @@ import com.wireguard.util.KeyedList; * A list that is both keyed and observable. */ +@NonNullForAll public interface ObservableKeyedList<K, E extends Keyed<? extends K>> extends KeyedList<K, E>, ObservableList<E> { } diff --git a/ui/src/main/java/com/wireguard/android/util/ObservableSortedKeyedArrayList.java b/ui/src/main/java/com/wireguard/android/util/ObservableSortedKeyedArrayList.java index 1d585856..77d6bbf3 100644 --- a/ui/src/main/java/com/wireguard/android/util/ObservableSortedKeyedArrayList.java +++ b/ui/src/main/java/com/wireguard/android/util/ObservableSortedKeyedArrayList.java @@ -5,6 +5,8 @@ package com.wireguard.android.util; +import com.wireguard.util.NonNullForAll; + import androidx.annotation.Nullable; import com.wireguard.util.Keyed; @@ -26,6 +28,7 @@ import java.util.Spliterator; * key still require O(n) time. */ +@NonNullForAll public class ObservableSortedKeyedArrayList<K, E extends Keyed<? extends K>> extends ObservableKeyedArrayList<K, E> implements ObservableSortedKeyedList<K, E> { @Nullable private final Comparator<? super K> comparator; diff --git a/ui/src/main/java/com/wireguard/android/util/ObservableSortedKeyedList.java b/ui/src/main/java/com/wireguard/android/util/ObservableSortedKeyedList.java index d796704e..59531408 100644 --- a/ui/src/main/java/com/wireguard/android/util/ObservableSortedKeyedList.java +++ b/ui/src/main/java/com/wireguard/android/util/ObservableSortedKeyedList.java @@ -5,6 +5,8 @@ package com.wireguard.android.util; +import com.wireguard.util.NonNullForAll; + import com.wireguard.util.Keyed; import com.wireguard.util.SortedKeyedList; @@ -12,6 +14,7 @@ import com.wireguard.util.SortedKeyedList; * A list that is both sorted/keyed and observable. */ +@NonNullForAll public interface ObservableSortedKeyedList<K, E extends Keyed<? extends K>> extends ObservableKeyedList<K, E>, SortedKeyedList<K, E> { } |