From 740af74ebb4bcbd744a4b43a92523f2b12a80a6d Mon Sep 17 00:00:00 2001 From: Lenni0451 <20379977+Lenni0451@users.noreply.github.com> Date: Tue, 3 Oct 2023 21:06:12 +0200 Subject: [PATCH] Removed suppressed warnings --- .../src/main/java/net/lenni0451/commons/ArrayUtils.java | 1 - .../main/java/net/lenni0451/commons/ByteArrayClassLoader.java | 1 - .../src/main/java/net/lenni0451/commons/RandomUtils.java | 1 - commons-main/src/main/java/net/lenni0451/commons/Sneaky.java | 4 ---- .../main/java/net/lenni0451/commons/collections/Lists.java | 1 - .../src/main/java/net/lenni0451/commons/collections/Maps.java | 2 -- .../src/main/java/net/lenni0451/commons/collections/Sets.java | 1 - .../main/java/net/lenni0451/commons/color/ColorConverter.java | 1 - .../src/main/java/net/lenni0451/commons/io/FileSystemZip.java | 1 - .../src/main/java/net/lenni0451/commons/io/FileUtils.java | 1 - .../main/java/net/lenni0451/commons/math/SliceCalculator.java | 1 - .../src/main/java/net/lenni0451/commons/network/TorProxy.java | 1 - .../java/net/lenni0451/commons/threading/ThreadScheduler.java | 1 - .../java/net/lenni0451/commons/threading/ThreadUtils.java | 2 -- .../main/java/net/lenni0451/commons/time/TimeFormatter.java | 1 - 15 files changed, 20 deletions(-) diff --git a/commons-main/src/main/java/net/lenni0451/commons/ArrayUtils.java b/commons-main/src/main/java/net/lenni0451/commons/ArrayUtils.java index beaadd3..dc2a910 100644 --- a/commons-main/src/main/java/net/lenni0451/commons/ArrayUtils.java +++ b/commons-main/src/main/java/net/lenni0451/commons/ArrayUtils.java @@ -2,7 +2,6 @@ import java.lang.reflect.Array; -@SuppressWarnings({"unused", "unchecked"}) public class ArrayUtils { /* diff --git a/commons-main/src/main/java/net/lenni0451/commons/ByteArrayClassLoader.java b/commons-main/src/main/java/net/lenni0451/commons/ByteArrayClassLoader.java index 4b5b8e0..97c5e87 100644 --- a/commons-main/src/main/java/net/lenni0451/commons/ByteArrayClassLoader.java +++ b/commons-main/src/main/java/net/lenni0451/commons/ByteArrayClassLoader.java @@ -18,7 +18,6 @@ /** * A class loader with the ability to load classes from a byte array. */ -@SuppressWarnings("unused") public class ByteArrayClassLoader extends ClassLoader { private final Map content = new HashMap<>(); diff --git a/commons-main/src/main/java/net/lenni0451/commons/RandomUtils.java b/commons-main/src/main/java/net/lenni0451/commons/RandomUtils.java index 1f8c433..6284d47 100644 --- a/commons-main/src/main/java/net/lenni0451/commons/RandomUtils.java +++ b/commons-main/src/main/java/net/lenni0451/commons/RandomUtils.java @@ -3,7 +3,6 @@ import java.util.List; import java.util.Random; -@SuppressWarnings("unused") public class RandomUtils { private static final Random RND = new Random(); diff --git a/commons-main/src/main/java/net/lenni0451/commons/Sneaky.java b/commons-main/src/main/java/net/lenni0451/commons/Sneaky.java index 30eb48b..465c33a 100644 --- a/commons-main/src/main/java/net/lenni0451/commons/Sneaky.java +++ b/commons-main/src/main/java/net/lenni0451/commons/Sneaky.java @@ -10,7 +10,6 @@ public class Sneaky { * @param The type of the exception * @throws T The exception */ - @SuppressWarnings({"unused", "RedundantThrows"}) public static void fake(final Class exceptionType) throws T { } @@ -21,7 +20,6 @@ public static void fake(final Class exceptionType) thro * @param The type of the throwable * @throws T The throwable */ - @SuppressWarnings("unchecked") public static void sneak(final Throwable t) throws T { throw (T) t; } @@ -33,7 +31,6 @@ public static void sneak(final Throwable t) throws T { * @param The type of the throwable * @throws T The throwable */ - @SuppressWarnings("unchecked") public static void sneak(final SneakyRunnable runnable) throws T { try { runnable.run(); @@ -51,7 +48,6 @@ public static void sneak(final SneakyRunnable runnable) th * @return The value * @throws T The throwable */ - @SuppressWarnings("unchecked") public static O sneak(final SneakySupplier supplier) throws T { try { return supplier.get(); diff --git a/commons-main/src/main/java/net/lenni0451/commons/collections/Lists.java b/commons-main/src/main/java/net/lenni0451/commons/collections/Lists.java index f23399e..051750f 100644 --- a/commons-main/src/main/java/net/lenni0451/commons/collections/Lists.java +++ b/commons-main/src/main/java/net/lenni0451/commons/collections/Lists.java @@ -7,7 +7,6 @@ import java.util.function.Consumer; import java.util.function.Supplier; -@SuppressWarnings({"UnusedReturnValue", "unused"}) public class Lists { /** diff --git a/commons-main/src/main/java/net/lenni0451/commons/collections/Maps.java b/commons-main/src/main/java/net/lenni0451/commons/collections/Maps.java index 8ce11f6..720774e 100644 --- a/commons-main/src/main/java/net/lenni0451/commons/collections/Maps.java +++ b/commons-main/src/main/java/net/lenni0451/commons/collections/Maps.java @@ -9,7 +9,6 @@ import java.util.function.Supplier; import java.util.stream.Collectors; -@SuppressWarnings("unused") public class Maps { /** @@ -59,7 +58,6 @@ public static Map merge(final Map map, final Map... oth * @param The value type * @return The created map */ - @SuppressWarnings("unchecked") public static , K, V> T any(final Supplier mapSupplier, final Object... objects) { if (objects.length % 2 != 0) throw new IllegalArgumentException("Uneven object count"); diff --git a/commons-main/src/main/java/net/lenni0451/commons/collections/Sets.java b/commons-main/src/main/java/net/lenni0451/commons/collections/Sets.java index 0e543f1..b4a105b 100644 --- a/commons-main/src/main/java/net/lenni0451/commons/collections/Sets.java +++ b/commons-main/src/main/java/net/lenni0451/commons/collections/Sets.java @@ -6,7 +6,6 @@ import java.util.function.Supplier; import java.util.stream.Collectors; -@SuppressWarnings("unused") public class Sets { /** diff --git a/commons-main/src/main/java/net/lenni0451/commons/color/ColorConverter.java b/commons-main/src/main/java/net/lenni0451/commons/color/ColorConverter.java index de63dfd..4c639ad 100644 --- a/commons-main/src/main/java/net/lenni0451/commons/color/ColorConverter.java +++ b/commons-main/src/main/java/net/lenni0451/commons/color/ColorConverter.java @@ -5,7 +5,6 @@ /** * Convert colors between different formats. */ -@SuppressWarnings("unused") public class ColorConverter { /** diff --git a/commons-main/src/main/java/net/lenni0451/commons/io/FileSystemZip.java b/commons-main/src/main/java/net/lenni0451/commons/io/FileSystemZip.java index b64211b..be806c0 100644 --- a/commons-main/src/main/java/net/lenni0451/commons/io/FileSystemZip.java +++ b/commons-main/src/main/java/net/lenni0451/commons/io/FileSystemZip.java @@ -16,7 +16,6 @@ /** * A fast zip file using the {@link FileSystem} API. */ -@SuppressWarnings("unused") public class FileSystemZip implements AutoCloseable { private final File file; diff --git a/commons-main/src/main/java/net/lenni0451/commons/io/FileUtils.java b/commons-main/src/main/java/net/lenni0451/commons/io/FileUtils.java index 4880169..634474b 100644 --- a/commons-main/src/main/java/net/lenni0451/commons/io/FileUtils.java +++ b/commons-main/src/main/java/net/lenni0451/commons/io/FileUtils.java @@ -10,7 +10,6 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -@SuppressWarnings("unused") public class FileUtils { /** diff --git a/commons-main/src/main/java/net/lenni0451/commons/math/SliceCalculator.java b/commons-main/src/main/java/net/lenni0451/commons/math/SliceCalculator.java index fc05512..e7f05f9 100644 --- a/commons-main/src/main/java/net/lenni0451/commons/math/SliceCalculator.java +++ b/commons-main/src/main/java/net/lenni0451/commons/math/SliceCalculator.java @@ -7,7 +7,6 @@ * * @param The type of the list */ -@SuppressWarnings("unused") public class SliceCalculator { private final List list; diff --git a/commons-main/src/main/java/net/lenni0451/commons/network/TorProxy.java b/commons-main/src/main/java/net/lenni0451/commons/network/TorProxy.java index 5aed588..4eb361f 100644 --- a/commons-main/src/main/java/net/lenni0451/commons/network/TorProxy.java +++ b/commons-main/src/main/java/net/lenni0451/commons/network/TorProxy.java @@ -15,7 +15,6 @@ * Start and manage a Tor proxy instance.
* The proxy has to be provided by the user. */ -@SuppressWarnings("unused") public class TorProxy { private static final Set shutdownListener = Collections.newSetFromMap(new WeakHashMap<>()); diff --git a/commons-main/src/main/java/net/lenni0451/commons/threading/ThreadScheduler.java b/commons-main/src/main/java/net/lenni0451/commons/threading/ThreadScheduler.java index 81f24ec..45f5f45 100644 --- a/commons-main/src/main/java/net/lenni0451/commons/threading/ThreadScheduler.java +++ b/commons-main/src/main/java/net/lenni0451/commons/threading/ThreadScheduler.java @@ -7,7 +7,6 @@ * A thread scheduler that can execute tasks with a delay or repeat them.
* Internally a {@link ScheduledExecutorService} is used. */ -@SuppressWarnings({"unused", "UnusedReturnValue"}) public class ThreadScheduler { private static final AtomicInteger THREAD_ID = new AtomicInteger(0); diff --git a/commons-main/src/main/java/net/lenni0451/commons/threading/ThreadUtils.java b/commons-main/src/main/java/net/lenni0451/commons/threading/ThreadUtils.java index 20e2962..de943e8 100644 --- a/commons-main/src/main/java/net/lenni0451/commons/threading/ThreadUtils.java +++ b/commons-main/src/main/java/net/lenni0451/commons/threading/ThreadUtils.java @@ -2,7 +2,6 @@ import java.util.concurrent.TimeUnit; -@SuppressWarnings({"unused", "UnusedReturnValue"}) public class ThreadUtils { private static final long SLEEP_PRECISION = TimeUnit.MILLISECONDS.toNanos(2); @@ -12,7 +11,6 @@ public class ThreadUtils { * Start a thread that will sleep forever.
* This increases the precision of {@link Thread#sleep(long)}. */ - @SuppressWarnings("BusyWait") public static void startTimerHackThread() { Thread thread = new Thread(() -> { try { diff --git a/commons-main/src/main/java/net/lenni0451/commons/time/TimeFormatter.java b/commons-main/src/main/java/net/lenni0451/commons/time/TimeFormatter.java index c803a37..85157f4 100644 --- a/commons-main/src/main/java/net/lenni0451/commons/time/TimeFormatter.java +++ b/commons-main/src/main/java/net/lenni0451/commons/time/TimeFormatter.java @@ -3,7 +3,6 @@ import java.text.SimpleDateFormat; import java.util.TimeZone; -@SuppressWarnings("unused") public class TimeFormatter { /**