Skip to content

Commit 57e20cd

Browse files
committed
Revise Javadoc and release notes regarding void lookups
See #4048
1 parent 4fa576f commit 57e20cd

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc

+4-2
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,10 @@ JUnit repository on GitHub.
4242
`addClassContainerSelectorResolver()`.
4343
* Introduce `ReflectionSupport.makeAccessible(Field)` for third-party use rather than
4444
calling the internal `ReflectionUtils.makeAccessible(Field)` method directly.
45-
* Support both the primitive type `void` and the wrapper type `Void` in the internal
46-
`ReflectionUtils` to allow `String` to `Class` conversion in parameterized tests.
45+
* The `ReflectionSupport.tryToLoadClass(...)` utility methods now support lookups for the
46+
`"void"` pseudo-type, which indirectly supports `String` to `Class` conversion for
47+
`"void"` in parameterized tests in JUnit Jupiter.
48+
* `ReflectionUtils` now treats `Void` as a _wrapper_ type for the `void` pseudo-type.
4749
* New `--exclude-methodname` and `--include-methodname` options added to the
4850
`ConsoleLauncher` to include or exclude methods based on fully qualified method names
4951
without parameters. For example, `--exclude-methodname=^org\.example\..+#methodname`

junit-platform-commons/src/main/java/org/junit/platform/commons/util/ReflectionUtils.java

+9-8
Original file line numberDiff line numberDiff line change
@@ -418,9 +418,9 @@ public static boolean isMultidimensionalArray(Object obj) {
418418
* supplied target type for the purpose of reflective method invocations.
419419
*
420420
* <p>In contrast to {@link Class#isAssignableFrom(Class)}, this method
421-
* returns {@code true} if the target type represents a primitive type whose
422-
* wrapper matches the supplied source type. In addition, this method
423-
* also supports
421+
* returns {@code true} if the target type represents a primitive type (or
422+
* {@code void}) whose wrapper matches the supplied source type. In addition,
423+
* this method also supports
424424
* <a href="https://docs.oracle.com/javase/specs/jls/se8/html/jls-5.html#jls-5.1.2">
425425
* widening conversions</a> for primitive target types.
426426
*
@@ -454,8 +454,8 @@ public static boolean isAssignableTo(Class<?> sourceType, Class<?> targetType) {
454454
* type for the purpose of reflective method invocations.
455455
*
456456
* <p>In contrast to {@link Class#isInstance(Object)}, this method returns
457-
* {@code true} if the target type represents a primitive type whose
458-
* wrapper matches the supplied object's type. In addition, this method
457+
* {@code true} if the target type represents a primitive type (or {@code void})
458+
* whose wrapper matches the supplied object's type. In addition, this method
459459
* also supports
460460
* <a href="https://docs.oracle.com/javase/specs/jls/se8/html/jls-5.html#jls-5.1.2">
461461
* widening conversions</a> for primitive types and their corresponding
@@ -550,11 +550,12 @@ static boolean isWideningConversion(Class<?> sourceType, Class<?> targetType) {
550550
}
551551

552552
/**
553-
* Get the wrapper type for the supplied primitive type.
553+
* Get the wrapper type for the supplied primitive type (or {@code void}).
554554
*
555-
* @param type the primitive type for which to retrieve the wrapper type
555+
* @param type the primitive type (or {@code void}) for which to retrieve the
556+
* wrapper type
556557
* @return the corresponding wrapper type or {@code null} if the
557-
* supplied type is {@code null} or not a primitive type
558+
* supplied type is {@code null} or not a primitive type or {@code void}
558559
*/
559560
public static Class<?> getWrapperType(Class<?> type) {
560561
return primitiveToWrapperMap.get(type);

0 commit comments

Comments
 (0)