Chaitali Rajhans created SOLR-18209:
---------------------------------------

             Summary: Replace Arrays.asList with List.of for immutable static 
final fields in solrj and core
                 Key: SOLR-18209
                 URL: https://issues.apache.org/jira/browse/SOLR-18209
             Project: Solr
          Issue Type: Improvement
          Components: clients - java, SolrCloud
    Affects Versions: 10.0.1
            Reporter: Chaitali Rajhans


Several private static final fields in solrj and core use Arrays.asList() to 
initialize collections that are never mutated after creation. Arrays.asList() 
returns a fixed-size but still mutable list, callers can call .set() on it  to 
replace elements. For fields declared static final that are only ever read, 
List.of() or Set.of() (Java 9+) is the correct choice as it returns a truly 
immutable collection and better communicates intent.

Fields affected:
- ContentStreamBase.java: UNHELPFUL_TYPES, XML_SUF, JSON_SUF, CSV_SUF
- HttpSolrClientBase.java: errPath
- NodeHealth.java: UNHEALTHY_STATES
- SchemaDesignerConfigSetHelper.java: includeLangIds, removeFieldProps
- FileTypeMagicUtil.java: SKIP_FOLDERS
- test-framework HttpSolrClient.java: errPath



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to