Skip to content

fix: add JSpecify @Nullable annotations to SearchService parameters#109

Closed
adityamparikh wants to merge 1 commit into
apache:mainfrom
adityamparikh:fix/search-service-jspecify-nullable
Closed

fix: add JSpecify @Nullable annotations to SearchService parameters#109
adityamparikh wants to merge 1 commit into
apache:mainfrom
adityamparikh:fix/search-service-jspecify-nullable

Conversation

@adityamparikh
Copy link
Copy Markdown
Contributor

Summary

  • Add @Nullable annotations to optional parameters in SearchService.search() (query, filterQueries, facetFields, sortClauses, start, rows)
  • Add @Nullable to SearchResponse.maxScore (nullable when scoring is disabled)
  • Add @NullMarked package-info.java for the search subpackage so NullAway enforces null safety
  • Fix test code to use null-safe dereference patterns (assertNotNull before Map.get() results)
  • Correctly expresses the nullability contract under the existing @NullMarked package declaration

Test plan

  • ./gradlew build passes (including NullAway checks)
  • ./gradlew nativeTest -Pnative passes (119/119 tests)
  • No regressions

🤖 Generated with Claude Code

…meters

Add @nullable annotations from JSpecify to optional parameters in
SearchService.search() (query, filterQueries, facetFields, sortClauses,
start, rows) and to SearchResponse.maxScore. This correctly expresses
the nullability contract for MCP tool parameters that AI clients may
omit.

Also add @NullMarked package-info.java for the search subpackage so
NullAway enforces null safety, and fix test code to use null-safe
patterns (assertNotNull before dereference) for Map.get() results.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: adityamparikh <aditya.m.parikh@gmail.com>
@adityamparikh
Copy link
Copy Markdown
Contributor Author

Closing as superseded by #133, which rolls @NullMarked out to every sub-package (not just search) and includes the exact same annotations from this PR — search/package-info.java, SearchResponse.maxScore, and the SearchService.search parameter annotations are byte-for-byte identical. The only thing not carried over is the test-site cleanup in SearchServiceIntegrationTest; #133 intentionally defers all test-side cleanup as a separate follow-up by disabling NullAway on compileTestJava.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant