Skip to content

Commit

Permalink
SuppressFBWarnings REC_CATCH_EXCEPTION
Browse files Browse the repository at this point in the history
Signed-off-by: tison <wander4096@gmail.com>
  • Loading branch information
tisonkun committed Jun 1, 2022
1 parent 31d5791 commit 2033c6a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/src/main/java/com/diffplug/spotless/ModuleHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

import javax.annotation.Nullable;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import sun.misc.Unsafe;

public final class ModuleHelper {
Expand Down Expand Up @@ -68,6 +69,7 @@ public static synchronized void doOpenInternalPackagesIfRequired() {
}
}

@SuppressFBWarnings("REC_CATCH_EXCEPTION") // workaround JDK11
private static List<String> unavailableRequiredPackages() {
final List<String> packages = new ArrayList<>();
for (Map.Entry<String, String> e : REQUIRED_PACKAGES_TO_TEST_CLASSES.entrySet()) {
Expand Down Expand Up @@ -114,8 +116,9 @@ private static void openPackages(Collection<String> 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) {
Expand Down

0 comments on commit 2033c6a

Please sign in to comment.