Skip to content

SOLR-18164: Remove use of .singleton#4222

Open
epugh wants to merge 4 commits intoapache:mainfrom
epugh:SOLR-18164
Open

SOLR-18164: Remove use of .singleton#4222
epugh wants to merge 4 commits intoapache:mainfrom
epugh:SOLR-18164

Conversation

@epugh
Copy link
Contributor

@epugh epugh commented Mar 17, 2026

https://issues.apache.org/jira/browse/SOLR-18164

Description

Originally part of https://github.com/apache/solr/pull/4168/commits, this is to remove .singleton usage.

Solution

manual! can't quite get INtellij to do it for me.

Tests

Please describe the tests you've developed or run to confirm this patch implements the feature or solves the problem.

Checklist

Please review the following and check all that apply:

  • I have reviewed the guidelines for How to Contribute and my code conforms to the standards described there to the best of my ability.
  • I have created a Jira issue and added the issue ID to my pull request title.
  • I have given Solr maintainers access to contribute to my PR branch. (optional but recommended, not available for branches on forks living under an organisation)
  • I have developed this patch against the main branch.
  • I have run ./gradlew check.
  • I have added tests for my changes.
  • I have added documentation for the Reference Guide
  • I have added a changelog entry for my change
@epugh epugh marked this pull request as draft March 19, 2026 12:33
@epugh
Copy link
Contributor Author

epugh commented Mar 19, 2026

I want to track this from copilot for potentially seperate PR's.. cause using nulls intentionally in these seems, well, suss...

Preserved with @SuppressForbidden (8 locations, 7 files)

File Reason
RuleBasedAuthorizationPluginBase.java singletonList(null) – intentional null role
BaseTestRuleBasedAuthorizationPlugin.java singletonList(null) – test for null role
ClusterFileStore.java (×2) singletonMap(path, null) – NOFILE/METADATA cases
TestDistribFileStore.java singletonMap("...", null) – test expectation
NestedAtomicUpdateTest.java singletonMap("set", empty ? ... : null) – conditional null
LastFieldValueUpdateProcessorFactory.java Result may be null if field contains null values
FirstFieldValueUpdateProcessorFactory.java Iterator.next() may return null field values

Also:

ConfigSetAdminRequest.java: Has an inner static class List that shadows java.util.List, so used java.util.List.of(stream) with fully-qualified name

@epugh epugh marked this pull request as ready for review March 19, 2026 16:40
@epugh
Copy link
Contributor Author

epugh commented Mar 19, 2026

Okay, I think this is ready for merging.

Copy link
Contributor

@dsmiley dsmiley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ConfigSetAdminRequest.java: Has an inner static class List that shadows java.util.List, so used java.util.List.of(stream) with fully-qualified name

this PR doesn't touch that file

@epugh
Copy link
Contributor Author

epugh commented Mar 19, 2026

ConfigSetAdminRequest.java: Has an inner static class List that shadows java.util.List, so used java.util.List.of(stream) with fully-qualified name

this PR doesn't touch that file

Yeah, this was a note that copilot highlighted, and I wanted to keep it to look into.. It turns out it makes sense it has a "List" named class.. I wasn't sure if there was soemthing in there to dig into it.

At somepoint I want to go back and look at some of the places we are using "null" to see if they are the best way of doing things... I don't plan on making any changes to this PR more unless somethign comes up in review.

@dsmiley
Copy link
Contributor

dsmiley commented Mar 20, 2026

At somepoint I want to go back and look at some of the places we are using "null" to see if they are the best way of doing things... I don't plan on making any changes to this PR more unless somethign comes up in review.

I believe most Java projects should adopt JSpecify w/ Nullaway. This is the kind of work that I believe you love doing. Happy to chat with you about it sometime.

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