Skip to content

Commit 1746789

Browse files
committed
Disallow collections of nullable types for internal utility method
1 parent caf05bf commit 1746789

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ private CollectionUtils() {
6161
* @throws PreconditionViolationException if the collection is {@code null}
6262
* or does not contain exactly one element
6363
*/
64-
public static <T extends @Nullable Object> T getOnlyElement(Collection<T> collection) {
64+
public static <T> T getOnlyElement(Collection<T> collection) {
6565
Preconditions.notNull(collection, "collection must not be null");
6666
Preconditions.condition(collection.size() == 1,
6767
() -> "collection must contain exactly one element: " + collection);

0 commit comments

Comments
 (0)