1515import java .util .Optional ;
1616
1717import org .apiguardian .api .API ;
18+ import org .jspecify .annotations .Nullable ;
1819import org .junit .platform .commons .util .StringUtils ;
1920import org .junit .platform .commons .util .ToStringBuilder ;
2021
@@ -35,7 +36,7 @@ public class ConditionEvaluationResult {
3536 * or an <em>empty</em> reason if the reason is unknown
3637 * @see StringUtils#isBlank(String)
3738 */
38- public static ConditionEvaluationResult enabled (String reason ) {
39+ public static ConditionEvaluationResult enabled (@ Nullable String reason ) {
3940 return new ConditionEvaluationResult (true , reason );
4041 }
4142
@@ -48,7 +49,7 @@ public static ConditionEvaluationResult enabled(String reason) {
4849 * or an <em>empty</em> reason if the reason is unknown
4950 * @see StringUtils#isBlank(String)
5051 */
51- public static ConditionEvaluationResult disabled (String reason ) {
52+ public static ConditionEvaluationResult disabled (@ Nullable String reason ) {
5253 return new ConditionEvaluationResult (false , reason );
5354 }
5455
@@ -69,7 +70,8 @@ public static ConditionEvaluationResult disabled(String reason) {
6970 * @see StringUtils#isBlank(String)
7071 */
7172 @ API (status = STABLE , since = "5.7" )
72- public static ConditionEvaluationResult disabled (String reason , String customReason ) {
73+ @ SuppressWarnings ("NullAway" ) // StringUtils.isBlank() does not yet have a nullability @Contract
74+ public static ConditionEvaluationResult disabled (@ Nullable String reason , @ Nullable String customReason ) {
7375 if (StringUtils .isBlank (reason )) {
7476 return disabled (customReason );
7577 }
@@ -84,7 +86,7 @@ public static ConditionEvaluationResult disabled(String reason, String customRea
8486 private final Optional <String > reason ;
8587
8688 @ SuppressWarnings ("NullAway" ) // StringUtils.isNotBlank() does not yet have a nullability @Contract
87- private ConditionEvaluationResult (boolean enabled , String reason ) {
89+ private ConditionEvaluationResult (boolean enabled , @ Nullable String reason ) {
8890 this .enabled = enabled ;
8991 this .reason = StringUtils .isNotBlank (reason ) ? Optional .of (reason .strip ()) : Optional .empty ();
9092 }
0 commit comments