From 8a3bbdda2f2dead8b5cf1e6fb29fba952fe50357 Mon Sep 17 00:00:00 2001 From: Olivier Truong Date: Mon, 1 Oct 2018 22:04:01 +0200 Subject: [PATCH] [JENKINS-53847] Improve JavaDoc for Util.fixNull --- core/src/main/java/hudson/Util.java | 34 ++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/hudson/Util.java b/core/src/main/java/hudson/Util.java index 00a88df95e..ac4b7e0d90 100644 --- a/core/src/main/java/hudson/Util.java +++ b/core/src/main/java/hudson/Util.java @@ -1199,7 +1199,7 @@ public class Util { } /** - * Convert {@code null} to a default value. + * Convert {@code null} to a default immutable value. * @since TODO */ @Nonnull @@ -1227,21 +1227,53 @@ public class Util { return fixEmpty(s.trim()); } + /** + * + * @param l list to check + * @param + * @return + * l if l is not {@code null} + * an empty immutable list if l is {@code null} + */ @Nonnull public static List fixNull(@CheckForNull List l) { return fixNull(l, Collections.emptyList()); } + /** + * + * @param l set to check + * @param + * @return + * l if l is not {@code null} + * an empty immutable set if l is {@code null} + */ @Nonnull public static Set fixNull(@CheckForNull Set l) { return fixNull(l, Collections.emptySet()); } + /** + * + * @param l collection to check + * @param + * @return + * l if l is not {@code null} + * an empty immutable set if l is {@code null} + */ @Nonnull public static Collection fixNull(@CheckForNull Collection l) { return fixNull(l, Collections.emptySet()); } + /** + * + * @param l iterable to check + * @param + * @return + * l if l is not {@code null} + * an empty immutable set if l is {@code null} + */ @Nonnull public static Iterable fixNull(@CheckForNull Iterable l) { return fixNull(l, Collections.emptySet());