From 947da619a6b52eab45cef644887704e084c9a74e Mon Sep 17 00:00:00 2001 From: Uwe Schindler Date: Mon, 24 Aug 2015 00:06:11 +0200 Subject: [PATCH] Prevent bug with empty options (EnumSet.copyOf needs at least one element) --- src/main/java/de/thetaphi/forbiddenapis/Checker.java | 3 +-- .../de/thetaphi/forbiddenapis/CheckerSetupTest.java | 12 ++++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/thetaphi/forbiddenapis/Checker.java b/src/main/java/de/thetaphi/forbiddenapis/Checker.java index 56912e32..f05f22ce 100644 --- a/src/main/java/de/thetaphi/forbiddenapis/Checker.java +++ b/src/main/java/de/thetaphi/forbiddenapis/Checker.java @@ -94,9 +94,8 @@ public static enum Option { protected abstract void logWarn(String msg); protected abstract void logInfo(String msg); - //public Checker(ClassLoader loader, boolean internalRuntimeForbidden, boolean failOnMissingClasses, boolean failOnViolation, boolean defaultFailOnUnresolvableSignatures) { public Checker(ClassLoader loader, Option... options) { - this(loader, EnumSet.copyOf(Arrays.asList(options))); + this(loader, (options.length == 0) ? EnumSet.noneOf(Option.class) : EnumSet.copyOf(Arrays.asList(options))); } public Checker(ClassLoader loader, EnumSet