Re: [PR] SOLR-18164: Remove use of .singleton [solr]

2026-04-24 Thread via GitHub


epugh merged PR #4222:
URL: https://github.com/apache/solr/pull/4222


-- 
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]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] SOLR-18164: Remove use of .singleton [solr]

2026-04-13 Thread via GitHub


epugh commented on PR #4222:
URL: https://github.com/apache/solr/pull/4222#issuecomment-4234595357

   Okay, updated the PR and ran the tests.  I will merge this later today.


-- 
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]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] SOLR-18164: Remove use of .singleton [solr]

2026-03-25 Thread via GitHub


epugh commented on code in PR #4222:
URL: https://github.com/apache/solr/pull/4222#discussion_r2988469876


##
solr/core/src/java/org/apache/solr/handler/admin/BaseHandlerApiSupport.java:
##
@@ -134,7 +133,7 @@ private static void wrapParams(
 final Map pathValues = req.getPathTemplateValues();
 final Map map =
 co == null || !(co.getCommandData() instanceof Map)
-? Collections.singletonMap("", co.getCommandData())
+? Map.of("", co.getCommandData())
 : co.getDataMap();

Review Comment:
   I tried some stuff, and gave up and just went with allowing a singletonMap 
;-)



-- 
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]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] SOLR-18164: Remove use of .singleton [solr]

2026-03-25 Thread via GitHub


epugh commented on code in PR #4222:
URL: https://github.com/apache/solr/pull/4222#discussion_r2988467961


