[
https://issues.apache.org/jira/browse/SOLR-18209?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18075994#comment-18075994
]
Eric Pugh commented on SOLR-18209:
----------------------------------
Please do... I wanted to flag that we have
[https://github.com/apache/solr/pull/4222/changes] that may cover this as well
taht I plan on merging shortly. I'd love your review.
> 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
> Priority: Minor
> Labels: newdev
>
> 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]