Skip to content

CAMEL-22640: Add JSpecify null safety annotations to camel-api#22313

Open
gnodet wants to merge 1 commit intoapache:mainfrom
gnodet:CAMEL-22640-jspecify-null-annotations
Open

CAMEL-22640: Add JSpecify null safety annotations to camel-api#22313
gnodet wants to merge 1 commit intoapache:mainfrom
gnodet:CAMEL-22640-jspecify-null-annotations

Conversation

@gnodet
Copy link
Copy Markdown
Contributor

@gnodet gnodet commented Mar 29, 2026

Summary

Add JSpecify null safety annotations to the camel-api module, following the same approach adopted by Spring Framework 7 / Spring Boot 4.

  • Add org.jspecify:jspecify:1.0.0 dependency to parent POM (dependencyManagement) and camel-api
  • Add @NullMarked to all 16 packages in camel-api via package-info.java, making non-null the default
  • Annotate ~200 API interfaces and classes with @Nullable where parameters or return values can legitimately be null
  • Covers the full API surface: CamelContext, Exchange, Message, Component, Endpoint, TypeConverter, ProducerTemplate, ConsumerTemplate, all SPI interfaces, vault configs, JSE support, health checks, etc.

This establishes the convention and pattern for Camel null safety. Follow-up PRs can extend coverage to camel-support, camel-core-model, and individual components.

JIRA: https://issues.apache.org/jira/browse/CAMEL-22640

Add @NullMarked (JSpecify 1.0.0) to all packages in camel-api,
making non-null the default. Annotate ~200 API interfaces and
classes with @nullable where parameters or return values can
legitimately be null, covering the core API surface including
CamelContext, Exchange, Message, Component, Endpoint, TypeConverter,
and all SPI interfaces.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gnodet gnodet requested review from davsclaus and oscerd March 29, 2026 21:03
@github-actions
Copy link
Copy Markdown
Contributor

🌟 Thank you for your contribution to the Apache Camel project! 🌟
🤖 CI automation will test this PR automatically.

🐫 Apache Camel Committers, please review the following items:

  • First-time contributors require MANUAL approval for the GitHub Actions to run
  • You can use the command /component-test (camel-)component-name1 (camel-)component-name2.. to request a test from the test bot although they are normally detected and executed by CI.
  • You can label PRs using build-all, build-dependents, skip-tests and test-dependents to fine-tune the checks executed by this PR.
  • Build and test logs are available in the summary page. Only Apache Camel committers have access to the summary.

⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant