Skip to content

Commit

Permalink
Deprecate Map, List, and Set in org.opensearch.common.collect (#6609) (
Browse files Browse the repository at this point in the history
…#6631) (#6687)

* Deprecate Map, List, and Set in org.opensearch.common.collect (#6609)

Signed-off-by: Dilip Roshitha <diliproshitha@gmail.com>

* Deprecate Map, List, and Set in org.opensearch.common.collect - PR review points (#6609)

Signed-off-by: Dilip Roshitha <diliproshitha@gmail.com>

* Deprecate Map, List, and Set in org.opensearch.common.collect - removed associated tests (#6609)

Signed-off-by: Dilip Roshitha <diliproshitha@gmail.com>

---------

Signed-off-by: Dilip Roshitha <diliproshitha@gmail.com>
(cherry picked from commit defcdf9)

Co-authored-by: Dilip Roshitha <diliproshitha@gmail.com>
  • Loading branch information
kotwanikunal and diliproshitha authored Mar 16, 2023
1 parent 188e043 commit 4e45e44
Show file tree
Hide file tree
Showing 143 changed files with 500 additions and 1,223 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- [Refactor] XContent base classes from xcontent to core library ([#5902](https://github.com/opensearch-project/OpenSearch/pull/5902))

### Deprecated
- Map, List, and Set in org.opensearch.common.collect ([#6609](https://github.com/opensearch-project/OpenSearch/pull/6609))

### Removed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,7 @@
@State(Scope.Benchmark)
public class StringTermsSerializationBenchmark {
private static final NamedWriteableRegistry REGISTRY = new NamedWriteableRegistry(
org.opensearch.common.collect.List.of(
new NamedWriteableRegistry.Entry(InternalAggregation.class, StringTerms.NAME, StringTerms::new)
)
List.of(new NamedWriteableRegistry.Entry(InternalAggregation.class, StringTerms.NAME, StringTerms::new))
);
@Param(value = { "1000" })
private int buckets;
Expand All @@ -75,15 +73,13 @@ public class StringTermsSerializationBenchmark {

@Setup
public void initResults() {
results = DelayableWriteable.referencing(InternalAggregations.from(org.opensearch.common.collect.List.of(newTerms(true))));
results = DelayableWriteable.referencing(InternalAggregations.from(List.of(newTerms(true))));
}

private StringTerms newTerms(boolean withNested) {
List<StringTerms.Bucket> resultBuckets = new ArrayList<>(buckets);
for (int i = 0; i < buckets; i++) {
InternalAggregations inner = withNested
? InternalAggregations.from(org.opensearch.common.collect.List.of(newTerms(false)))
: InternalAggregations.EMPTY;
InternalAggregations inner = withNested ? InternalAggregations.from(List.of(newTerms(false))) : InternalAggregations.EMPTY;
resultBuckets.add(new StringTerms.Bucket(new BytesRef("test" + i), i, inner, false, 0, DocValueFormat.RAW));
}
return new StringTerms(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2031,8 +2031,8 @@ public void testSimulateIndexTemplate() throws Exception {
Settings settings = Settings.builder().put("index.number_of_shards", 1).build();
CompressedXContent mappings = new CompressedXContent("{\"properties\":{\"host_name\":{\"type\":\"keyword\"}}}");
AliasMetadata alias = AliasMetadata.builder("alias").writeIndex(true).build();
Template template = new Template(settings, mappings, org.opensearch.common.collect.Map.of("alias", alias));
List<String> pattern = org.opensearch.common.collect.List.of("pattern");
Template template = new Template(settings, mappings, Map.of("alias", alias));
List<String> pattern = List.of("pattern");
ComposableIndexTemplate indexTemplate = new ComposableIndexTemplate(
pattern,
template,
Expand All @@ -2057,7 +2057,7 @@ public void testSimulateIndexTemplate() throws Exception {
AliasMetadata simulationAlias = AliasMetadata.builder("simulation-alias").writeIndex(true).build();
ComposableIndexTemplate simulationTemplate = new ComposableIndexTemplate(
pattern,
new Template(null, null, org.opensearch.common.collect.Map.of("simulation-alias", simulationAlias)),
new Template(null, null, Map.of("simulation-alias", simulationAlias)),
Collections.emptyList(),
2L,
1L,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@
/**
* Java 9 List
*
* todo: deprecate and remove w/ min jdk upgrade to 11?
*
* @opensearch.internal
*/
@Deprecated(forRemoval = true)
public class List {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@
/**
* Java 9 Map
*
* todo: deprecate and remove w/ min jdk upgrade to 11?
*
* @opensearch.internal
*/
@Deprecated(forRemoval = true)
public class Map {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@
/**
* Java 9 Set
*
* todo: deprecate and remove w/ min jdk upgrade to 11?
*
* @opensearch.internal
*/
@Deprecated(forRemoval = true)
public class Set {

/**
Expand Down

This file was deleted.

210 changes: 0 additions & 210 deletions libs/common/src/test/java/org/opensearch/common/collect/MapTests.java

This file was deleted.

Loading

0 comments on commit 4e45e44

Please sign in to comment.