From 5fd9e88d07a333f1e41360281bbdd98b6d4754df Mon Sep 17 00:00:00 2001 From: Sam Brannen <104798+sbrannen@users.noreply.github.com> Date: Mon, 20 Jan 2025 13:01:03 +0100 Subject: [PATCH] Remove Void wrapper registration in ReflectionUtils Closes #4048 --- .../docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc | 1 - .../java/org/junit/platform/commons/util/ReflectionUtils.java | 1 - .../org/junit/platform/commons/util/ReflectionUtilsTests.java | 4 +++- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc index 185878c45198..5d6ceaea5dc0 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc @@ -52,7 +52,6 @@ JUnit repository on GitHub. * The `ReflectionSupport.tryToLoadClass(...)` utility methods now support lookups for the `"void"` pseudo-type, which indirectly supports `String` to `Class` conversion for `"void"` in parameterized tests in JUnit Jupiter. -* `ReflectionUtils` now treats `Void` as a _wrapper_ type for the `void` pseudo-type. * New `addResourceContainerSelectorResolver()` method in `EngineDiscoveryRequestResolver.Builder` which supports the discovery of class path resource based tests, analogous to the existing `addClassContainerSelectorResolver()` diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ReflectionUtils.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ReflectionUtils.java index 7b4a70d3ae27..dd4116d73938 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ReflectionUtils.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ReflectionUtils.java @@ -263,7 +263,6 @@ public enum HierarchyTraversalMode { primitivesToWrappers.put(long.class, Long.class); primitivesToWrappers.put(float.class, Float.class); primitivesToWrappers.put(double.class, Double.class); - primitivesToWrappers.put(void.class, Void.class); primitiveToWrapperMap = Collections.unmodifiableMap(primitivesToWrappers); } diff --git a/platform-tests/src/test/java/org/junit/platform/commons/util/ReflectionUtilsTests.java b/platform-tests/src/test/java/org/junit/platform/commons/util/ReflectionUtilsTests.java index e6411d5a3b5a..7195f25ab14a 100644 --- a/platform-tests/src/test/java/org/junit/platform/commons/util/ReflectionUtilsTests.java +++ b/platform-tests/src/test/java/org/junit/platform/commons/util/ReflectionUtilsTests.java @@ -561,7 +561,9 @@ void isAssignableTo() { // Wrappers to Primitives assertTrue(ReflectionUtils.isAssignableTo(Integer.class, int.class)); assertTrue(ReflectionUtils.isAssignableTo(Boolean.class, boolean.class)); - assertTrue(ReflectionUtils.isAssignableTo(Void.class, void.class)); + + // Void to void + assertFalse(ReflectionUtils.isAssignableTo(Void.class, void.class)); // Widening Conversions from Wrappers to Primitives assertTrue(ReflectionUtils.isAssignableTo(Integer.class, long.class));