@@ -166,8 +166,8 @@ table lists the optional conditions and shows how to use them:
166
166
| Null | where(id, isNull().filter(BooleanSupplier) | The condition will render if BooleanSupplier.getAsBoolean() returns true |
167
167
168
168
### "When Present" Condition Builders
169
- The library supplies several methods that supply conditions to be used in the common case of checking for null
170
- values. The table below lists the rendering rules for each of these "when present" condition builder methods .
169
+ The library supplies conditions for use in the common case of checking for null
170
+ values. The table below lists the rendering rules for each of these "when present" conditions .
171
171
172
172
| Condition | Example | Rendering Rules |
173
173
| ---------------------------| ---------------------------------------------------| ---------------------------------------------------------------|
@@ -184,14 +184,20 @@ values. The table below lists the rendering rules for each of these "when presen
184
184
| Not Like | where(id, isNotLikeWhenPresent(x)) | The condition will render if x is non-null |
185
185
| Not Like Case Insensitive | where(id, isNotLikeCaseInsensitiveWhenPresent(x)) | The condition will render if x is non-null |
186
186
187
- Note that these methods simply apply a "NotNull" filter to a condition. For example:
187
+ With our adoption of JSpecify, it is now considered a misuse of the library to pass a null value into a condition
188
+ unless the condition is one of the "when present" conditions. If you previously wrote code like this:
188
189
189
190
``` java
190
- // the following two lines are functionally equivalent
191
- ... where (id, isEqualToWhenPresent(x)) ...
192
191
... where (id, isEqualTo(x). filter(Objects :: nonNull)) ...
193
192
```
194
193
194
+ Starting in version 2.0.0 of the library, you will now see IDE warnings related to nullability. You should change it
195
+ to this:
196
+
197
+ ``` java
198
+ ... where (id, isEqualToWhenPresent(x)) ...
199
+ ```
200
+
195
201
### Optionality with the "In" Conditions
196
202
Optionality with the "in" and "not in" conditions is a bit more complex than the other types of conditions. The rules
197
203
are different for the base conditions ("isIn", "isNotIn", etc.) and the "when present" conditions ("isInWhenPresent",
0 commit comments