From 1847fc1b3094f6bdc382ce6cd73bd0f87e1e35bf Mon Sep 17 00:00:00 2001 From: Johannes Link Date: Wed, 8 Nov 2023 11:04:27 +0100 Subject: [PATCH] Added some logging to JqwikReflectionSupport --- .../net/jqwik/engine/support/JqwikReflectionSupport.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/engine/src/main/java/net/jqwik/engine/support/JqwikReflectionSupport.java b/engine/src/main/java/net/jqwik/engine/support/JqwikReflectionSupport.java index 6d4823b77..9465ea0af 100644 --- a/engine/src/main/java/net/jqwik/engine/support/JqwikReflectionSupport.java +++ b/engine/src/main/java/net/jqwik/engine/support/JqwikReflectionSupport.java @@ -6,6 +6,7 @@ import java.nio.file.*; import java.util.*; import java.util.function.*; +import java.util.logging.*; import java.util.stream.*; import org.junit.platform.commons.support.*; @@ -13,6 +14,7 @@ import net.jqwik.api.*; import net.jqwik.api.providers.*; import net.jqwik.api.support.*; +import net.jqwik.engine.properties.shrinking.*; import net.jqwik.engine.support.types.*; import static java.util.stream.Collectors.*; @@ -21,6 +23,8 @@ public class JqwikReflectionSupport { + private static final Logger LOG = Logger.getLogger(JqwikReflectionSupport.class.getName()); + public static Stream streamInstancesFromInside(Object inner) { return addInstances(inner, new ArrayList<>()).stream(); } @@ -50,6 +54,9 @@ private static Optional getOuterInstance(Object inner) { try { return makeAccessible(field).get(inner); } catch (SecurityException | IllegalArgumentException | IllegalAccessException ex) { + String message = String.format("Could not access outer instance of %s." + + "%nReason: %s", inner, ex); + LOG.warning(message); return Optional.empty(); } });