-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Replace "blacklist/whitelist" terminology in Java APIs #1683
Description
Is your feature request related to a problem? Please describe.
Replace the "blacklist/whitelist" terminology in all Java APIs, including field, method, class, and package names.
The "Java APIs" refers to those packaged in Java libraries and are published to Maven (https://search.maven.org/search?q=g:org.opensearch https://mvnrepository.com/artifact/org.opensearch)
Impact:
All plugins, clients and tools that use OpenSearch Java APIs from OpenSearch Java libraries which contain non-inclusive terminologies have to make corresponding changes to call new APIs, if they want to upgrade the dependency to a future major version of OpenSearch.
A part of #1483
Describe the solution you'd like
Replace the "blacklist/whitelist" terminology with "denylist/allowlist" in all Java APIs that are exposed in Java libraries.
Describe alternatives you've considered
None.
Additional context
Locations of "blacklist/whitelist" in API of Java library:
1 Painless SPI - multiple classes with name “Whitelist”
Code: https://github.com/opensearch-project/OpenSearch/tree/1.0.0/modules/lang-painless/spi/src/main/java/org/opensearch/painless/spi
Javadoc: https://opensearch.org/javadocs/1.0.0/OpenSearch/modules/lang-painless/spi/build/docs/javadoc/org/opensearch/painless/spi/package-summary.html
2 Subclasses of the Painless SPI classes: ProcessorsWhitelistExtension
Code: https://github.com/opensearch-project/OpenSearch/blob/2.0.0/modules/ingest-common/src/main/java/org/opensearch/ingest/common/ProcessorsWhitelistExtension.java
The regex to filter the lines with public or protected class definition contains "whitelist" terminology:
(public|protected)(.)+(class|interface)\s(\w)*Whitelist
List of the classes need renaming:
In package org.opensearch.painless.spi
final class Whitelist
final class WhitelistClass
class WhitelistClassBinding
final class WhitelistConstructor
class WhitelistField
class WhitelistInstanceBinding
final class WhitelistLoader
class WhitelistMethod
interface WhitelistAnnotationParser
In package org.opensearch.ingest.common:
class ProcessorsWhitelistExtension
LIst of the public method and variables need renaming:
In final class Whitelist:
public static final List<Whitelist> BASE_WHITELISTS
public final List<WhitelistClass> whitelistClasses
public final List<WhitelistMethod> whitelistImportedMethods
public final List<WhitelistClassBinding> whitelistClassBindings
public final List<WhitelistInstanceBinding> whitelistInstanceBindings
In final class WhitelistClass:
public final List<WhitelistConstructor> whitelistConstructors
public final List<WhitelistMethod> whitelistMethods
public final List<WhitelistField> whitelistFields
In interface PainlessExtension:
Map<ScriptContext<?>, List<Whitelist>> getContextWhitelists();
There are some methods whose return type are objects of classes contain Whitelist, so the backwards compatibility needs to be considered:
In final class WhitelistLoader:
public static Whitelist loadFromResourceFiles(Class<?> resource, String... filepaths)
public static Whitelist loadFromResourceFiles(Class<?> resource, Map<String, WhitelistAnnotationParser> parsers, String... filepaths)
In interface WhitelistAnnotationParser:
Map<String, WhitelistAnnotationParser> BASE_ANNOTATION_PARSERS