Hi, I have a property that is a Boolean, where null is a distinct and important value ("inherit from parent context").
I currently have code like this @NonNull @POST public ListBoxModel doFillFooItems(@CheckForNull @AncestorInPath Item item) { if (item != null) { item.checkPermission(Item.CONFIGURE); } final ListBoxModel model = new ListBoxModel(); model.add("description 1", null); model.add("description 2", "true"); model.add("description 3", "false"); return model; } which works exactly as I want it to, setting the Boolean property to null, true or false. However, this is hitting a SpotBugs check, claiming that the value in that add() call must not be null. But if I change it to another value, like "", it breaks - that sets the property to false. So I am wondering how I resolve this - is that value really not supposed to be null (especially given that it works fine)? If so, that means the code is unsafe and I should not disable the SpotBugs diagnostic (if it would even let me). Is there a way around it? Like can I configure my own string-to-value mapping method for the property (which could map "" to null)? And if it's not really required to be non-null, should I file a PR to change the annotation for the parameter? But then that would mean the SpotBugs failure would not go away unless I set the required Jenkins version to the latest, which isn't exactly desirable either. The strange thing is that I don't really remember seeing this issue two years ago when I originally wrote that code. Looking at the history, the annotations were added in https://github.com/jenkinsci/jenkins/pull/5930 - but that just adds @Nonull to the value without really justifying why null is bad for it. -- You received this message because you are subscribed to the Google Groups "Jenkins Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CAKMi--AknRqLnaRzb2SWywbxyudcRKWhQZ25h1%3Dt8W_Eq1avLA%40mail.gmail.com.