##
solr/core/src/java/org/apache/solr/handler/export/ExportWriter.java:
##
@@ -180,14 +177,10 @@ protected void writeException(Exception e, PushWriter w, 
boolean logException)
   throws IOException {
 w.writeMap(
 mw -> {
-  mw.put("responseHeader", singletonMap("status", 400))
+  mw.put("responseHeader", Map.of("status", 400))
   .put(
   "response",
-  Map.of(
-  "numFound",
-  0,
-  "docs",
-  singletonList(singletonMap("EXCEPTION", 
e.getMessage();
+  Map.of("numFound", 0, "docs", List.of(Map.of("EXCEPTION", 
e.getMessage();
 });

Review Comment:
   Thanks!   I did this.



-- 
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]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] SOLR-18164: Remove use of .singleton [solr]

2026-03-24 Thread via GitHub


dsmiley commented on code in PR #4222:
URL: https://github.com/apache/solr/pull/4222#discussion_r2981776257


##
solr/core/src/java/org/apache/solr/handler/export/ExportWriter.java:
##
@@ -180,14 +177,10 @@ protected void writeException(Exception e, PushWriter w, 
boolean logException)
   throws IOException {
 w.writeMap(
 mw -> {
-  mw.put("responseHeader", singletonMap("status", 400))
+  mw.put("responseHeader", Map.of("status", 400))
   .put(
   "response",
-  Map.of(
-  "numFound",
-  0,
-  "docs",
-  singletonList(singletonMap("EXCEPTION", 
e.getMessage();
+  Map.of("numFound", 0, "docs", List.of(Map.of("EXCEPTION", 
e.getMessage();
 });

Review Comment:
   then use String.valueOf for e.getMessage



-- 
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]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] SOLR-18164: Remove use of .singleton [solr]

2026-03-23 Thread via GitHub


Copilot commented on code in PR #4222:
URL: https://github.com/apache/solr/pull/4222#discussion_r2978016752


##
solr/core/src/java/org/apache/solr/handler/admin/BaseHandlerApiSupport.java:
##
@@ -134,7 +133,7 @@ private static void wrapParams(
 final Map pathValues = req.getPathTemplateValues();
 final Map map =
 co == null || !(co.getCommandData() instanceof Map)
-? Collections.singletonMap("", co.getCommandData())
+? Map.of("", co.getCommandData())
 : co.getDataMap();

Review Comment:
   `wrapParams` now wraps non-map command data using `Map.of("", 
co.getCommandData())`. `Map.of` rejects null values, but `CommandOperation` can 
legitimately have `commandData == null` (e.g., commands with no payload / 
explicit JSON null), which would throw NPE here and break the API. Consider 
using a mutable map (e.g., `new HashMap<>(1)` + `put`) or another construction 
that permits a null value for this sentinel entry.



##
solr/core/src/java/org/apache/solr/handler/export/ExportWriter.java:
##
@@ -180,14 +177,10 @@ protected void writeException(Exception e, PushWriter w, 
boolean logException)
   throws IOException {
 w.writeMap(
 mw -> {
-  mw.put("responseHeader", singletonMap("status", 400))
+  mw.put("responseHeader", Map.of("status", 400))
   .put(
   "response",
-  Map.of(
-  "numFound",
-  0,
-  "docs",
-  singletonList(singletonMap("EXCEPTION", 
e.getMessage();
+  Map.of("numFound", 0, "docs", List.of(Map.of("EXCEPTION", 
e.getMessage();
 });

Review Comment:
   `writeException` builds the error response using `Map.of("EXCEPTION", 
e.getMessage())`. `Map.of` does not permit null values, but many exceptions can 
have a null message; that would cause a secondary NPE while trying to report 
the original error. Consider coercing the message to a non-null string (e.g., 
`Objects.toString(e.getMessage(), "")`) or using a map implementation that 
allows null values for this field.



-- 
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]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] SOLR-18164: Remove use of .singleton [solr]

2026-03-23 Thread via GitHub


dsmiley commented on PR #4222:
URL: https://github.com/apache/solr/pull/4222#issuecomment-4112096503

   Yes
   
   On Mon, Mar 23, 2026 at 12:08 PM Eric Pugh ***@***.***> wrote:
   
   > *epugh* left a comment (apache/solr#4222)
   > 
   >
   > @dsmiley  do you think I should do the
   > removal of Collections.singletonList and Collections.singletonMap in this
   > PR as well?
   >
   > —
   > Reply to this email directly, view it on GitHub
   > 
,
   > or unsubscribe
   > 

   > .
   > You are receiving this because you were mentioned.Message ID:
   > ***@***.***>
   >
   


-- 
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]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] SOLR-18164: Remove use of .singleton [solr]

2026-03-23 Thread via GitHub


epugh commented on PR #4222:
URL: https://github.com/apache/solr/pull/4222#issuecomment-4111788373

   @dsmiley do you think I should do the removal of `Collections.singletonList` 
and `Collections.singletonMap` in this PR as well?


-- 
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]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] SOLR-18164: Remove use of .singleton [solr]

2026-03-23 Thread via GitHub


epugh commented on PR #4222:
URL: https://github.com/apache/solr/pull/4222#issuecomment-4111774038

   > > 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.
   
   Cool!  Those are both new to me!


-- 
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]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] SOLR-18164: Remove use of .singleton [solr]

2026-03-19 Thread via GitHub


dsmiley commented on PR #4222:
URL: https://github.com/apache/solr/pull/4222#issuecomment-4094634318

   > 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.


-- 
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]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] SOLR-18164: Remove use of .singleton [solr]

2026-03-19 Thread via GitHub


epugh commented on PR #4222:
URL: https://github.com/apache/solr/pull/4222#issuecomment-4094148579

   > > 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.


-- 
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]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] SOLR-18164: Remove use of .singleton [solr]

2026-03-19 Thread via GitHub


epugh commented on PR #4222:
URL: https://github.com/apache/solr/pull/4222#issuecomment-4091678104

   Okay, I think this is ready for merging.


-- 
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]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Re: [PR] SOLR-18164: Remove use of .singleton [solr]

2026-03-19 Thread via GitHub


epugh commented on PR #4222:
URL: https://github.com/apache/solr/pull/4222#issuecomment-4089996682

   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 |
   


-- 
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]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]