add jspecify nullable annotations on streams Java DSL#2617
add jspecify nullable annotations on streams Java DSL#2617pjfanning merged 4 commits intoapache:mainfrom
Conversation
pjfanning
commented
Jan 10, 2026
- linked to Make use of jspecify #2563
- probably best to stick with Java DSL only
- can look at other libs later
He-Pin
left a comment
There was a problem hiding this comment.
Good addition -- JSpecify annotations on the Java DSL will help IDE static analysis and help Java users avoid NPEs.
Observations:
-
The
@Nullableannotations are applied consistently to parameters that can accept null (likerest,those,logparameters). This is correct. -
The
package-info.javawith@NullMarkedis the right approach -- it makes the entire Java DSL package null-safe by default, with explicit@Nullableoverrides where needed. -
JSpecify is added as an
Optionaldependency, which means it won't be required at runtime. This is correct since the annotations are only needed at compile time. -
One thing to consider: this PR only covers the stream Java DSL. The PR description mentions 'probably best to stick with Java DSL only' -- but the actor and other Java DSLs would benefit from the same treatment. Consider filing a follow-up issue for the remaining modules.
No blocking issues.
|
@He-Pin if we don't see any issues caused by this, I'll look into adding similar changes to other modules. |