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


##########
solr/core/src/java/org/apache/solr/schema/StrField.java:
##########
@@ -64,7 +64,7 @@ public List<IndexableField> createFields(SchemaField field, 
Object value) {
 
       fval = docval;
     }
-    return List.of(fval);
+    return fval == null ? List.of() : List.of(fval);

Review Comment:
   that sucks that we have to do this check!   I guess technically if `fval` is 
null, then the List.of is return a list with a single value, null instead of an 
empty list?   
   
   Out of curiosity, are we doing something wrong that we trigger this pattern? 
 I'm wondering if our coding style conflicts with how Java thinks we should do 
things...   Or is this just totally normal java code?  If it isn't totally 
normal java code, I wonder if there are other places we follow this pattern 
that are latent bugs?   
   
   Lastly, if `return List.of(fval);` is bad form, is there a errorprone or 
other checker rule that we could enable?
   
   



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