From 2033c6ab7cc570f7fedcb83af4647eac31dfee60 Mon Sep 17 00:00:00 2001 From: tison Date: Thu, 2 Jun 2022 07:31:39 +0800 Subject: [PATCH] SuppressFBWarnings REC_CATCH_EXCEPTION Signed-off-by: tison --- lib/src/main/java/com/diffplug/spotless/ModuleHelper.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/src/main/java/com/diffplug/spotless/ModuleHelper.java b/lib/src/main/java/com/diffplug/spotless/ModuleHelper.java index 0ccd3c8c15..0ab4f95540 100644 --- a/lib/src/main/java/com/diffplug/spotless/ModuleHelper.java +++ b/lib/src/main/java/com/diffplug/spotless/ModuleHelper.java @@ -28,6 +28,7 @@ import javax.annotation.Nullable; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import sun.misc.Unsafe; public final class ModuleHelper { @@ -68,6 +69,7 @@ public static synchronized void doOpenInternalPackagesIfRequired() { } } + @SuppressFBWarnings("REC_CATCH_EXCEPTION") // workaround JDK11 private static List unavailableRequiredPackages() { final List packages = new ArrayList<>(); for (Map.Entry e : REQUIRED_PACKAGES_TO_TEST_CLASSES.entrySet()) { @@ -114,8 +116,9 @@ private static void openPackages(Collection packagesToOpen) throws Throw } @Nullable - // calling ModuleLayer.boot().modules() by reflection + @SuppressFBWarnings("REC_CATCH_EXCEPTION") // workaround JDK11 private static Collection allModules() { + // calling ModuleLayer.boot().modules() by reflection try { final Object boot = Class.forName("java.lang.ModuleLayer").getMethod("boot").invoke(null); if (boot == null) {