CAMEL-24460: Mark ProducerTemplate body, header and property values as @Nullable (backport 4.22.x) - #26037
Conversation
…@nullable The org.apache.camel package is @NullMarked, so unannotated reference parameters are treated as non-null under JSpecify. Camel supports null message bodies at runtime, and the sibling FluentProducerTemplate already annotates its withBody/withHeader/withExchangeProperty values as @nullable. ProducerTemplate was missed in that rollout. Align ProducerTemplate by marking body, header value and property value parameters as @nullable. Header/property names and the headers Map stay non-null (keys cannot be null). Annotation-only change with no runtime or binary compatibility impact. Adds a test driving a null body, header value and property value through the API end-to-end. Closes #26032 Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com> (cherry picked from commit 01b6fd5)
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
|
🧪 CI tested the following changed modules:
🔬 Scalpel shadow comparison — Scalpel: 558 tested, 29 compile-only — current: 558 all testedMaveniverse Scalpel detected 587 affected modules (current approach: 558).
|
Backport of #26032 to
camel-4.22.x.Straight cherry-pick of the squashed commit merged to
main(01b6fd5) — no manual conflict resolution.Marks
ProducerTemplatebody / header value / property value parameters as@Nullableto align withFluentProducerTemplate. Annotation-only, source and binary compatible.Verified locally on
camel-4.22.x:DefaultProducerTemplateTest— 16 tests pass.JIRA: https://issues.apache.org/jira/browse/CAMEL-24460
Claude Code on behalf of @davsclaus