xiangfu0 opened a new pull request, #18837:
URL: https://github.com/apache/pinot/pull/18837

   ## Summary
   
   This PR addresses the follow-up from #18835 by removing 
`Collections.singletonList(...)` usage from the Java source tree and parser 
template, then banning new usage through Checkstyle.
   
   Changes:
   - Replaced `Collections.singletonList(...)` with `List.of(...)` across the 
repo.
   - Preserved single-null-list test semantics with `Arrays.asList((Object) 
null)` where `List.of(null)` would throw `NullPointerException`.
   - Added a Checkstyle `RegexpSingleline` guard to reject future 
`Collections.singletonList(` usage.
   
   ## Why
   
   `Collections.singletonList()` accepts null elements, while modern immutable 
list construction with `List.of()` rejects nulls. The repo-wide migration makes 
single-element immutable list creation consistent and lets Checkstyle prevent 
regressions.
   
   ## User Manual / Contributor Guidance
   
   For new Pinot code, use `List.of(value)` for non-null single-element lists. 
If a test intentionally needs a one-element list containing `null`, use an 
explicit null-preserving list construction such as `Arrays.asList((Object) 
null)` and keep the intent local to the test.
   
   ## Sample Table Config / Queries
   
   No table config or query syntax changes are introduced. Query behavior is 
unchanged; existing empty-aggregation/null-result test cases continue to cover 
the user-visible query results that motivated #18835.
   
   ## Validation
   
   - `rg -n 
"Collections\\.singletonList|List\\.(<[^>]+>)?of\\(\\s*(\\([^)]*\\)\\s*)?null\\s*\\)"
 --glob '!target/**' --glob '!kb/**' --glob '!config/checkstyle.xml' --glob 
'*.java'`
   - `./mvnw spotless:apply`
   - `./mvnw checkstyle:check`
   - `git diff --check`
   - `./mvnw -DskipTests test-compile`
     - The initial root run hit a local Maven cache miss for `jsr305` at 
`pinot-s3`; after refreshing the dependency cache, `./mvnw -DskipTests 
test-compile -rf :pinot-s3` passed through the remaining modules.
   


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

Reply via email to