Browse Source

Use string list setting throughout codebase (#95901)

We can dry things up a little here and also making things a little faster
(in case we missed a corner case where a list setting is hot) with the optimized
string list setting constructor.
Armin Braun 2 years ago
parent
commit
af5c11702b
39 changed files with 63 additions and 230 deletions
  1. 3 10
      modules/apm/src/main/java/org/elasticsearch/tracing/apm/APMAgentSettings.java
  2. 2 4
      modules/reindex/src/main/java/org/elasticsearch/reindex/ReindexSslConfig.java
  3. 1 6
      modules/reindex/src/main/java/org/elasticsearch/reindex/TransportReindexAction.java
  4. 2 5
      modules/repository-url/src/main/java/org/elasticsearch/repositories/url/URLRepository.java
  5. 3 15
      plugins/discovery-ec2/src/main/java/org/elasticsearch/discovery/ec2/AwsEc2Service.java
  6. 1 8
      plugins/discovery-gce/src/main/java/org/elasticsearch/cloud/gce/GceInstancesService.java
  7. 1 8
      plugins/discovery-gce/src/main/java/org/elasticsearch/discovery/gce/GceSeedHostsProvider.java
  8. 1 4
      server/src/internalClusterTest/java/org/elasticsearch/action/admin/indices/alias/ValidateIndicesAliasesRequestIT.java
  9. 1 4
      server/src/main/java/org/elasticsearch/cluster/coordination/ClusterBootstrapService.java
  10. 1 3
      server/src/main/java/org/elasticsearch/cluster/metadata/IndexMetadata.java
  11. 1 5
      server/src/main/java/org/elasticsearch/cluster/routing/allocation/decider/AwarenessAllocationDecider.java
  12. 1 7
      server/src/main/java/org/elasticsearch/common/network/NetworkService.java
  13. 1 0
      server/src/main/java/org/elasticsearch/common/settings/Setting.java
  14. 1 3
      server/src/main/java/org/elasticsearch/discovery/DiscoveryModule.java
  15. 1 6
      server/src/main/java/org/elasticsearch/discovery/SettingsBasedSeedHostsProvider.java
  16. 2 13
      server/src/main/java/org/elasticsearch/env/Environment.java
  17. 4 14
      server/src/main/java/org/elasticsearch/http/HttpTransportSettings.java
  18. 1 3
      server/src/main/java/org/elasticsearch/index/IndexModule.java
  19. 1 3
      server/src/main/java/org/elasticsearch/index/IndexSortConfig.java
  20. 1 6
      server/src/main/java/org/elasticsearch/plugins/PluginsService.java
  21. 2 7
      server/src/main/java/org/elasticsearch/script/ScriptService.java
  22. 5 14
      server/src/main/java/org/elasticsearch/transport/TransportSettings.java
  23. 1 3
      x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/authc/ldap/LdapSessionFactorySettings.java
  24. 1 1
      x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/authc/ldap/support/LdapMetadataResolverSettings.java
  25. 1 2
      x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/authc/ldap/support/SessionFactorySettings.java
  26. 1 2
      x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/authc/oidc/OpenIdConnectRealmSettings.java
  27. 2 4
      x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/authc/saml/SamlRealmSettings.java
  28. 1 1
      x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/authc/support/DelegatedAuthorizationSettings.java
  29. 1 4
      x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/user/AnonymousUser.java
  30. 3 7
      x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ssl/SSLConfigurationSettings.java
  31. 1 3
      x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/DeprecationChecks.java
  32. 2 6
      x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/collector/Collector.java
  33. 1 9
      x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/exporter/Exporter.java
  34. 1 3
      x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshots.java
  35. 1 9
      x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/Security.java
  36. 2 5
      x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/common/http/HttpSettings.java
  37. 2 4
      x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/notification/email/EmailService.java
  38. 4 17
      x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/notification/email/HtmlSanitizer.java
  39. 1 2
      x-pack/qa/security-example-spi-extension/src/main/java/org/elasticsearch/example/realm/CustomRealm.java

+ 3 - 10
modules/apm/src/main/java/org/elasticsearch/tracing/apm/APMAgentSettings.java

@@ -20,11 +20,9 @@ import org.elasticsearch.core.SuppressForbidden;
 
 import java.security.AccessController;
 import java.security.PrivilegedAction;
-import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 import java.util.Objects;
-import java.util.function.Function;
 
 import static org.elasticsearch.common.settings.Setting.Property.NodeScope;
 import static org.elasticsearch.common.settings.Setting.Property.OperatorDynamic;
@@ -124,23 +122,19 @@ class APMAgentSettings {
         }
     );
 
