From aa3d6a828a13b23b6879ae98d2558e6d06b2695f Mon Sep 17 00:00:00 2001 From: Scott Leberknight <174812+sleberknight@users.noreply.github.com> Date: Thu, 21 Apr 2022 20:56:09 -0400 Subject: [PATCH] Remove warning suppressions that are now redundant (#715) At some point Guava removed the "Beta" designation on both Resources and InetAddresses, so we can remove a bunch of the warning suppressions that we had in place. --- src/main/java/org/kiwiproject/io/KiwiPaths.java | 2 +- src/main/java/org/kiwiproject/jsch/KiwiJSchHelpers.java | 1 - src/main/java/org/kiwiproject/net/CidrRange.java | 2 +- src/main/java/org/kiwiproject/net/KiwiInternetAddresses.java | 1 - src/main/java/org/kiwiproject/net/SimpleHostAndPort.java | 1 - src/test/java/org/kiwiproject/internal/Fixtures.java | 4 ++-- .../org/kiwiproject/jackson/KiwiJacksonDataFormatsTest.java | 1 - .../org/kiwiproject/json/JsonHelperAdvancedFeaturesTest.java | 3 +-- .../java/org/kiwiproject/net/KiwiInternetAddressesTest.java | 1 - .../java/org/kiwiproject/security/SecureTestConstants.java | 1 - 10 files changed, 5 insertions(+), 12 deletions(-) diff --git a/src/main/java/org/kiwiproject/io/KiwiPaths.java b/src/main/java/org/kiwiproject/io/KiwiPaths.java index e128517f..f0d9b381 100644 --- a/src/main/java/org/kiwiproject/io/KiwiPaths.java +++ b/src/main/java/org/kiwiproject/io/KiwiPaths.java @@ -22,7 +22,7 @@ public class KiwiPaths { * @return the {@link Path} of the given resource name * @see Resources#getResource(String) */ - @SuppressWarnings("UnstableApiUsage") // because Guava's Resources has been around for a long time + // because Guava's Resources has been around for a long time public static Path pathFromResourceName(String resourceName) { try { return Paths.get(Resources.getResource(resourceName).toURI()); diff --git a/src/main/java/org/kiwiproject/jsch/KiwiJSchHelpers.java b/src/main/java/org/kiwiproject/jsch/KiwiJSchHelpers.java index c04eb7df..d3e5b801 100644 --- a/src/main/java/org/kiwiproject/jsch/KiwiJSchHelpers.java +++ b/src/main/java/org/kiwiproject/jsch/KiwiJSchHelpers.java @@ -51,7 +51,6 @@ public static void setSessionKeyExchangeType(Session session, String keyExchange session.setConfig("server_host_key", keyExchangeType); } - @SuppressWarnings("UnstableApiUsage") private static boolean hostMatchesKnownHost(String hostOrIpToFind, HostKey hostKey) { var knownHost = new KnownHost(hostKey); if (InetAddresses.isInetAddress(hostOrIpToFind)) { diff --git a/src/main/java/org/kiwiproject/net/CidrRange.java b/src/main/java/org/kiwiproject/net/CidrRange.java index f83a543d..f0798eaa 100644 --- a/src/main/java/org/kiwiproject/net/CidrRange.java +++ b/src/main/java/org/kiwiproject/net/CidrRange.java @@ -1,6 +1,7 @@ package org.kiwiproject.net; import com.google.common.net.InetAddresses; + import java.math.BigInteger; import java.net.InetAddress; import java.nio.ByteBuffer; @@ -12,7 +13,6 @@ * https://github.com/edazdarevic/CIDRUtils which has not been * updated since 2019 and seems to be unmaintained. */ -@SuppressWarnings("UnstableApiUsage") public class CidrRange { private final InetAddress inetAddress; diff --git a/src/main/java/org/kiwiproject/net/KiwiInternetAddresses.java b/src/main/java/org/kiwiproject/net/KiwiInternetAddresses.java index 8168f963..5afd5dc6 100644 --- a/src/main/java/org/kiwiproject/net/KiwiInternetAddresses.java +++ b/src/main/java/org/kiwiproject/net/KiwiInternetAddresses.java @@ -42,7 +42,6 @@ *

* Last, note that {@link SimpleHostInfo} only contains the host name and host address as a string. */ -@SuppressWarnings("UnstableApiUsage") // Because Guava's InetAddresses is marked @Beta (but has been there a long time) @UtilityClass @Slf4j public class KiwiInternetAddresses { diff --git a/src/main/java/org/kiwiproject/net/SimpleHostAndPort.java b/src/main/java/org/kiwiproject/net/SimpleHostAndPort.java index a832acce..050fd6ad 100644 --- a/src/main/java/org/kiwiproject/net/SimpleHostAndPort.java +++ b/src/main/java/org/kiwiproject/net/SimpleHostAndPort.java @@ -18,7 +18,6 @@ */ @EqualsAndHashCode @AllArgsConstructor(access = AccessLevel.PRIVATE) -@SuppressWarnings("UnstableApiUsage") // Because Guava's InetAddresses is marked @Beta (but has been there a long time) public class SimpleHostAndPort { @Getter diff --git a/src/test/java/org/kiwiproject/internal/Fixtures.java b/src/test/java/org/kiwiproject/internal/Fixtures.java index 17fa5b61..316f0582 100644 --- a/src/test/java/org/kiwiproject/internal/Fixtures.java +++ b/src/test/java/org/kiwiproject/internal/Fixtures.java @@ -19,7 +19,7 @@ public class Fixtures { public static String fixture(String resourceName) { try { - @SuppressWarnings("UnstableApiUsage") var url = Resources.getResource(resourceName); + var url = Resources.getResource(resourceName); var path = Paths.get(url.toURI()); return Files.readString(path, StandardCharsets.UTF_8); } catch (URISyntaxException | IOException e) { @@ -28,7 +28,7 @@ public static String fixture(String resourceName) { } public static Path fixturePath(String resourceName) { - @SuppressWarnings("UnstableApiUsage") var url = Resources.getResource(resourceName); + var url = Resources.getResource(resourceName); try { return Paths.get(url.toURI()); } catch (URISyntaxException e) { diff --git a/src/test/java/org/kiwiproject/jackson/KiwiJacksonDataFormatsTest.java b/src/test/java/org/kiwiproject/jackson/KiwiJacksonDataFormatsTest.java index 6b23da33..e2568902 100644 --- a/src/test/java/org/kiwiproject/jackson/KiwiJacksonDataFormatsTest.java +++ b/src/test/java/org/kiwiproject/jackson/KiwiJacksonDataFormatsTest.java @@ -350,7 +350,6 @@ static Stream utf8ContentStream() { * "Stolen" from {@link io.dropwizard.testing.FixtureHelpers} since they made it private there for whatever * reason! Renamed so as not to collide with the fixture method. */ - @SuppressWarnings("UnstableApiUsage") private static String fixtureWithCharset(String filename, Charset charset) { try { return Resources.toString(Resources.getResource(filename), charset).trim(); diff --git a/src/test/java/org/kiwiproject/json/JsonHelperAdvancedFeaturesTest.java b/src/test/java/org/kiwiproject/json/JsonHelperAdvancedFeaturesTest.java index 7b4cd9e0..779a635f 100644 --- a/src/test/java/org/kiwiproject/json/JsonHelperAdvancedFeaturesTest.java +++ b/src/test/java/org/kiwiproject/json/JsonHelperAdvancedFeaturesTest.java @@ -486,7 +486,6 @@ void shouldRemoveNestedPaths(SoftAssertions softly) { Map.of("foo2", "bar2") ); - //noinspection unchecked softly.assertThat(newSampleObject.getObjectMap()) .containsOnlyKeys("key1", "key2", "key4") .contains(entry("key4", List.of(4.2))); @@ -1161,4 +1160,4 @@ static class Limited { static class All extends Limited { } } -} \ No newline at end of file +} diff --git a/src/test/java/org/kiwiproject/net/KiwiInternetAddressesTest.java b/src/test/java/org/kiwiproject/net/KiwiInternetAddressesTest.java index f681ce6b..c60d379e 100644 --- a/src/test/java/org/kiwiproject/net/KiwiInternetAddressesTest.java +++ b/src/test/java/org/kiwiproject/net/KiwiInternetAddressesTest.java @@ -22,7 +22,6 @@ import java.util.List; import java.util.function.Supplier; -@SuppressWarnings("UnstableApiUsage") @DisplayName("KiwiInternetAddresses") class KiwiInternetAddressesTest { diff --git a/src/test/java/org/kiwiproject/security/SecureTestConstants.java b/src/test/java/org/kiwiproject/security/SecureTestConstants.java index d52c5d51..799e7dcd 100644 --- a/src/test/java/org/kiwiproject/security/SecureTestConstants.java +++ b/src/test/java/org/kiwiproject/security/SecureTestConstants.java @@ -25,7 +25,6 @@ public class SecureTestConstants { LOG.info("Set JKS_FILE_PATH to {}", JKS_FILE_PATH); } - @SuppressWarnings("UnstableApiUsage") private static String getJksFilePath() { try { var uri = Resources.getResource(SecureTestConstants.JKS_FILE_NAME).toURI();