davsclaus opened a new pull request, #25994:
URL: https://github.com/apache/camel/pull/25994

   ## Summary
   
   - `org.apache.camel.spi` is `@NullMarked` (since 4.21, CAMEL-22640), and 
`DataFormat.marshal`'s `graph` parameter had no `@Nullable`, so it was 
implicitly declared non-null.
   - `MarshalProcessor` (camel-support) passes the message body straight 
through with no null guard, and `Message.getBody()` is itself `@Nullable` and 
documented as possibly null.
   - Java implementations never noticed the mismatch, but a Kotlin 
implementation of `DataFormat` gets a compiler-generated non-null assertion on 
`graph`, which throws `NullPointerException` before user code runs whenever the 
body is legitimately null — for example on an error route, or for a 
`DataFormat` that marshals from `Exchange` state rather than from `graph`.
   - `DataFormat.java` was not touched by the original CAMEL-22640 annotation 
sweep, so this parameter was never actually reviewed for nullability; it just 
inherited non-null-by-default from the package-level `@NullMarked`.
   - Fix: annotate `graph` as `@Nullable` to match actual runtime behavior. 
This is a contract/Javadoc-only change — `MarshalProcessor`'s behavior is 
unchanged, so no existing Java implementation is affected. Added an 
upgrade-guide note for 4.23 since this is a public SPI signature change 
relevant to Kotlin implementers.
   
   Reported by Petr H. on the dev mailing list.
   
   _Claude Code on behalf of davsclaus_
   
   ## Test plan
   
   - [x] `mvn -pl core/camel-api -am install -DskipTests` builds cleanly
   - [x] `mvn formatter:format impsort:sort` produces no diff
   - [ ] CI green
   
   Jira: https://issues.apache.org/jira/browse/CAMEL-24579


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to