-    static final Setting<List<String>> APM_TRACING_NAMES_INCLUDE_SETTING = Setting.listSetting(
+    static final Setting<List<String>> APM_TRACING_NAMES_INCLUDE_SETTING = Setting.stringListSetting(
         APM_SETTING_PREFIX + "names.include",
-        Collections.emptyList(),
-        Function.identity(),
         OperatorDynamic,
         NodeScope
     );
 
-    static final Setting<List<String>> APM_TRACING_NAMES_EXCLUDE_SETTING = Setting.listSetting(
+    static final Setting<List<String>> APM_TRACING_NAMES_EXCLUDE_SETTING = Setting.stringListSetting(
         APM_SETTING_PREFIX + "names.exclude",
-        Collections.emptyList(),
-        Function.identity(),
         OperatorDynamic,
         NodeScope
     );
 
-    static final Setting<List<String>> APM_TRACING_SANITIZE_FIELD_NAMES = Setting.listSetting(
+    static final Setting<List<String>> APM_TRACING_SANITIZE_FIELD_NAMES = Setting.stringListSetting(
         APM_SETTING_PREFIX + "sanitize_field_names",
         List.of(
             "password",
@@ -156,7 +150,6 @@ class APMAgentSettings {
             "*principal*",
             "set-cookie"
         ),
-        Function.identity(),
         OperatorDynamic,
         NodeScope
     );

+ 2 - 4
modules/reindex/src/main/java/org/elasticsearch/reindex/ReindexSslConfig.java

@@ -28,17 +28,15 @@ import java.io.IOException;
 import java.io.UncheckedIOException;
 import java.nio.file.Path;
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.function.Function;
 
 import javax.net.ssl.HostnameVerifier;
 import javax.net.ssl.SSLContext;
 
-import static org.elasticsearch.common.settings.Setting.listSetting;
 import static org.elasticsearch.common.settings.Setting.simpleString;
+import static org.elasticsearch.common.settings.Setting.stringListSetting;
 
 /**
  * Loads "reindex.ssl.*" configuration from Settings, and makes the applicable configuration (trust manager / key manager / hostname
@@ -63,7 +61,7 @@ public class ReindexSslConfig {
         for (String key : SslConfigurationKeys.getListKeys()) {
             String settingName = "reindex.ssl." + key;
             final Setting.Property[] properties = SslConfigurationKeys.isDeprecated(key) ? deprecatedProperties : defaultProperties;
-            SETTINGS.put(settingName, listSetting(settingName, Collections.emptyList(), Function.identity(), properties));
+            SETTINGS.put(settingName, stringListSetting(settingName, properties));
         }
         for (String key : SslConfigurationKeys.getSecureStringKeys()) {
             String settingName = "reindex.ssl." + key;

+ 1 - 6
modules/reindex/src/main/java/org/elasticsearch/reindex/TransportReindexAction.java

@@ -29,15 +29,10 @@ import org.elasticsearch.threadpool.ThreadPool;
 import org.elasticsearch.transport.TransportService;
 
 import java.util.List;
-import java.util.function.Function;
-
-import static java.util.Collections.emptyList;
 
 public class TransportReindexAction extends HandledTransportAction<ReindexRequest, BulkByScrollResponse> {
-    public static final Setting<List<String>> REMOTE_CLUSTER_WHITELIST = Setting.listSetting(
+    public static final Setting<List<String>> REMOTE_CLUSTER_WHITELIST = Setting.stringListSetting(
         "reindex.remote.whitelist",
-        emptyList(),
-        Function.identity(),
         Property.NodeScope
     );
 

+ 2 - 5
modules/repository-url/src/main/java/org/elasticsearch/repositories/url/URLRepository.java

@@ -32,10 +32,8 @@ import org.elasticsearch.xcontent.NamedXContentRegistry;
 import java.net.MalformedURLException;
 import java.net.URISyntaxException;
 import java.net.URL;
-import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
-import java.util.function.Function;
 
 /**
  * Read-only URL-based implementation of the BlobStoreRepository
@@ -56,10 +54,9 @@ public class URLRepository extends BlobStoreRepository {
         assert TYPE.equals(BlobStoreRepository.URL_REPOSITORY_TYPE);
     }
 
-    public static final Setting<List<String>> SUPPORTED_PROTOCOLS_SETTING = Setting.listSetting(
+    public static final Setting<List<String>> SUPPORTED_PROTOCOLS_SETTING = Setting.stringListSetting(
         "repositories.url.supported_protocols",
-        Arrays.asList("http", "https", "ftp", "file", "jar"),
-        Function.identity(),
+        List.of("http", "https", "ftp", "file", "jar"),
         Property.NodeScope
     );
 

+ 3 - 15
plugins/discovery-ec2/src/main/java/org/elasticsearch/discovery/ec2/AwsEc2Service.java

@@ -13,8 +13,6 @@ import org.elasticsearch.common.settings.Setting.Property;
 import org.elasticsearch.core.TimeValue;
 
 import java.io.Closeable;
-import java.util.ArrayList;
-import java.util.Collections;
 import java.util.List;
 import java.util.function.Function;
 
@@ -50,22 +48,12 @@ interface AwsEc2Service extends Closeable {
      * discovery.ec2.groups: Either a comma separated list or array based list of (security) groups. Only instances with the provided
      * security groups will be used in the cluster discovery. (NOTE: You could provide either group NAME or group ID.)
      */
-    Setting<List<String>> GROUPS_SETTING = Setting.listSetting(
-        "discovery.ec2.groups",
-        new ArrayList<>(),
-        s -> s.toString(),
-        Property.NodeScope
-    );
+    Setting<List<String>> GROUPS_SETTING = Setting.stringListSetting("discovery.ec2.groups", Property.NodeScope);
     /**
      * discovery.ec2.availability_zones: Either a comma separated list or array based list of availability zones. Only instances within
      * the provided availability zones will be used in the cluster discovery.
      */
-    Setting<List<String>> AVAILABILITY_ZONES_SETTING = Setting.listSetting(
-        "discovery.ec2.availability_zones",
-        Collections.emptyList(),
-        s -> s.toString(),
-        Property.NodeScope
-    );
+    Setting<List<String>> AVAILABILITY_ZONES_SETTING = Setting.stringListSetting("discovery.ec2.availability_zones", Property.NodeScope);
     /**
      * discovery.ec2.node_cache_time: How long the list of hosts is cached to prevent further requests to the AWS API. Defaults to 10s.
      */
@@ -83,7 +71,7 @@ interface AwsEc2Service extends Closeable {
      */
     Setting.AffixSetting<List<String>> TAG_SETTING = Setting.prefixKeySetting(
         "discovery.ec2.tag.",
-        key -> Setting.listSetting(key, Collections.emptyList(), Function.identity(), Property.NodeScope)
+        key -> Setting.stringListSetting(key, Property.NodeScope)
     );
 
     /**

+ 1 - 8
plugins/discovery-gce/src/main/java/org/elasticsearch/cloud/gce/GceInstancesService.java

@@ -16,9 +16,7 @@ import org.elasticsearch.core.TimeValue;
 
 import java.io.Closeable;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.List;
-import java.util.function.Function;
 
 public interface GceInstancesService extends Closeable {
 
@@ -37,12 +35,7 @@ public interface GceInstancesService extends Closeable {
     /**
      * cloud.gce.zone: Google Compute Engine zones
      */
-    Setting<List<String>> ZONE_SETTING = Setting.listSetting(
-        "cloud.gce.zone",
-        Collections.emptyList(),
-        Function.identity(),
-        Property.NodeScope
-    );
+    Setting<List<String>> ZONE_SETTING = Setting.stringListSetting("cloud.gce.zone", Property.NodeScope);
 
     /**
      * cloud.gce.refresh_interval: How long the list of hosts is cached to prevent further requests to the AWS API. 0 disables caching.

+ 1 - 8
plugins/discovery-gce/src/main/java/org/elasticsearch/discovery/gce/GceSeedHostsProvider.java

@@ -31,9 +31,7 @@ import java.net.InetAddress;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
-import java.util.function.Function;
 
-import static java.util.Collections.emptyList;
 import static org.elasticsearch.core.Strings.format;
 
 public class GceSeedHostsProvider implements SeedHostsProvider {
@@ -43,12 +41,7 @@ public class GceSeedHostsProvider implements SeedHostsProvider {
     /**
      * discovery.gce.tags: The gce discovery can filter machines to include in the cluster based on tags.
      */
-    public static final Setting<List<String>> TAGS_SETTING = Setting.listSetting(
-        "discovery.gce.tags",
-        emptyList(),
-        Function.identity(),
-        Property.NodeScope
-    );
+    public static final Setting<List<String>> TAGS_SETTING = Setting.stringListSetting("discovery.gce.tags", Property.NodeScope);
 
     static final class Status {
         private static final String TERMINATED = "TERMINATED";

+ 1 - 4
server/src/internalClusterTest/java/org/elasticsearch/action/admin/indices/alias/ValidateIndicesAliasesRequestIT.java

@@ -24,7 +24,6 @@ import java.util.Collections;
 import java.util.List;
 import java.util.Locale;
 import java.util.Optional;
-import java.util.function.Function;
 
 import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
 import static org.hamcrest.Matchers.containsString;
@@ -36,10 +35,8 @@ public class ValidateIndicesAliasesRequestIT extends ESSingleNodeTestCase {
 
     public static class IndicesAliasesPlugin extends Plugin implements ActionPlugin {
 
-        static final Setting<List<String>> ALLOWED_ORIGINS_SETTING = Setting.listSetting(
+        static final Setting<List<String>> ALLOWED_ORIGINS_SETTING = Setting.stringListSetting(
             "index.aliases.allowed_origins",
-            Collections.emptyList(),
-            Function.identity(),
             Setting.Property.IndexScope,
             Setting.Property.Dynamic
         );

+ 1 - 4
server/src/main/java/org/elasticsearch/cluster/coordination/ClusterBootstrapService.java

@@ -33,7 +33,6 @@ import java.util.Set;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.function.BooleanSupplier;
 import java.util.function.Consumer;
-import java.util.function.Function;
 import java.util.function.Supplier;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
@@ -46,10 +45,8 @@ import static org.elasticsearch.discovery.SettingsBasedSeedHostsProvider.DISCOVE
 
 public class ClusterBootstrapService implements Coordinator.PeerFinderListener {
 
-    public static final Setting<List<String>> INITIAL_MASTER_NODES_SETTING = Setting.listSetting(
+    public static final Setting<List<String>> INITIAL_MASTER_NODES_SETTING = Setting.stringListSetting(
         "cluster.initial_master_nodes",
-        emptyList(),
-        Function.identity(),
         Property.NodeScope
     );
 

+ 1 - 3
server/src/main/java/org/elasticsearch/cluster/metadata/IndexMetadata.java

@@ -480,10 +480,8 @@ public class IndexMetadata implements Diffable<IndexMetadata>, ToXContentFragmen
         Setting.Property.Final
     );
 
-    public static final Setting<List<String>> INDEX_ROUTING_PATH = Setting.listSetting(
+    public static final Setting<List<String>> INDEX_ROUTING_PATH = Setting.stringListSetting(
         "index.routing_path",
-        List.of(),
-        Function.identity(),
         Setting.Property.IndexScope,
         Setting.Property.Final
     );

+ 1 - 5
server/src/main/java/org/elasticsearch/cluster/routing/allocation/decider/AwarenessAllocationDecider.java

@@ -24,10 +24,8 @@ import java.util.List;
 import java.util.Map;
 import java.util.Optional;
 import java.util.Set;
-import java.util.function.Function;
 import java.util.stream.Stream;
 
-import static java.util.Collections.emptyList;
 import static java.util.stream.Collectors.toList;
 
 /**
@@ -74,10 +72,8 @@ public class AwarenessAllocationDecider extends AllocationDecider {
 
     public static final String NAME = "awareness";
 
-    public static final Setting<List<String>> CLUSTER_ROUTING_ALLOCATION_AWARENESS_ATTRIBUTE_SETTING = Setting.listSetting(
+    public static final Setting<List<String>> CLUSTER_ROUTING_ALLOCATION_AWARENESS_ATTRIBUTE_SETTING = Setting.stringListSetting(
         "cluster.routing.allocation.awareness.attributes",
-        emptyList(),
-        Function.identity(),
         Property.Dynamic,
         Property.NodeScope
     );

+ 1 - 7
server/src/main/java/org/elasticsearch/common/network/NetworkService.java

@@ -16,7 +16,6 @@ import java.io.IOException;
 import java.net.InetAddress;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Objects;
@@ -27,12 +26,7 @@ public final class NetworkService {
     /** By default, we bind to loopback interfaces */
     public static final String DEFAULT_NETWORK_HOST = "_local_";
     public static final Setting<Boolean> NETWORK_SERVER = Setting.boolSetting("network.server", true, Property.NodeScope);
-    public static final Setting<List<String>> GLOBAL_NETWORK_HOST_SETTING = Setting.listSetting(
-        "network.host",
-        Collections.emptyList(),
-        Function.identity(),
-        Property.NodeScope
-    );
+    public static final Setting<List<String>> GLOBAL_NETWORK_HOST_SETTING = Setting.stringListSetting("network.host", Property.NodeScope);
     public static final Setting<List<String>> GLOBAL_NETWORK_BIND_HOST_SETTING = Setting.listSetting(
         "network.bind_host",
         GLOBAL_NETWORK_HOST_SETTING,

+ 1 - 0
server/src/main/java/org/elasticsearch/common/settings/Setting.java

@@ -1644,6 +1644,7 @@ public class Setting<T> implements ToXContentObject {
         return new ListSetting<>(key, null, s -> defValue, Setting::parseableStringToList, v -> {}, properties) {
             @Override
             public List<String> get(Settings settings) {
+                checkDeprecation(settings);
                 return settings.getAsList(getKey(), defValue);
             }
         };

+ 1 - 3
server/src/main/java/org/elasticsearch/discovery/DiscoveryModule.java

@@ -76,10 +76,8 @@ public class DiscoveryModule {
         Property.NodeScope
     );
 
-    public static final Setting<List<String>> DISCOVERY_SEED_PROVIDERS_SETTING = Setting.listSetting(
+    public static final Setting<List<String>> DISCOVERY_SEED_PROVIDERS_SETTING = Setting.stringListSetting(
         "discovery.seed_providers",
-        Collections.emptyList(),
-        Function.identity(),
         Property.NodeScope
     );
 

+ 1 - 6
server/src/main/java/org/elasticsearch/discovery/SettingsBasedSeedHostsProvider.java

@@ -17,9 +17,6 @@ import org.elasticsearch.common.transport.TransportAddress;
 import org.elasticsearch.transport.TransportService;
 
 import java.util.List;
-import java.util.function.Function;
-
-import static java.util.Collections.emptyList;
 
 /**
  * An implementation of {@link SeedHostsProvider} that reads hosts/ports
@@ -33,10 +30,8 @@ public class SettingsBasedSeedHostsProvider implements SeedHostsProvider {
 
     private static final Logger logger = LogManager.getLogger(SettingsBasedSeedHostsProvider.class);
 
-    public static final Setting<List<String>> DISCOVERY_SEED_HOSTS_SETTING = Setting.listSetting(
+    public static final Setting<List<String>> DISCOVERY_SEED_HOSTS_SETTING = Setting.stringListSetting(
         "discovery.seed_hosts",
-        emptyList(),
-        Function.identity(),
         Property.NodeScope
     );
 

+ 2 - 13
server/src/main/java/org/elasticsearch/env/Environment.java

@@ -26,7 +26,6 @@ import java.nio.file.FileStore;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.util.Arrays;
-import java.util.Collections;
 import java.util.List;
 import java.util.Objects;
 import java.util.function.Function;
@@ -42,19 +41,9 @@ public class Environment {
     private static final Path[] EMPTY_PATH_ARRAY = new Path[0];
 
     public static final Setting<String> PATH_HOME_SETTING = Setting.simpleString("path.home", Property.NodeScope);
-    public static final Setting<List<String>> PATH_DATA_SETTING = Setting.listSetting(
-        "path.data",
-        Collections.emptyList(),
-        Function.identity(),
-        Property.NodeScope
-    );
+    public static final Setting<List<String>> PATH_DATA_SETTING = Setting.stringListSetting("path.data", Property.NodeScope);
     public static final Setting<String> PATH_LOGS_SETTING = new Setting<>("path.logs", "", Function.identity(), Property.NodeScope);
-    public static final Setting<List<String>> PATH_REPO_SETTING = Setting.listSetting(
-        "path.repo",
-        Collections.emptyList(),
-        Function.identity(),
-        Property.NodeScope
-    );
+    public static final Setting<List<String>> PATH_REPO_SETTING = Setting.stringListSetting("path.repo", Property.NodeScope);
     public static final Setting<String> PATH_SHARED_DATA_SETTING = Setting.simpleString("path.shared_data", Property.NodeScope);
 
     private final Settings settings;

+ 4 - 14
server/src/main/java/org/elasticsearch/http/HttpTransportSettings.java

@@ -16,14 +16,13 @@ import org.elasticsearch.common.unit.ByteSizeUnit;
 import org.elasticsearch.common.unit.ByteSizeValue;
 import org.elasticsearch.core.TimeValue;
 
-import java.util.Collections;
 import java.util.List;
 import java.util.function.Function;
 
-import static java.util.Collections.emptyList;
 import static org.elasticsearch.common.settings.Setting.boolSetting;
 import static org.elasticsearch.common.settings.Setting.intSetting;
 import static org.elasticsearch.common.settings.Setting.listSetting;
+import static org.elasticsearch.common.settings.Setting.stringListSetting;
 
 public final class HttpTransportSettings {
 
@@ -67,12 +66,7 @@ public final class HttpTransportSettings {
     // we intentionally use a different compression level as Netty here as our benchmarks have shown that a compression level of 3 is the
     // best compromise between reduction in network traffic and added latency. For more details please check #7309.
     public static final Setting<Integer> SETTING_HTTP_COMPRESSION_LEVEL = intSetting("http.compression_level", 3, Property.NodeScope);
-    public static final Setting<List<String>> SETTING_HTTP_HOST = listSetting(
-        "http.host",
-        emptyList(),
-        Function.identity(),
-        Property.NodeScope
-    );
+    public static final Setting<List<String>> SETTING_HTTP_HOST = stringListSetting("http.host", Property.NodeScope);
     public static final Setting<List<String>> SETTING_HTTP_PUBLISH_HOST = listSetting(
         "http.publish_host",
         SETTING_HTTP_HOST,
@@ -191,17 +185,13 @@ public final class HttpTransportSettings {
         Setting.Property.NodeScope
     );
 
-    public static final Setting<List<String>> SETTING_HTTP_TRACE_LOG_INCLUDE = Setting.listSetting(
+    public static final Setting<List<String>> SETTING_HTTP_TRACE_LOG_INCLUDE = Setting.stringListSetting(
         "http.tracer.include",
-        Collections.emptyList(),
-        Function.identity(),
         Setting.Property.Dynamic,
         Setting.Property.NodeScope
     );
-    public static final Setting<List<String>> SETTING_HTTP_TRACE_LOG_EXCLUDE = Setting.listSetting(
+    public static final Setting<List<String>> SETTING_HTTP_TRACE_LOG_EXCLUDE = Setting.stringListSetting(
         "http.tracer.exclude",
-        Collections.emptyList(),
-        Function.identity(),
         Setting.Property.Dynamic,
         Setting.Property.NodeScope
     );

+ 1 - 3
server/src/main/java/org/elasticsearch/index/IndexModule.java

@@ -121,10 +121,8 @@ public final class IndexModule {
     /** On which extensions to load data into the file-system cache upon opening of files.
      *  This only works with the mmap directory, and even in that case is still
      *  best-effort only. */
-    public static final Setting<List<String>> INDEX_STORE_PRE_LOAD_SETTING = Setting.listSetting(
+    public static final Setting<List<String>> INDEX_STORE_PRE_LOAD_SETTING = Setting.stringListSetting(
         "index.store.preload",
-        Collections.emptyList(),
-        Function.identity(),
         Property.IndexScope,
         Property.NodeScope
     );

+ 1 - 3
server/src/main/java/org/elasticsearch/index/IndexSortConfig.java

@@ -59,10 +59,8 @@ public final class IndexSortConfig {
     /**
      * The list of field names
      */
-    public static final Setting<List<String>> INDEX_SORT_FIELD_SETTING = Setting.listSetting(
+    public static final Setting<List<String>> INDEX_SORT_FIELD_SETTING = Setting.stringListSetting(
         "index.sort.field",
-        Collections.emptyList(),
-        Function.identity(),
         Setting.Property.IndexScope,
         Setting.Property.Final
     );

+ 1 - 6
server/src/main/java/org/elasticsearch/plugins/PluginsService.java

@@ -110,12 +110,7 @@ public class PluginsService implements ReportingService<PluginsAndModules> {
     private final PluginsAndModules info;
     private final StablePluginsRegistry stablePluginsRegistry = new StablePluginsRegistry();
 
-    public static final Setting<List<String>> MANDATORY_SETTING = Setting.listSetting(
-        "plugin.mandatory",
-        Collections.emptyList(),
-        Function.identity(),
-        Property.NodeScope
-    );
+    public static final Setting<List<String>> MANDATORY_SETTING = Setting.stringListSetting("plugin.mandatory", Property.NodeScope);
 
     /**
      * Constructs a new PluginService

+ 2 - 7
server/src/main/java/org/elasticsearch/script/ScriptService.java

@@ -50,7 +50,6 @@ import java.util.Map;
 import java.util.Objects;
 import java.util.Set;
 import java.util.concurrent.atomic.AtomicReference;
-import java.util.function.Function;
 import java.util.function.LongSupplier;
 import java.util.stream.Collectors;
 
@@ -163,16 +162,12 @@ public class ScriptService implements Closeable, ClusterStateApplier, ScriptComp
 
     public static final String ALLOW_NONE = "none";
 
-    public static final Setting<List<String>> TYPES_ALLOWED_SETTING = Setting.listSetting(
+    public static final Setting<List<String>> TYPES_ALLOWED_SETTING = Setting.stringListSetting(
         "script.allowed_types",
-        Collections.emptyList(),
-        Function.identity(),
         Setting.Property.NodeScope
     );
-    public static final Setting<List<String>> CONTEXTS_ALLOWED_SETTING = Setting.listSetting(
+    public static final Setting<List<String>> CONTEXTS_ALLOWED_SETTING = Setting.stringListSetting(
         "script.allowed_contexts",
-        Collections.emptyList(),
-        Function.identity(),
         Setting.Property.NodeScope
     );
 

+ 5 - 14
server/src/main/java/org/elasticsearch/transport/TransportSettings.java

@@ -13,17 +13,16 @@ import org.elasticsearch.common.settings.Settings;
 import org.elasticsearch.common.unit.ByteSizeValue;
 import org.elasticsearch.core.TimeValue;
 
-import java.util.Arrays;
 import java.util.List;
 import java.util.concurrent.TimeUnit;
 import java.util.function.Function;
 
-import static java.util.Collections.emptyList;
 import static org.elasticsearch.common.settings.Setting.affixKeySetting;
 import static org.elasticsearch.common.settings.Setting.boolSetting;
 import static org.elasticsearch.common.settings.Setting.enumSetting;
 import static org.elasticsearch.common.settings.Setting.intSetting;
 import static org.elasticsearch.common.settings.Setting.listSetting;
+import static org.elasticsearch.common.settings.Setting.stringListSetting;
 import static org.elasticsearch.common.settings.Setting.timeSetting;
 
 public final class TransportSettings {
@@ -31,12 +30,7 @@ public final class TransportSettings {
     public static final String DEFAULT_PROFILE = "default";
     public static final String FEATURE_PREFIX = "transport.features";
 
-    public static final Setting<List<String>> HOST = listSetting(
-        "transport.host",
-        emptyList(),
-        Function.identity(),
-        Setting.Property.NodeScope
-    );
+    public static final Setting<List<String>> HOST = stringListSetting("transport.host", Setting.Property.NodeScope);
     public static final Setting<List<String>> PUBLISH_HOST = listSetting(
         "transport.publish_host",
         HOST,
@@ -224,17 +218,14 @@ public final class TransportSettings {
 
     // Tracer settings
 
-    public static final Setting<List<String>> TRACE_LOG_INCLUDE_SETTING = listSetting(
+    public static final Setting<List<String>> TRACE_LOG_INCLUDE_SETTING = stringListSetting(
         "transport.tracer.include",
-        emptyList(),
-        Function.identity(),
         Setting.Property.Dynamic,
         Setting.Property.NodeScope
     );
-    public static final Setting<List<String>> TRACE_LOG_EXCLUDE_SETTING = listSetting(
+    public static final Setting<List<String>> TRACE_LOG_EXCLUDE_SETTING = stringListSetting(
         "transport.tracer.exclude",
-        Arrays.asList("internal:coordination/fault_detection/*"),
-        Function.identity(),
+        List.of("internal:coordination/fault_detection/*"),
         Setting.Property.Dynamic,
         Setting.Property.NodeScope
     );

+ 1 - 3
x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/authc/ldap/LdapSessionFactorySettings.java

@@ -10,11 +10,9 @@ import org.elasticsearch.common.settings.Setting;
 import org.elasticsearch.xpack.core.security.authc.RealmSettings;
 import org.elasticsearch.xpack.core.security.authc.ldap.support.SessionFactorySettings;
 
-import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
-import java.util.function.Function;
 
 import static org.elasticsearch.xpack.core.security.authc.ldap.LdapRealmSettings.LDAP_TYPE;
 
@@ -23,7 +21,7 @@ public final class LdapSessionFactorySettings {
     public static final Setting.AffixSetting<List<String>> USER_DN_TEMPLATES_SETTING = Setting.affixKeySetting(
         RealmSettings.realmSettingPrefix(LDAP_TYPE),
         "user_dn_templates",
-        key -> Setting.listSetting(key, Collections.emptyList(), Function.identity(), Setting.Property.NodeScope)
+        key -> Setting.stringListSetting(key, Setting.Property.NodeScope)
     );
 
     public static Set<Setting.AffixSetting<?>> getSettings() {

+ 1 - 1
x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/authc/ldap/support/LdapMetadataResolverSettings.java

@@ -16,7 +16,7 @@ import java.util.function.Function;
 public final class LdapMetadataResolverSettings {
     public static final Function<String, Setting.AffixSetting<List<String>>> ADDITIONAL_METADATA_SETTING = RealmSettings.affixSetting(
         "metadata",
-        key -> Setting.listSetting(key, Collections.emptyList(), Function.identity(), Setting.Property.NodeScope)
+        key -> Setting.stringListSetting(key, Setting.Property.NodeScope)
     );
 
     private LdapMetadataResolverSettings() {}

+ 1 - 2
x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/authc/ldap/support/SessionFactorySettings.java

@@ -11,7 +11,6 @@ import org.elasticsearch.core.TimeValue;
 import org.elasticsearch.xpack.core.security.authc.RealmSettings;
 import org.elasticsearch.xpack.core.ssl.SSLConfigurationSettings;
 
-import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
@@ -21,7 +20,7 @@ public final class SessionFactorySettings {
 
     public static final Function<String, Setting.AffixSetting<List<String>>> URLS_SETTING = RealmSettings.affixSetting(
         "url",
-        key -> Setting.listSetting(key, Collections.emptyList(), Function.identity(), Setting.Property.NodeScope)
+        key -> Setting.stringListSetting(key, Setting.Property.NodeScope)
     );
 
     public static final TimeValue TIMEOUT_DEFAULT = TimeValue.timeValueSeconds(5);

+ 1 - 2
x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/authc/oidc/OpenIdConnectRealmSettings.java

@@ -18,7 +18,6 @@ import org.elasticsearch.xpack.core.ssl.SSLConfigurationSettings;
 
 import java.net.URI;
 import java.net.URISyntaxException;
-import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
@@ -102,7 +101,7 @@ public class OpenIdConnectRealmSettings {
     public static final Setting.AffixSetting<List<String>> RP_REQUESTED_SCOPES = Setting.affixKeySetting(
         RealmSettings.realmSettingPrefix(TYPE),
         "rp.requested_scopes",
-        key -> Setting.listSetting(key, Collections.singletonList("openid"), Function.identity(), Setting.Property.NodeScope)
+        key -> Setting.stringListSetting(key, List.of("openid"), Setting.Property.NodeScope)
     );
     public static final Setting.AffixSetting<String> RP_CLIENT_AUTH_METHOD = Setting.affixKeySetting(
         RealmSettings.realmSettingPrefix(TYPE),

+ 2 - 4
x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/authc/saml/SamlRealmSettings.java

@@ -17,10 +17,8 @@ import org.elasticsearch.xpack.core.ssl.X509KeyPairSettings;
 
 import java.util.Arrays;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.List;
 import java.util.Set;
-import java.util.function.Function;
 
 public class SamlRealmSettings {
 
@@ -126,13 +124,13 @@ public class SamlRealmSettings {
     public static final Setting.AffixSetting<List<String>> SIGNING_MESSAGE_TYPES = Setting.affixKeySetting(
         RealmSettings.realmSettingPrefix(TYPE),
         "signing.saml_messages",
-        key -> Setting.listSetting(key, Collections.singletonList("*"), Function.identity(), Setting.Property.NodeScope)
+        key -> Setting.stringListSetting(key, List.of("*"), Setting.Property.NodeScope)
     );
 
     public static final Setting.AffixSetting<List<String>> REQUESTED_AUTHN_CONTEXT_CLASS_REF = Setting.affixKeySetting(
         RealmSettings.realmSettingPrefix(TYPE),
         "req_authn_context_class_ref",
-        key -> Setting.listSetting(key, Collections.emptyList(), Function.identity(), Setting.Property.NodeScope)
+        key -> Setting.stringListSetting(key, Setting.Property.NodeScope)
     );
 
     public static final Setting.AffixSetting<TimeValue> CLOCK_SKEW = Setting.affixKeySetting(

+ 1 - 1
x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/authc/support/DelegatedAuthorizationSettings.java

@@ -23,7 +23,7 @@ public class DelegatedAuthorizationSettings {
     public static final String AUTHZ_REALMS_SUFFIX = "authorization_realms";
     public static final Function<String, Setting.AffixSetting<List<String>>> AUTHZ_REALMS = RealmSettings.affixSetting(
         AUTHZ_REALMS_SUFFIX,
-        key -> Setting.listSetting(key, Collections.emptyList(), Function.identity(), Setting.Property.NodeScope)
+        key -> Setting.stringListSetting(key, Setting.Property.NodeScope)
     );
 
     public static Collection<Setting.AffixSetting<?>> getSettings(String realmType) {

+ 1 - 4
x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/user/AnonymousUser.java

@@ -12,7 +12,6 @@ import org.elasticsearch.common.settings.Setting.Property;
 import org.elasticsearch.common.settings.Settings;
 import org.elasticsearch.xpack.core.security.support.MetadataUtils;
 
-import java.util.Collections;
 import java.util.List;
 
 import static org.elasticsearch.xpack.core.security.SecurityField.setting;
@@ -29,10 +28,8 @@ public class AnonymousUser extends User {
         s -> s,
         Property.NodeScope
     );
-    public static final Setting<List<String>> ROLES_SETTING = Setting.listSetting(
+    public static final Setting<List<String>> ROLES_SETTING = Setting.stringListSetting(
         setting("authc.anonymous.roles"),
-        Collections.emptyList(),
-        s -> s,
         Property.NodeScope
     );
 

+ 3 - 7
x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ssl/SSLConfigurationSettings.java

@@ -57,10 +57,8 @@ public class SSLConfigurationSettings {
     private final List<Setting<?>> enabledSettings;
     private final List<Setting<?>> disabledSettings;
 
-    private static final Function<String, Setting<List<String>>> CIPHERS_SETTING_TEMPLATE = key -> Setting.listSetting(
+    private static final Function<String, Setting<List<String>>> CIPHERS_SETTING_TEMPLATE = key -> Setting.stringListSetting(
         key,
-        List.of(),
-        Function.identity(),
         Property.NodeScope,
         Property.Filtered
     );
@@ -68,7 +66,7 @@ public class SSLConfigurationSettings {
 
     private static final SslSetting<List<String>> SUPPORTED_PROTOCOLS = SslSetting.setting(
         SslConfigurationKeys.PROTOCOLS,
-        key -> Setting.listSetting(key, List.of(), Function.identity(), Property.NodeScope, Property.Filtered)
+        key -> Setting.stringListSetting(key, Property.NodeScope, Property.Filtered)
     );
 
     private static final SslSetting<Optional<String>> KEYSTORE_PATH = SslSetting.setting(
@@ -187,10 +185,8 @@ public class SSLConfigurationSettings {
         X509KeyPairSettings.CERT_TEMPLATE
     );
 
-    public static final Function<String, Setting<List<String>>> CAPATH_SETTING_TEMPLATE = key -> Setting.listSetting(
+    public static final Function<String, Setting<List<String>>> CAPATH_SETTING_TEMPLATE = key -> Setting.stringListSetting(
         key,
-        Collections.emptyList(),
-        Function.identity(),
         Property.NodeScope,
         Property.Filtered
     );

+ 1 - 3
x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/DeprecationChecks.java

@@ -27,10 +27,8 @@ import java.util.stream.Collectors;
  */
 public class DeprecationChecks {
 
-    public static final Setting<List<String>> SKIP_DEPRECATIONS_SETTING = Setting.listSetting(
+    public static final Setting<List<String>> SKIP_DEPRECATIONS_SETTING = Setting.stringListSetting(
         "deprecation.skip_deprecated_settings",
-        Collections.emptyList(),
-        Function.identity(),
         Setting.Property.NodeScope,
         Setting.Property.Dynamic
     );

+ 2 - 6
x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/collector/Collector.java

@@ -24,11 +24,9 @@ import org.elasticsearch.xpack.core.monitoring.exporter.MonitoringDoc;
 import java.util.Collection;
 import java.util.List;
 import java.util.Objects;
-import java.util.function.Function;
 
-import static java.util.Collections.emptyList;
 import static org.elasticsearch.common.settings.Setting.Property;
-import static org.elasticsearch.common.settings.Setting.listSetting;
+import static org.elasticsearch.common.settings.Setting.stringListSetting;
 import static org.elasticsearch.common.settings.Setting.timeSetting;
 
 /**
@@ -39,10 +37,8 @@ public abstract class Collector {
     /**
      * List of indices names whose stats will be exported (default to all indices)
      */
-    public static final Setting<List<String>> INDICES = listSetting(
+    public static final Setting<List<String>> INDICES = stringListSetting(
         collectionSetting("indices"),
-        emptyList(),
-        Function.identity(),
         Property.Dynamic,
         Property.NodeScope,
         Setting.Property.DeprecatedWarning

+ 1 - 9
x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/exporter/Exporter.java

@@ -25,7 +25,6 @@ import java.util.List;
 import java.util.Map;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.function.Consumer;
-import java.util.function.Function;
 
 public abstract class Exporter implements AutoCloseable {
 
@@ -99,14 +98,7 @@ public abstract class Exporter implements AutoCloseable {
     public static final Setting.AffixSetting<List<String>> CLUSTER_ALERTS_BLACKLIST_SETTING = Setting.affixKeySetting(
         "xpack.monitoring.exporters.",
         "cluster_alerts.management.blacklist",
-        key -> Setting.listSetting(
-            key,
-            Collections.emptyList(),
-            Function.identity(),
-            Property.Dynamic,
-            Property.NodeScope,
-            Property.DeprecatedWarning
-        ),
+        key -> Setting.stringListSetting(key, Property.Dynamic, Property.NodeScope, Property.DeprecatedWarning),
         TYPE_DEPENDENCY
     );
 

+ 1 - 3
x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshots.java

@@ -190,10 +190,8 @@ public class SearchableSnapshots extends Plugin implements IndexStorePlugin, Eng
         Setting.Property.NotCopyableOnResize
     );
     // The file extensions that are excluded from the cache
-    public static final Setting<List<String>> SNAPSHOT_CACHE_EXCLUDED_FILE_TYPES_SETTING = Setting.listSetting(
+    public static final Setting<List<String>> SNAPSHOT_CACHE_EXCLUDED_FILE_TYPES_SETTING = Setting.stringListSetting(
         "index.store.snapshot.cache.excluded_file_types",
-        Collections.emptyList(),
-        Function.identity(),
         Setting.Property.IndexScope,
         Setting.Property.NodeScope,
         Setting.Property.NotCopyableOnResize

+ 1 - 9
x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/Security.java

@@ -1180,15 +1180,7 @@ public class Security extends Plugin
         settingsList.add(SimpleRole.CACHE_SIZE_SETTING);
 
         // hide settings
-        settingsList.add(
-            Setting.listSetting(
-                SecurityField.setting("hide_settings"),
-                Collections.emptyList(),
-                Function.identity(),
-                Property.NodeScope,
-                Property.Filtered
-            )
-        );
+        settingsList.add(Setting.stringListSetting(SecurityField.setting("hide_settings"), Property.NodeScope, Property.Filtered));
         return settingsList;
     }
 

+ 2 - 5
x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/common/http/HttpSettings.java

@@ -14,9 +14,7 @@ import org.elasticsearch.core.TimeValue;
 import org.elasticsearch.xpack.core.ssl.SSLConfigurationSettings;
 
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.List;
-import java.util.function.Function;
 
 /**
  * Handles the configuration and parsing of settings for the <code>xpack.http.</code> prefix
@@ -51,10 +49,9 @@ public class HttpSettings {
     static final Setting<String> PROXY_HOST = Setting.simpleString(PROXY_HOST_KEY, Property.NodeScope);
     static final Setting<String> PROXY_SCHEME = Setting.simpleString(PROXY_SCHEME_KEY, Scheme::parse, Property.NodeScope);
     static final Setting<Integer> PROXY_PORT = Setting.intSetting(PROXY_PORT_KEY, 0, 0, 0xFFFF, Property.NodeScope);
-    static final Setting<List<String>> HOSTS_WHITELIST = Setting.listSetting(
+    static final Setting<List<String>> HOSTS_WHITELIST = Setting.stringListSetting(
         "xpack.http.whitelist",
-        Collections.singletonList("*"),
-        Function.identity(),
+        List.of("*"),
         Property.NodeScope,
         Property.Dynamic
     );

+ 2 - 4
x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/notification/email/EmailService.java

@@ -25,7 +25,6 @@ import org.elasticsearch.xpack.watcher.notification.NotificationService;
 
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Optional;
@@ -57,10 +56,9 @@ public class EmailService extends NotificationService<Account> {
         (key) -> Setting.simpleString(key, Property.Dynamic, Property.NodeScope)
     );
 
-    private static final Setting<List<String>> SETTING_DOMAIN_ALLOWLIST = Setting.listSetting(
+    private static final Setting<List<String>> SETTING_DOMAIN_ALLOWLIST = Setting.stringListSetting(
         "xpack.notification.email.account.domain_allowlist",
-        Collections.singletonList("*"),
-        String::toString,
+        List.of("*"),
         Property.Dynamic,
         Property.NodeScope
     );

+ 4 - 17
x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/notification/email/HtmlSanitizer.java

@@ -19,11 +19,9 @@ import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.MethodType;
 import java.util.Arrays;
-import java.util.Collections;
 import java.util.EnumSet;
 import java.util.List;
 import java.util.Locale;
-import java.util.function.Function;
 import java.util.function.UnaryOperator;
 
 public class HtmlSanitizer {
@@ -50,33 +48,22 @@ public class HtmlSanitizer {
         "hr" };
     static final String[] BLOCK_TAGS = new String[] { "p", "div", "h1", "h2", "h3", "h4", "h5", "h6", "ul", "ol", "li", "blockquote" };
     static final String[] TABLE_TAGS = new String[] { "table", "th", "tr", "td", "caption", "col", "colgroup", "thead", "tbody", "tfoot" };
-    static final List<String> DEFAULT_ALLOWED = Arrays.asList(
-        "body",
-        "head",
-        "_tables",
-        "_links",
-        "_blocks",
-        "_formatting",
-        "img:embedded"
-    );
+    static final List<String> DEFAULT_ALLOWED = List.of("body", "head", "_tables", "_links", "_blocks", "_formatting", "img:embedded");
 
-    private static Setting<Boolean> SETTING_SANITIZATION_ENABLED = Setting.boolSetting(
+    private static final Setting<Boolean> SETTING_SANITIZATION_ENABLED = Setting.boolSetting(
         "xpack.notification.email.html.sanitization.enabled",
         true,
         Property.NodeScope
     );
 
-    private static Setting<List<String>> SETTING_SANITIZATION_ALLOW = Setting.listSetting(
+    private static final Setting<List<String>> SETTING_SANITIZATION_ALLOW = Setting.stringListSetting(
         "xpack.notification.email.html.sanitization.allow",
         DEFAULT_ALLOWED,
-        Function.identity(),
         Property.NodeScope
     );
 
-    private static Setting<List<String>> SETTING_SANITIZATION_DISALLOW = Setting.listSetting(
+    private static final Setting<List<String>> SETTING_SANITIZATION_DISALLOW = Setting.stringListSetting(
         "xpack.notification.email.html.sanitization.disallow",
-        Collections.emptyList(),
-        Function.identity(),
         Property.NodeScope
     );
     private static final MethodHandle sanitizeHandle;

+ 1 - 2
x-pack/qa/security-example-spi-extension/src/main/java/org/elasticsearch/example/realm/CustomRealm.java

@@ -21,7 +21,6 @@ import org.elasticsearch.xpack.core.security.authc.support.UsernamePasswordToken
 import org.elasticsearch.xpack.core.security.user.User;
 
 import java.util.List;
-import java.util.function.Function;
 
 public class CustomRealm extends Realm {
 
@@ -55,7 +54,7 @@ public class CustomRealm extends Realm {
     public static final Setting.AffixSetting<List<String>> ROLES_SETTING = Setting.affixKeySetting(
         RealmSettings.realmSettingPrefix(TYPE),
         "roles",
-        key -> Setting.listSetting(key, DEFAULT_ROLES, Function.identity(), Setting.Property.NodeScope)
+        key -> Setting.stringListSetting(key, DEFAULT_ROLES, Setting.Property.NodeScope)
     );
 
     private final String username;