Skip to content

Commit a963286

Browse files
committed
This can just be BiFunction
We don't need a purpose-built interface for these.
1 parent cc28dab commit a963286

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

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

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import java.util.Collections;
2222
import java.util.List;
2323
import java.util.Objects;
24+
import java.util.function.BiFunction;
2425
import java.util.function.Function;
2526
import java.util.stream.Collectors;
2627
import java.util.stream.Stream;
@@ -138,7 +139,7 @@ private DeprecationChecks() {
138139
).collect(Collectors.toList());
139140
}
140141

141-
static List<IndexDeprecationCheck<ClusterState, IndexMetadata, DeprecationIssue>> INDEX_SETTINGS_CHECKS =
142+
static List<BiFunction<ClusterState, IndexMetadata, DeprecationIssue>> INDEX_SETTINGS_CHECKS =
142143
Collections.unmodifiableList(Arrays.asList(
143144
(clusterState, indexMetadata) -> IndexDeprecationChecks.oldIndicesCheck(indexMetadata),
144145
(clusterState, indexMetadata) -> IndexDeprecationChecks.tooManyFieldsCheck(indexMetadata),
@@ -175,9 +176,4 @@ static <T> List<DeprecationIssue> filterChecks(List<T> checks, Function<T, Depre
175176
public interface NodeDeprecationCheck<A, B, C, D, R> {
176177
R apply(A first, B second, C third, D fourth);
177178
}
178-
179-
@FunctionalInterface
180-
public interface IndexDeprecationCheck<A, B, R> {
181-
R apply(A first, B second);
182-
}
183179
}

x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/DeprecationInfoAction.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import java.util.Map;
4040
import java.util.Objects;
4141
import java.util.Set;
42+
import java.util.function.BiFunction;
4243
import java.util.function.Function;
4344
import java.util.stream.Collectors;
4445

@@ -203,7 +204,7 @@ public static DeprecationInfoAction.Response from(
203204
IndexNameExpressionResolver indexNameExpressionResolver,
204205
Request request,
205206
NodesDeprecationCheckResponse nodeDeprecationResponse,
206-
List<DeprecationChecks.IndexDeprecationCheck<ClusterState, IndexMetadata, DeprecationIssue>> indexSettingsChecks,
207+
List<BiFunction<ClusterState, IndexMetadata, DeprecationIssue>> indexSettingsChecks,
207208
List<Function<ClusterState, DeprecationIssue>> clusterSettingsChecks,
208209
Map<String, List<DeprecationIssue>> pluginSettingIssues,
209210
List<String> skipTheseDeprecatedSettings

x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/DeprecationInfoActionResponseTests.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
import java.util.Map;
3737
import java.util.Set;
3838
import java.util.concurrent.atomic.AtomicReference;
39+
import java.util.function.BiFunction;
3940
import java.util.function.Function;
4041
import java.util.stream.Collectors;
4142
import java.util.stream.Stream;
@@ -97,7 +98,7 @@ public void testFrom() throws IOException {
9798
Collections.unmodifiableList(Arrays.asList(
9899
(s) -> clusterIssueFound ? foundIssue : null
99100
));
100-
List<DeprecationChecks.IndexDeprecationCheck<ClusterState, IndexMetadata, DeprecationIssue>> indexSettingsChecks =
101+
List<BiFunction<ClusterState, IndexMetadata, DeprecationIssue>> indexSettingsChecks =
101102
Collections.unmodifiableList(Arrays.asList(
102103
(cs, idx) -> indexIssueFound ? foundIssue : null
103104
));
@@ -170,7 +171,7 @@ public void testRemoveSkippedSettings() throws IOException {
170171
}
171172
));
172173
AtomicReference<Settings> visibleIndexSettings = new AtomicReference<>();
173-
List<DeprecationChecks.IndexDeprecationCheck<ClusterState, IndexMetadata, DeprecationIssue>> indexSettingsChecks =
174+
List<BiFunction<ClusterState, IndexMetadata, DeprecationIssue>> indexSettingsChecks =
174175
Collections.unmodifiableList(Arrays.asList(
175176
(cs, idx) -> {
176177
visibleIndexSettings.set(idx.getSettings());

0 commit comments

Comments
 (0)